]> git.lizzy.rs Git - mt.git/blob - nodedef.go
Add high-level protocol (de)serialization
[mt.git] / nodedef.go
1 package mt
2
3 import "image/color"
4
5 type Param1Type uint8
6
7 const (
8         P1Nothing Param1Type = iota
9         P1Light
10 )
11
12 type Param2Type uint8
13
14 const (
15         P2Nibble Param2Type = iota
16         P2Byte
17         P2Flowing
18         P2FaceDir
19         P2Mounted
20         P2Leveled
21         P2Rotation
22         P2Mesh
23         P2Color
24         P2ColorFaceDir
25         P2ColorMounted
26         P2GlassLikeLevel
27 )
28
29 // A DrawType specifies how a node is drawn.
30 type DrawType uint8
31
32 const (
33         DrawCube DrawType = iota
34         DrawNothing
35         DrawLiquid
36         DrawFlowing
37         DrawLikeGlass
38         DrawAllFaces
39         DrawAllFacesOpt
40         DrawTorch
41         DrawSign
42         DrawPlant
43         DrawFence
44         DrawRail
45         DrawNodeBox
46         DrawGlassFrame
47         DrawFire
48         DrawGlassFrameOpt
49         DrawMesh
50         DrawRootedPlant
51 )
52
53 type WaveType uint8
54
55 const (
56         NotWaving    WaveType = iota
57         PlantWaving           // Only top waves from side to side.
58         LeafWaving            // Wave side to side.
59         LiquidWaving          // Wave up and down.
60 )
61
62 type LiquidType uint8
63
64 const (
65         NotALiquid LiquidType = iota
66         FlowingLiquid
67         LiquidSrc
68 )
69
70 // AlphaUse specifies how the alpha channel of a texture is used.
71 type AlphaUse uint8
72
73 const (
74         Blend AlphaUse = iota
75         Mask           // "Rounded" to either fully opaque or transparent.
76         Opaque
77         Legacy
78 )
79
80 type NodeDef struct {
81         Param0 Content
82
83         //mt:lenhdr 16
84
85         //mt:const uint8(13)
86
87         Name   string
88         Groups []Group
89
90         P1Type   Param1Type
91         P2Type   Param2Type
92         DrawType DrawType
93
94         Mesh  string
95         Scale float32
96         //mt:const uint8(6)
97         Tiles        [6]TileDef
98         OverlayTiles [6]TileDef
99         //mt:const uint8(6)
100         SpecialTiles [6]TileDef
101
102         Color   color.NRGBA
103         Palette Texture
104
105         Waving       WaveType
106         ConnectSides uint8
107         ConnectTo    []Content
108         InsideTint   color.NRGBA
109         Level        uint8 // Must be < 128.
110
111         Translucent bool // Sunlight is scattered and becomes normal light.
112         Transparent bool // Sunlight isn't scattered.
113         LightSrc    uint8
114
115         GndContent   bool
116         Collides     bool
117         Pointable    bool
118         Diggable     bool
119         Climbable    bool
120         Replaceable  bool
121         OnRightClick bool
122
123         DmgPerSec int32
124
125         LiquidType   LiquidType
126         FlowingAlt   string
127         SrcAlt       string
128         Viscosity    uint8 // 0-7
129         LiqRenewable bool
130         FlowRange    uint8
131         DrownDmg     uint8
132         Floodable    bool
133
134         DrawBox, ColBox, SelBox NodeBox
135
136         FootstepSnd, DiggingSnd, DugSnd SoundDef
137
138         LegacyFaceDir bool
139         LegacyMounted bool
140
141         DigPredict string
142
143         MaxLvl uint8
144
145         AlphaUse
146
147         //mt:end
148 }