home · contact · privacy
Simplify toilet need calcuation, add pee-into-pants emergency exit.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 15 Dec 2020 04:24:13 +0000 (05:24 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 15 Dec 2020 04:24:13 +0000 (05:24 +0100)
plomrogue/tasks.py
plomrogue/things.py

index 09e9c56702083cefbff105268a5c7a241f20d8fb..4f390d47c92a88fbb1782944f623b3c44012d846 100644 (file)
@@ -195,8 +195,7 @@ class Task_INTOXICATE(Task):
             self.thing.carrying.full = False
             self.thing.carrying.empty()
             self.thing.send_msg('CHAT "You are drunk now."')
-            self.thing.need_for_toilet *= 2
-            self.thing.need_for_toilet += 1
+            self.thing.need_for_toilet += 10000
             self.thing.drunk = 10000
             self.thing.invalidate('fov')
             self.thing.game.record_change(self.thing.position, 'other')
index a677f5015c6e08f15a7ed3e1a7bfb6708c98b548..249a138eef3c7570b03e9d43d25cfd8e0cc790c7 100644 (file)
@@ -564,7 +564,6 @@ class Thing_Player(ThingAnimate):
     drunk = 0
     tripping = 0
     need_for_toilet = 0
-    last_pee_need_test = datetime.datetime.now()
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
@@ -577,18 +576,18 @@ class Thing_Player(ThingAnimate):
         if self.tripping >= 0:
             self.tripping -= 1
         if self.need_for_toilet > 0:
-            self.need_for_toilet *= 1.0001
+            self.need_for_toilet += 1
             terrain = self.game.maps[self.position[0]][self.position[1]]
             if terrain in self.game.terrains:
                 terrain_type = self.game.terrains[terrain]
                 if 'toilet' in terrain_type.tags:
                     self.send_msg('CHAT "You use the toilet. What a relief!"')
                     self.need_for_toilet = 0
-            if self.last_pee_need_test + datetime.timedelta(seconds=1) <\
-               datetime.datetime.now() and\
-               10000 * random.random() < self.need_for_toilet / 100000:
-                self.send_msg('CHAT "You need to use a toilet."')
-                self.last_pee_need_test = datetime.datetime.now()
+            if 10000 * random.random() < self.need_for_toilet / 100000:
+                self.send_msg('CHAT "You need to go to a toilet. %s"' % self.need_for_toilet)
+            if self.need_for_toilet > 1000000:
+                self.send_msg('CHAT "You pee into your pants. Eww!"')
+                self.need_for_toilet = 0
         if self.drunk == 0:
             self.send_msg('CHAT "You sober up."')
             self.invalidate('fov')