From: Christian Heller Date: Tue, 1 Dec 2020 02:58:32 +0000 (+0100) Subject: Store door state. X-Git-Url: https://plomlompom.com/repos/edit?a=commitdiff_plain;h=e91c0688ee0d273d7f106e837e1ad52009d79350;p=plomrogue2 Store door state. --- diff --git a/plomrogue/commands.py b/plomrogue/commands.py index c25740b..fc087fb 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -310,3 +310,14 @@ def cmd_GOD_THING_PROTECTION(game, thing_id, protection_char): raise GameError('thing of ID %s not found' % thing_id) t.protection = protection_char cmd_GOD_THING_PROTECTION.argtypes = 'int:pos char' + +def cmd_THING_DOOR_CLOSED(game, thing_id): + 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.blocking = True + t.portable = False + t.thing_char = '#' +cmd_THING_DOOR_CLOSED.argtypes = 'int:pos' diff --git a/plomrogue/game.py b/plomrogue/game.py index 8bc7f74..dd9c50a 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -343,6 +343,8 @@ class Game(GameBase): write(f, 'GOD_THING_PROTECTION %s %s' % (t.id_, quote(t.protection))) if hasattr(t, 'name'): write(f, 'GOD_THING_NAME %s %s' % (t.id_, quote(t.name))) + if t.type_ == 'Door' and t.blocking: + write(f, 'THING_DOOR_CLOSED %s' % t.id_) write(f, 'SPAWN_POINT %s %s' % (self.spawn_point[0], self.spawn_point[1])) diff --git a/rogue_chat.py b/rogue_chat.py index 7bd86ed..c4a4400 100755 --- a/rogue_chat.py +++ b/rogue_chat.py @@ -7,7 +7,7 @@ from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_NICK, cmd_PING, cmd_THIN cmd_GOD_ANNOTATE, cmd_GOD_PORTAL, cmd_THING_TYPES, cmd_THING_NAME, cmd_TERRAINS, cmd_ADMIN_PASSWORD, cmd_BECOME_ADMIN, cmd_SET_TILE_CONTROL, - cmd_GOD_THING_NAME, + cmd_GOD_THING_NAME, cmd_THING_DOOR_CLOSED, cmd_GOD_THING_PROTECTION, cmd_THING_PROTECTION, cmd_SET_MAP_CONTROL_PASSWORD, cmd_SPAWN_POINT) from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP, @@ -40,6 +40,7 @@ game.register_command(cmd_THING) game.register_command(cmd_THING_PROTECTION) game.register_command(cmd_GOD_THING_PROTECTION) game.register_command(cmd_THING_NAME) +game.register_command(cmd_THING_DOOR_CLOSED) game.register_command(cmd_GOD_THING_NAME) game.register_command(cmd_ADMIN_PASSWORD) game.register_command(cmd_SET_TILE_CONTROL)