diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index b41eed4..c2842a4 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -300,8 +300,9 @@ local function spawn_drops(self, pos) end end -function airutils.destroy(self, by_name) +function airutils.destroy(self, by_name, by_automation) by_name = by_name or "" + by_automation = by_automation or false local with_fire = self._enable_fire_explosion local owner = self.owner if by_name == owner then with_fire = false end @@ -338,32 +339,38 @@ function airutils.destroy(self, by_name) airutils.dettachPlayer(self, player) 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) if self._destroy_parts_method then self._destroy_parts_method(self) end - local destroyed_ent = nil - if self._destroyed_ent then - destroyed_ent = self._destroyed_ent - end + if by_automation == false then + local destroyed_ent = nil + if self._destroyed_ent then + destroyed_ent = self._destroyed_ent + end - --if dont have a destroyed version, destroy the inventory - if not destroyed_ent then - airutils.destroy_inventory(self) - spawn_drops(self, pos) - else - if not with_fire then --or by the owner itself + --if dont have a destroyed version, destroy the inventory + 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) + spawn_drops(self, pos) + end end + else + airutils.destroy_inventory(self) end 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) if destroyed_ent then