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