1 | =head1 CROSSFIRE+ PLUG-IN EVENTS |
1 | =head1 DELIANTRA PLUG-IN EVENTS |
2 | |
2 | |
3 | This document briefly describes each plug-in event. It is also used to |
3 | This document briefly describes each plug-in event. It is also used to |
4 | generate the event-list itself, so is always complete. Be careful wehn |
4 | generate the event-list itself, so is always complete. Be careful wehn |
5 | changing it, though. |
5 | changing it, though. |
6 | |
6 | |
7 | =head2 NOTATION |
7 | =head2 NOTATION |
8 | |
8 | |
9 | the event description below uses a variant of the forth stack notation - |
9 | The event description below uses a variant of the forth stack notation - |
10 | an opening parenthesis followed by the type of each parameter, optionally |
10 | an opening parenthesis followed by the type of each parameter, optionally |
11 | followed by two dashes and the returning parameters. If the latter is |
11 | followed by two dashes and the returning parameters. If the latter part is |
12 | missing, the event will be invoked but cannot change wether the event gets |
12 | missing, the event will be invoked but cannot change wether the event gets |
13 | processed. |
13 | processed. |
14 | |
14 | |
15 | If it is specified (even if no return values are supported), a plug-in |
15 | Return values are given by overriding (in Perl by calling C<cf::override>) |
16 | can override (e.g. using C<cf::override> in Perl) event processing, |
16 | with the return values, which will both stop further event processing and |
17 | basically short-circuiting it. For example, if you override from within a |
17 | tell the caller that it wants to override normal processing. |
18 | player BIRTH event, nothing much will happen with respect to the built-in |
18 | |
|
|
19 | Even if no return values are supported, a plug-in can override (e.g. using |
|
|
20 | C<cf::override> in Perl) event processing, basically short-circuiting |
|
|
21 | it. For example, if you override from within a player BIRTH event, |
|
|
22 | nothing much will happen with respect to the built-in processing, but if |
19 | processing, but if you override from within a player TELL event, the tell |
23 | you override from within a player TELL event, the tell will be ignored |
20 | will be ignored (presumably your plug-in took care of it). |
24 | (presumably your plug-in took care of it). |
21 | |
25 | |
22 | |
26 | |
23 | =head2 ATTACHABLE EVENTS |
27 | =head2 ATTACHABLE EVENTS |
24 | |
28 | |
25 | No time to document this, screw me. |
29 | No time to document this, screw me. |
… | |
… | |
50 | instances). If this is not the behaviour you need, you have to adjust the |
54 | instances). If this is not the behaviour you need, you have to adjust the |
51 | B<destination> object as you see fit. |
55 | B<destination> object as you see fit. |
52 | |
56 | |
53 | =head3 destroy (object -- ) |
57 | =head3 destroy (object -- ) |
54 | |
58 | |
55 | Invoked when the crossfire object gets destroyed, and only when the object |
59 | Invoked when the deliantra object gets destroyed, and only when the object |
56 | has a handler for this event. This event can occur many times, as its |
60 | has a handler for this event. This event can occur many times, as its |
57 | called when the in-memory object is destroyed, not when the object itself |
61 | called when the in-memory object is destroyed, not when the object itself |
58 | dies. |
62 | dies. |
59 | |
63 | |
60 | |
64 | |
… | |
… | |
62 | |
66 | |
63 | Object events always relate to a specific object, which is always the |
67 | Object events always relate to a specific object, which is always the |
64 | first argument. Not all events get generated for every object, some are |
68 | first argument. Not all events get generated for every object, some are |
65 | specific to an object type. |
69 | specific to an object type. |
66 | |
70 | |
67 | =head3 add_bonus (item creator difficulty max_magic flags) |
71 | =head3 add_bonus (item creator difficulty max_magic flags -- ) |
68 | |
72 | |
69 | A basic item has been created (e.g. for shops, monsters drops etc.) |
73 | A basic item has been created (e.g. for shops, monsters drops etc.) |
70 | that needs bonus values applied. The B<creator> object is a template |
74 | that needs bonus values applied. The B<creator> object is a template |
71 | object that can be used to inherit stuff (and can be NULL). Flags is a |
75 | object that can be used to inherit stuff (and can be NULL). Flags is a |
72 | combination of GT_ENVIRONMENT (???) or GT_STARTEQUIP (set FLAG_STARTEQUIP |
76 | combination of GT_ENVIRONMENT (???) or GT_STARTEQUIP (set FLAG_STARTEQUIP |
… | |
… | |
91 | Invoked whenever the object "ticks", i.e. has positive B<speed_left>. Only |
95 | Invoked whenever the object "ticks", i.e. has positive B<speed_left>. Only |
92 | during ticks should an objetc process any movement or other events. |
96 | during ticks should an objetc process any movement or other events. |
93 | |
97 | |
94 | =head3 kill (object hitter -- ) |
98 | =head3 kill (object hitter -- ) |
95 | |
99 | |
96 | Invoked whenever an object is dead and about to get removed. Overriding |
100 | Invoked whenever an object was killed (hp < 0 caused by an attack) and is |
97 | processing will skip removal, but to do this successfully you have to |
101 | about to get removed. Overriding processing will skip removal, but to do |
98 | objetc from dieing, otherwise the event gets invoked again and again. |
102 | this successfully you have to keep the object from dieing, otherwise the |
|
|
103 | event gets invoked again and again. |
99 | |
104 | |
100 | =head3 apply (object who -- applytype) |
105 | =head3 apply (object who -- applytype) |
101 | |
106 | |
102 | Invoked whenever the object is being applied in some way. The applytype is one of: |
107 | Invoked whenever the object is being applied in some way. The applytype is one of: |
103 | |
108 | |
… | |
… | |
108 | =item B<1> has been applied, or there was an error applying the object |
113 | =item B<1> has been applied, or there was an error applying the object |
109 | |
114 | |
110 | =item B<2> objects of that type can't be applied if not in inventory |
115 | =item B<2> objects of that type can't be applied if not in inventory |
111 | |
116 | |
112 | =back |
117 | =back |
|
|
118 | |
|
|
119 | =head3 reset (object) |
|
|
120 | |
|
|
121 | Invoked whenever the object is initialised on a map after it was |
|
|
122 | loaded. This can be used to emulate shop-floor behaviour for example. |
113 | |
123 | |
114 | =head3 throw (object thrower) |
124 | =head3 throw (object thrower) |
115 | |
125 | |
116 | Invoked when an B<object> is thrown by B<thrower>. |
126 | Invoked when an B<object> is thrown by B<thrower>. |
117 | |
127 | |
… | |
… | |
180 | damage that has been dealt. |
190 | damage that has been dealt. |
181 | |
191 | |
182 | =head3 skill_attack (attacker victim message skill -- success) |
192 | =head3 skill_attack (attacker victim message skill -- success) |
183 | |
193 | |
184 | Invoked whenever an B<attacker> attacks B<victim> using a B<skill> (skill |
194 | Invoked whenever an B<attacker> attacks B<victim> using a B<skill> (skill |
185 | cna be C<undef>). B<message> is the message that describes the attack when |
195 | can be C<undef>). B<message> is the message that describes the attack when |
186 | damage is done. |
196 | damage is done. |
187 | |
197 | |
188 | =head3 weapon_attack (weapon hitter victim) |
198 | =head3 weapon_attack (weapon hitter victim) |
189 | |
199 | |
190 | Invoked whenever an object is used as a B<weapon> by B<hitter> to attack |
200 | Invoked whenever an object is used as a B<weapon> by B<hitter> to attack |
… | |
… | |
215 | Invoked whenever a container gets closed. When overriden, the container |
225 | Invoked whenever a container gets closed. When overriden, the container |
216 | will not get closed, but you must tell op about the reason. This event |
226 | will not get closed, but you must tell op about the reason. This event |
217 | is not crash-safe, i.e. containers might be closed due to a server crash |
227 | is not crash-safe, i.e. containers might be closed due to a server crash |
218 | without this event being invoked. |
228 | without this event being invoked. |
219 | |
229 | |
|
|
230 | =head3 blocked_move (self who -- do_blocked) |
|
|
231 | |
|
|
232 | Invoked when an C<who> tries to move to the same space as C<self>, |
|
|
233 | C<self>'s C<move_block> causes blocked movement for C<who> and nothing |
|
|
234 | else explicitly allows movement to this space. |
|
|
235 | |
|
|
236 | Should return true when C<who> is blocked, i.e., should not be allowed to |
|
|
237 | move onto C<self>. |
|
|
238 | |
|
|
239 | When not overriding, normal blocked_move (blocked_link) processing will |
|
|
240 | happen. |
|
|
241 | |
220 | |
242 | |
221 | =head2 GLOBAL EVENTS |
243 | =head2 GLOBAL EVENTS |
222 | |
244 | |
223 | Global events have no relation to specific objects. |
245 | Global events have no relation to specific objects. |
224 | |
246 | |
225 | =head3 cleanup () |
247 | =head3 cleanup () |
226 | |
248 | |
227 | Called when the server is cleaning up, just before it calls exit. |
249 | Called when the server is cleaning up, just before it calls exit. |
228 | |
250 | |
229 | =head3 clock ( ) |
251 | =head3 clock () |
230 | |
252 | |
231 | Is invoked on every server tick, usually every 0.12 seconds. |
253 | Is invoked on every server tick, usually every 0.12 seconds. |
|
|
254 | |
|
|
255 | =head3 resource_update () |
|
|
256 | |
|
|
257 | Is invoked after each time the server reloads its resources, which is |
|
|
258 | usually one of the earliest things it does when starting up. |
232 | |
259 | |
233 | |
260 | |
234 | =head2 PLAYER EVENTS |
261 | =head2 PLAYER EVENTS |
235 | |
262 | |
236 | Player events always have a player object as first argument. |
263 | Player events always have a player object as first argument. |
… | |
… | |
271 | |
298 | |
272 | =head3 login (player) |
299 | =head3 login (player) |
273 | |
300 | |
274 | Invoked whenever a player logs in. |
301 | Invoked whenever a player logs in. |
275 | |
302 | |
276 | =head3 logout (player) |
303 | =head3 logout (player cleanly -- ) |
277 | |
304 | |
278 | Invoked whenever a player logs out, gets disconnected etc. |
305 | Invoked whenever a player logs out, gets disconnected etc. |
279 | |
306 | |
280 | =head3 death (player) |
307 | =head3 death (player) |
281 | |
308 | |
282 | Invoked whenever a player dies, before the death actually gets processed. |
309 | Invoked whenever a player dies, before the death actually gets processed. |
283 | |
310 | |
284 | =head3 map_change (player newmap x y -- ) |
311 | =head3 map_change (player newmap x y -- ) |
285 | |
312 | |
286 | Invoked before a player moves from one map to another, can override the movement. |
313 | Invoked before a player moves from one map to another, can override the movement. |
|
|
314 | |
|
|
315 | =head3 region_change (player newregion oldregion -- ) |
|
|
316 | |
|
|
317 | Invoked when a player entered a new region. Cannot be overriden. |
287 | |
318 | |
288 | =head3 command (player command args -- time) |
319 | =head3 command (player command args -- time) |
289 | |
320 | |
290 | Execute a user command send by the client. Programmable plug-ins usually |
321 | Execute a user command send by the client. Programmable plug-ins usually |
291 | handle this event internally. |
322 | handle this event internally. |
… | |
… | |
362 | =head3 leave (map player -- ) |
393 | =head3 leave (map player -- ) |
363 | |
394 | |
364 | Invoked whenever a player tries to leave the B<map>. Overriding means the |
395 | Invoked whenever a player tries to leave the B<map>. Overriding means the |
365 | player won't be able to leave. |
396 | player won't be able to leave. |
366 | |
397 | |
367 | =head3 trigger (map connection state -- ) |
398 | =head3 trigger (map connection state what? who? -- ) |
368 | |
399 | |
369 | Invoked whenever something activates a B<connection> on the B<map>. If B<state> |
400 | Invoked whenever something activates a B<connection> on the B<map>. If B<state> |
370 | is true the connection was 'state' and if false it is 'released'. |
401 | is true the connection was 'state' and if false it is 'released'. |
371 | |
402 | |
372 | |
403 | |