home · contact · privacy
Make fullness/emptiness of bottles visible via .thing_char.
[plomrogue2] / plomrogue / things.py
index 15216efe5fdbaa8309a6f5b48bd5e4dc971dce2e..1c99737c039390938804d467d8e9a490e2dc2a67 100644 (file)
@@ -141,14 +141,20 @@ class Thing_Door(Thing):
 
 
 
-class Thing_Consumable(Thing):
+class Thing_Bottle(Thing):
     symbol_hint = 'B'
     portable = True
+    full = True
+    thing_char = '~'
 
+    def empty(self):
+        self.thing_char = '_'
+        self.full = False
 
 
-class Thing_ConsumableSpawner(ThingSpawner):
-    child_type = 'Consumable'
+
+class Thing_BottleSpawner(ThingSpawner):
+    child_type = 'Bottle'
 
 
 
@@ -157,7 +163,6 @@ class Thing_MusicPlayer(Thing):
     symbol_hint = 'R'
     commandable = True
     portable = True
-    playlist = []
     repeat = True
     next_song_start = datetime.datetime.now()
     playlist_index = 0
@@ -166,6 +171,7 @@ class Thing_MusicPlayer(Thing):
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
         self.next_song_start = datetime.datetime.now()
+        self.playlist = []
 
     def proceed(self):
         if (not self.playing) or len(self.playlist) == 0:
@@ -249,6 +255,30 @@ class Thing_MusicPlayer(Thing):
 
 
 
+class Thing_BottleDeposit(Thing):
+    bottle_counter = 0
+    symbol_hint = 'O'
+
+    def proceed(self):
+        if self.bottle_counter >= 3:
+            self.bottle_counter = 0
+            t = self.game.thing_types['MusicPlayer'](self.game,
+                                                     position=self.position)
+            self.game.things += [t]
+            self.sound('BOTTLE DEPOSITOR',
+                       'here is a gift as a reward for ecological consciousness –'
+                       'use "command thing" on it to learn more!')
+            self.game.changed = True
+
+    def accept(self):
+        self.bottle_counter += 1
+        self.sound('BOTTLE DEPOSITOR',
+                   'thanks for this empty bottle – deposit %s more for a gift!' %
+                   (3 - self.bottle_counter))
+
+
+
+
 class ThingAnimate(Thing):
     blocking = True
     drunk = 0