home · contact · privacy
Show Thing installation status in Thing info display.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 02:12:40 +0000 (03:12 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 02:12:40 +0000 (03:12 +0100)
plomrogue/game.py
rogue_chat.html
rogue_chat_curses.py

index 647332452fdd3c94ecbf9e6f9fe0a7fea975dc1f..68d4858da793b07d9385a0ebcc25a579dc353263 100755 (executable)
@@ -242,6 +242,8 @@ class Game(GameBase):
                                                        quote(t.thing_char)), c_id)
                 if hasattr(t, 'carrying') and t.carrying:
                     self.io.send('THING_CARRYING %s' % (t.id_), c_id)
+                if hasattr(t, 'installable') and not t.portable:
+                    self.io.send('THING_INSTALLED %s' % (t.id_), 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 f0f2faa1213ac1786ca59eaaafeb4f4eac9467e9..27ae875da3b449e37f64ddecb5d241e667526980 100644 (file)
@@ -497,6 +497,11 @@ let server = {
             if (t) {
                 t.carrying = true;
             };
+        } else if (tokens[0] === 'THING_INSTALLED') {
+            let t = game.get_thing(tokens[1], false);
+            if (t) {
+                t.installed = true;
+            };
         } else if (tokens[0] === 'TERRAIN') {
             game.terrains[tokens[1]] = tokens[2]
         } else if (tokens[0] === 'MAP') {
@@ -1355,12 +1360,15 @@ let explorer = {
     get_thing_info: function(t) {
         const symbol = game.thing_types[t.type_];
         let info = t.type_ + " / " + symbol;
-         if (t.thing_char) {
-             info += t.thing_char;
-         };
-         if (t.name_) {
-             info += " (" + t.name_ + ")";
-         }
+        if (t.thing_char) {
+            info += t.thing_char;
+        };
+        if (t.name_) {
+            info += " (" + t.name_ + ")";
+        }
+        if (t.installed) {
+            info += " / installed";
+        }
         return info;
     },
     annotate: function(msg) {
index e6ddda87a20f62e71d64974dba56ad82d1e1653c..bc3c40d8839bd953e8d4e7ba36db3291a8df79dc 100755 (executable)
@@ -292,9 +292,13 @@ 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_INSTALLED(game, thing_id):
+    game.get_thing(thing_id).installed = True
+cmd_THING_INSTALLED.argtypes = 'int:pos'
+
 def cmd_THING_CARRYING(game, thing_id):
     game.get_thing(thing_id).carrying = True
-cmd_THING_CARRYING.argtypes = 'int:nonneg'
+cmd_THING_CARRYING.argtypes = 'int:pos'
 
 def cmd_TERRAIN(game, terrain_char, terrain_desc):
     game.terrains[terrain_char] = terrain_desc
@@ -331,6 +335,7 @@ class Game(GameBase):
         self.register_command(cmd_THING_NAME)
         self.register_command(cmd_THING_CHAR)
         self.register_command(cmd_THING_CARRYING)
+        self.register_command(cmd_THING_INSTALLED)
         self.register_command(cmd_TERRAIN)
         self.register_command(cmd_MAP)
         self.register_command(cmd_MAP_CONTROL)
@@ -720,6 +725,8 @@ class TUI:
             info += t.thing_char
         if hasattr(t, 'name'):
             info += ' (%s)' % t.name
+        if hasattr(t, 'installed'):
+            info += ' / installed'
         return info
 
     def loop(self, stdscr):