mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Now removes AI aircraft on landing
This commit is contained in:
parent
cfcb772c17
commit
ddd1332454
@ -114,6 +114,7 @@ do
|
|||||||
TUM.playerScore.onEvent(event)
|
TUM.playerScore.onEvent(event)
|
||||||
TUM.mission.onEvent(event)
|
TUM.mission.onEvent(event)
|
||||||
TUM.supportWingmen.onEvent(event)
|
TUM.supportWingmen.onEvent(event)
|
||||||
|
TUM.mizCleaner.onEvent(event) -- Must be last, can remove units which could cause bugs in other onEvent methods
|
||||||
end
|
end
|
||||||
|
|
||||||
function TUM.onEvent(event)
|
function TUM.onEvent(event)
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
-- ====================================================================================
|
-- ====================================================================================
|
||||||
-- (local) removeAIWingmen()
|
-- (local) removeAIWingmen()
|
||||||
-- TUM.mizCleaner.onStartUp()
|
-- TUM.mizCleaner.onStartUp()
|
||||||
|
-- TUM.mizCleaner.onEvent(event)
|
||||||
-- ====================================================================================
|
-- ====================================================================================
|
||||||
|
|
||||||
TUM.mizCleaner = {}
|
TUM.mizCleaner = {}
|
||||||
@ -52,4 +53,18 @@ do
|
|||||||
removeAIWingmen()
|
removeAIWingmen()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
-- Called when an event is raised
|
||||||
|
-- @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()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user