X-Git-Url: https://plomlompom.com/repos/process_titles?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=9cdab97a20963109c70460b6135c610b8cf94aaf;hb=7c03e8e8e4ed15f01e29dd331596719058af9f07;hp=074cc343873a80b17e6383b604c7e109217210c6;hpb=5cd44408532e23648ddcd1d59004a9dae59694af;p=plomrogue2 diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 074cc34..9cdab97 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -396,3 +396,35 @@ 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' + +def cmd_MAP_CONTROL_PRESETS(game, draw_control_presets): + game.draw_control_presets = draw_control_presets +cmd_MAP_CONTROL_PRESETS.argtypes = 'bool' + +def cmd_THING_SPAWNPOINT_CREATED(game, spawnpoint_id, timestamp): + import datetime + spawnpoint = game.get_thing(spawnpoint_id) + if not spawnpoint: + raise GameError('thing of ID %s not found' % spawnpoint_id) + if spawnpoint.type_ != 'SpawnPoint': + raise GameError('thing of ID %s not a SpawnPoint' % spawnpoint_id) + if timestamp == 0: + spawnpoint.temporary = False + else: + spawnpoint.temporary = True + spawnpoint.created_at = datetime.datetime.fromtimestamp(timestamp) +cmd_THING_SPAWNPOINT_CREATED.argtypes = 'int:pos int:nonneg'