evennia.server.server

This module implements the main Evennia server process, the core of the game engine.

This module should be started with the ‘twistd’ executable since it sets up all the networking features. (this is done automatically by evennia/server/server_runner.py).

class evennia.server.server.Evennia(application)[source]

Bases: object

The main Evennia server handler. This object sets up the database and tracks and interlinks all the twisted network services that make up evennia.

__init__(application)[source]

Setup the server.

application - an instantiated Twisted application

sqlite3_prep()[source]

Optimize some SQLite stuff at startup since we can’t save it to the database.

update_defaults()[source]

We make sure to store the most important object defaults here, so we can catch if they change and update them on-objects automatically. This allows for changing default cmdset locations and default typeclasses in the settings file and have them auto-update all already existing objects.

run_initial_setup()[source]

This is triggered by the amp protocol when the connection to the portal has been established. This attempts to run the initial_setup script of the server. It returns if this is not the first time the server starts. Once finished the last_initial_setup_step is set to -1.

run_init_hooks(mode)[source]

Called by the amp client once receiving sync back from Portal

Parameters

mode (str) – One of shutdown, reload or reset

shutdown(mode='reload', _reactor_stopping=False)[source]

Shuts down the server from inside it.

mode - sets the server restart mode.
  • ‘reload’ - server restarts, no “persistent” scripts are stopped, at_reload hooks called.

  • ‘reset’ - server restarts, non-persistent scripts stopped, at_shutdown hooks called but sessions will not be disconnected.

  • ‘shutdown’ - like reset, but server will not auto-restart.

_reactor_stopping - this is set if server is stopped by a kill

command OR this method was already called once - in both cases the reactor is dead/stopping already.

get_info_dict()[source]

Return the server info, for display.

at_server_start()[source]

This is called every time the server starts up, regardless of how it was shut down.

at_server_stop()[source]

This is called just before a server is shut down, regardless of it is fore a reload, reset or shutdown.

at_server_reload_start()[source]

This is called only when server starts back up after a reload.

at_post_portal_sync(mode)[source]

This is called just after the portal has finished syncing back data to the server after reconnecting.

Parameters

mode (str) – One of reload, reset or shutdown.

at_server_reload_stop()[source]

This is called only time the server stops before a reload.

at_server_cold_start()[source]

This is called only when the server starts “cold”, i.e. after a shutdown or a reset.

at_server_cold_stop()[source]

This is called only when the server goes down due to a shutdown or reset.