mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Added TUM.mizCleaner table
This commit is contained in:
@@ -87,6 +87,7 @@ do
|
|||||||
if not TUM.playerCareer.onStartUp() then return nil end
|
if not TUM.playerCareer.onStartUp() then return nil end
|
||||||
if not TUM.intermission.onStartUp() then return nil end
|
if not TUM.intermission.onStartUp() then return nil end
|
||||||
if not TUM.airForce.onStartUp() then return nil end
|
if not TUM.airForce.onStartUp() then return nil end
|
||||||
|
if not TUM.mizCleaner.onStartUp() then return nil end -- Must be called after TUM.settings.onStartUp()
|
||||||
|
|
||||||
TUM.hasStarted = true
|
TUM.hasStarted = true
|
||||||
|
|
||||||
|
|||||||
55
Script/The Universal Mission/MizCleaner.lua
Normal file
55
Script/The Universal Mission/MizCleaner.lua
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
-- ====================================================================================
|
||||||
|
-- TUM.MIZCLEANER - REMOVED UNWANTED UNIT GROUPS FROM THE MIZ FILE
|
||||||
|
-- ====================================================================================
|
||||||
|
-- (local) removeAIWingmen()
|
||||||
|
-- TUM.mizCleaner.onStartUp()
|
||||||
|
-- ====================================================================================
|
||||||
|
|
||||||
|
TUM.mizCleaner = {}
|
||||||
|
|
||||||
|
do
|
||||||
|
-------------------------------------
|
||||||
|
-- Removes all AI wingmen units
|
||||||
|
-------------------------------------
|
||||||
|
local function removeAIWingmen()
|
||||||
|
local groups = DCSEx.envMission.getGroups(TUM.settings.getPlayerCoalition())
|
||||||
|
|
||||||
|
local aiWingMenToRemove = {}
|
||||||
|
for _,g in ipairs(groups) do
|
||||||
|
if g.units then
|
||||||
|
local isPlayerGroup = false
|
||||||
|
|
||||||
|
for _,u in ipairs(g.units) do
|
||||||
|
if u.skill == "Player" or u.skill == "Client" then
|
||||||
|
isPlayerGroup = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if isPlayerGroup then
|
||||||
|
for _,u in ipairs(g.units) do
|
||||||
|
if u.skill ~= "Player" and u.skill ~= "Client" then
|
||||||
|
table.insert(aiWingMenToRemove, u.unitId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #aiWingMenToRemove > 0 then
|
||||||
|
for _,id in ipairs(aiWingMenToRemove) do
|
||||||
|
local u = DCSEx.world.getUnitByID(id)
|
||||||
|
if u then u:destroy() end
|
||||||
|
end
|
||||||
|
TUM.log("Removed "..tostring(#aiWingMenToRemove).." AI wingmen from the mission.\nPlease do not add AI wingmen to the mission, The Universal Mission uses its own wingman system.", TUM.logLevel.WARNING)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
-- Called on mission start up
|
||||||
|
-- @return True if started up properly, false if an error happened
|
||||||
|
-------------------------------------
|
||||||
|
function TUM.mizCleaner.onStartUp()
|
||||||
|
removeAIWingmen()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user