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

@ -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