home · contact · privacy
Make door closing visible.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 1 Dec 2020 02:31:25 +0000 (03:31 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 1 Dec 2020 02:31:25 +0000 (03:31 +0100)
plomrogue/commands.py
plomrogue/game.py
plomrogue/things.py
rogue_chat.html
rogue_chat_curses.py

index 94d1c591045dcee8ffbdbcf0f7dd0ab5b5186efa..c25740bd98f93d174b6f4312147abfa448761052 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'
index f504599f59e4146adcc96a2645c9b48583f8e672..8bc7f74b64a2890793352b7717a9c7222831fb38 100755 (executable)
@@ -214,9 +214,9 @@ class Game(GameBase):
                                                     quote(t.protection), t.id_), c_id)
                 if hasattr(t, 'name'):
                     self.io.send('THING_NAME %s %s' % (t.id_, quote(t.name)), c_id)
-                if hasattr(t, 'player_char'):
+                if hasattr(t, 'thing_char'):
                     self.io.send('THING_CHAR %s %s' % (t.id_,
-                                                       quote(t.player_char)), c_id)
+                                                       quote(t.thing_char)), c_id)
             for big_yx in self.portals:
                 for little_yx in [little_yx for little_yx in self.portals[big_yx]
                                   if player.fov_test(big_yx, little_yx)]:
index 4d319b9d21e0781b98d615d5d29f39e28392d2fd..b757157d99cef4375f344ec0038f83599503cae6 100644 (file)
@@ -87,10 +87,12 @@ class Thing_Door(Thing):
     def open(self):
         self.blocking = False
         self.portable = True
+        del self.thing_char
 
     def close(self):
         self.blocking = True
         self.portable = False
+        self.thing_char = '#'
 
 
 
index ce0b6a2c9d69785c9f33b315a7660dc2f514a77f..554c5945232f7aac6d57d786b02b206c7f8052cf 100644 (file)
@@ -430,7 +430,7 @@ let server = {
         } else if (tokens[0] === 'THING_CHAR') {
             let t = game.get_thing(tokens[1], false);
             if (t) {
-                t.player_char = tokens[2];
+                t.thing_char = tokens[2];
             };
         } else if (tokens[0] === 'TASKS') {
             game.tasks = tokens[1].split(',');
@@ -897,8 +897,8 @@ let tui = {
             let t = game.things[thing_id];
             let symbol = game.thing_types[t.type_];
             let meta_char = ' ';
-            if (t.player_char) {
-                meta_char = t.player_char;
+            if (t.thing_char) {
+                meta_char = t.thing_char;
             }
             if (used_positions.includes(t.position.toString())) {
                 meta_char = '+';
@@ -1231,8 +1231,8 @@ let explorer = {
                      protection = 'none';
                  }
                  info += "THING: " + t.type_ + " / " + symbol;
-                 if (t.player_char) {
-                     info += t.player_char;
+                 if (t.thing_char) {
+                     info += t.thing_char;
                  };
                  if (t.name_) {
                      info += " (" + t.name_ + ")";
index eb708a249a3ddc6c4392e2349fa81d0587de7d43..f715018cc85ef339591c7cfbf119bff5f73d041e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+e!/usr/bin/env python3
 import curses
 import queue
 import threading
@@ -179,7 +179,7 @@ cmd_THING_NAME.argtypes = 'int:nonneg string'
 def cmd_THING_CHAR(game, thing_id, c):
     t = game.get_thing(thing_id)
     if t:
-        t.player_char = c
+        t.thing_char = c
 cmd_THING_CHAR.argtypes = 'int:nonneg char'
 
 def cmd_MAP(game, geometry, size, content):
@@ -694,8 +694,8 @@ class TUI:
                             protection = 'none'
                         info += 'THING: %s / %s' % (t.type_,
                                                     self.game.thing_types[t.type_])
-                        if hasattr(t, 'player_char'):
-                            info += t.player_char
+                        if hasattr(t, 'thing_char'):
+                            info += t.thing_char
                         if hasattr(t, 'name'):
                             info += ' (%s)' % t.name
                         info += ' / protection: %s\n' % protection
@@ -757,8 +757,8 @@ class TUI:
                 for t in self.game.things:
                     symbol = self.game.thing_types[t.type_]
                     meta_char = ' '
-                    if hasattr(t, 'player_char'):
-                        meta_char = t.player_char
+                    if hasattr(t, 'thing_char'):
+                        meta_char = t.thing_char
                     if t.position in used_positions:
                         meta_char = '+'
                     map_lines_split[t.position.y][t.position.x] = symbol + meta_char