]> git.lizzy.rs Git - mt.git/blob - nodebox.go
Add high-level protocol (de)serialization
[mt.git] / nodebox.go
1 package mt
2
3 type Box [2]Vec
4
5 type NodeBoxType uint8
6
7 const (
8         CubeBox NodeBoxType = iota
9         FixedBox
10         MountedBox
11         LeveledBox
12         ConnectedBox
13         maxBox
14 )
15
16 type DirBoxes struct {
17         Top, Bot                 []Box
18         Front, Left, Back, Right []Box
19 }
20
21 type NodeBox struct {
22         //mt:const uint8(6)
23
24         Type NodeBoxType
25         //mt:assert %s.Type < maxBox
26
27         //mt:if %s.Type == MountedBox
28         WallTop, WallBot, WallSides Box
29         //mt:end
30
31         //mt:if t := %s.Type; t == FixedBox || t == LeveledBox || t == ConnectedBox
32         Fixed []Box
33         //mt:end
34
35         //mt:if %s.Type == ConnectedBox
36         ConnDirs, DiscoDirs  DirBoxes
37         DiscoAll, DiscoSides []Box
38         //mt:end
39 }