From: Christian Heller Date: Mon, 7 Dec 2020 02:12:40 +0000 (+0100) Subject: Show Thing installation status in Thing info display. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/day?a=commitdiff_plain;h=5e1dd193ed529ff9d3ca3746736d74d3ca55d864;p=plomrogue2 Show Thing installation status in Thing info display. --- diff --git a/plomrogue/game.py b/plomrogue/game.py index 6473324..68d4858 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -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)]: diff --git a/rogue_chat.html b/rogue_chat.html index f0f2faa..27ae875 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -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) { diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index e6ddda8..bc3c40d 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -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):