More death messages, more reliable

This commit is contained in:
Wuzzy 2019-03-08 20:22:01 +01:00
parent db8d7af245
commit 20576431e1
12 changed files with 148 additions and 128 deletions

View file

@ -1,3 +1,6 @@
local S = minetest.get_translator("mcl_hunger")
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
local org_eat = minetest.do_item_eat
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
@ -110,7 +113,11 @@ local function poisonp(tick, time, time_left, damage, exhaustion, name)
end
-- Deal damage and exhaust player
-- TODO: Introduce fatal poison at higher difficulties
if player:get_hp()-damage > 0 then
if mod_death_messages then
mcl_death_messages.player_damage(player, S("@1 succumbed to the poison."), name)
end
player:set_hp(player:get_hp()-damage)
end