home · contact · privacy
Server: Add WORLD_ACTIVE checks.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 5 Mar 2016 20:59:52 +0000 (21:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 5 Mar 2016 20:59:52 +0000 (21:59 +0100)
server/commands.py
server/io.py

index 97fce9aad9881c3befb75c344b1485c50d67f828..b8216a0fec6433699401b6eefc9cfa4bf41a7080 100644 (file)
@@ -441,7 +441,8 @@ def set_command(action):
 
 def play_wait():
     """Try "wait" as player's T_COMMAND."""
-    set_command("wait")
+    if world_db["WORLD_ACTIVE"]:
+        set_command("wait")
 
 
 def action_exists(action):
@@ -455,7 +456,7 @@ def action_exists(action):
 
 def play_pickup():
     """Try "pickup" as player's T_COMMAND"."""
-    if action_exists("pickup"):
+    if action_exists("pickup") and world_db["WORLD_ACTIVE"]:
         t = world_db["Things"][0]
         ids = [tid for tid in world_db["Things"] if tid
                if not world_db["Things"][tid]["carried"]
@@ -469,7 +470,7 @@ def play_pickup():
 
 def play_drop(str_arg):
     """Try "drop" as player's T_COMMAND, int(str_arg) as T_ARGUMENT / slot."""
-    if action_exists("drop"):
+    if action_exists("drop") and world_db["WORLD_ACTIVE"]:
         t = world_db["Things"][0]
         if 0 == len(t["T_CARRIES"]):
             log("You have NOTHING to drop in your inventory.")
@@ -484,7 +485,7 @@ def play_drop(str_arg):
 
 def play_use(str_arg):
     """Try "use" as player's T_COMMAND, int(str_arg) as T_ARGUMENT / slot."""
-    if action_exists("use"):
+    if action_exists("use") and world_db["WORLD_ACTIVE"]:
         t = world_db["Things"][0]
         if 0 == len(t["T_CARRIES"]):
             log("You have NOTHING to use in your inventory.")
@@ -507,7 +508,7 @@ def play_use(str_arg):
 
 def play_move(str_arg):
     """Try "move" as player's T_COMMAND, str_arg as T_ARGUMENT / direction."""
-    if action_exists("move"):
+    if action_exists("move") and world_db["WORLD_ACTIVE"]:
         from server.config.world_data import directions_db, symbols_passable
         t = world_db["Things"][0]
         if not str_arg in directions_db:
@@ -534,5 +535,6 @@ def play_move(str_arg):
 def command_ai():
     """Call ai() on player Thing, then turn_over()."""
     from server.ai import ai
-    ai(world_db["Things"][0])
-    turn_over()
+    if world_db["WORLD_ACTIVE"]:
+        ai(world_db["Things"][0])
+        turn_over()
index 3e1fb41862e18827fb4ad805e3aab556900c6a99..ce3ee1a947eca4b9109cf4e9df51c57f41248028 100644 (file)
@@ -286,7 +286,7 @@ def obey_lines_in_file(path, name, do_record=False):
 
 def try_worldstate_update():
     """Write worldstate file if io_db["worldstate_updateable"] is set."""
-    if io_db["worldstate_updateable"]:
+    if world_db["WORLD_ACTIVE"] and io_db["worldstate_updateable"]:
         string = ""
         for entry in io_db["worldstate_write_order"]:
             if entry[1] == "world_int":