home · contact · privacy
Store door state.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 1 Dec 2020 02:58:32 +0000 (03:58 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 1 Dec 2020 02:58:32 +0000 (03:58 +0100)
plomrogue/commands.py
plomrogue/game.py
rogue_chat.py

index c25740bd98f93d174b6f4312147abfa448761052..fc087fbe7434a4cc6966b773f123da07425909d4 100644 (file)
@@ -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'
index 8bc7f74b64a2890793352b7717a9c7222831fb38..dd9c50a76a7e65c211f9425d413c18911611200d 100755 (executable)
@@ -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]))
 
index 7bd86edc6ef5d522d88da351881de3923af50550..c4a44008c4b20bf78df8148ba38b3bebf2191286 100755 (executable)
@@ -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)