summaryrefslogtreecommitdiff
path: root/itemdef.go
blob: 2cbebb19076dcf29fd60100074b9800700e52464 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package mt

import "image/color"

type ItemType uint8

const (
	_ ItemType = iota
	NodeItem
	CraftItem
	ToolItem
)

//go:generate stringer -type ItemType

// 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

	SoundUse    SoundDef
	SoundUseAir SoundDef

	HasPlaceParam2 bool

	//mt:if %s.HasPlaceParam2
	PlaceParam2 uint8
	//mt:end

	WallmountedRotateVertical bool
	TouchInteraction          TouchInteraction

	Pointabilities string

	HasWearBarParams bool

	//mt:if %s.HasWearBarParams
	WearBarParams WearBarParams
	//mt:end

	//mt:end
}

type TouchInteractionMode uint8

const (
	UserDefined TouchInteractionMode = iota
)

// A TouchInteraction defines how touchscreen taps should be handled
// depending on what the player is pointing at.
type TouchInteraction struct {
	Nothing, Node, Object TouchInteractionMode
}

type BlendMode uint8

const (
	Constant BlendMode = iota
	Linear
)

// A WearBarParams specifies the wear bar colors for certain wear levels.
type WearBarParams struct {
	// Version.
	//mt:const uint8(1)

	Blend BlendMode

	ColorStops map[float32]color.NRGBA
}