From efbd21eed1dbb9fd74eb2af6325a87b056951efe Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 6 Apr 2016 00:12:20 +0100 Subject: [PATCH] Attribute thrower as killer --- mods/ctf_events/init.lua | 6 +----- mods/ctf_pvp_engine | 2 +- mods/shooter/grenade.lua | 3 ++- mods/shooter/shooter.lua | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mods/ctf_events/init.lua b/mods/ctf_events/init.lua index 44d14c2..95f5d6f 100644 --- a/mods/ctf_events/init.lua +++ b/mods/ctf_events/init.lua @@ -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.post("kill_" .. type, killer, victim) ctf_events.update_all() end) diff --git a/mods/ctf_pvp_engine b/mods/ctf_pvp_engine index f3379d0..aa6cef7 160000 --- a/mods/ctf_pvp_engine +++ b/mods/ctf_pvp_engine @@ -1 +1 @@ -Subproject commit f3379d0dfde59a09c4065b0f424ce8a61e2593f9 +Subproject commit aa6cef7a398fa6e539de7f035ae153a70343db5e diff --git a/mods/shooter/grenade.lua b/mods/shooter/grenade.lua index 0313ce8..075d056 100644 --- a/mods/shooter/grenade.lua +++ b/mods/shooter/grenade.lua @@ -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 - diff --git a/mods/shooter/shooter.lua b/mods/shooter/shooter.lua index c89cea3..51dacf5 100644 --- a/mods/shooter/shooter.lua +++ b/mods/shooter/shooter.lua @@ -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