if enable_damage is false, disable eating functions
This commit is contained in:
parent
0fb4e82b58
commit
96570a558e
10
init.lua
10
init.lua
@ -485,6 +485,10 @@ local function stamina_globaltimer(dtime)
|
||||
end
|
||||
|
||||
|
||||
-- stamina and eating functions disabled if damage is disabled
|
||||
if minetest.settings:get_bool("enable_damage")
|
||||
and minetest.settings:get_bool("enable_stamina") ~= false then
|
||||
|
||||
-- override core.do_item_eat() so we can redirect hp_change to stamina
|
||||
core.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
|
||||
@ -510,7 +514,6 @@ core.do_item_eat = function(hp_change, replace_with_item, itemstack, user, point
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- not local since it's called from within core context
|
||||
function stamina.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
|
||||
@ -608,11 +611,6 @@ function stamina.eat(hp_change, replace_with_item, itemstack, user, pointed_thin
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- stamina is disabled if damage is disabled
|
||||
if minetest.settings:get_bool("enable_damage")
|
||||
and minetest.settings:get_bool("enable_stamina") ~= false then
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
|
||||
if not player then return end
|
||||
|
Loading…
x
Reference in New Issue
Block a user