home · contact · privacy
Enable un-naming of things.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 12 Dec 2020 23:59:37 +0000 (00:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 12 Dec 2020 23:59:37 +0000 (00:59 +0100)
plomrogue/commands.py

index 8ea4ff34a738615c53b65f9349f905e483d39169..026f99603de4b90562c1d4f1d639481a3b3bddaf 100644 (file)
@@ -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)