From f4380908997d885bdd2fc641dd4352538f3eeb84 Mon Sep 17 00:00:00 2001 From: Duane Date: Wed, 22 Jun 2016 08:24:30 -0500 Subject: [PATCH] Expire elixirs on death option. --- demon.lua | 1 + elixir.lua | 10 ++++++++++ init.lua | 1 + settingtypes.txt | 3 +++ 4 files changed, 15 insertions(+) diff --git a/demon.lua b/demon.lua index e893aaa..e2c9e2e 100644 --- a/demon.lua +++ b/demon.lua @@ -115,6 +115,7 @@ mobs:register_mob("fun_caves:snow_demon", { type = "monster", passive = false, damage = 3, + -- change to dogshoot? attack_type = "dogfight", attacks_monsters = true, hp_min = 10, diff --git a/elixir.lua b/elixir.lua index 11dcd9c..1cf45bb 100644 --- a/elixir.lua +++ b/elixir.lua @@ -1,5 +1,15 @@ fun_caves.armor_expire = {} +if fun_caves.expire_elixir_on_death then + minetest.register_on_dieplayer(function(player) + local name = player:get_player_name() + if fun_caves.armor_expire[name] then + player:set_armor_groups({fleshy = 100}) + fun_caves.armor_expire[name] = nil + end + end) +end + local function armor(user, factor) local player_name = user:get_player_name() local armor = user:get_armor_groups() diff --git a/init.lua b/init.lua index 05f66de..178ddb0 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,7 @@ fun_caves.light_max = 8 -- light intensity for mushroom growth fun_caves.path = minetest.get_modpath(minetest.get_current_modname()) fun_caves.world = minetest.get_worldpath() fun_caves.elixir_armor = minetest.setting_getbool('fun_caves_use_armor_elixirs') +fun_caves.expire_elixir_on_death = minetest.setting_getbool('fun_caves_expire_elixir_on_death') fun_caves.DEBUG = false -- for maintenance only diff --git a/settingtypes.txt b/settingtypes.txt index afabd54..d6f14aa 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,2 +1,5 @@ # Set to false if you're using an armor mod. fun_caves_use_armor_elixirs (Use Armor Elixirs) bool true + +# If set, you will lose the effects of elixirs when you die. +fun_caves_expire_elixir_on_death (Elixirs Expire On Death) bool true