From: Christian Heller Date: Sat, 12 Dec 2020 23:59:37 +0000 (+0100) Subject: Enable un-naming of things. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/conditions?a=commitdiff_plain;h=7fc75c298c5e54159bc86d5841ee9feab2fc64d0;p=plomrogue2 Enable un-naming of things. --- 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)