t.protection = protection_char
cmd_GOD_THING_PROTECTION.argtypes = 'int:pos char'
-def cmd_THING_DOOR_CLOSED(game, thing_id):
+def cmd_THING_DOOR_CLOSED(game, thing_id, locked):
t = game.get_thing(thing_id)
if not t:
raise GameError('thing of ID %s not found' % thing_id)
if not t.type_ == 'Door':
raise GameError('thing of ID %s not door' % thing_id)
t.close()
-cmd_THING_DOOR_CLOSED.argtypes = 'int:pos'
+ if locked:
+ t.lock()
+cmd_THING_DOOR_CLOSED.argtypes = 'int:pos bool'
def cmd_THING_MUSICPLAYER_SETTINGS(game, thing_id, playing, index, repeat):
t = game.get_thing(thing_id)
raise GameError('thing of ID %s not a hat' % thing_id)
t.design = design
cmd_THING_HAT_DESIGN.argtypes = 'int:pos string'
+
+def cmd_THING_DOOR_KEY(game, key_id, door_id):
+ key = game.get_thing(key_id)
+ if not key:
+ raise GameError('thing of ID %s not found' % key_id)
+ if key.type_ != 'DoorKey':
+ raise GameError('thing of ID %s not a door key' % key_id)
+ door = game.get_thing(door_id)
+ if not door:
+ raise GameError('thing of ID %s not found' % door_id)
+ if door.type_ != 'Door':
+ raise GameError('thing of ID %s not a door' % key_id)
+ key.door = door
+cmd_THING_DOOR_KEY.argtypes = 'int:pos int:pos'