Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/doc/lua/object.md
blob: 00dba68f0329ff042f478fb504ed365830f2fff6 (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
The object table contains bindings specific to objects which are available in addition to their common tables.

---

#### `String` object.name()

Returns the object's type name.

---

#### `int` object.direction()

Returns the object's facing direction. This will be 1 for right or -1 for left.

---

#### `Vec2F` object.position()

Returns the object's tile position. This is identical to entity.position(), so use that instead.

---

#### `void` object.setInteractive(`bool` interactive)

Sets whether the object is currently interactive.

---

#### `String` object.uniqueId()

Returns the object's unique entity id, or `nil` if no unique id is set. This should be identical to entity.uniqueId(), so use that instead.

---

#### `void` object.setUniqueId([`String` uniqueId])

Sets the objects unique entity id, or clears it if unspecified.

---

#### `RectF` object.boundBox()

Returns the object's metaBoundBox in world space.

---

#### `List<Vec2I>` object.spaces()

Returns a list of the tile spaces that the object occupies.

---

#### `void` object.setProcessingDirectives(`String` directives)

Sets the image processing directives that should be applied to the object's animation.

---

#### `void` object.setSoundEffectEnabled(`bool` enabled)

Enables or disables the object's persistent sound effect, if one is configured.

---

#### `void` object.smash([`bool` smash])

Breaks the object. If smash is `true` then it will be smashed, causing it to (by default) drop no items.

---

#### `float` object.level()

Returns the "level" parameter if set, otherwise returns the current world's threat level.

---

#### `Vec2F` object.toAbsolutePosition(`Vec2F` relativePosition)

Returns an absolute world position calculated from the given relative position.

---

#### `bool` object.say(`String` line, [`Map<String, String>` tags], [`Json` config])

Causes the object to say the line, optionally replacing any specified tags in the text, and using the provided additional chat configuration. Returns `true` if anything is said (i.e. the line is not empty) and `false` otherwise.

---

#### `bool` object.sayPortrait(`String` line, `String` portrait, [`Map<String, String>` tags], [`Json` config])

Similar to object.say, but uses a portrait chat bubble with the specified portrait image.

---

#### `bool` object.isTouching(`EntityId` entityId)

Returns `true` if the specified entity's collision area overlaps the object's bound box and `false` otherwise.

---

#### `void` object.setLightColor(`Color` color)

Sets the color of light for the object to emit. This is not the same as animator.setLightColor and the animator light configuration should be used for more featureful light sources.

---

#### `Color` object.getLightColor()

Returns the object's currently configured light color.

---

#### `unsigned` object.inputNodeCount()

Returns the number of wire input nodes the object has.

---

#### `unsigned` object.outputNodeCount()

Returns the number of wire output nodes the object has.

---

#### `Vec2I` object.getInputNodePosition(`unsigned` nodeIndex)

Returns the relative position of the specified wire input node.

---

#### `Vec2I` object.getOutputNodePosition(`unsigned` nodeIndex)

Returns the relative position of the specified wire output node.

---

#### `bool` object.getInputNodeLevel(`unsigned` nodeIndex)

Returns the current level of the specified wire input node.

---

#### `bool` object.getOutputNodeLevel(`unsigned` nodeIndex)

Returns the current level of the specified wire output node.

---

#### `bool` object.isInputNodeConnected(`unsigned` nodeIndex)

Returns `true` if any wires are currently connected to the specified wire input node and `false` otherwise.

---

#### `bool` object.isOutputNodeConnected(`unsigned` nodeIndex)

Returns `true` if any wires are currently connected to the specified wire output node and `false` otherwise

---

#### `Map<EntityId, unsigned>` object.getInputNodeIds(`unsigned` nodeIndex)

Returns a map of the entity id of each wire entity connected to the given wire input node and the index of that entity's output node to which the input node is connected.

---

#### `Map<EntityId, unsigned>` object.getOutputNodeIds(`unsigned` nodeIndex)

Returns a map of the entity id of each wire entity connected to the given wire output node and the index of that entity's input node to which the output node is connected.

---

#### `void` object.setOutputNodeLevel(`unsigned` nodeIndex, `bool` level)

Sets the level of the specified wire output node.

---

#### `void` object.setAllOutputNodes(`bool` level)

Sets the level of all wire output nodes.

---

#### `void` object.setOfferedQuests([`JsonArray` quests])

Sets the list of quests that the object will offer to start, or clears them if unspecified.

---

#### `void` object.setTurnInQuests([`JsonArray` quests])

Sets the list of quests that the object will accept turn-in for, or clears them if unspecified.

---

#### `void` object.setConfigParameter(`String` key, `Json` value)

Sets the specified override configuration parameter for the object.

---

#### `void` object.setAnimationParameter(`String` key, `Json` value)

Sets the specified animation parameter for the object's scripted animator.

---

#### `void` object.setMaterialSpaces([`JsonArray` spaces])

Sets the object's material spaces to the specified list, or clears them if unspecified. List entries should be in the form of `pair<Vec2I, String>` specifying the relative position and material name of materials to be set. __Objects should only set material spaces within their occupied tile spaces to prevent Bad Things TM from happening.__

---

#### `void` object.setDamageSources([`List<DamageSource>` damageSources])

Sets the object's active damage sources (or clears them if unspecified).

---

#### `float` object.health()

Returns the object's current health.

---

#### `void` object.setHealth(`float` health)

Sets the object's current health.