home · contact · privacy
Add crates.
[plomrogue2] / plomrogue / commands.py
index 074cc343873a80b17e6383b604c7e109217210c6..c86aebe402ad5c1c6d5fadc776ad6e429d5092ed 100644 (file)
@@ -396,3 +396,17 @@ def cmd_THING_DOOR_KEY(game, key_id, door_id):
         raise GameError('thing of ID %s not a door' % key_id)
     key.door = door
 cmd_THING_DOOR_KEY.argtypes = 'int:pos int:pos'
+
+def cmd_THING_CRATE_ITEM(game, crate_id, item_id):
+    crate = game.get_thing(crate_id)
+    if not crate:
+        raise GameError('thing of ID %s not found' % crate_id)
+    if crate.type_ != 'Crate':
+        raise GameError('thing of ID %s not a crate' % crate_id)
+    item = game.get_thing(item_id)
+    if not item:
+        raise GameError('thing of ID %s not found' % item_id)
+    if item.type_ == 'Crate':
+        raise GameError('thing of ID %s is a crate' % item_id)
+    crate.accept(item)
+cmd_THING_CRATE_ITEM.argtypes = 'int:pos int:pos'