More death messages, more reliable
This commit is contained in:
parent
db8d7af245
commit
20576431e1
12 changed files with 148 additions and 128 deletions
|
@ -1,2 +1,2 @@
|
|||
hudbars
|
||||
intllib?
|
||||
mcl_death_messages?
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local S = minetest.get_translator("mcl_hunger")
|
||||
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||
|
||||
mcl_hunger = {}
|
||||
|
||||
|
@ -172,7 +167,11 @@ minetest.register_globalstep(function(dtime)
|
|||
mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player))
|
||||
elseif h == 0 then
|
||||
-- Damage hungry player down to 1 HP
|
||||
-- TODO: Allow starvation at higher difficulty levels
|
||||
if hp-1 > 0 then
|
||||
if mod_death_messages then
|
||||
mcl_death_messages.player_damage(player, S("@1 starved to death."), name)
|
||||
end
|
||||
player:set_hp(hp-1)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue