X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=roguelike-server;h=7a61c81bec1fedbcf98476981dfbb65fe566089a;hb=2123beb75d5b818907d3926ba2229d3ee751614b;hp=cb6b3dd0c97f142392a9c46544f9c9319a705de6;hpb=19cb190d4504b3d4b957c188ae381bbb4ff0790c;p=plomrogue diff --git a/roguelike-server b/roguelike-server index cb6b3dd..7a61c81 100755 --- a/roguelike-server +++ b/roguelike-server @@ -360,31 +360,52 @@ def try_worldstate_update(): mem[(mt[1] * length) + mt[2]] = ord(c) string = write_map(string, mem) - stacksmap = bytearray(b'0' * (length ** 2)) # # + metamapA = bytearray(b'0' * (length ** 2)) # # for id in [id for id in world_db["Things"] # # if not world_db["Things"][id]["carried"] # # - if world_db["Things"][id]["T_LIFEPOINTS"] + if world_db["Things"][id]["T_LIFEPOINTS"] # # if world_db["Things"][0]["fovmap"][ # # world_db["Things"][id]["T_POSY"] * length # # + world_db["Things"][id]["T_POSX"]] == ord_v]: # # pos = (world_db["Things"][id]["T_POSY"] * length # # + world_db["Things"][id]["T_POSX"]) # # - stacksmap[pos] = ord('X') # # + if id == 0 or world_db["EMPATHY"]: # # + type = world_db["Things"][id]["T_TYPE"] # # + max_hp = world_db["ThingTypes"][type]["TT_LIFEPOINTS"] # # + third_of_hp = max_hp / 3 # # + hp = world_db["Things"][id]["T_LIFEPOINTS"] # # + add = 0 # # + if hp > 2 * third_of_hp: # # + add = 2 # # + elif hp > third_of_hp: # # + add = 1 # # + metamapA[pos] = ord('a') + add # # + else: # # + metamapA[pos] = ord('X') # # + for mt in world_db["Things"][0]["T_MEMTHING"]: # # + pos = mt[1] * length + mt[2] # # + if metamapA[pos] < ord('2'): # # + metamapA[pos] += 1 # # + string = write_map(string, metamapA) # # + + metamapB = bytearray(b' ' * (length ** 2)) # # for id in [id for id in world_db["Things"] # # if not world_db["Things"][id]["carried"] # # + if world_db["Things"][id]["T_LIFEPOINTS"] # # if world_db["Things"][0]["fovmap"][ # # world_db["Things"][id]["T_POSY"] * length # # + world_db["Things"][id]["T_POSX"]] == ord_v]: # # pos = (world_db["Things"][id]["T_POSY"] * length # # + world_db["Things"][id]["T_POSX"]) # # - if stacksmap[pos] < ord('2'): # # - stacksmap[pos] += 1 # # - for mt in world_db["Things"][0]["T_MEMTHING"]: # # - pos = mt[1] * length + mt[2] # # - if stacksmap[pos] < ord('2'): # # - stacksmap[pos] += 1 # # - string = write_map(string, stacksmap) # # - + if id == 0 or world_db["EMPATHY"]: # # + action = world_db["Things"][id]["T_COMMAND"] # # + if 0 != action: # # + name = world_db["ThingActions"][action]["TA_NAME"] # # + else: # # + name = " " # # + metamapB[pos] = ord(name[0]) # # + string = write_map(string, metamapB) # # + atomic_write(io_db["path_worldstate"], string, delete=False) strong_write(io_db["file_out"], "WORLD_UPDATED\n") io_db["worldstate_updateable"] = False @@ -1077,7 +1098,11 @@ def hunger(t): stomach = int(32767 / world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"]) if int(int(testbase / stomach) / ((rand.next() % stomach) + 1)): if t == world_db["Things"][0]: - strong_write(io_db["file_out"], "LOG You suffer from hunger.\n") + if t["T_SATIATION"] < 0: + strong_write(io_db["file_out"], "LOG You suffer from hunger.\n") + else: + strong_write(io_db["file_out"], + "LOG You suffer from over-eating.\n") decrement_lifepoints(t) @@ -1984,6 +2009,7 @@ commands_db = { "PLANT_1": (1, False, specialtypesetter("PLANT_1")), # # "LUMBER": (1, False, specialtypesetter("LUMBER")), # # "TOOL_0": (1, False, specialtypesetter("TOOL_0")), # # + "EMPATHY": (1, False, setter(None, "EMPATHY", 0, 1)), # # "TA_ID": (1, False, command_taid), "TA_EFFORT": (1, False, setter("ThingAction", "TA_EFFORT", 0, 255)), "TA_NAME": (1, False, command_taname), @@ -2038,6 +2064,7 @@ world_db = { "PLANT_1": 0, # # "LUMBER": 0, # # "TOOL_0": 0, # # + "EMPATHY": 1, # # "ThingActions": {}, "ThingTypes": {}, "Things": {}