From 425da65ed46061303604610bb539d6495b2b1f3f Mon Sep 17 00:00:00 2001 From: anon5 Date: Mon, 21 Jun 2021 18:47:26 +0000 Subject: Add high-level protocol (de)serialization --- itemdef.go | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 itemdef.go (limited to 'itemdef.go') diff --git a/itemdef.go b/itemdef.go new file mode 100644 index 0000000..a761b65 --- /dev/null +++ b/itemdef.go @@ -0,0 +1,56 @@ +package mt + +import "image/color" + +type ItemType uint8 + +const ( + _ ItemType = iota + NodeItem + CraftItem + ToolItem +) + +// An ItemDef defines the properties of an item. +type ItemDef struct { + //mt:lenhdr 16 + + // Version. + //mt:const uint8(6) + + Type ItemType + + Name, Desc string + + InvImg, WieldImg Texture + WieldScale [3]float32 + + StackMax uint16 + + Usable bool + CanPointLiquids bool + + ToolCaps ToolCaps + + Groups []Group + + PlacePredict string + + PlaceSnd, PlaceFailSnd SoundDef + + PointRange float32 + + // Set index in Palette with "palette_index" item meta field, + // this overrides Color. + Palette Texture + Color color.NRGBA + + // Texture overlays. + InvOverlay, WieldOverlay Texture + + ShortDesc string + + PlaceParam2 byte + + //mt:end +} -- cgit v1.2.3