From 7fc75c298c5e54159bc86d5841ee9feab2fc64d0 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 13 Dec 2020 00:59:37 +0100 Subject: [PATCH] Enable un-naming of things. --- plomrogue/commands.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 8ea4ff3..026f996 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -252,7 +252,13 @@ def cmd_THING_NAME(game, thing_id, name, pw, connection_id): raise GameError('thing of ID %s not found' % thing_id) if not game.can_do_thing_with_pw(t, pw): raise GameError('wrong password for thing') - t.name = name + if name == ' ': + if hasattr(t.__class__, 'name'): + raise GameError('cannot un-name things of this type') + if hasattr(t, 'name'): + del t.name + else: + t.name = name game.changed = True # FIXME: pseudo-FOV-change actually game.record_fov_change(t.position) -- 2.30.2