X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=c86aebe402ad5c1c6d5fadc776ad6e429d5092ed;hb=249d0afc8663af2a1dbdd9d2f893582fe235cf6c;hp=074cc343873a80b17e6383b604c7e109217210c6;hpb=5cd44408532e23648ddcd1d59004a9dae59694af;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'