home · contact · privacy
Enforce sane create_unfound decisions.
[plomrogue2-experiments] / new / plomrogue / commands.py
index c09bc4e177ff145bdcf17510d0aaf13c89bc40eb..7eecf23b77a7e2fb515674626a99f33f72389855 100644 (file)
@@ -34,7 +34,7 @@ def cmd_MAP_STATS(game, map_pos, type_, population, health):
 cmd_MAP_STATS = 'yx_tuple string:thingtype int:nonneg int:nonneg'
 
 def cmd_THING_TYPE(game, i, type_):
-    t_old = game.get_thing(i)
+    t_old = game.get_thing(i, create_unfound=True)
     t_new = game.thing_types[type_](game, i)
     #attr_names_of_old = [name for name in dir(t_old) where name[:2] != '__']
     #attr_names_of_new = [name for name in dir(t_new) where name[:2] != '__']
@@ -56,21 +56,21 @@ def cmd_THING_TYPE(game, i, type_):
 cmd_THING_TYPE.argtypes = 'int:nonneg string:thingtype'
 
 def cmd_THING_POS(game, i, big_yx, small_yx):
-    t = game.get_thing(i)
+    t = game.get_thing(i, create_unfound=True)
     t.position = (big_yx, small_yx)
 cmd_THING_POS.argtypes = 'int:nonneg yx_tuple yx_tuple:nonneg'
 
 def cmd_THING_INVENTORY(game, id_, ids):
-    carrier = game.get_thing(id_)
+    carrier = game.get_thing(id_, create_unfound=True)
     carrier.inventory = ids
     for id_ in ids:
-        t = game.get_thing(id_)
+        t = game.get_thing(id_, create_unfound=True)
         t.in_inventory = True
         t.position = carrier.position
 cmd_THING_INVENTORY.argtypes = 'int:nonneg seq:int:nonneg'
 
 def cmd_THING_HEALTH(game, id_, health):
-    t = game.get_thing(id_)
+    t = game.get_thing(id_, create_unfound=True)
     t.health = health
 cmd_THING_HEALTH.argtypes = 'int:nonneg int:nonneg'