Implement arrow shot source

This commit is contained in:
Wuzzy 2017-07-24 20:57:23 +02:00
parent 9e095d0c0c
commit 89a266f78c

@ -6,6 +6,9 @@ local msgs = {
"%s was fatally hit by an arrow.", "%s was fatally hit by an arrow.",
"%s has been killed with an arrow.", "%s has been killed with an arrow.",
}, },
["arrow_name"] = {
"%s was shot by an arrow from %s.",
},
["fire"] = { ["fire"] = {
"%s has been cooked crisp.", "%s has been cooked crisp.",
"%s felt the burn.", "%s felt the burn.",
@ -152,7 +155,17 @@ minetest.register_on_dieplayer(function(player)
end end
-- Arrow -- Arrow
elseif last_damages[name].hittertype == "arrow" then elseif last_damages[name].hittertype == "arrow" then
msg = dmsg("arrow", name) if last_damages[name].hitter:is_player() then
msg = dmsg("arrow_name", name, last_damages[name].hitter:get_player_name())
elseif last_damages[name].hitter:get_luaentity()._cmi_is_mob then
if last_damages[name].hitter:get_luaentity().nametag ~= "" then
msg = dmsg("arrow_name", name, last_damages[name].hitter:get_player_name())
else
msg = dmsg("arrow", name)
end
else
msg = dmsg("arrow", name)
end
-- Fireball -- Fireball
elseif last_damages[name].hittertype == "blaze_fireball" then elseif last_damages[name].hittertype == "blaze_fireball" then
msg = dmsg("blaze_fireball", name) msg = dmsg("blaze_fireball", name)