summaryrefslogtreecommitdiff
path: root/nodebox.go
diff options
context:
space:
mode:
authoranon5 <anon5clam@protonmail.com>2021-06-21 18:47:26 +0000
committeranon5 <anon5clam@protonmail.com>2021-06-21 18:47:26 +0000
commit425da65ed46061303604610bb539d6495b2b1f3f (patch)
tree10ae3e665132c369ce0207676321cef870679923 /nodebox.go
parent9f239d341ef46b656dda759020da87bdd0606344 (diff)
Add high-level protocol (de)serialization
Diffstat (limited to 'nodebox.go')
-rw-r--r--nodebox.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/nodebox.go b/nodebox.go
new file mode 100644
index 0000000..46d704c
--- /dev/null
+++ b/nodebox.go
@@ -0,0 +1,39 @@
+package mt
+
+type Box [2]Vec
+
+type NodeBoxType uint8
+
+const (
+ CubeBox NodeBoxType = iota
+ FixedBox
+ MountedBox
+ LeveledBox
+ ConnectedBox
+ maxBox
+)
+
+type DirBoxes struct {
+ Top, Bot []Box
+ Front, Left, Back, Right []Box
+}
+
+type NodeBox struct {
+ //mt:const uint8(6)
+
+ Type NodeBoxType
+ //mt:assert %s.Type < maxBox
+
+ //mt:if %s.Type == MountedBox
+ WallTop, WallBot, WallSides Box
+ //mt:end
+
+ //mt:if t := %s.Type; t == FixedBox || t == LeveledBox || t == ConnectedBox
+ Fixed []Box
+ //mt:end
+
+ //mt:if %s.Type == ConnectedBox
+ ConnDirs, DiscoDirs DirBoxes
+ DiscoAll, DiscoSides []Box
+ //mt:end
+}