From: Christian Heller Date: Sun, 20 Dec 2020 16:15:44 +0000 (+0100) Subject: Add chairs. X-Git-Url: https://plomlompom.com/repos/do_day?a=commitdiff_plain;h=2df42b53c56bd32dc445df532b4c42c53d97b767;p=plomrogue2 Add chairs. --- diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index b230326..ad8cfc8 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -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') diff --git a/plomrogue/things.py b/plomrogue/things.py index 3a72ca3..ad87ebd 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -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 diff --git a/rogue_chat.py b/rogue_chat.py index b49f07c..f37477b 100755 --- a/rogue_chat.py +++ b/rogue_chat.py @@ -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']: