home · contact · privacy
Add chairs.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 20 Dec 2020 16:15:44 +0000 (17:15 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 20 Dec 2020 16:15:44 +0000 (17:15 +0100)
plomrogue/tasks.py
plomrogue/things.py
rogue_chat.py

index b2303261dbdedf60e88bae280eab1e11110ecadc..ad8cfc8b648c3a2cfcc53d76166e5d7dc5060395 100644 (file)
@@ -70,6 +70,11 @@ class Task_MOVE(Task):
                 self.thing.send_msg('CHAT "You sink into the %s. '
                                     'Staying here will replenish your energy."'
                                     % terrain_type.description)
+        for t in [t for t in self.thing.game.things
+                  if t.type_ == 'Chair' and t.position == self.thing.position]:
+            self.thing.standing = False
+            self.thing.send_msg('CHAT "You sink into the Chair. '
+                                'Staying here will replenish your energy."')
         self.thing.invalidate('fov')
         if self.thing.blocks_light:
             self.thing.game.record_change(self.thing.position, 'fov')
index 3a72ca31728dfd72ebeb8e6cd8b23510db34615c..ad87ebd90c52bd65c3b44615b89a971e1144d00c 100644 (file)
@@ -29,6 +29,7 @@ class Thing(ThingBase):
     cookable = False
     carried = False
     consumable = False
+    sittable = False
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
@@ -482,6 +483,19 @@ class Thing_StimulantSpawner(ThingSpawner):
 
 
 
+class Thing_Chair(Thing):
+    symbol_hint = 'h'
+    portable = True
+    sittable = True
+
+
+
+class Thing_ChairSpawner(ThingSpawner):
+    symbol_hint = 'e'
+    child_type = 'Chair'
+
+
+
 class Thing_Cookie(Thing):
     symbol_hint = 'c'
     portable = True
index b49f07c23d448fe9aa16f427198ef30188588ef9..f37477b3c3f28b6c9fdb26ec1d8bbb6d1d3db789 100755 (executable)
@@ -33,7 +33,7 @@ from plomrogue.things import (Thing_Player, Thing_Item, Thing_ItemSpawner,
                               Thing_PsychedelicSpawner, Thing_DoorKey,
                               Thing_Crate, Thing_CrateSpawner, Thing_Stimulant,
                               Thing_StimulantSpawner, Thing_Sign,
-                              Thing_SignSpawner)
+                              Thing_SignSpawner, Thing_Chair, Thing_ChairSpawner)
 
 from plomrogue.config import config
 game = Game(config['savefile'])
@@ -120,6 +120,8 @@ game.register_thing_type(Thing_Stimulant)
 game.register_thing_type(Thing_StimulantSpawner)
 game.register_thing_type(Thing_Sign)
 game.register_thing_type(Thing_SignSpawner)
+game.register_thing_type(Thing_Chair)
+game.register_thing_type(Thing_ChairSpawner)
 game.read_savefile()
 game.io.start_loop()
 for port in config['servers']: