home · contact · privacy
TCE: Add voluntary urination.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 9 Mar 2016 22:12:24 +0000 (23:12 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 9 Mar 2016 22:12:24 +0000 (23:12 +0100)
confserver/TheCrawlingEater
plugins/client/TheCrawlingEater.py
plugins/server/TheCrawlingEater.py

index 5338708b75f1bb59b77f93ec0b6b3e60b63b07f6..81e10dca4ba41a162be298a76b6eaaad4f248964 100644 (file)
@@ -15,6 +15,9 @@ TA_NAME drop
 TA_ID 4
 TA_NAME drink
 
+TA_ID 5
+TA_NAME pee
+
 TT_ID 0
 TT_START_NUMBER 1
 TT_LIFEPOINTS 1
index e5559c54ff2185d0d76beaefbfb4cb892d65c7da..b2acb06eb8c4c25f9745f275e7b5cbd707fc288a 100644 (file)
@@ -113,3 +113,4 @@ from client.commands import command_sender
 from client.config.commands import commands
 commands["S"] = (command_sender("drop"),)
 commands["D"] = (command_sender("drink"),)
+commands["P"] = (command_sender("pee"),)
index 210356a1753e267b730502237270b7cb4c9d6c70..6b56488b4e89b8d4e8dc038959912fd575e2771a 100644 (file)
@@ -20,6 +20,23 @@ def actor_drink(t):
         t["T_BLADDER"] += 1
 
 
+def play_pee():
+    if action_exists("pee") and world_db["WORLD_ACTIVE"]:
+        if world_db["Things"][0]["T_BLADDER"] < 1:
+            log("Nothing to drop from empty bladder.")
+            return
+        world_db["set_command"]("pee")
+
+
+def actor_pee(t):
+    if t["T_BLADDER"] < 1:
+        return
+    if t == world_db["Things"][0]:
+        log("You LOSE fluid.")
+    terrain = world_db["MAP"][t["pos"]]
+    t["T_BLADDER"] -= 1
+
+
 def play_drop():
     if action_exists("drop") and world_db["WORLD_ACTIVE"]:
         if world_db["Things"][0]["T_BOWEL"] < 1:
@@ -252,6 +269,7 @@ commands_db["move"] = (1, False, play_move)
 commands_db["wait"] = (0, False, play_wait)
 commands_db["drop"] = (0, False, play_drop)
 commands_db["drink"] = (0, False, play_drink)
+commands_db["pee"] = (0, False, play_pee)
 commands_db["use"] = (1, False, lambda x: None)
 commands_db["pickup"] = (0, False, lambda: None)
 commands_db["T_BOWEL"] = (1, False, setter("Thing", "T_BOWEL", 0, 255))
@@ -263,6 +281,7 @@ server.config.actions.action_db = {
     "actor_move": actor_move,
     "actor_drop": actor_drop,
     "actor_drink": actor_drink,
+    "actor_pee": actor_pee,
 }
 
 strong_write(io_db["file_out"], "PLUGIN TheCrawlingEater\n")