blob: db08bec2357425e1f0a713c3aaa4b2bcb7522a81 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 void reset(int arg) /* compat mode */
3 void reset(void) /* native mode */
4
5DESCRIPTION
6 The H_RESET hook defines the function or closure to be called
7 when the driver needs to reset an object. In older drivers
8 this was hardwired to the lfun reset(), and a lot of hook
9 implementations still follow this tradition.
10
11 In compat mode, reset() was called with arg 0 after the object
12 was compiled, and with arg != 0 every once in a while. In
13 native mode, create() is called after compiling, and reset()
14 is called without arguments every once in a while.
15
16 So, if the argument is zero, the parser is running in compat
17 mode, and reset() may call your create() code. If create() is
18 called, you're on the new version and reset() is not called
19 for object creation. You may call reset() from create() and
20 vice versa, but make sure they do not call each other
21 recursive on either type of driver.
22
23 reset() will be called only in objects that have been used
24 since the last call to reset(), i.e. a function in them was
25 called (other than reset() or clean_up()), or it was moved
26 around.
27
28 This function can be used to reset the state of the object or
29 do some checks or what ever. The game wouldn't be fun if no
30 challenges remained.
31
32 For 3.2.1, the mudlib can be programmed to call an other lfun
33 than reset() to reset an object.
34
35SEE ALSO
36 clean_up(A), heart_beat(A), call_out(E), create(A), __INIT(A),
37 reset(H), hooks(C), initialisation(M), native(C)