mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Added removeAIAircraftOnLandEvent(event)
This commit is contained in:
parent
ddd1332454
commit
6934f8beda
@ -1,6 +1,7 @@
|
||||
-- ====================================================================================
|
||||
-- TUM.MIZCLEANER - REMOVED UNWANTED UNIT GROUPS FROM THE MIZ FILE
|
||||
-- ====================================================================================
|
||||
-- (local) removeAIAircraftOnLandEvent(event)
|
||||
-- (local) removeAIWingmen()
|
||||
-- TUM.mizCleaner.onStartUp()
|
||||
-- TUM.mizCleaner.onEvent(event)
|
||||
@ -9,6 +10,19 @@
|
||||
TUM.mizCleaner = {}
|
||||
|
||||
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
|
||||
-------------------------------------
|
||||
@ -59,12 +73,6 @@ do
|
||||
-- @param event The DCS World 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
|
||||
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()
|
||||
removeAIAircraftOnLandEvent(event)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user