From: Christian Heller Date: Tue, 1 Dec 2020 02:31:25 +0000 (+0100) Subject: Make door closing visible. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/tasks?a=commitdiff_plain;h=6cb3a857a09ae974bf0f510dfa94fb19fba2ce31;p=plomrogue2 Make door closing visible. --- diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 94d1c59..c25740b 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -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' diff --git a/plomrogue/game.py b/plomrogue/game.py index f504599..8bc7f74 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -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)]: diff --git a/plomrogue/things.py b/plomrogue/things.py index 4d319b9..b757157 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -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 = '#' diff --git a/rogue_chat.html b/rogue_chat.html index ce0b6a2..554c594 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -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_ + ")"; diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index eb708a2..f715018 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -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