X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=plomrogue%2Fcommands.py;h=c86aebe402ad5c1c6d5fadc776ad6e429d5092ed;hb=509d9ca8e54529b5d728b1635df4ba4bbb0bcc23;hp=074cc343873a80b17e6383b604c7e109217210c6;hpb=023f991e645730e150bfd2782d16cbb4e440f78c;p=plomrogue2
diff --git a/plomrogue/commands.py b/plomrogue/commands.py
index 074cc34..c86aebe 100644
--- a/plomrogue/commands.py
+++ b/plomrogue/commands.py
@@ -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'