home · contact · privacy
Mark thing-carrying players with $ instead of +.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 00:50:20 +0000 (01:50 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 00:50:20 +0000 (01:50 +0100)
plomrogue/game.py
rogue_chat.html
rogue_chat_curses.py

index a1c2ee641cc1dcfefd8797b284676095ab69e83b..cd1ce2ea8ee5e3c947e10075acb2a0e39ae64969 100755 (executable)
@@ -238,6 +238,8 @@ class Game(GameBase):
                 if hasattr(t, 'thing_char'):
                     self.io.send('THING_CHAR %s %s' % (t.id_,
                                                        quote(t.thing_char)), c_id)
+                if hasattr(t, 'carrying') and t.carrying:
+                    self.io.send('THING_CARRYING %s' % (t.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 573e295874411a5a8ebe319adbddb7472dbd4b1a..0c0cb307c65366d9ff1d6ec0de0c45f55230bf6f 100644 (file)
@@ -488,6 +488,11 @@ let server = {
             tui.mode_take_thing.legal = game.tasks.includes('PICK_UP');
         } else if (tokens[0] === 'THING_TYPE') {
             game.thing_types[tokens[1]] = tokens[2]
+        } else if (tokens[0] === 'THING_CARRYING') {
+            let t = game.get_thing(tokens[1], false);
+            if (t) {
+                t.carrying = true;
+            };
         } else if (tokens[0] === 'TERRAIN') {
             game.terrains[tokens[1]] = tokens[2]
         } else if (tokens[0] === 'MAP') {
@@ -994,6 +999,9 @@ let tui = {
                 if (used_positions.includes(t.position.toString())) {
                     meta_char = '+';
                 };
+                if (t.carrying) {
+                    meta_char = '$';
+                }
                 map_lines_split[t.position[0]][t.position[1]] = symbol + meta_char;
                 used_positions.push(t.position.toString());
             }
index b7590381055dc93123178b82bf80811e0844e019..6a30f746f8cdc86e7fc787dfc676c1f3955a59e1 100755 (executable)
@@ -291,6 +291,10 @@ def cmd_THING_TYPE(game, thing_type, symbol_hint):
     game.thing_types[thing_type] = symbol_hint
 cmd_THING_TYPE.argtypes = 'string char'
 
+def cmd_THING_CARRYING(game, thing_id):
+    game.get_thing(thing_id).carrying = True
+cmd_THING_CARRYING.argtypes = 'int:nonneg'
+
 def cmd_TERRAIN(game, terrain_char, terrain_desc):
     game.terrains[terrain_char] = terrain_desc
 cmd_TERRAIN.argtypes = 'char string'
@@ -325,6 +329,7 @@ class Game(GameBase):
         self.register_command(cmd_THING_TYPE)
         self.register_command(cmd_THING_NAME)
         self.register_command(cmd_THING_CHAR)
+        self.register_command(cmd_THING_CARRYING)
         self.register_command(cmd_TERRAIN)
         self.register_command(cmd_MAP)
         self.register_command(cmd_MAP_CONTROL)
@@ -846,6 +851,8 @@ class TUI:
                             meta_char = t.thing_char
                         if t.position in used_positions:
                             meta_char = '+'
+                        if hasattr(t, 'carrying') and t.carrying:
+                            meta_char = '$'
                         map_lines_split[t.position.y][t.position.x] = symbol + meta_char
                         used_positions += [t.position]