walder/Skynet-IADS

Autonomous States doesn't work properly with command centers

fnslayeroc opened this issue · 2 comments

Autonomous states do not work right with command centers, they will turn off and go live when you get into range instead of staying off

To add to this, I tested several things and I think I've narrowed down the issue to Autonomous States don't update while a system is ON.

During testing of both Command Centers and Power to Command Centers, it appears that if I blow up the CC or Power to the CC without turning a SAM on, the autonomous state updates correctly and the SAM remains off. However, if you activate the SAM site, without being shot at, and then blow up the SAM site, it will NEVER turn off even if commanded to go dark at the loss of a CC.

In the test mission, I have:

  • A single SA-10 which is set to go DARK
  • A single SA-15 which is set to DCS Default
  • A 55G6 EWR set to act as an EWR (duh :P)
  • A command center
  • A power unit.

The SA-15 is set to act as point defense for the SA-10 (not that it matters). The SA-10, SA-15, and 55G6 are set to have a ConnectionNode to the command center. The Power Unit is connected to both the 55G6 AND the Command Center.

In testing:

  • If you blow up the Power OR Command Center while the SA-10 is ON, it never shuts off. (Incorrect Behavior)
  • If you blow up the Power OR Command Center while the SA-10 is OFF, it never turns on. (Correct Behavior)

Here is the relevant IADS LUA.

do
--REDFOR 
	--Basic Stuff
		redIADS = SkynetIADS:create('Enemy IADS')
		redIADS:addSAMSitesByPrefix('RSAM')
		redIADS:addEarlyWarningRadarsByPrefix('REW')
		redIADS:addRadioMenu()
		
	--Command Centers
		local EWPow1 = Unit.getByName('RPOW-1')
		local EastCommandCenter = StaticObject.getByName("Command Center")
		redIADS:addCommandCenter(EastCommandCenter):addPowerSource(EWPow1)
		--redIADS:addCommandCenter(StaticObject.getByName("Not Command Center"))
	
	--IADS Groups
		--Start Conditions
		--Group 1
			--EWR
				redIADS:getEarlyWarningRadarByUnitName("REW-1"):addPowerSource(EWPow1):addConnectionNode(EastCommandCenter)	

				--redIADS:addEarlyWarningRadar('RAWACS-1'):addConnectionNode(EastCommandCenter)
			
			--SA-2
				redIADS:getSAMSiteByGroupName('RSAM-SA-2-1'):addConnectionNode(EastCommandCenter):setAutonomousBehaviour(SkynetIADSAbstractRadarElement.AUTONOMOUS_STATE_DARK)
				local PDSA15 = redIADS:getSAMSiteByGroupName('RSAM-SA-15-PD-1')
				redIADS:getSAMSiteByGroupName('RSAM-SA-2-1'):addPointDefence(PDSA15)
				
			--Second SAM Type
			
		--Group 2	
			--EWR
			--First SAM Type
			--Second SAM Type
			
redIADS:activate()

The intended behavior is the SA-10 goes dark regardless of whether it was ON or OFF at the time of CC/Power destruction.

I have performed the same testing with simple mission, included:
SA-5 site (IADS)
Command Center (IADS)
EWR (IADS)

One very different thing - I destroyed CC by friendly fire from F-18C, so, no contacts were displayed in debug.

  • CC counted as destructed - good.
  • Active CC is zero - good.
  • For some reason EWR site didn't go down as it was intended by script - bad.
  • SA-5 site went dark as intended - good.

Below the script I've used for the mission. Quite simple.

do

redIADS = SkynetIADS:create('IADS')

local iadsDebug = redIADS:getDebugSettings()
iadsDebug.IADSStatus = true
iadsDebug.radarWentDark = true
iadsDebug.contacts = true
iadsDebug.radarWentLive = true
iadsDebug.noWorkingCommmandCenter = true
iadsDebug.samNoConnection = true
iadsDebug.jammerProbability = true
iadsDebug.addedEWRadar = true
iadsDebug.harmDefence = true

redIADS:addEarlyWarningRadarsByPrefix('EWR')

redIADS:addSAMSitesByPrefix('SAM')

local commandCenter = StaticObject.getByName('Command_Center')
redIADS:addCommandCenter(commandCenter)

redIADS:getEarlyWarningRadarByUnitName('EWR_Test'):setAutonomousBehaviour(SkynetIADSAbstractRadarElement.AUTONOMOUS_STATE_DARK)

redIADS:getSAMSiteByGroupName('SAM_Test_site'):setAutonomousBehaviour(SkynetIADSAbstractRadarElement.AUTONOMOUS_STATE_DARK):setHARMDetectionChance(30):setGoLiveRangeInPercent(85)



redIADS:activate()

end

Earlier testing included power sources connected to CC - same behaviour, EWRs didn't go dark when CC is not powered.
HOWEVER, that worked good when EWR were connected to the nodes - EWRs went dark as it was coded after node destruction.