mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-27 15:07:50 +00:00
Added removeAIAircraftOnLandEvent(event)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
-- ====================================================================================
|
-- ====================================================================================
|
||||||
-- TUM.MIZCLEANER - REMOVED UNWANTED UNIT GROUPS FROM THE MIZ FILE
|
-- TUM.MIZCLEANER - REMOVED UNWANTED UNIT GROUPS FROM THE MIZ FILE
|
||||||
-- ====================================================================================
|
-- ====================================================================================
|
||||||
|
-- (local) removeAIAircraftOnLandEvent(event)
|
||||||
-- (local) removeAIWingmen()
|
-- (local) removeAIWingmen()
|
||||||
-- TUM.mizCleaner.onStartUp()
|
-- TUM.mizCleaner.onStartUp()
|
||||||
-- TUM.mizCleaner.onEvent(event)
|
-- TUM.mizCleaner.onEvent(event)
|
||||||
@@ -9,6 +10,19 @@
|
|||||||
TUM.mizCleaner = {}
|
TUM.mizCleaner = {}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
-------------------------------------
|
||||||
|
-- If event is an AI aircraft land event, remove it so it "frees room" (e.g. don't occupy an "air force unit" slot) for new aircraft
|
||||||
|
-- @param event A DCS World event, possibly a S_EVENT_LAND event
|
||||||
|
-------------------------------------
|
||||||
|
local function removeAIAircraftOnLandEvent(event)
|
||||||
|
if event.id ~= world.event.S_EVENT_LAND then return end
|
||||||
|
if not event.initiator then return end
|
||||||
|
if Object.getCategory(event.initiator) ~= Object.Category.UNIT then return end -- Not an unit
|
||||||
|
if event.initiator:getPlayerName() then return end -- Don't remove player aircraft, that would cause horrendous bugs
|
||||||
|
|
||||||
|
event.initiator:destroy()
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
-- Removes all AI wingmen units
|
-- Removes all AI wingmen units
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
@@ -59,12 +73,6 @@ do
|
|||||||
-- @param event The DCS World event
|
-- @param event The DCS World event
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
function TUM.mizCleaner.onEvent(event)
|
function TUM.mizCleaner.onEvent(event)
|
||||||
-- Remove AI aircraft when they land, so they "free room" (e.g. don't occupy an "enemy air force unit" slot) for new aircraft
|
removeAIAircraftOnLandEvent(event)
|
||||||
if event.id ~= world.event.S_EVENT_LAND then return end
|
|
||||||
if not event.initiator then return end
|
|
||||||
if Object.getCategory(event.initiator) ~= Object.Category.UNIT then return end -- Not a unit
|
|
||||||
if event.initiator:getPlayerName() then return end -- Don't remove player aircraft, that would cause horrendous bugs
|
|
||||||
|
|
||||||
event.initiator:destroy()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user