blob: f111e196635a50ffab60f0e9c47f142f59c6eb72 [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_CLONE, value)
5
6 <value> being:
7
Zesstra85136122021-05-08 20:32:01 +02008 void <name> (...)
MG Mud User88f12472016-06-24 23:31:02 +02009 int <closure> ( void )
Zesstra85136122021-05-08 20:32:01 +020010 int <closure> (object obj_to_init, ...)
MG Mud User88f12472016-06-24 23:31:02 +020011
12DESCRIPTION
13 Optional hooks to initialize a cloned object after creation.
Zesstradaf2c672025-08-02 15:59:17 +020014 Hook setting can any closure, or the name of the function
15 (static or public) to call in the object.
MG Mud User88f12472016-06-24 23:31:02 +020016
Zesstradaf2c672025-08-02 15:59:17 +020017 If the hook is an unbound lambda closure expecting arguments,
18 it is bound to the current object and called with the created
19 object as the first argument and any further arguments from
20 the clone_object() call. If the hook is an unbound lambda
21 closure without arguments, it is bound to the object to be
22 initalized and called. If the hook is any other type of closure,
23 it is called with the created object as the first argument and
24 any further arguments from the clone_object() call.
MG Mud User88f12472016-06-24 23:31:02 +020025
26 If the result of the closure call is a non-zero number, it is used
27 as the interval to wait before the first reset(), else the default
28 interval computed from TIME_TO_RESET is used.
29
30 If the hook is defined as the name of an lfun in the object,
Zesstra85136122021-05-08 20:32:01 +020031 it is called in the object with any further arguments from the
32 clone_object() call, and any result is ignored.
MG Mud User88f12472016-06-24 23:31:02 +020033
34HISTORY
35 LDMud 3.2.10 allowed static functions to be given by name.
Zesstra85136122021-05-08 20:32:01 +020036 LDMud 3.6.5 removed the argument given for the lfun call.
MG Mud User88f12472016-06-24 23:31:02 +020037
38SEE ALSO
Zesstra85136122021-05-08 20:32:01 +020039 hooks(C), create_ob(H), create_super(H), create_lwobject(H)