home · contact · privacy
Store door state.
[plomrogue2] / plomrogue / commands.py
index 94d1c591045dcee8ffbdbcf0f7dd0ab5b5186efa..fc087fbe7434a4cc6966b773f123da07425909d4 100644 (file)
@@ -79,7 +79,7 @@ def cmd_LOGIN(game, nick, connection_id):
     t = game.thing_types['Player'](game)
     t.position = game.spawn_point
     game.things += [t]  # TODO refactor into Thing.__init__?
-    t.player_char = game.get_next_player_char()
+    t.thing_char = game.get_next_player_char()
     game.sessions[connection_id] = {
         'thing_id': t.id_,
         'status': 'player'
@@ -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'