home · contact · privacy
TCE: Fluid trickles down into earth, dirt; re-surfaces on ground.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 11 Mar 2016 11:55:15 +0000 (12:55 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 11 Mar 2016 11:55:15 +0000 (12:55 +0100)
plugins/client/TheCrawlingEater.py
plugins/server/TheCrawlingEater.py

index 081960ab8e8fe8f96eda9afa18cdb7b900342ac5..b1f4005a02ac63fb302b487dd0f4438c23436cab 100644 (file)
@@ -46,8 +46,8 @@ def win_map(self):
     curses.init_pair(5, curses.COLOR_CYAN, curses.COLOR_BLACK)
     curses.init_pair(6, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
     curses.init_pair(7, curses.COLOR_GREEN, curses.COLOR_BLACK)
-    curses.init_pair(8, curses.COLOR_BLACK, curses.COLOR_MAGENTA)
-    curses.init_pair(9, curses.COLOR_BLACK, curses.COLOR_BLUE)
+    curses.init_pair(8, curses.COLOR_BLACK, curses.COLOR_BLUE)
+    curses.init_pair(9, curses.COLOR_BLACK, curses.COLOR_MAGENTA)
     curses.init_pair(10, curses.COLOR_BLACK, curses.COLOR_CYAN)
     col_unknown = curses.color_pair(1)
     col_mem_obstacle = curses.color_pair(2)
index 7c05e78c8874323288191f1805137a0438d8eb1b..d4f0525efb365b62be885d5f16a878a844ca66fc 100644 (file)
@@ -42,14 +42,13 @@ def actor_pee(t):
         log("You LOSE fluid.")
     t["T_BLADDER"] -= 1
     terrain = world_db["MAP"][t["pos"]]
-    world_db["wetmap"][t["pos"]] += 1
-    if terrain == ord("_"):
-        world_db["MAP"][t["pos"]] = ord("~")
-    elif world_db["wetmap"][t["pos"]] > 51:
+    if world_db["wetmap"][t["pos"]] == 51:
         t["T_LIFEPOINTS"] = 0
         if t == world_db["Things"][0]:
             t["fovmap"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
             log("You DROWN.")
+    else:
+        world_db["wet_ground"](t["pos"])
 
 
 def play_drop():
@@ -249,6 +248,22 @@ def turn_over():
                     if Thing["T_BLADDER"] > 16:
                         if 0 == (rand.next() % (33 - Thing["T_BLADDER"])):
                             action_db["actor_pee"](Thing)
+        wetness = 0
+        for i in range(world_db["MAP_LENGTH"] ** 2):
+            if world_db["MAP"][i] != ord("~") and world_db["wetmap"][i] > 48 \
+                    and 0 == (rand.next() % 5):
+                world_db["wetmap"][i] -= 1
+                wetness += 1
+        if wetness > 0:
+            positions_to_wet = []
+            for i in range(world_db["MAP_LENGTH"] ** 2):
+                if chr(world_db["MAP"][i]) in "_~":
+                    positions_to_wet += [i]
+            while wetness > 0:
+                select = rand.next() % len(positions_to_wet)
+                world_db["wet_ground"](positions_to_wet[select])
+                wetness -= 1
+                log("New water at " + str(positions_to_wet[select]))
         world_db["TURN"] += 1
         io_db["worldstate_updateable"] = True
         try_worldstate_update()
@@ -310,6 +325,12 @@ def wetmapset(str_int, mapline):
         if not world_db["wetmap"]:
             world_db["wetmap"] = m
 
+def wet_ground(pos):
+    if world_db["MAP"][pos] == ord("_"):
+        world_db["MAP"][pos] = ord("~")
+    world_db["wetmap"][pos] += 1
+world_db["wet_ground"] = wet_ground
+
 
 def write_wetmap():
     from server.worldstate_write_helpers import write_map