Attribute thrower as killer

This commit is contained in:
rubenwardy 2016-04-06 00:12:20 +01:00
parent 2321195c7a
commit efbd21eed1
4 changed files with 6 additions and 9 deletions

View file

@ -23,11 +23,7 @@ function ctf_events.post(action, one, two)
end
ctf.register_on_killedplayer(function(victim, killer, type)
if killer == victim then
ctf_events.post("kill_grenade", nil, victim)
else
ctf_events.post("kill_" .. type, killer, victim)
end
ctf_events.update_all()
end)

@ -1 +1 @@
Subproject commit f3379d0dfde59a09c4065b0f424ce8a61e2593f9
Subproject commit aa6cef7a398fa6e539de7f035ae153a70343db5e

View file

@ -12,6 +12,7 @@ minetest.register_entity("shooter:grenade_entity", {
"shooter_grenade.png",
},
player = nil,
player_name = nil,
collisionbox = {0,0,0, 0,0,0},
on_activate = function(self, staticdata)
if staticdata == "expired" then
@ -62,6 +63,7 @@ minetest.register_tool("shooter:grenade", {
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or user
ent.player_name = user:get_player_name()
end
end
end
@ -77,4 +79,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
},
})
end

View file

@ -393,9 +393,9 @@ function shooter:blast(pos, radius, fleshy, distance, user)
obj_pos.y = obj_pos.y + 1.7
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
if minetest.line_of_sight(obj_pos, blast_pos, 1) then
obj:punch(obj, 2.0, {
obj:punch(user or obj, 2.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy=damage},
damage_groups = {fleshy=damage, grenade=damage},
})
end
end