Added wingman spawning logic

This commit is contained in:
Ambroise Garel 2025-07-23 12:01:14 +02:00
parent 9cd6c057fc
commit a5c6f4f753

View File

@ -12,6 +12,31 @@ do
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) then return end -- No wingmen in multiplayer
TUM.supportWingmen.removeAll() -- Destroy all pre-existing wingmen
TUM.log("Creating wingmen...")
local player = world:getPlayer()
if not player then return end
local count = 1 -- TODO
local groupInfo = DCSEx.unitGroupMaker.create(
TUM.settings.getPlayerCoalition(),
Group.Category.AIRPLANE, -- TODO: or helicopter!
DCSEx.math.randomPointInCircle(DCSEx.math.vec3ToVec2(player:getPoint()), 500, 250),
{ player:getTypeName() },
{
silenced = true,
taskFollow = DCSEx.dcs.getObjectIDAsNumber(player:getGroup()),
unlimitedFuel = true
}
)
if not groupInfo then
TUM.log("Failed to spawn AI wingmen", TUM.logLevel.WARNING)
return
end
TUM.log("Spawned AI wingmen")
wingmenGroupID = groupInfo.groupID
end
function TUM.supportWingmen.removeAll()