From ce80e43db5939580763b1f66bff4f87f1cccc383 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 16 Dec 2020 22:45:07 +0100 Subject: [PATCH] Only allow cookable items to be cooked into cookies. --- plomrogue/tasks.py | 6 ++++++ plomrogue/things.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 94f79a3..9b53bbe 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -155,6 +155,12 @@ class Task_DROP(Task): if t.type_ == 'BottleDeposit' and t.position == target_position]: raise PlayError('cannot drop full bottle into bottle deposit') + for t in [t for t in self.thing.game.things + if t.type_ == 'CookieSpawner' + and t.position == target_position]: + if not self.thing.carrying.cookable: + raise PlayError('cannot cook items of this type') + break def do(self): target_position = self._get_move_target() diff --git a/plomrogue/things.py b/plomrogue/things.py index f8f1373..6f8b79d 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -26,6 +26,7 @@ class Thing(ThingBase): portable = False protection = '.' commandable = False + cookable = False carried = False def __init__(self, *args, **kwargs): @@ -206,6 +207,7 @@ class Thing_Door(ThingInstallable): class Thing_Psychedelic(Thing): symbol_hint = 'P' portable = True + cookable = True @@ -221,6 +223,7 @@ class Thing_Bottle(Thing): full = True thing_char = '~' spinnable = True + cookable = True def empty(self): self.thing_char = '_' @@ -258,6 +261,7 @@ class Thing_Hat(Thing): portable = True design = ' +--+ ' + ' | | ' + '======' spinnable = True + cookable = True def spin(self): new_design = '' @@ -308,6 +312,7 @@ class Thing_MusicPlayer(Thing): next_song_start = datetime.datetime.now() playlist_index = -1 playing = True + cookable = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) -- 2.30.2