- action(Thing)
- Thing["T_COMMAND"] = 0
- Thing["T_PROGRESS"] = 0
- if Thing["T_BOWEL"] > 16:
- if 0 == (rand.next() % (33 - Thing["T_BOWEL"])):
- action_db["actor_drop"](Thing)
- if Thing["T_BLADDER"] > 16:
- if 0 == (rand.next() % (33 - Thing["T_BLADDER"])):
- action_db["actor_pee"](Thing)
+ action(t)
+ t["T_COMMAND"] = 0
+ t["T_PROGRESS"] = 0
+ if t["T_BOWEL"] > 16:
+ if 0 == (rand.next() % (33 - t["T_BOWEL"])):
+ action_db["actor_drop"](t)
+ if t["T_BLADDER"] > 16:
+ if 0 == (rand.next() % (33 - t["T_BLADDER"])):
+ action_db["actor_pee"](t)
+ if 0 == world_db["TURN"] % 5:
+ t["T_STOMACH"] -= 1
+ t["T_BOWEL"] += 1
+ t["T_KIDNEY"] -= 1
+ t["T_BLADDER"] += 1
+ if t["T_STOMACH"] == 0:
+ world_db["die"](t, "You DIE of hunger.")
+ elif t["T_KIDNEY"] == 0:
+ world_db["die"](t, "You DIE of dehydration.")
+ water = 0
+ positions_to_wet = []
+ for pos in range(world_db["MAP_LENGTH"] ** 2):
+ if world_db["MAP"][pos] == ord("0") \
+ and world_db["wetmap"][pos] < ord("5"):
+ positions_to_wet += [pos]
+ i_positions_to_wet = len(positions_to_wet)
+ for pos in range(world_db["MAP_LENGTH"] ** 2):
+ wetness = world_db["wetmap"][pos] - ord("0")
+ height = world_db["MAP"][pos] - ord("0")
+ if height == 0 and wetness > 0 \
+ and 0 == rand.next() % ((2 ** 13) / (2 ** wetness)):
+ world_db["MAP"][pos] = ord("-")
+ if pos in positions_to_wet:
+ positions_to_wet.remove(pos)
+ i_positions_to_wet -= 1
+ if ((wetness > 0 and height != 0) or wetness > 1) \
+ and 0 == rand.next() % 5:
+ world_db["wetmap"][pos] -= 1
+ water += 1
+ i_positions_to_wet -= 1
+ if i_positions_to_wet == 0:
+ break
+ if water > 0:
+ while water > 0:
+ select = rand.next() % len(positions_to_wet)
+ pos = positions_to_wet[select]
+ world_db["wetmap"][pos] += 1
+ positions_to_wet.remove(pos)
+ water -= 1