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,13 +339,16 @@ function airutils.destroy(self, by_name)
airutils.dettachPlayer(self, player) airutils.dettachPlayer(self, player)
end end
if by_automation == false then
airutils.add_destruction_effects(pos, 5, with_fire) 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
if by_automation == false then
local destroyed_ent = nil local destroyed_ent = nil
if self._destroyed_ent then if self._destroyed_ent then
destroyed_ent = self._destroyed_ent destroyed_ent = self._destroyed_ent
@ -360,10 +364,13 @@ function airutils.destroy(self, by_name)
spawn_drops(self, pos) spawn_drops(self, pos)
end end
end end
else
airutils.destroy_inventory(self)
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