From: Christian Heller Date: Tue, 10 Mar 2015 22:28:51 +0000 (+0100) Subject: 7DRL: Non-players picking up player-dropped consumables give GODS_FAVOR. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_data.id_%7D%7D?a=commitdiff_plain;h=8fb759331fcefbd559de144507f8b90aee3d7fb6;p=plomrogue 7DRL: Non-players picking up player-dropped consumables give GODS_FAVOR. --- diff --git a/roguelike-server b/roguelike-server index 50b62b5..809e03a 100755 --- a/roguelike-server +++ b/roguelike-server @@ -692,6 +692,7 @@ 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 most nutritious Thing. + # 7DRL: Non-player picking up player-dropped consumable -> GOD_FAVOR gain. 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 @@ -707,12 +708,12 @@ def actor_pick_up(t): nutritious = world_db["ThingTypes"][type]["TT_CONSUMABLE"] highest_id = id world_db["Things"][highest_id]["carried"] = True - #if (t != world_db["Things"][0] and # # - # world_db["Things"][highest_id]["T_PLAYERDROP"]): # # - # x = world_db["Things"][highest_id]["T_TYPE"] - # score = world_db["ThingTypes"][x]["TT_CONSUMABLE"] / 32 # # - # add_gods_favor(score) # # - # world_db["Things"][highest_id]["T_PLAYERDROP"] = 0 # # + if (t != world_db["Things"][0] and # # + world_db["Things"][highest_id]["T_PLAYERDROP"]): # # + x = world_db["Things"][highest_id]["T_TYPE"] + score = world_db["ThingTypes"][x]["TT_CONSUMABLE"] / 32 # # + add_gods_favor(score) # # + world_db["Things"][highest_id]["T_PLAYERDROP"] = 0 # # 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") @@ -733,6 +734,7 @@ def actor_drop(t): world_db["Things"][id]["carried"] = False if t == world_db["Things"][0]: strong_write(io_db["file_out"], "LOG You drop an object.\n") + world_db["Things"][id]["T_PLAYERDROP"] = 1 # # elif t == world_db["Things"][0]: err = "You try to drop an object, but you own none." strong_write(io_db["file_out"], "LOG " + err + "\n") @@ -1126,6 +1128,7 @@ def new_Thing(type, pos=(0, 0)): "T_PROGRESS": 0, "T_SATIATION": 0, "T_COMMAND": 0, + "T_PLAYERDROP": 0, # # "T_TYPE": type, "T_POSY": pos[0], "T_POSX": pos[1], @@ -1642,7 +1645,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)), # # + "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)), @@ -1656,6 +1659,7 @@ commands_db = { "T_MEMTHING": (3, False, command_tmemthing), "T_POSY": (1, False, setter_tpos("Y")), "T_POSX": (1, False, setter_tpos("X")), + "T_PLAYERDROP": (1, False, setter("Thing", "T_PLAYERDROP", 0, 1)), # # "wait": (0, False, play_commander("wait")), "move": (1, False, play_commander("move")), "pick_up": (0, False, play_commander("pick_up")), diff --git a/testing/ref_end b/testing/ref_end index 62f61c7..173590a 100644 --- a/testing/ref_end +++ b/testing/ref_end @@ -110,6 +110,7 @@ T_COMMAND 0 T_LIFEPOINTS 30 T_TYPE 0 T_ARGUMENT 101 +T_PLAYERDROP 0 T_POSY 48 T_POSX 28 T_PROGRESS 0 @@ -247,6 +248,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 29 T_POSX 21 T_PROGRESS 0 @@ -280,6 +282,7 @@ T_COMMAND 0 T_LIFEPOINTS 5 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 27 T_POSX 42 T_PROGRESS 0 @@ -417,6 +420,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 18 T_POSX 40 T_PROGRESS 0 @@ -554,6 +558,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 99 +T_PLAYERDROP 0 T_POSY 20 T_POSX 38 T_PROGRESS 0 @@ -586,6 +591,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 41 T_POSX 38 T_PROGRESS 0 @@ -743,6 +749,7 @@ T_COMMAND 0 T_LIFEPOINTS 3 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 15 T_POSX 27 T_PROGRESS 0 @@ -894,6 +901,7 @@ T_COMMAND 0 T_LIFEPOINTS 1 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 37 T_POSX 17 T_PROGRESS 0 @@ -1031,6 +1039,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 119 +T_PLAYERDROP 0 T_POSY 29 T_POSX 40 T_PROGRESS 4 @@ -1040,6 +1049,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 99 +T_PLAYERDROP 0 T_POSY 41 T_POSX 24 T_PROGRESS 0 @@ -1073,6 +1083,7 @@ T_COMMAND 0 T_LIFEPOINTS 2 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 18 T_POSX 43 T_PROGRESS 0 @@ -1225,6 +1236,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 35 T_POSX 34 T_PROGRESS 0 @@ -1362,6 +1374,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 14 T_POSX 26 T_PROGRESS 0 @@ -1372,6 +1385,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 52 T_POSX 41 T_PROGRESS 0 @@ -1509,6 +1523,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 30 T_POSX 41 T_PROGRESS 1 @@ -1525,6 +1540,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 41 T_POSX 15 T_PROGRESS 0 @@ -1662,6 +1678,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 25 T_POSX 42 T_PROGRESS 0 @@ -1671,6 +1688,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 30 T_POSX 41 T_PROGRESS 0 @@ -1681,6 +1699,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 57 T_POSX 38 T_PROGRESS 0 @@ -1833,6 +1852,7 @@ T_COMMAND 0 T_LIFEPOINTS 3 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 48 T_POSX 25 T_PROGRESS 0 @@ -1970,6 +1990,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 29 T_POSX 44 T_PROGRESS 4 @@ -1980,6 +2001,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 58 T_POSX 40 T_PROGRESS 0 @@ -2117,6 +2139,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 40 T_POSX 35 T_PROGRESS 4 @@ -2126,6 +2149,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 99 +T_PLAYERDROP 0 T_POSY 17 T_POSX 42 T_PROGRESS 4 @@ -2136,6 +2160,7 @@ T_COMMAND 0 T_LIFEPOINTS 6 T_TYPE 1 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 62 T_POSX 39 T_PROGRESS 0 @@ -2273,6 +2298,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 119 +T_PLAYERDROP 0 T_POSY 28 T_POSX 42 T_PROGRESS 4 @@ -2282,6 +2308,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 119 +T_PLAYERDROP 0 T_POSY 15 T_POSX 26 T_PROGRESS 4 @@ -2300,6 +2327,7 @@ T_COMMAND 0 T_LIFEPOINTS 5 T_TYPE 1 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 45 T_POSX 30 T_PROGRESS 0 @@ -2450,6 +2478,7 @@ T_COMMAND 0 T_LIFEPOINTS 5 T_TYPE 2 T_ARGUMENT 101 +T_PLAYERDROP 0 T_POSY 45 T_POSX 27 T_PROGRESS 0 @@ -2600,6 +2629,7 @@ T_COMMAND 0 T_LIFEPOINTS 7 T_TYPE 2 T_ARGUMENT 101 +T_PLAYERDROP 0 T_POSY 47 T_POSX 30 T_PROGRESS 0 @@ -2737,6 +2767,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 100 +T_PLAYERDROP 0 T_POSY 41 T_POSX 36 T_PROGRESS 0 @@ -2772,6 +2803,7 @@ T_COMMAND 0 T_LIFEPOINTS 18 T_TYPE 2 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 32 T_POSX 39 T_PROGRESS 0 @@ -2909,6 +2941,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 24 T_POSX 43 T_PROGRESS 1 @@ -2938,6 +2971,7 @@ T_COMMAND 0 T_LIFEPOINTS 18 T_TYPE 2 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 44 T_POSX 39 T_PROGRESS 0 @@ -3094,6 +3128,7 @@ T_COMMAND 2 T_LIFEPOINTS 14 T_TYPE 2 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 36 T_POSX 19 T_PROGRESS 1 @@ -3231,6 +3266,7 @@ T_COMMAND 2 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 101 +T_PLAYERDROP 0 T_POSY 41 T_POSX 34 T_PROGRESS 3 @@ -3257,6 +3293,7 @@ T_COMMAND 0 T_LIFEPOINTS 3 T_TYPE 2 T_ARGUMENT 99 +T_PLAYERDROP 0 T_POSY 36 T_POSX 41 T_PROGRESS 0 @@ -3398,6 +3435,7 @@ T_COMMAND 0 T_LIFEPOINTS 54 T_TYPE 3 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 62 T_POSX 36 T_PROGRESS 0 @@ -3558,6 +3596,7 @@ T_COMMAND 0 T_LIFEPOINTS 54 T_TYPE 3 T_ARGUMENT 120 +T_PLAYERDROP 0 T_POSY 48 T_POSX 36 T_PROGRESS 0 @@ -3715,6 +3754,7 @@ T_COMMAND 0 T_LIFEPOINTS 53 T_TYPE 3 T_ARGUMENT 115 +T_PLAYERDROP 0 T_POSY 21 T_POSX 39 T_PROGRESS 0 @@ -3852,6 +3892,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 24 T_POSX 27 T_PROGRESS 0 @@ -3861,6 +3902,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 46 T_POSX 21 T_PROGRESS 0 @@ -3870,6 +3912,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 13 T_POSX 25 T_PROGRESS 0 @@ -3879,6 +3922,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 15 T_POSX 28 T_PROGRESS 0 @@ -3888,6 +3932,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 14 T_POSX 24 T_PROGRESS 0 @@ -3897,6 +3942,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 36 T_POSX 32 T_PROGRESS 0 @@ -3906,6 +3952,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 20 T_POSX 25 T_PROGRESS 0 @@ -3915,6 +3962,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 35 T_POSX 37 T_PROGRESS 0 @@ -3924,6 +3972,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 4 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 54 T_POSX 31 T_PROGRESS 0 @@ -3933,6 +3982,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 23 T_POSX 35 T_PROGRESS 0 @@ -3942,6 +3992,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 46 T_POSX 20 T_PROGRESS 0 @@ -3951,6 +4002,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 46 T_POSX 24 T_PROGRESS 0 @@ -3960,6 +4012,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 14 T_POSX 23 T_PROGRESS 0 @@ -3969,6 +4022,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 48 T_POSX 36 T_PROGRESS 0 @@ -3978,6 +4032,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 21 T_POSX 23 T_PROGRESS 0 @@ -3987,6 +4042,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 40 T_POSX 17 T_PROGRESS 0 @@ -3996,6 +4052,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 31 T_POSX 18 T_PROGRESS 0 @@ -4005,6 +4062,7 @@ T_COMMAND 0 T_LIFEPOINTS 0 T_TYPE 5 T_ARGUMENT 0 +T_PLAYERDROP 0 T_POSY 26 T_POSX 14 T_PROGRESS 0