MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | SYNOPSIS |
| 2 | #include <sys/driver_hooks.h> |
| 3 | |
| 4 | set_driver_hook(H_CREATE_CLONE, value) |
| 5 | |
| 6 | <value> being: |
| 7 | |
| 8 | void <name> (0) |
| 9 | int <closure> ( void ) |
| 10 | int <closure> (object obj_to_init) |
| 11 | |
| 12 | DESCRIPTION |
| 13 | Optional hooks to initialize a cloned object after creation. |
| 14 | Hook setting can be unbound lambda closures, or the name of |
| 15 | the function (static or public) to call in the object. |
| 16 | |
| 17 | If the hook is a closure expecting an argument, it is bound |
| 18 | to the current object and called with the created object as |
| 19 | argument. If the hook as a closure without arguments, it is bound to |
| 20 | the object to be initalized and called. |
| 21 | |
| 22 | If the result of the closure call is a non-zero number, it is used |
| 23 | as the interval to wait before the first reset(), else the default |
| 24 | interval computed from TIME_TO_RESET is used. |
| 25 | |
| 26 | If the hook is defined as the name of an lfun in the object, |
| 27 | it is called in the object with 0 as argument, and any result |
| 28 | is ignored. |
| 29 | |
| 30 | HISTORY |
| 31 | LDMud 3.2.10 allowed static functions to be given by name. |
| 32 | |
| 33 | SEE ALSO |
| 34 | hooks(C), create_ob(H), create_super(H) |