From 538c2cf71829a894a719d8422fa0cfbbaefdc1e1 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Tue, 24 Apr 2018 13:54:36 +0200 Subject: [PATCH] damage entities --- cannon.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cannon.lua b/cannon.lua index 148f1e4..b3fc3c5 100644 --- a/cannon.lua +++ b/cannon.lua @@ -44,15 +44,12 @@ local register_spacecannon = function(color, range, timeout, speed) if node.name == "air" then local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 3) for k, obj in pairs(objs) do - if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= self.name and obj:get_luaentity().name ~= "__builtin:item" then --something other found - local mob = obj - -- self.on_mob_hit(self,pos,mob) - end - elseif obj:is_player() then --player found - local player = obj - -- self.on_player_hit(self,pos,player) - end + if obj:get_luaentity() ~= nil and obj:get_luaentity().name ~= self.name then + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=range*2}, + }, nil) + end end elseif node.name ~= "air" then -- collision