home · contact · privacy
Server: Make ai func selectable.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 21 Feb 2016 20:53:37 +0000 (21:53 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 21 Feb 2016 20:53:37 +0000 (21:53 +0100)
server/commands.py
server/config/actions.py
server/world.py

index 975e1bd4477800d0d3a22693aeba28981f6c76df..9a103372d91fd8aae96bf403dc93d7fc881a80d8 100644 (file)
@@ -507,6 +507,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])
+    from server.config.actions import ai_func
+    ai_func(world_db["Things"][0])
     turn_over()
index 3e10f3231dfb2b089814bc4fb44189e115dc3012..66be0e20d9370e17208131852a6b527bd32a4df5 100644 (file)
@@ -5,7 +5,6 @@
 
 from server.actions import actor_wait, actor_move, actor_pickup, actor_drop, \
     actor_use
-
 action_db = {
     "actor_wait": actor_wait,
     "actor_move": actor_move,
@@ -13,3 +12,6 @@ action_db = {
     "actor_drop": actor_drop,
     "actor_use": actor_use
 }
+
+from server.ai import ai
+ai_func = ai
index 7940f70d700f177be5c9bce75374e8f8de0fcab9..9bd9f6d197f3e65bc09f0bcfebd27643189ceef1 100644 (file)
@@ -309,8 +309,7 @@ def make_world(seed):
 
 def turn_over():
     """Run game world and its inhabitants until new player input expected."""
-    from server.config.actions import action_db
-    from server.ai import ai
+    from server.config.actions import action_db, ai_func
     id = 0
     whilebreaker = False
     while world_db["Things"][0]["T_LIFEPOINTS"]:
@@ -331,7 +330,7 @@ def turn_over():
                     if 0 == id:
                         whilebreaker = True
                         break
-                    ai(Thing)
+                    ai_func(Thing)
                 try_healing(Thing)
                 hunger(Thing)
                 if Thing["T_LIFEPOINTS"]: