blob: ed5af8165e33aa2dd1db61130f9ef487f6603e82 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001CONCEPT
2 driver hooks
3
4DESCRIPTION
5 To allow a greater flexibility of the muds, the gamedrivers
6 since 3.2.1 moved several once hardcoded 'underground'
7 activities from the driver into the mudlib. This includes for
8 example the differences between compat and native mode.
9
10 The hooks are set with the privileged efun set_driver_hook().
11 Some of the hooks are mandatory, some not. Most hooks accept
12 unbound lambda closures as values, some also lfun closures or
13 even strings.
Zesstra7ea4a032019-11-26 20:11:40 +010014
MG Mud User88f12472016-06-24 23:31:02 +020015 The hooks are identified by an ordinal number, for which
16 symbolic names are defined in /sys/driverhooks.h.
17
18 H_MOVE_OBJECT0
19 H_MOVE_OBJECT1
20 Mandatory hooks to implement the efun void move_object().
21
22
23 H_LOAD_UIDS
24 H_CLONE_UIDS
Zesstra5481d492021-04-08 20:07:06 +020025 H_LWOBJECT_UIDS
26 Mandatory hooks to determine the uid and euid of loaded,
27 cloned or lightweight objects.
MG Mud User88f12472016-06-24 23:31:02 +020028
29
30 H_CREATE_SUPER
31 H_CREATE_OB
32 H_CREATE_CLONE
Zesstra5481d492021-04-08 20:07:06 +020033 H_CREATE_LWOBJECT
MG Mud User88f12472016-06-24 23:31:02 +020034 Optional hooks to initialize an object after creation.
35
Zesstra7ea4a032019-11-26 20:11:40 +010036 H_CREATE_SUPER is called for blueprints implicitly loaded
MG Mud User88f12472016-06-24 23:31:02 +020037 by inheritance, H_CREATE_OB for explicitely loaded
Zesstra5481d492021-04-08 20:07:06 +020038 blueprints/objects, H_CREATE_CLONE for cloned objects, and
39 H_CREATE_LWOBJECT for lightweight objects.
MG Mud User88f12472016-06-24 23:31:02 +020040
41
42 H_RESET
43 Optional hook to reset an object.
44
45
46 H_CLEAN_UP
47 Optional hook to clean up an object.
48
49
50 H_DEFAULT_METHOD
51 Optional hook to provide default implementation for unresolved
52 calls.
53
54
55 H_DEFAULT_PROMPT
56 Optional hook for the command prompt. If this hook is not used,
57 the driver will use "> " as the command prompt.
58
59
60 H_PRINT_PROMPT
61 Optional hook to print the current command prompt. If this hook is
62 not set, the driver will just print the prompt to the user.
63
64
65 H_COMMAND
66 Optional hook to parse and execute commands. If this hook is used,
67 it bypasses the normal command parsing done by the driver (including
68 the MODIFY_COMMAND and NOTIFY_FAIL hooks).
69
70
71 H_MODIFY_COMMAND
72 Optional hook to modify commands (both entered or given by a
73 call to command()) before the parser sees them (this includes
74 special commands like 'status').
75
76
77 H_MODIFY_COMMAND_FNAME
78 Mandatory hook specifying the name of the 'modify_command'
79 lfun to call for newly entered commands as result of a
80 set_modify_command().
81
82
83 H_NOTIFY_FAIL
84 Mandatory hook to issue the default message if an entered
85 command couldn't be parsed and no notify_fail() command is
86 in effect.
87
88
89 H_SEND_NOTIFY_FAIL
90 Optional hook to send the notify fail message, regardless
91 of how it was determined, to the player. If the hook is not
92 set, the message is delivered using tell_object() internally.
93
94
95 H_NO_IPC_SLOT
96 Optional hook specifying the message given to logins
97 rejected due to space limitations (MAX_PLAYER).
98
99
100 H_INCLUDE_DIRS
101 Semi-mandatory hook specifying the directories where <>-type
102 include files are searched (this includes ""-includes not
103 found as specified).
104
105
106 H_AUTO_INCLUDE
107 Optional hook specifying a string to be included before
108 the source of every compiled LPC object.
109
110
Zesstra7ea4a032019-11-26 20:11:40 +0100111 H_FILE_ENCODING
112 Optonal hook specifying the name of the encoding to be used
113 for decoding a file (default: "ascii").
114
115
MG Mud User88f12472016-06-24 23:31:02 +0200116 H_TELNET_NEG
117 Optional hook to specifiy how to perform a single telnet
Zesstra7ea4a032019-11-26 20:11:40 +0100118 negotiation. If not set, most telnet options are rejected (read:
MG Mud User88f12472016-06-24 23:31:02 +0200119 only a very minimal negotiation takes place).
120
121
122 H_NOECHO
123 Optional hook to specifiy how to perform the telnet actions
124 to switch the echo mode (used for e.g. password input_to()s).
125 If not set, a default handling is performed.
126
127 IMPORTANT: If this hook is used, the control of all telnet
128 negotiation is transferred to the mudlib (you must combine it
129 with H_TELNET_NEG to conform to the telnet protocol).
130
131
132 H_ERQ_STOP
133 Optional hook to notify the mudlib about the termination of
134 the erq demon.
135
136
Zesstra7ea4a032019-11-26 20:11:40 +0100137 H_MSG_DISCARDED
138 Optional hook to specify a message or take other measures
139 when a message had to be discarded.
140
MG Mud User88f12472016-06-24 23:31:02 +0200141HISTORY
142 The hooks concept was introduced in 3.2.1
143 H_MOVE_OBJECT0/1 were introduced in 3.2.1@1
144 H_CLEAN_UP was introduced in 3.2.1@34
145 H_MODIFY_COMMAND was introduced in 3.2.1@51.
146 H_MODIFY_COMMAND_FNAME was 'hooked' in 3.2.1@109.
147 H_NOTIFY_FAILE and H_NO_IPC_SLOT were introduced in 3.2.1@55.
148 H_INCLUDE_DIRS was introduced in 3.2.1@57.
149 H_TELNET_NEG was introduced in 3.2.1@60.
150 H_NOECHO and H_ERQ_STOP were introduced in 3.2.1@85.
151 H_COMMAND was introduced in 3.2.7.
152 H_SEND_NOTIFY_FAIL and H_AUTO_INCLUDE were introduced in 3.2.9.
153 H_DEFAULT_METHOD was introduced in 3.3.113.
154 H_DEFAULT_PROMPT and H_PRINT_PROMPT were introduced in 3.3.163.
Zesstra5481d492021-04-08 20:07:06 +0200155 H_CREATE_LWOBJECT and H_LWOBJECT_UIDS were introduced in 3.6.5.
MG Mud User88f12472016-06-24 23:31:02 +0200156
157SEE ALSO
158 native(C), set_driver_hook(E), all in (H)