ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/doc/events.pod
Revision: 1.4
Committed: Mon Aug 28 14:05:24 2006 UTC (17 years, 8 months ago) by root
Branch: MAIN
Changes since 1.3: +44 -44 lines
Log Message:
improved,more automatic freezer

File Contents

# User Rev Content
1 root 1.1 =head1 CROSSFIRE PLUG-IN EVENTS
2    
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
5     changing it, though.
6    
7     =head2 NOTATION
8    
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
11     followed by two dashes and the returning parameters. If the latter is
12 root 1.2 missing, the event will be invoked but cannot change wether the event gets
13 root 1.1 processed.
14    
15     If it is specified (even if no return values are supported), a plug-in
16     can override (e.g. using C<cf::override> in Perl) event processing,
17     basically short-circuiting it. For example, if you override from within a
18     player BIRTH event, nothing much will happen with respect to the built-in
19     processing, but if you override from within a player TELL event, the tell
20     will be ignored (presumably your plug-in took care of it).
21    
22    
23     =head2 GLOBAL EVENTS
24    
25     Global events have no relation to specific objects.
26    
27 root 1.4 =head3 clock ( )
28 root 1.1
29     Is invoked on every server tick, usually every 0.12 seconds.
30    
31    
32     =head2 PLAYER EVENTS
33    
34     Player events always have a player object as first argument.
35    
36 root 1.4 =head3 reattach (player)
37 root 1.1
38 root 1.2 Invoked whenever attachments/plug-ins need to get reattached to the player
39 root 1.1 object. This usually happens when the player gets loaded from disk, or
40     when the server is reloaded.
41    
42 root 1.4 =head3 birth (player)
43 root 1.1
44 root 1.2 Invoked as very first thing after creating a player.
45 root 1.1
46 root 1.4 =head3 quit (player)
47 root 1.1
48 root 1.2 Invoked wheneever a player quits, before actually removing him/her.
49 root 1.1
50 root 1.4 =head3 load (player)
51 root 1.1
52 root 1.2 Invoked whenever a player has been loaded from disk, but before
53 root 1.1 actual login.
54    
55 root 1.4 =head3 save (player)
56 root 1.1
57 root 1.2 Invoked just before a player gets saved.
58 root 1.1
59 root 1.4 =head3 login (player)
60 root 1.1
61 root 1.2 Invoked whenever a player logs in.
62 root 1.1
63 root 1.4 =head3 logout (player)
64 root 1.1
65 root 1.2 Invoked whenever a player logs out, gets disconnected etc.
66 root 1.1
67 root 1.4 =head3 death (player)
68 root 1.1
69 root 1.2 Invoked whenever a player dies, before the death actually gets processed.
70 root 1.1
71 root 1.4 =head3 map_change (player oldmap newmap)
72 root 1.1
73 root 1.2 Invoked whenever a player moves from one map to another.
74 root 1.1
75 root 1.4 =head3 extcmd (player string)
76 root 1.1
77 root 1.2 Invoked whenever a client issues the C<extcmd> protocol command. It's
78 root 1.1 argument is passed without any changes.
79    
80 root 1.4 =head3 pray_altar (player altar skill -- )
81 root 1.1
82 root 1.2 Invoked whenever the B<player> prays over an B<altar>, using the given B<skill>.
83 root 1.1
84 root 1.4 =head3 tell (player -- )
85 root 1.1
86 root 1.2 Invoked whenever the player uses the B<tell> command, before it gets processed.
87 root 1.1
88 root 1.4 =head3 say (player --)
89 root 1.1
90 root 1.2 Invoked whenever the player uses the B<say> command, before it gets processed.
91 root 1.1
92 root 1.4 =head3 shout (player --)
93 root 1.1
94 root 1.2 Invoked whenever the player uses the B<shout> command, before it gets processed.
95 root 1.1
96    
97     =head2 OBJECT EVENTS
98    
99     Object events always relate to a specific object, which is always the
100     first argument. Not all events get generated for every object, some are
101     specific to an object type.
102    
103 root 1.4 =head3 instantiate (object init-args...)
104 root 1.1
105     An archetype was instantiated into an object. This event occurs when
106     a map is loaded for the first time, or when the object was created
107     dynamically. The arguments are as specified in the C<attach> attribute of
108     the object or archetype.
109    
110     This is useful to initialise any per-object state you might need.
111    
112 root 1.4 =head3 reattach (object)
113 root 1.1
114 root 1.2 Invoked whenever attachments/plug-ins need to get reattached to the
115 root 1.1 object. This usually happens when it was loaded from disk, or when the
116     server was reloaded. This event will only be generated if the object has
117     attachments.
118    
119 root 1.4 =head3 clone (object destination)
120 root 1.1
121     An object with _attached extension_ is cloned, that is, a copy was
122     made. The copy automatically has all attachments the original object
123     had. The perl variables get copied in a shallow way (references are shared
124     between instances). If this is not the behaviour you need, you have to
125     adjust the B<destination> object as you see fit.
126    
127 root 1.4 =head3 tick (object)
128 root 1.1
129 root 1.2 Invoked whenever the object "ticks", i.e. has positive B<speed_left>. Only
130 root 1.1 during ticks should an objetc process any movement or other events.
131    
132 root 1.4 =head3 kill (object hitter -- )
133 root 1.1
134 root 1.2 Invoked whenever an object is dead and about to get removed. Overriding
135 root 1.1 processing will skip removal, but to do this successfully you have to
136     objetc from dieing, otherwise the event gets invoked again and again.
137    
138 root 1.4 =head3 apply (object who -- applytype)
139 root 1.1
140 root 1.2 Invoked whenever the object is being applied in some way. The applytype is one of:
141 root 1.1
142     =over 4
143    
144     =item B<0> player or monster can't apply objects of that type
145    
146     =item B<1> has been applied, or there was an error applying the object
147    
148     =item B<2> objects of that type can't be applied if not in inventory
149    
150 root 1.3 =back
151 root 1.1
152 root 1.4 =head3 use_skill (skill who part direction strignarg -- )
153 root 1.1
154 root 1.2 Invoked whenever a skill is used by somebody or something.
155 root 1.1
156 root 1.4 =head3 cast_spell (spell casting_object owner direction stringarg -- )
157 root 1.1
158 root 1.4 Invoked whenever a given spell is cast by B<casting_object> (used by
159 root 1.1 B<owner>).
160    
161 root 1.4 =head3 drop (object who -- )
162 root 1.1
163 root 1.2 Invoked whenever an item gets dropped by somebody, e.g. as a result of a
164 root 1.1 drop command.
165    
166 root 1.4 =head3 drop_on (floor object who -- )
167 root 1.1
168 root 1.2 Invoked whenever some B<object> is being dropped on the B<floor> object.
169 root 1.1
170 root 1.4 =head3 listen
171 root 1.1
172 root 1.2 Invoked whenever the object can hear something beign said in its
173 root 1.1 vicinity. Not yet implemented.
174    
175 root 1.4 =head3 move (monster enemy -- )
176 root 1.1
177 root 1.2 Invoked whenever the B<monster> tries to move, just after B<enemy> and
178 root 1.1 other parameters have been determined, but before movement is actually
179     executed.
180    
181 root 1.4 =head3 attack (object hitter -- damage)
182 root 1.1
183     Object gets attacked by somebody - when overriden, should return the
184     damage that has been dealt.
185    
186 root 1.4 =head3 attacks (weapon hitter victim)
187 root 1.1
188 root 1.2 Invoked whenever an object is used as a B<weapon> by B<hitter> to attack
189 root 1.1 B<victim>.
190    
191 root 1.4 =head3 inscribe_note (book pl message skill -- )
192 root 1.1
193     Used whenever a book gets inscribed with a message.
194    
195 root 1.4 =head3 trigger (object who -- )
196 root 1.1
197 root 1.2 Invoked whenever a lever-like B<object> has been activated/triggered in some
198 root 1.1 (manual) way.
199    
200 root 1.4 =head3 move_trigger (object victim originator -- )
201 root 1.1
202 root 1.2 Invoked whenever a trap-like B<object> has been activated, usually by
203 root 1.1 moving onto it. This includes not just traps, but also buttons, holes,
204     signs and similar stuff.
205    
206 root 1.4 =head3 close (container -- )
207 root 1.1
208 root 1.2 Invoked whenever a container gets closed (this event is not yet reliable!).
209 root 1.1
210    
211     =head2 MAP EVENTS
212    
213     These events are generally dependent on a map and thus all have a map
214     as first argument.
215    
216 root 1.4 =head3 reattach (map)
217 root 1.1
218 root 1.2 Invoked whenever attachments/plug-ins need to get reattached to the
219 root 1.1 B<map>. This usually happens when the map was loaded from disk, or when the
220     server was reloaded.
221    
222 root 1.4 =head3 instantiate (map)
223 root 1.1
224     Original B<map> has been loaded (e.g. on first use, or after a map
225 root 1.4 reset).
226 root 1.1
227 root 1.4 =head3 swapin (map)
228 root 1.1
229 root 1.2 Invoked when a previously swapped-out temporary B<map> has been loaded again.
230 root 1.1
231 root 1.4 =head3 swapout (map)
232 root 1.1
233 root 1.2 Invoked after a B<map> has been swapped out to disk.
234 root 1.1
235 root 1.4 =head3 reset (map)
236 root 1.1
237 root 1.2 Invoked when a B<map> gets reset.
238 root 1.1
239 root 1.4 =head3 clean (map)
240 root 1.1
241 root 1.2 Invoked when a temporary B<map> gets deleted on-disk.
242 root 1.1
243 root 1.4 =head3 enter (map player)
244 root 1.1
245 root 1.2 Invoked whenever a player enters the B<map>. This event is likely unreliable.
246 root 1.1
247 root 1.4 =head3 leave (map player)
248 root 1.1
249 root 1.2 Invoked whenever a player leaves the B<map>. This event is likely unreliable.
250 root 1.1
251 root 1.4 =head3 upgrade (map)
252 root 1.1
253 root 1.2 (TEMPORARY EVENT) gets invoked whenever a old-style map has been upgraded.
254 root 1.1