home · contact · privacy
Add attempt to wear bottle on head.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 9 Dec 2020 04:44:18 +0000 (05:44 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 9 Dec 2020 04:44:18 +0000 (05:44 +0100)
plomrogue/tasks.py
plomrogue/things.py

index 1e6737b64671188b967e42210a6fda8f73b7e3c9..6a886496658f4c228e33563fb6958a09c8efe4cc 100644 (file)
@@ -234,8 +234,8 @@ class Task_WEAR(Task):
             raise PlayError('carrying nothing to wear')
         if self.thing.name in self.thing.game.hats:
             raise PlayError('already wearing a hat')
-        if self.thing.carrying.type_ != 'Hat':
-            raise PlayError('can only wear a hat')
+        if self.thing.carrying.type_ not in {'Hat', 'Bottle'}:
+            raise PlayError('can not wear the kind of thing you hold')
 
     def do(self):
         if self.thing.name in self.thing.game.hats:
@@ -249,10 +249,16 @@ class Task_WEAR(Task):
                 remixer.accept(t)
                 break
         else:
-            self.thing.game.hats[self.thing.name] = self.thing.carrying.design
+            if self.thing.carrying.type_ == 'Bottle':
+                self.thing.send_msg('CHAT "Your attempt to wear a bottle on '
+                                    'your head fails."')
+                self.thing.carrying.sound('BOTTLE', 'SMASH')
+            elif self.thing.carrying.type_ == 'Hat':
+                self.thing.game.hats[self.thing.name] =\
+                    self.thing.carrying.design
+                self.thing.send_msg('CHAT "You put on a hat."')
             self.thing.game.remove_thing(self.thing.carrying)
             self.thing.carrying = None
-            self.thing.send_msg('CHAT "You put on a hat."')
 
 
 
index ab54e306c2a86215565159a10ddda45e57e0e4a7..ea0e71ccb912aee1ce9ae60ea34a6b23a4dd44fa 100644 (file)
@@ -24,6 +24,7 @@ class Thing(ThingBase):
     protection = '.'
     commandable = False
     carried = False
+    carrying = False
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)