Module driver.engine
Holds the Engine class which manages the following things:
-
registered managers (who get nice things like startup and shutdown
calls)
-
hooks and all registered functions
-
the thread that manages the event queue and execution of events
therein
Hooks<hooks> are pretty interesting. Our
hooks are created when something first registers with the hook. If
nothing registers with the hook, then calling spamHook will do nothing.
Hooks can be regular hooks (list of registered functions) or priority
hooks. Spamming a hook can also take a mapping function enabling you to
mutate the data between function calls. You can also spam a hook in such
a way that each individual function is called in a try/except block for
added safety. See spamHook for more information.
The driver creates the following important hooks:
startup - the startup hook for when the mud starts up. Things
should get initialized, but wait to spin off threads until this hook is
spammed. By the time this hook is spammed, you're guaranteed to have the
rest of the mud bootstrapped.
args tuple is (options dict,)
connect - the connect hook gets spammed when something connects
to the server.
args tuple is (Connection,)
disconnect - the disconnect hook gets spammed when something
disconnects from the mud--this could be from the network thread (the user
dropped his/her connection) or from an in-game source (the user quit or
was booted).
args tuple is (Connection, reason_int)
user_input - the user_input hook gets spammed whenever a Connection
has incoming input. Depending on the connection state, this is typically
a complete line of input.
args tuple is (Connection, input string)
Function Summary |
Engine
|
get_engine ()
This will instantiate a new Engine object if none has been
created. |
get_engine()
This will instantiate a new Engine object if none has been created.
Otherwise it returns the existing singleton Engine object.
-
- Returns:
-
the Engine object
(type=Engine)
|
my_engine
-
- Type:
-
NoneType
- Value:
|