added parameter to simply remove the plane

This commit is contained in:
Alexsandro Percy 2024-03-13 19:00:44 -03:00
parent 465d7c562e
commit 836c6d10f6

View file

@ -300,8 +300,9 @@ local function spawn_drops(self, pos)
end end
end end
function airutils.destroy(self, by_name) function airutils.destroy(self, by_name, by_automation)
by_name = by_name or "" by_name = by_name or ""
by_automation = by_automation or false
local with_fire = self._enable_fire_explosion local with_fire = self._enable_fire_explosion
local owner = self.owner local owner = self.owner
if by_name == owner then with_fire = false end if by_name == owner then with_fire = false end
@ -338,32 +339,38 @@ function airutils.destroy(self, by_name)
airutils.dettachPlayer(self, player) airutils.dettachPlayer(self, player)
end end
airutils.add_destruction_effects(pos, 5, with_fire) if by_automation == false then
airutils.add_destruction_effects(pos, 5, with_fire)
end
airutils.seats_destroy(self) airutils.seats_destroy(self)
if self._destroy_parts_method then if self._destroy_parts_method then
self._destroy_parts_method(self) self._destroy_parts_method(self)
end end
local destroyed_ent = nil if by_automation == false then
if self._destroyed_ent then local destroyed_ent = nil
destroyed_ent = self._destroyed_ent if self._destroyed_ent then
end destroyed_ent = self._destroyed_ent
end
--if dont have a destroyed version, destroy the inventory --if dont have a destroyed version, destroy the inventory
if not destroyed_ent then if not destroyed_ent then
airutils.destroy_inventory(self)
spawn_drops(self, pos)
else
if not with_fire then --or by the owner itself
airutils.destroy_inventory(self) airutils.destroy_inventory(self)
spawn_drops(self, pos) spawn_drops(self, pos)
else
if not with_fire then --or by the owner itself
airutils.destroy_inventory(self)
spawn_drops(self, pos)
end
end end
else
airutils.destroy_inventory(self)
end end
self.object:remove() self.object:remove()
if airutils.blast_damage == true and with_fire == true then if airutils.blast_damage == true and with_fire == true and by_automation == false then
airutils.add_blast_damage(pos, 7, 10) airutils.add_blast_damage(pos, 7, 10)
if destroyed_ent then if destroyed_ent then