From: Christian Heller Date: Sun, 15 Mar 2015 19:40:19 +0000 (+0100) Subject: 7DRL: Re-spawn died-out species. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Byoutube_prefix%7D%7D%7B%7Bresult.id%7D%7D?a=commitdiff_plain;h=8e04d119af90a77ac4cae8e7c9ce4029719803ed;p=plomrogue 7DRL: Re-spawn died-out species. --- diff --git a/roguelike-server b/roguelike-server index 8ffa7a4..33545c8 100755 --- a/roguelike-server +++ b/roguelike-server @@ -699,7 +699,9 @@ def decrement_lifepoints(t): Dying actors drop all their things. """ # 7DRL: Return 1 if death, else 0. + # 7DRL: Re-spawn died-out species. t["T_LIFEPOINTS"] -= 1 + live_type = t["T_TYPE"] # 7DRL if 0 == t["T_LIFEPOINTS"]: for id in t["T_CARRIES"]: t["T_CARRIES"].remove(id) @@ -716,6 +718,16 @@ def decrement_lifepoints(t): t["T_MEMMAP"] = False t["T_MEMDEPTHMAP"] = False t["T_MEMTHING"] = [] + n_species = len([id for id in world_db["Things"] # # + if world_db["Things"][id]["T_TYPE"] == live_type]) + if 0 == n_species: # # + id = id_setter(-1, "Things") + world_db["Things"][id] = new_Thing(live_type, + world_db["altar"]) + log("Species " + + world_db["ThingTypes"][live_type]["TT_NAME"] + + " has temporarily died out. " + + "One new-born is spawned at the altar.") return world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"] # # return 0 # #