Attribute thrower as killer
This commit is contained in:
parent
2321195c7a
commit
efbd21eed1
4 changed files with 6 additions and 9 deletions
|
@ -23,11 +23,7 @@ function ctf_events.post(action, one, two)
|
||||||
end
|
end
|
||||||
|
|
||||||
ctf.register_on_killedplayer(function(victim, killer, type)
|
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)
|
ctf_events.post("kill_" .. type, killer, victim)
|
||||||
end
|
|
||||||
ctf_events.update_all()
|
ctf_events.update_all()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f3379d0dfde59a09c4065b0f424ce8a61e2593f9
|
Subproject commit aa6cef7a398fa6e539de7f035ae153a70343db5e
|
|
@ -12,6 +12,7 @@ minetest.register_entity("shooter:grenade_entity", {
|
||||||
"shooter_grenade.png",
|
"shooter_grenade.png",
|
||||||
},
|
},
|
||||||
player = nil,
|
player = nil,
|
||||||
|
player_name = nil,
|
||||||
collisionbox = {0,0,0, 0,0,0},
|
collisionbox = {0,0,0, 0,0,0},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
if staticdata == "expired" then
|
if staticdata == "expired" then
|
||||||
|
@ -62,6 +63,7 @@ minetest.register_tool("shooter:grenade", {
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
ent.player = ent.player or user
|
ent.player = ent.player or user
|
||||||
|
ent.player_name = user:get_player_name()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -77,4 +79,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -393,9 +393,9 @@ function shooter:blast(pos, radius, fleshy, distance, user)
|
||||||
obj_pos.y = obj_pos.y + 1.7
|
obj_pos.y = obj_pos.y + 1.7
|
||||||
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
|
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
|
||||||
if minetest.line_of_sight(obj_pos, blast_pos, 1) then
|
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,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy=damage},
|
damage_groups = {fleshy=damage, grenade=damage},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue