X-Git-Url: https://plomlompom.com/repos/bar%20baz.html?a=blobdiff_plain;f=plomrogue-server.py;h=fc0a82a853066c5006e4e304a2ec3dcc2064c125;hb=7ea9de2749221e7c5fd5182bd32a386522c9fd65;hp=cb7f9b0cbb31b81d006330528971d99ec56a7151;hpb=21873292b1a80e842bdb7b9ac8ee763d9ab2ead5;p=plomrogue diff --git a/plomrogue-server.py b/plomrogue-server.py index cb7f9b0..fc0a82a 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -455,7 +455,7 @@ def actor_wait(t): strong_write(io_db["file_out"], "LOG You wait.\n") -def actor_move(Thing): +def actor_move(t): pass @@ -484,13 +484,30 @@ def actor_drop(t): t["T_CARRIES"].remove(id) world_db["Things"][id]["carried"] = False if t == world_db["Things"][0]: - print("You drop an object.") + strong_write(io_db["file_out"], "LOG You drop an object.\n") elif t == world_db["Things"][0]: - print("You try to drop an object, but you own none.") + err = "You try to drop an object, but you own none." + strong_write(io_db["file_out"], "LOG " + err + "\n") -def actor_use(Thing): - pass +def actor_use(t): + """Make t use (for now: consume) T_ARGUMENT-indexed Thing in inventory.""" + # Original wrongly featured lifepoints increase through consumable! + # TODO: Handle case where T_ARGUMENT matches nothing. + if len(t["T_CARRIES"]): + id = t["T_CARRIES"][t["T_ARGUMENT"]] + type = world_db["Things"][id]["T_TYPE"] + if world_db["ThingTypes"][type]["TT_CONSUMABLE"]: + t["T_CARRIES"].remove(id) + del world_db["Things"][id] + t["T_SATIATION"] += world_db["ThingTypes"][type]["TT_CONSUMABLE"] + strong_write(io_db["file_out"], "LOG You consume this object.\n") + else: + strong_write(io_db["file_out"], "LOG You try to use this " + \ + "object, but fail.\n") + else: + strong_write(io_db["file_out"], "LOG You try to use an object, " + \ + "but you own none.\n") def turn_over():