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'
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)]:
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 = '#'
} 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(',');
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 = '+';
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_ + ")";
-#!/usr/bin/env python3
+e!/usr/bin/env python3
import curses
import queue
import threading
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):
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
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