X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/form?a=blobdiff_plain;f=roguelike-server;h=0461c5cf25a0f8a51ce09a325e2007f1c5b52a2f;hb=d0373bc682e1619555ee94fb09eeacc251001e04;hp=a26ff25091f77518271a3c9f4d975bc7b625a658;hpb=e6d205f81bcd3e815ecb4694a0a81e1de5258862;p=plomrogue diff --git a/roguelike-server b/roguelike-server index a26ff25..0461c5c 100755 --- a/roguelike-server +++ b/roguelike-server @@ -593,7 +593,6 @@ def decrement_lifepoints(t): t["T_MEMMAP"] = False t["T_MEMDEPTHMAP"] = False t["T_MEMTHING"] = [] - strong_write(io_db["file_out"], "LOG It dies.\n") def mv_yx_in_dir_legal(dir, y, x): @@ -626,14 +625,14 @@ def actor_move(t): if world_db["Things"][id]["T_POSX"] == move_result[2]] if len(hitted): hit_id = hitted[0] - hitter_name = world_db["ThingTypes"][t["T_TYPE"]]["TT_NAME"] - hitter = "You" if t == world_db["Things"][0] else hitter_name - hitted_type = world_db["Things"][hit_id]["T_TYPE"] - hitted_name = world_db["ThingTypes"][hitted_type]["TT_NAME"] - hitted = "you" if hit_id == 0 else hitted_name - verb = " wound " if hitter == "You" else " wounds " - strong_write(io_db["file_out"], "LOG " + hitter + verb + hitted + - ".\n") + if t == world_db["Things"][0]: + hitted_name = world_db["ThingTypes"][hitted_type]["TT_NAME"] + strong_write(io_db["file_out"], "LOG You wound " + hitted + + ".\n") + elif 0 == hit_id: + hitter_name = world_db["ThingTypes"][t["T_TYPE"]]["TT_NAME"] + strong_write(io_db["file_out"], "LOG " + hitter + + " wounds you.\n") decrement_lifepoints(world_db["Things"][hit_id]) return dir = [dir for dir in directions_db @@ -654,22 +653,27 @@ def actor_move(t): def actor_pick_up(t): """Make t pick up (topmost?) Thing from ground into inventory.""" # Topmostness is actually not defined so far. Picks Thing with highest ID. - ids = [id for id in world_db["Things"] if world_db["Things"][id] != t - if not world_db["Things"][id]["carried"] - if world_db["Things"][id]["T_POSY"] == t["T_POSY"] - if world_db["Things"][id]["T_POSX"] == t["T_POSX"]] - if len(ids): - highest_id = 0 - for id in ids: - if id > highest_id: - highest_id = id - world_db["Things"][highest_id]["carried"] = True - t["T_CARRIES"].append(highest_id) - if t == world_db["Things"][0]: - strong_write(io_db["file_out"], "LOG You pick up an object.\n") - elif t == world_db["Things"][0]: - err = "You try to pick up an object, but there is none." - strong_write(io_db["file_out"], "LOG " + err + "\n") + used_slots = len(t["T_CARRIES"]) # # + if used_slots < world_db["ThingTypes"][t["T_TYPE"]]["TT_STORAGE"]: # # + ids = [id for id in world_db["Things"] if world_db["Things"][id] != t + if not world_db["Things"][id]["carried"] + if world_db["Things"][id]["T_POSY"] == t["T_POSY"] + if world_db["Things"][id]["T_POSX"] == t["T_POSX"]] + if len(ids): + highest_id = 0 + for id in ids: + if id > highest_id: + highest_id = id + world_db["Things"][highest_id]["carried"] = True + t["T_CARRIES"].append(highest_id) + if t == world_db["Things"][0]: + strong_write(io_db["file_out"], "LOG You pick up an object.\n") + elif t == world_db["Things"][0]: + err = "You try to pick up an object, but there is none." + strong_write(io_db["file_out"], "LOG " + err + "\n") + elif t == world_db["Things"][0]: # # + strong_write(io_db["file_out"], "LOG Can't pick up object: " + # # + "No storage room to carry more.\n") # # def actor_drop(t): @@ -756,9 +760,6 @@ def try_healing(t): t["T_SATIATION"] -= 32 if t == world_db["Things"][0]: strong_write(io_db["file_out"], "LOG You heal.\n") - else: - name = world_db["ThingTypes"][t["T_TYPE"]]["TT_NAME"] - strong_write(io_db["file_out"], "LOG " + name + "heals.\n") def hunger(t): @@ -772,10 +773,6 @@ def hunger(t): 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") - else: - name = world_db["ThingTypes"][t["T_TYPE"]]["TT_NAME"] - strong_write(io_db["file_out"], "LOG " + name + - " suffers from hunger.\n") decrement_lifepoints(t) @@ -1012,6 +1009,7 @@ def ai(t): none, they will explore parts of the map unseen since ever or for at least one turn; if there is nothing to explore, they will simply wait. """ + # 7DRL add: Don't pick up or search things when inventory is full. t["T_COMMAND"] = [id for id in world_db["ThingActions"] if world_db["ThingActions"][id]["TA_NAME"] == "wait"][0] if not get_dir_to_target(t, "f"): @@ -1021,11 +1019,16 @@ def ai(t): if world_db["ThingActions"][id]["TA_NAME"] == "use"][0] t["T_ARGUMENT"] = sel - elif standing_on_consumable(t): + elif standing_on_consumable(t) \ + and (len(t["T_CARRIES"]) < # # + world_db["ThingTypes"][t["T_TYPE"]]["TT_STORAGE"]): # # t["T_COMMAND"] = [id for id in world_db["ThingActions"] if world_db["ThingActions"][id]["TA_NAME"] == "pick_up"][0] - elif (not get_dir_to_target(t, "c")) and \ + elif (not + (len(t["T_CARRIES"]) < # # + world_db["ThingTypes"][t["T_TYPE"]]["TT_STORAGE"] # # + and get_dir_to_target(t, "c"))) and \ (not get_dir_to_target(t, "a")): get_dir_to_target(t, "s") @@ -1472,6 +1475,7 @@ def command_ttid(id_string): "TT_LIFEPOINTS": 0, "TT_PROLIFERATE": 0, "TT_START_NUMBER": 0, + "TT_STORAGE": 0, # # "TT_SYMBOL": "?", "TT_CORPSE_ID": id } @@ -1585,6 +1589,7 @@ commands_db = { "TT_PROLIFERATE": (1, False, setter("ThingType", "TT_PROLIFERATE", 0, 255)), "TT_LIFEPOINTS": (1, False, setter("ThingType", "TT_LIFEPOINTS", 0, 255)), + "TT_STORAGE": (1, False, setter("ThingType", "TT_STORAGE", 0, 255)), # # "T_ID": (1, False, command_tid), "T_ARGUMENT": (1, False, setter("Thing", "T_ARGUMENT", 0, 255)), "T_PROGRESS": (1, False, setter("Thing", "T_PROGRESS", 0, 255)),