mirror of
https://github.com/SmallJoker/upgrade_packs.git
synced 2024-12-21 13:25:46 +01:00
Quicker wear out on damage
For compensation, healing will undo more HP upgrade pack wear.
This commit is contained in:
parent
3aec15fbb8
commit
217a651495
8
init.lua
8
init.lua
@ -55,17 +55,17 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
|
||||
return
|
||||
end
|
||||
-- Undo some of the wear when eating instead of dying
|
||||
upgrade_packs.add_wear(user, "health", hp_change * -2)
|
||||
upgrade_packs.add_wear(user, "health", hp_change * -100)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||
if hp_change >= 0 then
|
||||
return hp_change
|
||||
end
|
||||
if reason == "drown" then
|
||||
upgrade_packs.add_wear(player, "breath", 400)
|
||||
if reason.type == "drown" then
|
||||
upgrade_packs.add_wear(player, "breath", hp_change * -2000)
|
||||
else
|
||||
upgrade_packs.add_wear(player, "health", hp_change * -25)
|
||||
upgrade_packs.add_wear(player, "health", hp_change * -200)
|
||||
end
|
||||
|
||||
return hp_change
|
||||
|
Loading…
Reference in New Issue
Block a user