Implement food poisoning damage properly~

This commit is contained in:
Elias Fleckenstein 2021-04-18 18:49:00 +02:00
parent 3ad5b30ea5
commit 2827542002
2 changed files with 4 additions and 7 deletions

@ -12,7 +12,7 @@ mcl_damage = {
cactus = {}, cactus = {},
fall = {bypasses_armor = true}, fall = {bypasses_armor = true},
fly_into_wall = {bypasses_armor = true}, -- unused fly_into_wall = {bypasses_armor = true}, -- unused
out_of_world = {bypasses_armor = true, bypasses_invulnerability = true, bypasses_magic = true}, out_of_world = {bypasses_armor = true, bypasses_invulnerability = true},
generic = {bypasses_armor = true}, generic = {bypasses_armor = true},
magic = {is_magic = true, bypasses_armor = true}, magic = {is_magic = true, bypasses_armor = true},
wither = {bypasses_armor = true}, -- unused wither = {bypasses_armor = true}, -- unused
@ -25,8 +25,8 @@ mcl_damage = {
fireball = {is_projectile = true, is_fire = true}, fireball = {is_projectile = true, is_fire = true},
thorns = {is_magic = true}, thorns = {is_magic = true},
explosion = {is_explosion = true}, explosion = {is_explosion = true},
cramming = {bypasses_armor = true}, cramming = {bypasses_armor = true}, -- unused
fireworks = {is_explosion = true}, fireworks = {is_explosion = true}, -- unused
} }
} }

@ -110,10 +110,7 @@ local function poisonp(tick, time, time_left, damage, exhaustion, name)
-- Deal damage and exhaust player -- Deal damage and exhaust player
-- TODO: Introduce fatal poison at higher difficulties -- TODO: Introduce fatal poison at higher difficulties
if player:get_hp()-damage > 0 then if player:get_hp()-damage > 0 then
if mod_death_messages then mcl_util.deal_damage(player, damage, {type = "hunger"})
mcl_death_messages.player_damage(player, S("@1 succumbed to the poison.", name))
end
player:set_hp(player:get_hp()-damage)
end end
mcl_hunger.exhaust(name, exhaustion) mcl_hunger.exhaust(name, exhaustion)