blob: aada84e267faa58672d37ffd300c36b6a2d49e8c [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
25 Mandatory hooks to determine the uid and euid of loaded or cloned
26 objects.
27
28
29 H_CREATE_SUPER
30 H_CREATE_OB
31 H_CREATE_CLONE
32 Optional hooks to initialize an object after creation.
33
Zesstra7ea4a032019-11-26 20:11:40 +010034 H_CREATE_SUPER is called for blueprints implicitly loaded
MG Mud User88f12472016-06-24 23:31:02 +020035 by inheritance, H_CREATE_OB for explicitely loaded
36 blueprints/objects, and H_CREATE_CLONE for cloned objects.
37
38
39 H_RESET
40 Optional hook to reset an object.
41
42
43 H_CLEAN_UP
44 Optional hook to clean up an object.
45
46
47 H_DEFAULT_METHOD
48 Optional hook to provide default implementation for unresolved
49 calls.
50
51
52 H_DEFAULT_PROMPT
53 Optional hook for the command prompt. If this hook is not used,
54 the driver will use "> " as the command prompt.
55
56
57 H_PRINT_PROMPT
58 Optional hook to print the current command prompt. If this hook is
59 not set, the driver will just print the prompt to the user.
60
61
62 H_COMMAND
63 Optional hook to parse and execute commands. If this hook is used,
64 it bypasses the normal command parsing done by the driver (including
65 the MODIFY_COMMAND and NOTIFY_FAIL hooks).
66
67
68 H_MODIFY_COMMAND
69 Optional hook to modify commands (both entered or given by a
70 call to command()) before the parser sees them (this includes
71 special commands like 'status').
72
73
74 H_MODIFY_COMMAND_FNAME
75 Mandatory hook specifying the name of the 'modify_command'
76 lfun to call for newly entered commands as result of a
77 set_modify_command().
78
79
80 H_NOTIFY_FAIL
81 Mandatory hook to issue the default message if an entered
82 command couldn't be parsed and no notify_fail() command is
83 in effect.
84
85
86 H_SEND_NOTIFY_FAIL
87 Optional hook to send the notify fail message, regardless
88 of how it was determined, to the player. If the hook is not
89 set, the message is delivered using tell_object() internally.
90
91
92 H_NO_IPC_SLOT
93 Optional hook specifying the message given to logins
94 rejected due to space limitations (MAX_PLAYER).
95
96
97 H_INCLUDE_DIRS
98 Semi-mandatory hook specifying the directories where <>-type
99 include files are searched (this includes ""-includes not
100 found as specified).
101
102
103 H_AUTO_INCLUDE
104 Optional hook specifying a string to be included before
105 the source of every compiled LPC object.
106
107
Zesstra7ea4a032019-11-26 20:11:40 +0100108 H_FILE_ENCODING
109 Optonal hook specifying the name of the encoding to be used
110 for decoding a file (default: "ascii").
111
112
MG Mud User88f12472016-06-24 23:31:02 +0200113 H_TELNET_NEG
114 Optional hook to specifiy how to perform a single telnet
Zesstra7ea4a032019-11-26 20:11:40 +0100115 negotiation. If not set, most telnet options are rejected (read:
MG Mud User88f12472016-06-24 23:31:02 +0200116 only a very minimal negotiation takes place).
117
118
119 H_NOECHO
120 Optional hook to specifiy how to perform the telnet actions
121 to switch the echo mode (used for e.g. password input_to()s).
122 If not set, a default handling is performed.
123
124 IMPORTANT: If this hook is used, the control of all telnet
125 negotiation is transferred to the mudlib (you must combine it
126 with H_TELNET_NEG to conform to the telnet protocol).
127
128
129 H_ERQ_STOP
130 Optional hook to notify the mudlib about the termination of
131 the erq demon.
132
133
Zesstra7ea4a032019-11-26 20:11:40 +0100134 H_MSG_DISCARDED
135 Optional hook to specify a message or take other measures
136 when a message had to be discarded.
137
MG Mud User88f12472016-06-24 23:31:02 +0200138HISTORY
139 The hooks concept was introduced in 3.2.1
140 H_MOVE_OBJECT0/1 were introduced in 3.2.1@1
141 H_CLEAN_UP was introduced in 3.2.1@34
142 H_MODIFY_COMMAND was introduced in 3.2.1@51.
143 H_MODIFY_COMMAND_FNAME was 'hooked' in 3.2.1@109.
144 H_NOTIFY_FAILE and H_NO_IPC_SLOT were introduced in 3.2.1@55.
145 H_INCLUDE_DIRS was introduced in 3.2.1@57.
146 H_TELNET_NEG was introduced in 3.2.1@60.
147 H_NOECHO and H_ERQ_STOP were introduced in 3.2.1@85.
148 H_COMMAND was introduced in 3.2.7.
149 H_SEND_NOTIFY_FAIL and H_AUTO_INCLUDE were introduced in 3.2.9.
150 H_DEFAULT_METHOD was introduced in 3.3.113.
151 H_DEFAULT_PROMPT and H_PRINT_PROMPT were introduced in 3.3.163.
152
153SEE ALSO
154 native(C), set_driver_hook(E), all in (H)