home
·
contact
·
privacy
projects
/
plomrogue2
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add player-identifying meta characters next to @ symbols.
[plomrogue2]
/
rogue_chat_curses.py
diff --git
a/rogue_chat_curses.py
b/rogue_chat_curses.py
index f69153f1006cb127cf9f25a24bf52e6c2b118330..22ebc01aa526831a9c077c1e7f49bb19e213982d 100755
(executable)
--- a/
rogue_chat_curses.py
+++ b/
rogue_chat_curses.py
@@
-87,6
+87,12
@@
def cmd_THING_NAME(game, thing_id, name):
t.name = name
cmd_THING_NAME.argtypes = 'int:nonneg string'
t.name = name
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
+cmd_THING_CHAR.argtypes = 'int:nonneg char'
+
def cmd_MAP(game, geometry, size, content):
map_geometry_class = globals()['MapGeometry' + geometry]
game.map_geometry = map_geometry_class(size)
def cmd_MAP(game, geometry, size, content):
map_geometry_class = globals()['MapGeometry' + geometry]
game.map_geometry = map_geometry_class(size)
@@
-183,6
+189,7
@@
class Game(GameBase):
self.register_command(cmd_THING)
self.register_command(cmd_THING_TYPE)
self.register_command(cmd_THING_NAME)
self.register_command(cmd_THING)
self.register_command(cmd_THING_TYPE)
self.register_command(cmd_THING_NAME)
+ self.register_command(cmd_THING_CHAR)
self.register_command(cmd_MAP)
self.register_command(cmd_MAP_CONTROL)
self.register_command(cmd_PORTAL)
self.register_command(cmd_MAP)
self.register_command(cmd_MAP_CONTROL)
self.register_command(cmd_PORTAL)
@@
-445,7
+452,10
@@
class TUI:
info = 'TERRAIN: %s\n' % self.game.map_content[pos_i]
for t in self.game.things:
if t.position == self.explorer:
info = 'TERRAIN: %s\n' % self.game.map_content[pos_i]
for t in self.game.things:
if t.position == self.explorer:
- info += 'THING: %s' % t.type_
+ info += 'THING: %s / %s' % (t.type_,
+ self.game.thing_types[t.type_])
+ if hasattr(t, 'player_char'):
+ info += t.player_char
if hasattr(t, 'name'):
info += ' (name: %s)' % t.name
info += '\n'
if hasattr(t, 'name'):
info += ' (name: %s)' % t.name
info += '\n'
@@
-492,22
+502,29
@@
class TUI:
for y in range(self.game.map_geometry.size.y):
start = self.game.map_geometry.size.x * y
end = start + self.game.map_geometry.size.x
for y in range(self.game.map_geometry.size.y):
start = self.game.map_geometry.size.x * y
end = start + self.game.map_geometry.size.x
- map_lines_split += [
list(map_content[start:end])
]
+ map_lines_split += [
[c + ' ' for c in map_content[start:end]]
]
if self.map_mode == 'terrain':
if self.map_mode == 'terrain':
+ used_positions = []
for t in self.game.things:
symbol = self.game.thing_types[t.type_]
for t in self.game.things:
symbol = self.game.thing_types[t.type_]
- map_lines_split[t.position.y][t.position.x] = symbol
+ meta_char = ' '
+ if hasattr(t, 'player_char'):
+ meta_char = t.player_char
+ if t.position in used_positions:
+ meta_char = '+'
+ map_lines_split[t.position.y][t.position.x] = symbol + meta_char
+ used_positions += [t.position]
if self.mode.shows_info:
if self.mode.shows_info:
- map_lines_split[self.explorer.y][self.explorer.x] = '?'
+ map_lines_split[self.explorer.y][self.explorer.x] = '?
?
'
map_lines = []
if type(self.game.map_geometry) == MapGeometryHex:
indent = 0
for line in map_lines_split:
map_lines = []
if type(self.game.map_geometry) == MapGeometryHex:
indent = 0
for line in map_lines_split:
- map_lines += [indent*' ' + '
'.join(line)]
+ map_lines += [indent*' ' + ''.join(line)]
indent = 0 if indent else 1
else:
for line in map_lines_split:
indent = 0 if indent else 1
else:
for line in map_lines_split:
- map_lines += ['
'.join(line)]
+ map_lines += [''.join(line)]
window_center = YX(int(self.size.y / 2),
int(self.window_width / 2))
player = self.game.get_thing(self.game.player_id)
window_center = YX(int(self.size.y / 2),
int(self.window_width / 2))
player = self.game.get_thing(self.game.player_id)