mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
Cleaned out some files from Polar Shield that we don't need anymore.
This commit is contained in:
parent
a2786f2325
commit
fff98e1670
@ -1,126 +0,0 @@
|
|||||||
-- Simple AFAC Test Script
|
|
||||||
-- This is a minimal version to test if scripts load at all
|
|
||||||
|
|
||||||
-- Test if script loads
|
|
||||||
trigger.action.outText("TEST SCRIPT: Loading AFAC test...", 15)
|
|
||||||
env.info("AFAC TEST: Script is loading")
|
|
||||||
|
|
||||||
-- Basic data structure
|
|
||||||
AFAC = {
|
|
||||||
pilots = {},
|
|
||||||
debug = true
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Simple logging
|
|
||||||
function AFAC.log(message)
|
|
||||||
env.info("AFAC TEST: " .. tostring(message))
|
|
||||||
trigger.action.outText("AFAC: " .. tostring(message), 5)
|
|
||||||
end
|
|
||||||
|
|
||||||
AFAC.log("Test script initialized")
|
|
||||||
|
|
||||||
-- Simple aircraft check
|
|
||||||
AFAC.afacTypes = {
|
|
||||||
"UH-1H"
|
|
||||||
}
|
|
||||||
|
|
||||||
function AFAC.isAFAC(unit)
|
|
||||||
if not unit then return false end
|
|
||||||
local unitType = unit:getTypeName()
|
|
||||||
AFAC.log("Checking aircraft type: " .. unitType)
|
|
||||||
|
|
||||||
for _, afacType in ipairs(AFAC.afacTypes) do
|
|
||||||
if unitType == afacType then
|
|
||||||
AFAC.log("MATCH FOUND: " .. unitType .. " is AFAC!")
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function AFAC.addPilot(unit)
|
|
||||||
local unitName = unit:getName()
|
|
||||||
AFAC.log("Adding AFAC pilot: " .. unitName)
|
|
||||||
|
|
||||||
local groupId = unit:getGroup():getID()
|
|
||||||
trigger.action.outTextForGroup(groupId, "AFAC ACTIVE: " .. unit:getTypeName(), 20)
|
|
||||||
|
|
||||||
-- Add simple F10 menu
|
|
||||||
local mainMenu = missionCommands.addSubMenuForGroup(groupId, "AFAC TEST")
|
|
||||||
missionCommands.addCommandForGroup(groupId, "Test Command", mainMenu, function()
|
|
||||||
trigger.action.outTextForGroup(groupId, "AFAC Test Menu Works!", 10)
|
|
||||||
end)
|
|
||||||
|
|
||||||
AFAC.pilots[unitName] = unit
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event handler
|
|
||||||
AFAC.EventHandler = {}
|
|
||||||
|
|
||||||
function AFAC.EventHandler:onEvent(event)
|
|
||||||
AFAC.log("Event received: " .. tostring(event.id))
|
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then
|
|
||||||
AFAC.log("Player entered unit event")
|
|
||||||
local unit = event.initiator
|
|
||||||
|
|
||||||
if unit then
|
|
||||||
AFAC.log("Unit type: " .. unit:getTypeName())
|
|
||||||
if AFAC.isAFAC(unit) then
|
|
||||||
AFAC.log("AFAC detected, adding pilot")
|
|
||||||
AFAC.addPilot(unit)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_BIRTH then
|
|
||||||
AFAC.log("Birth event")
|
|
||||||
local unit = event.initiator
|
|
||||||
|
|
||||||
if unit and Object.getCategory(unit) == Object.Category.UNIT then
|
|
||||||
local objDesc = unit:getDesc()
|
|
||||||
if objDesc.category == Unit.Category.AIRPLANE or objDesc.category == Unit.Category.HELICOPTER then
|
|
||||||
AFAC.log("Aircraft born: " .. unit:getTypeName())
|
|
||||||
if AFAC.isAFAC(unit) then
|
|
||||||
timer.scheduleFunction(function(args)
|
|
||||||
if args[1]:isActive() then
|
|
||||||
AFAC.addPilot(args[1])
|
|
||||||
end
|
|
||||||
end, {unit}, timer.getTime() + 2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add event handler
|
|
||||||
world.addEventHandler(AFAC.EventHandler)
|
|
||||||
AFAC.log("Event handler added")
|
|
||||||
|
|
||||||
-- Check existing units
|
|
||||||
timer.scheduleFunction(function()
|
|
||||||
AFAC.log("Checking existing units...")
|
|
||||||
|
|
||||||
for coalitionId = 1, 2 do
|
|
||||||
local heliGroups = coalition.getGroups(coalitionId, Group.Category.HELICOPTER)
|
|
||||||
AFAC.log("Found " .. #heliGroups .. " helicopter groups for coalition " .. coalitionId)
|
|
||||||
|
|
||||||
for _, group in ipairs(heliGroups) do
|
|
||||||
local units = group:getUnits()
|
|
||||||
if units then
|
|
||||||
for _, unit in ipairs(units) do
|
|
||||||
if unit and unit:isActive() then
|
|
||||||
AFAC.log("Found helicopter: " .. unit:getTypeName())
|
|
||||||
if AFAC.isAFAC(unit) and unit:getPlayerName() then
|
|
||||||
AFAC.log("Found player AFAC: " .. unit:getName())
|
|
||||||
AFAC.addPilot(unit)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, nil, timer.getTime() + 3)
|
|
||||||
|
|
||||||
AFAC.log("AFAC Test Script loaded successfully!")
|
|
||||||
trigger.action.outText("AFAC Test Script loaded!", 10)
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,304 +0,0 @@
|
|||||||
-- TADC Diagnostic Script
|
|
||||||
-- This script will run diagnostics on the TADC system to identify why no aircraft are launching
|
|
||||||
|
|
||||||
env.info("=== TADC DIAGNOSTIC SCRIPT STARTING ===")
|
|
||||||
|
|
||||||
-- Test 1: Check if zones exist and are properly defined
|
|
||||||
local function testZones()
|
|
||||||
env.info("=== ZONE DIAGNOSTIC ===")
|
|
||||||
|
|
||||||
local redBorderGroup = GROUP:FindByName("RED BORDER")
|
|
||||||
local heloBorderGroup = GROUP:FindByName("HELO BORDER")
|
|
||||||
|
|
||||||
if redBorderGroup then
|
|
||||||
env.info("✓ RED BORDER group found")
|
|
||||||
local redZone = ZONE_POLYGON:New("RED BORDER TEST", redBorderGroup)
|
|
||||||
if redZone then
|
|
||||||
env.info("✓ RED BORDER zone created successfully")
|
|
||||||
local coord = redZone:GetCoordinate()
|
|
||||||
if coord then
|
|
||||||
env.info("✓ RED BORDER zone coordinate: " .. coord:ToStringLLDMS())
|
|
||||||
else
|
|
||||||
env.info("✗ RED BORDER zone has no coordinate")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("✗ Failed to create RED BORDER zone")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("✗ RED BORDER group NOT found - this is likely the problem!")
|
|
||||||
end
|
|
||||||
|
|
||||||
if heloBorderGroup then
|
|
||||||
env.info("✓ HELO BORDER group found")
|
|
||||||
local heloZone = ZONE_POLYGON:New("HELO BORDER TEST", heloBorderGroup)
|
|
||||||
if heloZone then
|
|
||||||
env.info("✓ HELO BORDER zone created successfully")
|
|
||||||
local coord = heloZone:GetCoordinate()
|
|
||||||
if coord then
|
|
||||||
env.info("✓ HELO BORDER zone coordinate: " .. coord:ToStringLLDMS())
|
|
||||||
else
|
|
||||||
env.info("✗ HELO BORDER zone has no coordinate")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("✗ Failed to create HELO BORDER zone")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("✗ HELO BORDER group NOT found - this may be the problem!")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test 2: Check if Blue aircraft exist on the map
|
|
||||||
local function testBlueAircraft()
|
|
||||||
env.info("=== BLUE AIRCRAFT DIAGNOSTIC ===")
|
|
||||||
|
|
||||||
local BlueAircraft = SET_GROUP:New():FilterCoalitions("blue"):FilterCategoryAirplane():FilterStart()
|
|
||||||
local blueCount = BlueAircraft:Count()
|
|
||||||
|
|
||||||
env.info("Total Blue aircraft on map: " .. blueCount)
|
|
||||||
|
|
||||||
if blueCount > 0 then
|
|
||||||
env.info("Blue aircraft found:")
|
|
||||||
BlueAircraft:ForEach(function(blueGroup)
|
|
||||||
if blueGroup and blueGroup:IsAlive() then
|
|
||||||
local coord = blueGroup:GetCoordinate()
|
|
||||||
local name = blueGroup:GetName()
|
|
||||||
if coord then
|
|
||||||
env.info(" - " .. name .. " at " .. coord:ToStringLLDMS())
|
|
||||||
else
|
|
||||||
env.info(" - " .. name .. " (no coordinate)")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
env.info("✗ NO BLUE AIRCRAFT FOUND - this is likely why no intercepts are launching!")
|
|
||||||
env.info("SOLUTION: Add Blue coalition aircraft to the mission or spawn some for testing")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test 3: Check if Blue aircraft are in the detection zones
|
|
||||||
local function testBlueInZones()
|
|
||||||
env.info("=== BLUE AIRCRAFT IN ZONES DIAGNOSTIC ===")
|
|
||||||
|
|
||||||
local redBorderGroup = GROUP:FindByName("RED BORDER")
|
|
||||||
local heloBorderGroup = GROUP:FindByName("HELO BORDER")
|
|
||||||
|
|
||||||
if not redBorderGroup or not heloBorderGroup then
|
|
||||||
env.info("✗ Cannot test zones - border groups missing")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local redZone = ZONE_POLYGON:New("RED BORDER TEST", redBorderGroup)
|
|
||||||
local heloZone = ZONE_POLYGON:New("HELO BORDER TEST", heloBorderGroup)
|
|
||||||
|
|
||||||
local BlueAircraft = SET_GROUP:New():FilterCoalitions("blue"):FilterCategoryAirplane():FilterStart()
|
|
||||||
local blueCount = BlueAircraft:Count()
|
|
||||||
|
|
||||||
if blueCount == 0 then
|
|
||||||
env.info("✗ No Blue aircraft to test zone containment")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local inRedZone = 0
|
|
||||||
local inHeloZone = 0
|
|
||||||
|
|
||||||
BlueAircraft:ForEach(function(blueGroup)
|
|
||||||
if blueGroup and blueGroup:IsAlive() then
|
|
||||||
local coord = blueGroup:GetCoordinate()
|
|
||||||
local name = blueGroup:GetName()
|
|
||||||
|
|
||||||
if coord then
|
|
||||||
local inRed = redZone and redZone:IsCoordinateInZone(coord)
|
|
||||||
local inHelo = heloZone and heloZone:IsCoordinateInZone(coord)
|
|
||||||
|
|
||||||
if inRed then
|
|
||||||
inRedZone = inRedZone + 1
|
|
||||||
env.info(" ✓ " .. name .. " is in RED BORDER zone")
|
|
||||||
elseif inHelo then
|
|
||||||
inHeloZone = inHeloZone + 1
|
|
||||||
env.info(" ✓ " .. name .. " is in HELO BORDER zone")
|
|
||||||
else
|
|
||||||
env.info(" - " .. name .. " is NOT in any border zone")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
env.info("Summary: " .. inRedZone .. " in RED zone, " .. inHeloZone .. " in HELO zone")
|
|
||||||
|
|
||||||
if inRedZone == 0 and inHeloZone == 0 then
|
|
||||||
env.info("✗ NO BLUE AIRCRAFT IN DETECTION ZONES - this is why no intercepts are launching!")
|
|
||||||
env.info("SOLUTION: Move Blue aircraft into the border zones or expand the zone definitions")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test 4: Check squadron templates
|
|
||||||
local function testSquadronTemplates()
|
|
||||||
env.info("=== SQUADRON TEMPLATE DIAGNOSTIC ===")
|
|
||||||
|
|
||||||
local squadronTemplates = {
|
|
||||||
"FIGHTER_SWEEP_RED_Kilpyavr",
|
|
||||||
"FIGHTER_SWEEP_RED_Severomorsk-1",
|
|
||||||
"FIGHTER_SWEEP_RED_Severomorsk-3",
|
|
||||||
"FIGHTER_SWEEP_RED_Murmansk",
|
|
||||||
"FIGHTER_SWEEP_RED_Monchegorsk",
|
|
||||||
"FIGHTER_SWEEP_RED_Olenya",
|
|
||||||
"HELO_SWEEP_RED_Afrikanda"
|
|
||||||
}
|
|
||||||
|
|
||||||
local found = 0
|
|
||||||
local total = #squadronTemplates
|
|
||||||
|
|
||||||
for _, templateName in pairs(squadronTemplates) do
|
|
||||||
local template = GROUP:FindByName(templateName)
|
|
||||||
if template then
|
|
||||||
env.info("✓ Found template: " .. templateName)
|
|
||||||
|
|
||||||
-- Check if template is alive (should NOT be for Late Activation)
|
|
||||||
local isAlive = template:IsAlive()
|
|
||||||
if isAlive then
|
|
||||||
env.info(" ⚠ WARNING: Template is ALIVE - should be set to Late Activation")
|
|
||||||
else
|
|
||||||
env.info(" ✓ Template correctly set to Late Activation")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check coalition
|
|
||||||
local coalition = template:GetCoalition()
|
|
||||||
if coalition == 1 then
|
|
||||||
env.info(" ✓ Template is Red coalition")
|
|
||||||
else
|
|
||||||
env.info(" ✗ Template is NOT Red coalition (coalition=" .. coalition .. ")")
|
|
||||||
end
|
|
||||||
|
|
||||||
found = found + 1
|
|
||||||
else
|
|
||||||
env.info("✗ Missing template: " .. templateName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info("Squadron templates found: " .. found .. "/" .. total)
|
|
||||||
|
|
||||||
if found == 0 then
|
|
||||||
env.info("✗ NO SQUADRON TEMPLATES FOUND - this is why no aircraft can launch!")
|
|
||||||
env.info("SOLUTION: Create squadron groups in Mission Editor with the correct names and set to Late Activation")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test 5: Check airbases
|
|
||||||
local function testAirbases()
|
|
||||||
env.info("=== AIRBASE DIAGNOSTIC ===")
|
|
||||||
|
|
||||||
local airbases = {
|
|
||||||
"Kilpyavr", "Severomorsk-1", "Severomorsk-3",
|
|
||||||
"Murmansk International", "Monchegorsk", "Olenya", "Afrikanda"
|
|
||||||
}
|
|
||||||
|
|
||||||
local found = 0
|
|
||||||
local redBases = 0
|
|
||||||
|
|
||||||
for _, airbaseName in pairs(airbases) do
|
|
||||||
local airbase = AIRBASE:FindByName(airbaseName)
|
|
||||||
if airbase then
|
|
||||||
env.info("✓ Found airbase: " .. airbaseName)
|
|
||||||
|
|
||||||
local coalition = airbase:GetCoalition()
|
|
||||||
local coalitionName = coalition == 1 and "Red" or (coalition == 2 and "Blue" or "Neutral")
|
|
||||||
env.info(" Coalition: " .. coalitionName)
|
|
||||||
|
|
||||||
if coalition == 1 then
|
|
||||||
redBases = redBases + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
found = found + 1
|
|
||||||
else
|
|
||||||
env.info("✗ Airbase not found: " .. airbaseName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info("Airbases found: " .. found .. "/" .. #airbases .. " (Red: " .. redBases .. ")")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test 6: Manual threat detection test
|
|
||||||
local function testThreatDetection()
|
|
||||||
env.info("=== THREAT DETECTION TEST ===")
|
|
||||||
|
|
||||||
-- Try to manually detect threats
|
|
||||||
local BlueAircraft = SET_GROUP:New():FilterCoalitions("blue"):FilterCategoryAirplane():FilterStart()
|
|
||||||
local blueCount = BlueAircraft:Count()
|
|
||||||
|
|
||||||
env.info("Manual threat scan - found " .. blueCount .. " blue aircraft")
|
|
||||||
|
|
||||||
if blueCount > 0 then
|
|
||||||
local redBorderGroup = GROUP:FindByName("RED BORDER")
|
|
||||||
local heloBorderGroup = GROUP:FindByName("HELO BORDER")
|
|
||||||
|
|
||||||
if redBorderGroup and heloBorderGroup then
|
|
||||||
local redZone = ZONE_POLYGON:New("RED BORDER TEST", redBorderGroup)
|
|
||||||
local heloZone = ZONE_POLYGON:New("HELO BORDER TEST", heloBorderGroup)
|
|
||||||
|
|
||||||
local threatsInZones = 0
|
|
||||||
|
|
||||||
BlueAircraft:ForEach(function(blueGroup)
|
|
||||||
if blueGroup and blueGroup:IsAlive() then
|
|
||||||
local coord = blueGroup:GetCoordinate()
|
|
||||||
local name = blueGroup:GetName()
|
|
||||||
|
|
||||||
if coord then
|
|
||||||
local inRed = redZone:IsCoordinateInZone(coord)
|
|
||||||
local inHelo = heloZone:IsCoordinateInZone(coord)
|
|
||||||
|
|
||||||
if inRed or inHelo then
|
|
||||||
threatsInZones = threatsInZones + 1
|
|
||||||
local classification = "UNKNOWN"
|
|
||||||
local category = blueGroup:GetCategory()
|
|
||||||
local typeName = blueGroup:GetTypeName() or "Unknown"
|
|
||||||
|
|
||||||
if category == Group.Category.AIRPLANE then
|
|
||||||
if string.find(typeName:upper(), "B-") or string.find(typeName:upper(), "BOMBER") then
|
|
||||||
classification = "BOMBER"
|
|
||||||
elseif string.find(typeName:upper(), "A-") or string.find(typeName:upper(), "ATTACK") then
|
|
||||||
classification = "ATTACK"
|
|
||||||
else
|
|
||||||
classification = "FIGHTER"
|
|
||||||
end
|
|
||||||
elseif category == Group.Category.HELICOPTER then
|
|
||||||
classification = "HELICOPTER"
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info(" THREAT DETECTED: " .. name .. " (" .. classification .. ") in " .. (inRed and "RED BORDER" or "HELO BORDER"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if threatsInZones == 0 then
|
|
||||||
env.info("✗ No threats detected in border zones")
|
|
||||||
else
|
|
||||||
env.info("✓ " .. threatsInZones .. " threats detected in border zones")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Run all diagnostic tests
|
|
||||||
local function runAllDiagnostics()
|
|
||||||
env.info("Starting comprehensive TADC diagnostic...")
|
|
||||||
|
|
||||||
testZones()
|
|
||||||
testBlueAircraft()
|
|
||||||
testBlueInZones()
|
|
||||||
testSquadronTemplates()
|
|
||||||
testAirbases()
|
|
||||||
testThreatDetection()
|
|
||||||
|
|
||||||
env.info("=== DIAGNOSTIC COMPLETE ===")
|
|
||||||
env.info("Check the log above for any ✗ (failed) items - these are likely the cause of the problem")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Schedule the diagnostic to run after a delay
|
|
||||||
SCHEDULER:New(nil, runAllDiagnostics, {}, 3)
|
|
||||||
|
|
||||||
-- Also create a repeating diagnostic every 60 seconds for ongoing monitoring
|
|
||||||
SCHEDULER:New(nil, function()
|
|
||||||
env.info("=== PERIODIC THREAT CHECK ===")
|
|
||||||
testBlueInZones()
|
|
||||||
end, {}, 10, 60) -- Start after 10 seconds, repeat every 60 seconds
|
|
||||||
@ -1,164 +0,0 @@
|
|||||||
-- TADC Manual Launch Test
|
|
||||||
-- This script will attempt to manually launch one aircraft to test if the spawn system works
|
|
||||||
|
|
||||||
env.info("=== TADC MANUAL LAUNCH TEST ===")
|
|
||||||
|
|
||||||
-- Wait a few seconds for MOOSE to initialize, then try a manual launch
|
|
||||||
SCHEDULER:New(nil, function()
|
|
||||||
|
|
||||||
env.info("Attempting manual aircraft launch...")
|
|
||||||
|
|
||||||
-- Test configuration - using the first squadron
|
|
||||||
local testConfig = {
|
|
||||||
templateName = "FIGHTER_SWEEP_RED_Severomorsk-1",
|
|
||||||
displayName = "Severomorsk-1 TEST",
|
|
||||||
airbaseName = "Severomorsk-1",
|
|
||||||
aircraft = 1,
|
|
||||||
skill = AI.Skill.GOOD,
|
|
||||||
altitude = 20000,
|
|
||||||
speed = 350,
|
|
||||||
patrolTime = 25,
|
|
||||||
type = "FIGHTER"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Manual launch function (simplified version)
|
|
||||||
local function manualLaunch(config)
|
|
||||||
env.info("=== MANUAL LAUNCH ATTEMPT ===")
|
|
||||||
env.info("Template: " .. config.templateName)
|
|
||||||
env.info("Airbase: " .. config.airbaseName)
|
|
||||||
|
|
||||||
local success, errorMsg = pcall(function()
|
|
||||||
-- Check if template exists
|
|
||||||
local templateGroup = GROUP:FindByName(config.templateName)
|
|
||||||
if not templateGroup then
|
|
||||||
env.info("✗ CRITICAL: Template group not found: " .. config.templateName)
|
|
||||||
env.info("DIAGNOSIS: This template does not exist in the mission!")
|
|
||||||
env.info("SOLUTION: Create a group named '" .. config.templateName .. "' in Mission Editor")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info("✓ Template group found: " .. config.templateName)
|
|
||||||
|
|
||||||
-- Check template properties
|
|
||||||
local coalition = templateGroup:GetCoalition()
|
|
||||||
local isAlive = templateGroup:IsAlive()
|
|
||||||
|
|
||||||
env.info("Template coalition: " .. (coalition == 1 and "Red" or (coalition == 2 and "Blue" or "Neutral")))
|
|
||||||
env.info("Template alive: " .. tostring(isAlive))
|
|
||||||
|
|
||||||
if coalition ~= 1 then
|
|
||||||
env.info("✗ CRITICAL: Template is not Red coalition!")
|
|
||||||
env.info("SOLUTION: Set '" .. config.templateName .. "' to Red coalition in Mission Editor")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if isAlive then
|
|
||||||
env.info("⚠ WARNING: Template is alive - Late Activation may not be set")
|
|
||||||
env.info("RECOMMENDATION: Set '" .. config.templateName .. "' to Late Activation in Mission Editor")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check airbase
|
|
||||||
local airbaseObj = AIRBASE:FindByName(config.airbaseName)
|
|
||||||
if not airbaseObj then
|
|
||||||
env.info("✗ CRITICAL: Airbase not found: " .. config.airbaseName)
|
|
||||||
env.info("SOLUTION: Check airbase name spelling or use a different airbase")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info("✓ Airbase found: " .. config.airbaseName)
|
|
||||||
|
|
||||||
local airbaseCoalition = airbaseObj:GetCoalition()
|
|
||||||
env.info("Airbase coalition: " .. (airbaseCoalition == 1 and "Red" or (airbaseCoalition == 2 and "Blue" or "Neutral")))
|
|
||||||
|
|
||||||
-- Create SPAWN object
|
|
||||||
env.info("Creating SPAWN object...")
|
|
||||||
local spawner = SPAWN:New(config.templateName)
|
|
||||||
|
|
||||||
-- Try to spawn
|
|
||||||
env.info("Attempting to spawn aircraft...")
|
|
||||||
local spawnedGroup = nil
|
|
||||||
|
|
||||||
-- Method 1: Air spawn
|
|
||||||
local airbaseCoord = airbaseObj:GetCoordinate()
|
|
||||||
local spawnCoord = airbaseCoord:Translate(2000, math.random(0, 360)):SetAltitude(config.altitude * 0.3048)
|
|
||||||
|
|
||||||
env.info("Trying air spawn at " .. config.altitude .. "ft...")
|
|
||||||
spawnedGroup = spawner:SpawnFromCoordinate(spawnCoord, nil, SPAWN.Takeoff.Air)
|
|
||||||
|
|
||||||
if not spawnedGroup then
|
|
||||||
env.info("Air spawn failed, trying hot start at airbase...")
|
|
||||||
spawnedGroup = spawner:SpawnAtAirbase(airbaseObj, SPAWN.Takeoff.Hot)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not spawnedGroup then
|
|
||||||
env.info("Hot start failed, trying cold start at airbase...")
|
|
||||||
spawnedGroup = spawner:SpawnAtAirbase(airbaseObj, SPAWN.Takeoff.Cold)
|
|
||||||
end
|
|
||||||
|
|
||||||
if spawnedGroup then
|
|
||||||
env.info("✓ SUCCESS: Aircraft spawned successfully!")
|
|
||||||
env.info("Spawned group: " .. spawnedGroup:GetName())
|
|
||||||
|
|
||||||
-- Set basic CAP task after a delay
|
|
||||||
SCHEDULER:New(nil, function()
|
|
||||||
if spawnedGroup and spawnedGroup:IsAlive() then
|
|
||||||
env.info("Setting up basic CAP task...")
|
|
||||||
|
|
||||||
local currentCoord = spawnedGroup:GetCoordinate()
|
|
||||||
if currentCoord then
|
|
||||||
env.info("Aircraft position: " .. currentCoord:ToStringLLDMS())
|
|
||||||
|
|
||||||
-- Clear tasks and set basic patrol
|
|
||||||
spawnedGroup:ClearTasks()
|
|
||||||
spawnedGroup:OptionROEOpenFire()
|
|
||||||
|
|
||||||
-- Simple patrol task
|
|
||||||
local patrolCoord = currentCoord:Translate(10000, math.random(0, 360)):SetAltitude(config.altitude * 0.3048)
|
|
||||||
|
|
||||||
local patrolTask = {
|
|
||||||
id = 'Orbit',
|
|
||||||
params = {
|
|
||||||
pattern = 'Circle',
|
|
||||||
point = {x = patrolCoord.x, y = patrolCoord.z},
|
|
||||||
radius = 5000,
|
|
||||||
altitude = config.altitude * 0.3048,
|
|
||||||
speed = config.speed * 0.514444,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spawnedGroup:PushTask(patrolTask, 1)
|
|
||||||
|
|
||||||
env.info("✓ Basic CAP task assigned")
|
|
||||||
|
|
||||||
-- Clean up after 10 minutes
|
|
||||||
SCHEDULER:New(nil, function()
|
|
||||||
if spawnedGroup and spawnedGroup:IsAlive() then
|
|
||||||
env.info("Test complete - cleaning up spawned aircraft")
|
|
||||||
spawnedGroup:Destroy()
|
|
||||||
end
|
|
||||||
end, {}, 600) -- 10 minutes
|
|
||||||
|
|
||||||
else
|
|
||||||
env.info("⚠ Could not get aircraft coordinate")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("⚠ Aircraft not alive for task assignment")
|
|
||||||
end
|
|
||||||
end, {}, 5) -- 5 second delay
|
|
||||||
|
|
||||||
else
|
|
||||||
env.info("✗ CRITICAL: All spawn methods failed!")
|
|
||||||
env.info("DIAGNOSIS: There may be an issue with the template or MOOSE setup")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not success then
|
|
||||||
env.info("✗ CRITICAL ERROR in manual launch: " .. tostring(errorMsg))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Attempt the manual launch
|
|
||||||
manualLaunch(testConfig)
|
|
||||||
|
|
||||||
end, {}, 5) -- Wait 5 seconds for MOOSE initialization
|
|
||||||
|
|
||||||
env.info("Manual launch test scheduled - check log in 5 seconds")
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
-- TADC Verification Script
|
|
||||||
-- This script provides a simple way to verify that all TADC components are properly configured
|
|
||||||
-- Run this in DCS to check for missing functions, configuration errors, etc.
|
|
||||||
|
|
||||||
-- Verification function to check if all required elements exist
|
|
||||||
local function verifyTADC()
|
|
||||||
local errors = {}
|
|
||||||
local warnings = {}
|
|
||||||
|
|
||||||
-- Check if GCI_Config exists and has required values
|
|
||||||
if not GCI_Config then
|
|
||||||
table.insert(errors, "GCI_Config not found")
|
|
||||||
else
|
|
||||||
local requiredConfig = {
|
|
||||||
"threatRatio", "maxSimultaneousCAP", "useEWRDetection", "ewrDetectionRadius",
|
|
||||||
"mainLoopInterval", "mainLoopDelay", "squadronCooldown", "supplyMode",
|
|
||||||
"defaultSquadronSize", "reservePercent", "responseDelay", "capSetupDelay",
|
|
||||||
"capOrbitRadius", "capEngagementRange", "capZoneConstraint",
|
|
||||||
"statusReportInterval", "engagementUpdateInterval", "fighterVsFighter",
|
|
||||||
"fighterVsBomber", "fighterVsHelicopter", "threatTimeout", "debugLevel"
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, configKey in pairs(requiredConfig) do
|
|
||||||
if GCI_Config[configKey] == nil then
|
|
||||||
table.insert(errors, "Missing config: GCI_Config." .. configKey)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if TADC data structure exists
|
|
||||||
if not TADC then
|
|
||||||
table.insert(errors, "TADC data structure not found")
|
|
||||||
else
|
|
||||||
local requiredTADC = {"squadrons", "activeCAPs", "threats", "missions"}
|
|
||||||
for _, key in pairs(requiredTADC) do
|
|
||||||
if TADC[key] == nil then
|
|
||||||
table.insert(errors, "Missing TADC." .. key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if zones exist
|
|
||||||
if not CCCPBorderZone then
|
|
||||||
table.insert(errors, "CCCPBorderZone not found")
|
|
||||||
end
|
|
||||||
if not HeloBorderZone then
|
|
||||||
table.insert(errors, "HeloBorderZone not found")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if main functions exist
|
|
||||||
local requiredFunctions = {
|
|
||||||
"TADC_Log", "validateConfiguration", "mainTADCLoop", "simpleDetectThreats",
|
|
||||||
"launchCAP", "launchInterceptMission", "maintainPersistentCAP"
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, funcName in pairs(requiredFunctions) do
|
|
||||||
if not _G[funcName] then
|
|
||||||
table.insert(errors, "Missing function: " .. funcName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Count squadrons
|
|
||||||
local squadronCount = 0
|
|
||||||
if TADC and TADC.squadrons then
|
|
||||||
for _ in pairs(TADC.squadrons) do
|
|
||||||
squadronCount = squadronCount + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Print results
|
|
||||||
env.info("=== TADC VERIFICATION RESULTS ===")
|
|
||||||
|
|
||||||
if #errors > 0 then
|
|
||||||
env.error("VERIFICATION FAILED - " .. #errors .. " errors found:")
|
|
||||||
for _, error in pairs(errors) do
|
|
||||||
env.error(" ❌ " .. error)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
env.info("✅ All critical components verified successfully!")
|
|
||||||
end
|
|
||||||
|
|
||||||
if #warnings > 0 then
|
|
||||||
env.warning("Warnings found:")
|
|
||||||
for _, warning in pairs(warnings) do
|
|
||||||
env.warning(" ⚠️ " .. warning)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
env.info("📊 Squadron count: " .. squadronCount)
|
|
||||||
env.info("📊 Config debug level: " .. (GCI_Config and GCI_Config.debugLevel or "N/A"))
|
|
||||||
env.info("=== VERIFICATION COMPLETE ===")
|
|
||||||
|
|
||||||
return #errors == 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Run verification after a short delay to ensure everything is loaded
|
|
||||||
SCHEDULER:New(nil, function()
|
|
||||||
env.info("Starting TADC verification...")
|
|
||||||
verifyTADC()
|
|
||||||
end, {}, 10)
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
-- Add this at the very beginning after MOOSE loads
|
|
||||||
env.info("=== MOOSE DEBUG INFO ===")
|
|
||||||
env.info("MOOSE loaded: " .. tostring(MOOSE ~= nil))
|
|
||||||
env.info("OPS available: " .. tostring(OPS ~= nil))
|
|
||||||
env.info("_G.OPS available: " .. tostring(_G.OPS ~= nil))
|
|
||||||
|
|
||||||
-- Check what's in the global namespace
|
|
||||||
for k,v in pairs(_G) do
|
|
||||||
if string.find(k, "OPS") then
|
|
||||||
env.info("Found OPS-related: " .. k .. " = " .. tostring(v))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Debug airbase availability
|
|
||||||
env.info("=== AIRBASE DEBUG ===")
|
|
||||||
env.info("AIRBASE table exists: " .. tostring(AIRBASE ~= nil))
|
|
||||||
|
|
||||||
if AIRBASE then
|
|
||||||
env.info("AIRBASE.Kola exists: " .. tostring(AIRBASE.Kola ~= nil))
|
|
||||||
|
|
||||||
-- List all airbases found on the map
|
|
||||||
env.info("=== ALL AIRBASES ON MAP ===")
|
|
||||||
|
|
||||||
-- Method 1: Try using SET_AIRBASE to get all airbases
|
|
||||||
if SET_AIRBASE then
|
|
||||||
env.info("Using SET_AIRBASE method...")
|
|
||||||
local airbaseSet = SET_AIRBASE:New():FilterOnce()
|
|
||||||
if airbaseSet then
|
|
||||||
local count = airbaseSet:Count()
|
|
||||||
env.info("Total airbases found: " .. count)
|
|
||||||
airbaseSet:ForEach(function(airbase)
|
|
||||||
if airbase then
|
|
||||||
local name = airbase:GetName()
|
|
||||||
local coalition = airbase:GetCoalition()
|
|
||||||
local coalitionName = "Unknown"
|
|
||||||
if coalition == 0 then coalitionName = "Neutral"
|
|
||||||
elseif coalition == 1 then coalitionName = "Red"
|
|
||||||
elseif coalition == 2 then coalitionName = "Blue"
|
|
||||||
end
|
|
||||||
env.info("Airbase: '" .. name .. "' (" .. coalitionName .. ")")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Method 2: Try specific airbase names we expect
|
|
||||||
env.info("=== TESTING SPECIFIC AIRBASES ===")
|
|
||||||
local testNames = {
|
|
||||||
"Severomorsk-1", "Severomorsk-3", "Kilpyavr", "Murmansk",
|
|
||||||
"Monchegorsk", "Olenya", "Afrikanda"
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, name in pairs(testNames) do
|
|
||||||
local airbase = AIRBASE:FindByName(name)
|
|
||||||
env.info(name .. ": " .. tostring(airbase ~= nil))
|
|
||||||
if airbase then
|
|
||||||
env.info(" - Coalition: " .. airbase:GetCoalition())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Alternative method - check AIRBASE.Kola if it exists
|
|
||||||
if AIRBASE.Kola then
|
|
||||||
env.info("=== AIRBASE.Kola CONSTANTS ===")
|
|
||||||
for k,v in pairs(AIRBASE.Kola) do
|
|
||||||
env.info("AIRBASE.Kola." .. k .. " = " .. tostring(v))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
x
Reference in New Issue
Block a user