Meta commands
-------------
-PLUGIN [string]
-Run plugin code in ./plugins/[argument], with argument only consisting of
-alphanumeric characters and underscores.
-
PING
Write "PONG" line to ./server_run/out file.
God commands
------------
+PLUGIN [string]
+Run plugin code in ./plugins/[argument], with argument only consisting of
+alphanumeric characters and underscores.
+
TURN [0 to 65535]
Set world turn to argument. (Initial value: 0.)
if (str_plugin.replace("_", "").isalnum()
and os.access("plugins/server/" + str_plugin, os.F_OK)):
exec(open("plugins/server/" + str_plugin).read())
+ world_db["PLUGIN"] += [str_plugin]
return
print("Bad plugin name:", str_plugin)
to be called on it.
"""
commands_db = {
- "PLUGIN": (1, True, command_plugin),
+ "PLUGIN": (1, False, command_plugin),
"QUIT": (0, True, command_quit),
"PING": (0, True, command_ping),
"THINGS_HERE": (2, True, command_thingshere),
"PLAYER_TYPE": 0,
"WORLD_ACTIVE": 0,
"MAP": False,
+ "PLUGIN": [],
"ThingActions": {},
"ThingTypes": {},
"Things": {}
string = ""
for key in sorted(world_db.keys()):
- if (not isinstance(world_db[key], dict)) and key != "MAP" and \
+ if (not isinstance(world_db[key], dict) and
+ not isinstance(world_db[key], list)) and key != "MAP" and \
key != "WORLD_ACTIVE":
string = string + key + " " + str(world_db[key]) + "\n"
+ for plugin in world_db["PLUGIN"]:
+ string = string + "PLUGIN " + plugin + "\n"
string = string + mapsetter("MAP")()
string = string + helper("ThingActions", "TA_ID")
string = string + helper("ThingTypes", "TT_ID", {"TT_CORPSE_ID": False})