]> git.lizzy.rs Git - mt.git/blobdiff - nodedef.go
Add WaitGroup to SerializePkt
[mt.git] / nodedef.go
index 5606452935eea78057396ed3c0013719d0f0abb8..f29231435b0db4b354ac8c971c7959dc8139fd14 100644 (file)
@@ -9,6 +9,8 @@ const (
        P1Light
 )
 
+//go:generate stringer -trimprefix P1 -type Param1Type
+
 type Param2Type uint8
 
 const (
@@ -24,8 +26,11 @@ const (
        P2ColorFaceDir
        P2ColorMounted
        P2GlassLikeLevel
+       P2ColorRotation
 )
 
+//go:generate stringer -trimprefix P2 -type Param2Type
+
 // A DrawType specifies how a node is drawn.
 type DrawType uint8
 
@@ -50,6 +55,8 @@ const (
        DrawRootedPlant
 )
 
+//go:generate stringer -trimprefix Draw -type DrawType
+
 type WaveType uint8
 
 const (
@@ -59,6 +66,8 @@ const (
        LiquidWaving          // Wave up and down.
 )
 
+//go:generate stringer -type WaveType
+
 type LiquidType uint8
 
 const (
@@ -67,6 +76,8 @@ const (
        LiquidSrc
 )
 
+//go:generate stringer -type LiquidType
+
 // AlphaUse specifies how the alpha channel of a texture is used.
 type AlphaUse uint8
 
@@ -77,6 +88,8 @@ const (
        Legacy
 )
 
+//go:generate stringer -type AlphaUse
+
 type NodeDef struct {
        Param0 Content
 
@@ -144,5 +157,33 @@ type NodeDef struct {
 
        AlphaUse
 
+       MoveResistance uint8
+
+       LiquidMovePhysics bool
+
        //mt:end
 }
+
+func BuiltinNodeDefs(n int) map[Content]NodeDef {
+       defs := make(map[Content]NodeDef, 3+n)
+       defs[Unknown] = NodeDef{
+               Name: "unknown",
+       }
+       defs[Air] = NodeDef{
+               Name:        "air",
+               DrawType:    DrawNothing,
+               P1Type:      P1Light,
+               Translucent: true,
+               Transparent: true,
+               Replaceable: true,
+               Floodable:   true,
+               GndContent:  true,
+       }
+       defs[Ignore] = NodeDef{
+               Name:        "ignore",
+               DrawType:    DrawNothing,
+               Replaceable: true,
+               GndContent:  true,
+       }
+       return defs
+}