blob: f1ba78ad97cf90ba4236ec3aa0baca100ea829f4 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <sys/driver_hooks.h>
3
4 set_driver_hook(H_RESET, value)
5
6 <value> being:
7
Zesstra85136122021-05-08 20:32:01 +02008 void <name>( void )
Zesstradaf2c672025-08-02 15:59:17 +02009 void|int <closure> ( void )
10 void|int <closure> (object obj_to_reset)
MG Mud User88f12472016-06-24 23:31:02 +020011
12DESCRIPTION
Zesstradaf2c672025-08-02 15:59:17 +020013 Optional hook to reset an object. Hook setting can be any
14 closure, or the name of the function (static or public) to
15 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, it is bound to the
18 object to be reset and called with no argument. If the hook
19 is any other type of closure, it is called with the target
20 object as argument.
MG Mud User88f12472016-06-24 23:31:02 +020021
22 If the result of this call is a positive number, it is used as
Zesstra7ea4a032019-11-26 20:11:40 +010023 the interval to wait before the next reset(). If the result
MG Mud User88f12472016-06-24 23:31:02 +020024 is 0, the default interval computed from TIME_TO_RESET is
Zesstra7ea4a032019-11-26 20:11:40 +010025 used. If the result is a negative number, the object will not
MG Mud User88f12472016-06-24 23:31:02 +020026 be reset again, unless directed otherwise by set_next_reset().
27
28 If the hook is defined as the name of an lfun in the object,
Zesstra85136122021-05-08 20:32:01 +020029 it is called in the object with no argument, and any result
Zesstra7ea4a032019-11-26 20:11:40 +010030 is ignored. In this call the previous_object() is the object
31 initiating the reset. If the function does not exist, the
MG Mud User88f12472016-06-24 23:31:02 +020032 object won't be reset again.
33
34 Note that an object is only reset by call to this hook if it
35 has been used since the last reset.
36
37HISTORY
38 LDMud 3.2.10 allowed static functions to be given by name.
Zesstra85136122021-05-08 20:32:01 +020039 LDMud 3.6.5 removed the argument given for the lfun call.
MG Mud User88f12472016-06-24 23:31:02 +020040
41SEE ALSO
42 hooks(C)