blob: 3bb879868652b77a7d2b4b4dbd046d0670714f5a [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <sys/driver_hooks.h>
3
4 set_driver_hook(H_CREATE_OB, value)
5
6 <value> being:
7
8 void <name> (0)
9 int <closure> ( void )
10 int <closure> (object obj_to_init)
11
12DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +010013 Optional hooks to initialize an explicitly loaded
14 object/blueprint after creation. Hook setting can be unbound
15 lambda closures or the name of the function (static or public) to
MG Mud User88f12472016-06-24 23:31:02 +020016 call in the object.
17
18 If the hook is a closure expecting an argument, it is bound
19 to the current object and called with the created object as
Zesstra7ea4a032019-11-26 20:11:40 +010020 argument. If the hook is a closure without arguments, it is bound to
MG Mud User88f12472016-06-24 23:31:02 +020021 the object to be initalized and called.
22
23 If the result of the closure call is a non-zero number, it is used
24 as the interval to wait before the first reset(), else the default
25 interval computed from TIME_TO_RESET is used.
26
27 If the hook is defined as the name of an lfun in the object,
Zesstra7ea4a032019-11-26 20:11:40 +010028 it is called in the object with 0 as argument and any result
MG Mud User88f12472016-06-24 23:31:02 +020029 is ignored.
30
31HISTORY
32 LDMud 3.2.10 allowed static functions to be given by name.
33
34SEE ALSO
35 hooks(C), create_super(H), create_clone(H)