Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Give kill type to on_killedplayer, and fix crash in ctf_colors.get_co…
Browse files Browse the repository at this point in the history
…lor()
  • Loading branch information
rubenwardy committed Apr 5, 2016
1 parent 386d729 commit f1bc56f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion ctf/teams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,19 @@ minetest.register_on_punchplayer(function(player, hitter,
end

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
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
return false
end
Expand Down
6 changes: 5 additions & 1 deletion ctf_colors/hud.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
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]
if not tcolor_hex then
tcolor_hex = "0x000000"
Expand Down

0 comments on commit f1bc56f

Please sign in to comment.