Fix crash

master
ElCeejo 2020-04-10 18:01:39 -07:00 committed by GitHub
parent 941be6a068
commit ead07e2b64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,10 @@ local function return_to_owner(self,pos) -- Return to Owner
local owner_pos = owner:get_pos()
owner_pos.y = owner_pos.y + 1
local dir = vector.direction(pos,owner_pos)
if self.owner == nil then
self.object:remove()
minetest.add_item(pos,"adv_lightsabers:lightsaber_"..type.."_"..color.."_off")
end
for _,entity in pairs(minetest.get_objects_inside_radius(pos,2)) do
if entity:is_player() and entity:get_player_name() ~= self.owner then -- Punch Player
entity:punch(self.object,2.0,{full_punch_interval = 0.1,damage_groups = {fleshy = 6}},nil)
@ -305,4 +309,4 @@ function adv_lightsabers:register_lightsaber(type,color)
groups = {not_in_creative_inventory=1,lightsaber=1},
})
end
end
end