Give kill type to on_killedplayer, and fix crash in ctf_colors.get_color()
This commit is contained in:
parent
386d72965e
commit
f1bc56f4cd
@ -449,8 +449,19 @@ minetest.register_on_punchplayer(function(player, hitter,
|
|||||||
end
|
end
|
||||||
|
|
||||||
if player:get_hp() - damage <= 0 then
|
if player:get_hp() - damage <= 0 then
|
||||||
|
local wielded = hitter:get_wielded_item()
|
||||||
|
local wname = wielded:get_name()
|
||||||
|
print(wname)
|
||||||
|
local type = "sword"
|
||||||
|
if wname:sub(1, 8) == "shooter:" then
|
||||||
|
if wname == "shooter:grenade" then
|
||||||
|
type = "grenade"
|
||||||
|
else
|
||||||
|
type = "bullet"
|
||||||
|
end
|
||||||
|
end
|
||||||
for i = 1, #ctf.registered_on_killedplayer do
|
for i = 1, #ctf.registered_on_killedplayer do
|
||||||
ctf.registered_on_killedplayer[i](player:get_player_name(), hitter:get_player_name())
|
ctf.registered_on_killedplayer[i](player:get_player_name(), hitter:get_player_name(), type)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
function ctf_colors.get_color(name, tplayer)
|
function ctf_colors.get_color(name, tplayer)
|
||||||
local tcolor_text = ctf.team(tplayer.team).data.color
|
local team = ctf.team(tplayer.team)
|
||||||
|
local tcolor_text = nil
|
||||||
|
if team then
|
||||||
|
tcolor_text = team.data.color
|
||||||
|
end
|
||||||
local tcolor_hex = ctf.flag_colors[tcolor_text]
|
local tcolor_hex = ctf.flag_colors[tcolor_text]
|
||||||
if not tcolor_hex then
|
if not tcolor_hex then
|
||||||
tcolor_hex = "0x000000"
|
tcolor_hex = "0x000000"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user