game.things += [t_new]
game.changed = True
cmd_THING.argtypes = 'yx_tuple:nonneg string:thing_type int:nonneg'
+
+def cmd_THING_NAME(game, thing_id, name):
+ t = game.get_thing(thing_id)
+ if not t:
+ raise GameError('thing of ID %s not found' % thing_id)
+ t.name = name
+cmd_THING_NAME.argtypes = 'int:pos string'
self.map_control_passwords[tile_class]))
for t in [t for t in self.things if not t.type_ == 'Player']:
write(f, 'THING %s %s %s' % (t.position, t.type_, t.id_))
+ if hasattr(t, 'name'):
+ write(f, 'THING_NAME %s %s' % (t.id_, quote(t.name)))
def new_world(self, map_geometry):
self.map_geometry = map_geometry
if not arg.isdigit():
raise ArgError('Argument must be non-negative integer.')
args += [int(arg)]
+ elif tmpl == 'int:pos':
+ if not arg.isdigit() or int(arg) < 1:
+ raise ArgError('Argument must be positive integer.')
+ args += [int(arg)]
elif tmpl == 'char':
try:
ord(arg)
cmd_MAP, cmd_TURN, cmd_MAP_LINE, cmd_GET_ANNOTATION,
cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE,
cmd_TASKS, cmd_MAP_CONTROL_LINE, cmd_MAP_CONTROL_PW,
- cmd_GOD_ANNOTATE, cmd_GOD_PORTAL, cmd_THING_TYPES)
+ cmd_GOD_ANNOTATE, cmd_GOD_PORTAL, cmd_THING_TYPES,
+ cmd_THING_NAME)
from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP,
Task_DROP, Task_FLATTEN_SURROUNDINGS)
from plomrogue.things import Thing_Player, Thing_Stone
game.register_command(cmd_TASKS)
game.register_command(cmd_THING_TYPES)
game.register_command(cmd_THING)
+game.register_command(cmd_THING_NAME)
game.register_task(Task_WAIT)
game.register_task(Task_MOVE)
game.register_task(Task_WRITE)
if hasattr(t, 'player_char'):
info += t.player_char
if hasattr(t, 'name'):
- info += ' (name: %s)' % t.name
+ info += ' (%s)' % t.name
info += '\n'
if self.explorer in self.game.portals:
info += 'PORTAL: ' + self.game.portals[self.explorer] + '\n'