mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
Add setting for damage_enabled
This commit is contained in:
parent
d8af2d4ced
commit
75565e7118
2 changed files with 6 additions and 3 deletions
|
@ -34,7 +34,9 @@ mcl_damage = {
|
|||
}
|
||||
}
|
||||
|
||||
local damage_enabled = minetest.settings:get_bool("enabled_damage",true)
|
||||
local damage_enabled = vl_tuning.setting("damage_enabled", "bool",{
|
||||
default = minetest.settings:get_bool("enabled_damage",true)
|
||||
})
|
||||
|
||||
function mcl_damage.register_modifier(func, priority)
|
||||
table.insert(mcl_damage.modifiers, {func = func, priority = priority or 0})
|
||||
|
@ -142,7 +144,7 @@ function mcl_damage.register_type(name, def)
|
|||
end
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
if not damage_enabled then return 0 end
|
||||
if not damage_enabled[1] then return 0 end
|
||||
if hp_change < 0 then
|
||||
if player:get_hp() <= 0 then
|
||||
return 0
|
||||
|
@ -153,7 +155,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|||
end, true)
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
if not damage_enabled then return 0 end
|
||||
if not damage_enabled[1] then return 0 end
|
||||
if player:get_hp() > 0 then
|
||||
if hp_change < 0 then
|
||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
name = mcl_damage
|
||||
author = Fleckenstein
|
||||
description = Minecraft-like damage reason system
|
||||
depends = vl_tuning
|
||||
|
|
Loading…
Reference in a new issue