From: Christian Heller Date: Fri, 11 Mar 2016 22:12:09 +0000 (+0100) Subject: TCE: Ground under water may erode, leaving deadly holes. X-Git-Tag: tce~46 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=fa6fec4689b183dc3a4c1528ced578e4fcd6348c;p=plomrogue TCE: Ground under water may erode, leaving deadly holes. --- diff --git a/plugins/client/TheCrawlingEater.py b/plugins/client/TheCrawlingEater.py index 3d13d2c..e3e413f 100644 --- a/plugins/client/TheCrawlingEater.py +++ b/plugins/client/TheCrawlingEater.py @@ -31,6 +31,7 @@ def win_map(self): "3": "%", "4": "#", "5": "X", + "-": "O", } win_size = self.size offset = [0, 0] diff --git a/plugins/server/TheCrawlingEater.py b/plugins/server/TheCrawlingEater.py index cf6f204..867f05c 100644 --- a/plugins/server/TheCrawlingEater.py +++ b/plugins/server/TheCrawlingEater.py @@ -127,6 +127,9 @@ def actor_move(t): t["T_POSY"] = move_result[1] t["T_POSX"] = move_result[2] t["pos"] = move_result[1] * world_db["MAP_LENGTH"] + move_result[2] + if world_db["MAP"][t["pos"]] == ord("-"): + world_db["die"](t, "You FALL in a hole, and die.") + return build_fov_map(t) else: height = world_db["MAP"][pos] - ord("0") @@ -150,15 +153,20 @@ def actor_move(t): def catch_air(t): if (world_db["wetmap"][t["pos"]] - ord("0")) \ + (world_db["MAP"][t["pos"]] - ord("0")) > 4: - t["T_LIFEPOINTS"] = 0 - if t == world_db["Things"][0]: - t["fovmap"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2)) - log("You SUFFOCATE.") + world_db["die"](t, "You SUFFOCATE") return False return True world_db["catch_air"] = catch_air +def die(t, message): + t["T_LIFEPOINTS"] = 0 + if t == world_db["Things"][0]: + t["fovmap"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2)) + log(message) +world_db["die"] = die + + def make_map(): from server.make_map import new_pos, is_neighbor from server.utils import rand @@ -241,16 +249,22 @@ def turn_over(): action_db["actor_pee"](Thing) water = 0 positions_to_wet = [] - for i in range(world_db["MAP_LENGTH"] ** 2): - if world_db["MAP"][i] == ord("0") \ - and world_db["wetmap"][i] < ord("5"): - positions_to_wet += [i] + 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): - if 0 == rand.next() % 5 \ - and ((world_db["wetmap"][pos] > ord("0") - and not world_db["MAP"][pos] == ord("0")) - or world_db["wetmap"][pos] > ord("1")): + 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 ** 16) / (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 @@ -340,7 +354,7 @@ io_db["worldstate_write_order"] += [["T_BLADDER", "player_int"]] io_db["worldstate_write_order"] += [[write_wetmap, "func"]] import server.config.world_data server.config.world_data.symbols_hide = "345" -server.config.world_data.symbols_passable = "012" +server.config.world_data.symbols_passable = "012-" server.config.world_data.thing_defaults["T_BOWEL"] = 0 server.config.world_data.thing_defaults["T_BLADDER"] = 0 world_db["wetmap"] = bytearray(b"0" * world_db["MAP_LENGTH"] ** 2)