+def actor_use(t):
+ if len(t["T_CARRIES"]):
+ id = t["T_CARRIES"][t["T_ARGUMENT"]]
+ type = world_db["Things"][id]["T_TYPE"]
+ if type == world_db["SLIPPERS"]:
+ if t == world_db["Things"][0]:
+ log("You use the " + world_db["ThingTypes"][type]["TT_NAME"]
+ + ". It glows in wondrous colors, and emits a sound as if "
+ + "from a dying cat. The Island God laughs.\n")
+ t["T_LIFEPOINTS"] = 1
+ from server.config.misc import decrement_lifepoints_func
+ decrement_lifepoints_func(t)
+ elif world_db["ThingTypes"][type]["TT_TOOL"] == "food":
+ t["T_CARRIES"].remove(id)
+ del world_db["Things"][id]
+ t["T_SATIATION"] += world_db["ThingTypes"][type]["TT_TOOLPOWER"]
+ if t == world_db["Things"][0]:
+ log("You CONSUME this object.")
+ elif t == world_db["Things"][0]:
+ log("You try to use this object, but FAIL.")
+
+def decrement_lifepoints(t):
+ t["T_LIFEPOINTS"] -= 1
+ _id = [_id for _id in world_db["Things"] if world_db["Things"][_id] == t][0]
+ if 0 == t["T_LIFEPOINTS"]:
+ sadness = world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"]
+ for id in t["T_CARRIES"]:
+ t["T_CARRIES"].remove(id)
+ world_db["Things"][id]["T_POSY"] = t["T_POSY"]
+ world_db["Things"][id]["T_POSX"] = t["T_POSX"]
+ world_db["Things"][id]["carried"] = False
+ t["T_TYPE"] = world_db["ThingTypes"][t["T_TYPE"]]["TT_CORPSE_ID"]
+ if world_db["Things"][0] == t:
+ t["fovmap"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
+ log("You die.")
+ log("See README on how to start over.")
+ else:
+ t["fovmap"] = False
+ t["T_MEMMAP"] = False
+ t["T_MEMDEPTHMAP"] = False
+ t["T_MEMTHING"] = []
+ return sadness
+ return 0
+