Add more death messages

This commit is contained in:
Wuzzy 2017-07-24 19:36:04 +02:00
parent 8970bd16ef
commit 95e8f80f2c
5 changed files with 9 additions and 23 deletions

View file

@ -1,3 +1,4 @@
mcl_sounds
mcl_core
mcl_hunger
mcl_death_messages

View file

@ -35,10 +35,11 @@ local on_step_add = function(self, dtime)
if hp < 0 then
hp = 0
end
v:set_hp(hp)
if v:is_player() then
mcl_death_messages.player_damage(v, string.format("%s was smashed by a falling anvil.", v:get_player_name()))
mcl_hunger.exhaust(v:get_player_name(), mcl_hunger.EXHAUST_DAMAGE)
end
v:set_hp(hp)
if hp == 0 then
kill = true
end

View file

@ -24,7 +24,8 @@ local function do_tnt_physics(tnt_np,tntr)
if v ~= nil then
obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z})
else
if obj:is_player() ~= nil then
if obj:is_player() == true then
mcl_death_messages.player_damage(obj, string.format("%s was caught in an explosion.", obj:get_player_name()))
obj:set_hp(obj:get_hp() - 1)
mcl_hunger.exhaust(obj:get_player_name(), mcl_hunger.EXHAUST_DAMAGE)
end