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_RESET, value) |
| 5 | |
| 6 | <value> being: |
| 7 | |
| 8 | void|int <closure> ( void ) |
| 9 | void <name>(1) |
| 10 | |
| 11 | DESCRIPTION |
| 12 | Optional hook to reset an object. |
| 13 | Hook setting can be unbound lambda closures, or the name of |
| 14 | the function (static or public) to call in the object. |
| 15 | |
| 16 | If the hook is a closure, it is bound to the object to be |
| 17 | reset and called with no argument. |
| 18 | |
| 19 | If the result of this call is a positive number, it is used as |
| 20 | the interval to wait before the next reset(). If the result |
| 21 | is 0, the default interval computed from TIME_TO_RESET is |
| 22 | used. If the result is a negative number, the object will not |
| 23 | be reset again, unless directed otherwise by set_next_reset(). |
| 24 | |
| 25 | If the hook is defined as the name of an lfun in the object, |
| 26 | it is called in the object with 1 as argument, and any result |
| 27 | is ignored. In this call the previous_object() is the object |
| 28 | initiating the reset. If the function does not exist, the |
| 29 | object won't be reset again. |
| 30 | |
| 31 | Note that an object is only reset by call to this hook if it |
| 32 | has been used since the last reset. |
| 33 | |
| 34 | HISTORY |
| 35 | LDMud 3.2.10 allowed static functions to be given by name. |
| 36 | |
| 37 | SEE ALSO |
| 38 | hooks(C) |