mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
Bug fixes
This commit is contained in:
parent
53f810a6b5
commit
c480895b76
Binary file not shown.
@ -256,6 +256,24 @@ function blue_ctld:OnAfterTroopsDeployed(From,Event,To,Group,Unit,Troops)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- FARP Radio. First one has 130AM name London, next 131 name Dallas, and so forth.
|
||||||
|
local BlueFARPFreq = 129
|
||||||
|
local BlueFARPName = 1 --numbers 1..10
|
||||||
|
|
||||||
|
local BlueFARPClearnames = {
|
||||||
|
[1]="London",
|
||||||
|
[2]="Dallas",
|
||||||
|
[3]="Paris",
|
||||||
|
[4]="Moscow",
|
||||||
|
[5]="Berlin",
|
||||||
|
[6]="Rome",
|
||||||
|
[7]="Madrid",
|
||||||
|
[8]="Warsaw",
|
||||||
|
[9]="Dublin",
|
||||||
|
[10]="Perth",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function blue_ctld:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
function blue_ctld:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||||
if Unit then
|
if Unit then
|
||||||
@ -278,15 +296,24 @@ function blue_ctld:OnAfterTroopsDeployed(From,Event,To,Group,Unit,Troops)
|
|||||||
local Coord = Vehicle:GetCoordinate():GetVec2()
|
local Coord = Vehicle:GetCoordinate():GetVec2()
|
||||||
local mCoord = Vehicle:GetCoordinate()
|
local mCoord = Vehicle:GetCoordinate()
|
||||||
local zonename = "FOB-" .. math.random(1,10000)
|
local zonename = "FOB-" .. math.random(1,10000)
|
||||||
local fobzone = ZONE_RADIUS:New(zonename,Coord,1000)
|
local fobzone = ZONE_RADIUS:New(zonename,Coord,500)
|
||||||
local fobmarker = MARKER:New(mCoord, "FORWARD OPERATING BASE:\nBUILT BY: " .. PlayerName .. "\n\nTransport Helos may pick up troops and equipment from this location."):ReadOnly():ToCoalition(coalition.side.BLUE)
|
local fobmarker = MARKER:New(mCoord, "FORWARD OPERATING BASE:\nBUILT BY: " .. PlayerName .. "\n\nTransport Helos may pick up troops and equipment from this location."):ReadOnly():ToCoalition(coalition.side.BLUE)
|
||||||
fobzone:DrawZone(2,{.25,.63,.79},1,{0,0,0},0.25,2,true)
|
fobzone:DrawZone(2,{.25,.63,.79},1,{0,0,0},0.25,2,true)
|
||||||
blue_ctld:AddCTLDZone(zonename,CTLD.CargoZoneType.LOAD,SMOKECOLOR.Blue,true,false)
|
|
||||||
|
local FarpNameNumber = ((BlueFARPName-1)%10)+1 -- make sure 11 becomes 1 etc
|
||||||
|
local FName = BlueFARPClearnames[FarpNameNumber] -- get clear namee
|
||||||
|
|
||||||
|
BlueFARPFreq = BlueFARPFreq + 1
|
||||||
|
BlueFARPName = BlueFARPName + 1
|
||||||
|
|
||||||
|
-- Spawn a FARP with our little helper and fill it up with resources (10t fuel each type, 10 pieces of each known equipment)
|
||||||
|
UTILS.SpawnFARPAndFunctionalStatics(FName,Coord,ENUMS.FARPType.INVISIBLE,blue_ctld.coalition,country.id.USA,FarpNameNumber,BlueFARPFreq,radio.modulation.AM,nil,nil,nil,10,10)
|
||||||
|
|
||||||
|
blue_ctld:AddCTLDZone(FName,CTLD.CargoZoneType.LOAD,SMOKECOLOR.Blue,true,false)
|
||||||
MESSAGE:New("Pilot " .. PlayerName .. " has created a new loading zone for troops and equipment! See your F10 Map for marker!", msgTime, "[ Mission Info ]", false):ToBlue()
|
MESSAGE:New("Pilot " .. PlayerName .. " has created a new loading zone for troops and equipment! See your F10 Map for marker!", msgTime, "[ Mission Info ]", false):ToBlue()
|
||||||
else
|
else
|
||||||
env.info("CRATEBUILD: No! Not a FOB: " .. vname,false)
|
env.info("CRATEBUILD: No! Not a FOB: " .. vname,false)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -33,58 +33,32 @@ for _, zone in ipairs(blueZones) do
|
|||||||
table.insert(combinedZones, zone)
|
table.insert(combinedZones, zone)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a detection area using the Blue_Drone group and the combined zones
|
-- Define the drone using the MOOSE SPAWN class
|
||||||
local droneDetection = DETECTION_UNITS:New(Blue_Drone)
|
Blue_Drone = SPAWN:New("BLUE DRONE")
|
||||||
droneDetection:SetAcceptZones(combinedZones)
|
:InitLimit(1, 99)
|
||||||
droneDetection:Start()
|
:SpawnScheduled(1, 0.5)
|
||||||
|
|
||||||
-- Function to present target options to the player
|
-- Function to set the drone as a FAC after it spawns
|
||||||
local function RequestTargetOptions()
|
Blue_Drone:OnSpawnGroup(function(spawnGroup)
|
||||||
if not droneDetection then
|
local droneGroup = spawnGroup -- Reference to the spawned group
|
||||||
MESSAGE:New("Drone detection is not initialized", 10):ToAll()
|
local droneUnit = droneGroup:GetUnit(1) -- Get the first unit in the group
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local detectedTargets = droneDetection:GetDetectedSet()
|
if droneUnit then
|
||||||
if not detectedTargets or #detectedTargets == 0 then
|
-- Define a FAC task for the drone
|
||||||
MESSAGE:New("No targets detected", 10):ToAll()
|
local facTask = {
|
||||||
return
|
id = "FAC",
|
||||||
end
|
params = {
|
||||||
MESSAGE:New("Targets Detected, use menu again to select.", 10):ToAll()
|
callsign = 1, -- Arbitrary callsign (e.g., "Enfield")
|
||||||
local targetMenu = MENU_COALITION:New(coalition.side.BLUE, "Select Target", nil)
|
frequency = 255.0, -- Frequency for communication
|
||||||
|
}
|
||||||
for i, target in ipairs(detectedTargets) do
|
}
|
||||||
local targetName = target:GetName()
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, targetName, targetMenu, function()
|
|
||||||
PresentActionOptions(target)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Function to present action options for a selected target
|
-- Set the FAC task to the drone
|
||||||
local function PresentActionOptions(target)
|
droneUnit:SetTask(facTask)
|
||||||
local actionMenu = MENU_COALITION:New(coalition.side.BLUE, "Select Action for " .. target:GetName(), nil)
|
|
||||||
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Smoke (Red)", actionMenu, function()
|
|
||||||
target:SmokeTarget(SMOKECOLOR.Red)
|
|
||||||
end)
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Smoke (Green)", actionMenu, function()
|
|
||||||
target:SmokeTarget(SMOKECOLOR.Green)
|
|
||||||
end)
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Lase (Code 1688)", actionMenu, function()
|
|
||||||
target:LaseTarget(1688)
|
|
||||||
end)
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Flare (Red)", actionMenu, function()
|
|
||||||
target:FlareTarget(FLARECOLOR.Red)
|
|
||||||
end)
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Flare (Green)", actionMenu, function()
|
|
||||||
target:FlareTarget(FLARECOLOR.Green)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create the main mission menu
|
env.info("Blue Drone is now a FAC and ready to designate targets.")
|
||||||
missionMenu = MENU_MISSION:New("Mission Menu")
|
else
|
||||||
|
env.info("No valid unit found in Blue Drone group.")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- Create the Drone Menu for the player to interact with the drone
|
|
||||||
local DroneMenu = MENU_COALITION:New(coalition.side.BLUE, "Drone Ops", missionMenu)
|
|
||||||
MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Request Target Options", DroneMenu, RequestTargetOptions)
|
|
||||||
@ -295,14 +295,14 @@ function ZONE_CAPTURE_COALITION:OnEnterCaptured(From, Event, To)
|
|||||||
self:Smoke(SMOKECOLOR.Blue)
|
self:Smoke(SMOKECOLOR.Blue)
|
||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {0, 0, 1}, 2) -- Draw the zone on the map for 30 seconds, blue color, and thickness 2
|
self:DrawZone(-1, {0, 0, 1}, 2) -- Draw the zone on the map for 30 seconds, blue color, and thickness 2
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s has been captured by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s has been captured by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s has been captured by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s has been captured by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
else
|
else
|
||||||
self:Smoke(SMOKECOLOR.Red)
|
self:Smoke(SMOKECOLOR.Red)
|
||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {1, 0, 0}, 2) -- Draw the zone on the map for 30 seconds, red color, and thickness 2
|
self:DrawZone(-1, {1, 0, 0}, 2) -- Draw the zone on the map for 30 seconds, red color, and thickness 2
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s has been captured by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s has been captured by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s has been captured by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s has been captured by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -321,8 +321,8 @@ function ZONE_CAPTURE_COALITION:OnEnterGuarded(From, Event, To)
|
|||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {0, 0, 0.5}, 2) -- Draw the zone on the map for 30 seconds, dark blue color, and thickness 2
|
self:DrawZone(-1, {0, 0, 0.5}, 2) -- Draw the zone on the map for 30 seconds, dark blue color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is under protection of the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is under protection of the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is under protection of the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is under protection of the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:Smoke(SMOKECOLOR.Red)
|
self:Smoke(SMOKECOLOR.Red)
|
||||||
@ -330,8 +330,8 @@ function ZONE_CAPTURE_COALITION:OnEnterGuarded(From, Event, To)
|
|||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {0.5, 0, 0}, 2) -- Draw the zone on the map for 30 seconds, dark red color, and thickness 2
|
self:DrawZone(-1, {0.5, 0, 0}, 2) -- Draw the zone on the map for 30 seconds, dark red color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is under protection of Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is under protection of Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is under protection of Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is under protection of Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -348,8 +348,8 @@ function ZONE_CAPTURE_COALITION:OnEnterEmpty(From, Event, To)
|
|||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {0, 1, 0}, 2) -- Draw the zone on the map for 30 seconds, green color, and thickness 2
|
self:DrawZone(-1, {0, 1, 0}, 2) -- Draw the zone on the map for 30 seconds, green color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is now empty", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is now empty", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is now empty", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is now empty", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -368,16 +368,16 @@ function ZONE_CAPTURE_COALITION:OnEnterAttacked(From, Event, To)
|
|||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {1, 0.5, 0}, 2) -- Draw the zone on the map for 30 seconds, orange color, and thickness 2
|
self:DrawZone(-1, {1, 0.5, 0}, 2) -- Draw the zone on the map for 30 seconds, orange color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is under attack by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is under attack by Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is attacking the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is attacking the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:Smoke(SMOKECOLOR.Red)
|
self:Smoke(SMOKECOLOR.Red)
|
||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {1, 0.5, 0}, 2) -- Draw the zone on the map for 30 seconds, orange color, and thickness 2
|
self:DrawZone(-1, {1, 0.5, 0}, 2) -- Draw the zone on the map for 30 seconds, orange color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is under attack by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is under attack by the USA", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is attacking Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is attacking Russia", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -394,8 +394,8 @@ function ZONE_CAPTURE_COALITION:OnEnterNeutral(From, Event, To)
|
|||||||
self:UndrawZone()
|
self:UndrawZone()
|
||||||
self:DrawZone(-1, {0, 1, 0}, 2) -- Draw the zone on the map for 30 seconds, green color, and thickness 2
|
self:DrawZone(-1, {0, 1, 0}, 2) -- Draw the zone on the map for 30 seconds, green color, and thickness 2
|
||||||
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
if ENABLE_CAPTURE_ZONE_MESSAGES then
|
||||||
US_CC:MessageTypeToCoalition(string.format("%s is now neutral", self:GetZoneName()), MESSAGE.Type.Information)
|
--US_CC:MessageTypeToCoalition(string.format("%s is now neutral", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
RU_CC:MessageTypeToCoalition(string.format("%s is now neutral", self:GetZoneName()), MESSAGE.Type.Information)
|
--RU_CC:MessageTypeToCoalition(string.format("%s is now neutral", self:GetZoneName()), MESSAGE.Type.Information)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,6 +7,9 @@ local RedDefaultCAP = 2
|
|||||||
local BlueA2ADefaultOverhead = 1.5
|
local BlueA2ADefaultOverhead = 1.5
|
||||||
local BlueDefaultCAP = 2
|
local BlueDefaultCAP = 2
|
||||||
|
|
||||||
|
-- Create the main mission menu.
|
||||||
|
missionMenu = MENU_MISSION:New("Mission Menu")
|
||||||
|
|
||||||
--Build Command Center and Mission for Blue
|
--Build Command Center and Mission for Blue
|
||||||
US_CC = COMMANDCENTER:New( GROUP:FindByName( "BLUEHQ" ), "USA HQ" )
|
US_CC = COMMANDCENTER:New( GROUP:FindByName( "BLUEHQ" ), "USA HQ" )
|
||||||
US_Mission = MISSION:New( US_CC, "Insurgent Sandstorm", "Primary", "Clear the front lines of enemy activity.", coalition.side.BLUE)
|
US_Mission = MISSION:New( US_CC, "Insurgent Sandstorm", "Primary", "Clear the front lines of enemy activity.", coalition.side.BLUE)
|
||||||
@ -137,7 +140,8 @@ AI_A2A_GCICAP:New(EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, Grouping
|
|||||||
-- Setup Air Dispatchers for RED and BLUE
|
-- Setup Air Dispatchers for RED and BLUE
|
||||||
BLUEBorderZone = ZONE_POLYGON:New( "BLUE BORDER", GROUP:FindByName( "BLUE BORDER" ) )
|
BLUEBorderZone = ZONE_POLYGON:New( "BLUE BORDER", GROUP:FindByName( "BLUE BORDER" ) )
|
||||||
BLUEA2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "BLUE EWR" }, { "FIGHTER SWEEP BLUE" }, 'BLUE BORDER', 'BLUE BORDER', BlueDefaultCAP, 10000, 50000, 75000, 100)
|
BLUEA2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "BLUE EWR" }, { "FIGHTER SWEEP BLUE" }, 'BLUE BORDER', 'BLUE BORDER', BlueDefaultCAP, 10000, 50000, 75000, 100)
|
||||||
BLUEA2ADispatcher:SetDefaultLandingAtEngineShutdown()
|
BLUEA2ADispatcher:SetDefaultLandingAtRunway()
|
||||||
|
BLUEA2ADispatcher:SetDefaultTakeoffInAir()
|
||||||
BLUEA2ADispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
BLUEA2ADispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
||||||
BLUEA2ADispatcher:SetDefaultFuelThreshold( 0.20 )
|
BLUEA2ADispatcher:SetDefaultFuelThreshold( 0.20 )
|
||||||
BLUEA2ADispatcher:SetRefreshTimeInterval( 300 )
|
BLUEA2ADispatcher:SetRefreshTimeInterval( 300 )
|
||||||
@ -148,7 +152,8 @@ BLUEA2ADispatcher:SetGciRadius( 75000 )
|
|||||||
|
|
||||||
CCCPBorderZone = ZONE_POLYGON:New( "RED BORDER", GROUP:FindByName( "RED BORDER" ) )
|
CCCPBorderZone = ZONE_POLYGON:New( "RED BORDER", GROUP:FindByName( "RED BORDER" ) )
|
||||||
RedA2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "FIGHTER SWEEP RED" }, "RED BORDER", "RED BORDER", RedDefaultCAP, 10000, 50000, 75000, 100)
|
RedA2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "FIGHTER SWEEP RED" }, "RED BORDER", "RED BORDER", RedDefaultCAP, 10000, 50000, 75000, 100)
|
||||||
RedA2ADispatcher:SetDefaultLandingAtEngineShutdown()
|
RedA2ADispatcher:SetDefaultLandingAtRunway()
|
||||||
|
RedA2ADispatcher:SetDefaultTakeoffInAir()
|
||||||
RedA2ADispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
RedA2ADispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
||||||
RedA2ADispatcher:SetDefaultFuelThreshold( 0.20 )
|
RedA2ADispatcher:SetDefaultFuelThreshold( 0.20 )
|
||||||
RedA2ADispatcher:SetRefreshTimeInterval( 300 )
|
RedA2ADispatcher:SetRefreshTimeInterval( 300 )
|
||||||
@ -160,8 +165,9 @@ RedA2ADispatcher:SetGciRadius( 75000 )
|
|||||||
|
|
||||||
|
|
||||||
DwyerBorderZone = ZONE_POLYGON:New( "DwyerBorderZone", GROUP:FindByName( "DwyerBorderZone" ) )
|
DwyerBorderZone = ZONE_POLYGON:New( "DwyerBorderZone", GROUP:FindByName( "DwyerBorderZone" ) )
|
||||||
DwyerDispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "DwyerBorderCAP" }, "DwyerBorderZone", "DwyerBorderZone", RedDefaultCAP, 10000, 50000, 75000, 100)
|
DwyerDispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "DwyerBorderCAP" }, "DwyerBorderZone", "DwyerBorderZone", RedDefaultCAP, 10000, 50000, 75000, 100)
|
||||||
DwyerDispatcher:SetDefaultLandingAtEngineShutdown()
|
DwyerDispatcher:SetDefaultLandingAtRunway()
|
||||||
|
DwyerDispatcher:SetDefaultTakeoffInAir()
|
||||||
DwyerDispatcher:SetBorderZone( DwyerBorderZone )
|
DwyerDispatcher:SetBorderZone( DwyerBorderZone )
|
||||||
DwyerDispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
DwyerDispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
||||||
DwyerDispatcher:SetDefaultFuelThreshold( 0.20 )
|
DwyerDispatcher:SetDefaultFuelThreshold( 0.20 )
|
||||||
@ -174,7 +180,8 @@ DwyerDispatcher:SetGciRadius( 75000 )
|
|||||||
|
|
||||||
BostZone = ZONE_POLYGON:New( "BostBorderZone", GROUP:FindByName( "BostBorderZone" ) )
|
BostZone = ZONE_POLYGON:New( "BostBorderZone", GROUP:FindByName( "BostBorderZone" ) )
|
||||||
BostDispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "BostBorderCAP" }, "BostBorderZone", "BostBorderZone", RedDefaultCAP, 10000, 50000, 75000, 100)
|
BostDispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "BostBorderCAP" }, "BostBorderZone", "BostBorderZone", RedDefaultCAP, 10000, 50000, 75000, 100)
|
||||||
BostDispatcher:SetDefaultLandingAtEngineShutdown()
|
BostDispatcher:SetDefaultLandingAtRunway()
|
||||||
|
BostDispatcher:SetDefaultTakeoffInAir()
|
||||||
BostDispatcher:SetBorderZone(BostZone)
|
BostDispatcher:SetBorderZone(BostZone)
|
||||||
BostDispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
BostDispatcher:SetTacticalDisplay(TAC_DISPLAY)
|
||||||
BostDispatcher:SetDefaultFuelThreshold( 0.20 )
|
BostDispatcher:SetDefaultFuelThreshold( 0.20 )
|
||||||
@ -185,12 +192,10 @@ BostDispatcher:SetEngageRadius( 50000 )
|
|||||||
BostDispatcher:SetGciRadius( 75000 )
|
BostDispatcher:SetGciRadius( 75000 )
|
||||||
|
|
||||||
-- There are 12 units in this group. Need space for each one in the numbers. So if I want 4 SA11s i'm just rounding up to 48
|
-- There are 12 units in this group. Need space for each one in the numbers. So if I want 4 SA11s i'm just rounding up to 48
|
||||||
Blue_Drone = SPAWN:New("BLUE DRONE")
|
--Blue_Drone = SPAWN:New("BLUE DRONE")
|
||||||
:InitLimit(1, 99)
|
-- :InitLimit(1, 99)
|
||||||
:SpawnScheduled(1, 0.5)
|
-- :SpawnScheduled(1, 0.5)
|
||||||
|
|
||||||
-- Create the main mission menu.
|
|
||||||
missionMenu = MENU_MISSION:New("Mission Menu")
|
|
||||||
|
|
||||||
|
|
||||||
-- Spawn the RED Bunker Buster
|
-- Spawn the RED Bunker Buster
|
||||||
@ -198,6 +203,29 @@ Red_Bunker_Buster = SPAWN:New("BUNKER BUSTER")
|
|||||||
:InitLimit(1, 99)
|
:InitLimit(1, 99)
|
||||||
:SpawnScheduled(900, 0.5)
|
:SpawnScheduled(900, 0.5)
|
||||||
|
|
||||||
|
|
||||||
Red_Bunker_Buster2 = SPAWN:New("BUNKER BUSTER-1")
|
Red_Bunker_Buster2 = SPAWN:New("BUNKER BUSTER-1")
|
||||||
:InitLimit(1, 99)
|
:InitLimit(1, 99)
|
||||||
:SpawnScheduled(1800, 0.5)
|
:SpawnScheduled(1800, 0.5)
|
||||||
|
|
||||||
|
-- Spawn TRANSPORT truck. When it reaches it's last waypoint, despawn it and spawn a new one.
|
||||||
|
Blue_Transport = SPAWN:New("TRANSPORT")
|
||||||
|
:InitLimit(1, 99)
|
||||||
|
:SpawnScheduled(1, 0.5)
|
||||||
|
|
||||||
|
-- When Red_Transport reaches it's last waypoint, despawn it and spawn a new one.
|
||||||
|
function Blue_Transport:OnAfterWayPoint(From, Event, To)
|
||||||
|
if To == 9 then
|
||||||
|
Blue_Transport:Destroy()
|
||||||
|
Blue_Transport:Spawn()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--CleanUpAirports = CLEANUP_AIRBASE:New( {
|
||||||
|
-- AIRBASE.Afghanistan.Kandahar,
|
||||||
|
-- AIRBASE.Afghanistan.Camp_Bastion
|
||||||
|
|
||||||
|
--})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Red AWACS
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Define the event handler class for Red AWACS
|
-- Define the event handler class for Red AWACS
|
||||||
RedAwacsEventHandler = EVENTHANDLER:New()
|
RedAwacsEventHandler = EVENTHANDLER:New()
|
||||||
|
|
||||||
@ -35,7 +39,11 @@ RedAwacsEventHandler:HandleEvent(EVENTS.Birth)
|
|||||||
RedAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
RedAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
||||||
RedAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
RedAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
||||||
|
|
||||||
-- Define the event handler class for Blue AWACS
|
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Blue AWACS
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Define the event handler class for
|
||||||
BlueAwacsEventHandler = EVENTHANDLER:New()
|
BlueAwacsEventHandler = EVENTHANDLER:New()
|
||||||
|
|
||||||
-- Handle the Birth event for Blue AWACS
|
-- Handle the Birth event for Blue AWACS
|
||||||
@ -70,4 +78,22 @@ Blue_Awacs = SPAWN:New("BLUE EWR AWACS")
|
|||||||
-- Add the event handler to the Blue AWACS group
|
-- Add the event handler to the Blue AWACS group
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Birth)
|
BlueAwacsEventHandler:HandleEvent(EVENTS.Birth)
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
BlueAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
BlueAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
||||||
|
|
||||||
|
-- function to destroy the AWACS if it's alive and then respawn it for the specified coalition.
|
||||||
|
function ResetAwacs(coalition)
|
||||||
|
if coalition == "blue" then
|
||||||
|
Blue_Awacs:Destroy()
|
||||||
|
Blue_Awacs:Spawn()
|
||||||
|
elseif coalition == "red" then
|
||||||
|
Red_Awacs:Destroy()
|
||||||
|
Red_Awacs:Spawn()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create a mission menu to reset the awacs for the specified coalition.
|
||||||
|
MenuCoalitionBlue = MENU_COALITION:New(coalition.side.BLUE, "Reset AWACS", missionMenu)
|
||||||
|
MenuCoalitionBlueAwacs = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Reset Blue AWACS", MenuCoalitionBlue, ResetAwacs, "blue")
|
||||||
|
|
||||||
|
MenuCoalitionRed = MENU_COALITION:New(coalition.side.RED, "Reset AWACS", missionMenu)
|
||||||
|
MenuCoalitionRedAwacs = MENU_COALITION_COMMAND:New(coalition.side.RED, "Reset Red AWACS", MenuCoalitionRed, ResetAwacs, "red")
|
||||||
|
|||||||
95
Moose_.lua
95
Moose_.lua
@ -1,4 +1,4 @@
|
|||||||
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-11-18T18:36:47+01:00-75e80a00913b1f49ef1140350f0a2de989939ace ***')
|
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-11-20T11:15:09+01:00-5747c49abf7b02312ca3502f2e20e9a727698f82 ***')
|
||||||
if not MOOSE_DEVELOPMENT_FOLDER then
|
if not MOOSE_DEVELOPMENT_FOLDER then
|
||||||
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
||||||
end
|
end
|
||||||
@ -105500,6 +105500,14 @@ self.drawZone=true
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
function OPSZONE:SetDrawZoneForCoalition(Switch)
|
||||||
|
if Switch==true then
|
||||||
|
self.drawZoneForCoalition=true
|
||||||
|
else
|
||||||
|
self.drawZoneForCoalition=false
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
function OPSZONE:SetMarkZone(Switch,ReadOnly)
|
function OPSZONE:SetMarkZone(Switch,ReadOnly)
|
||||||
if Switch then
|
if Switch then
|
||||||
self.markZone=true
|
self.markZone=true
|
||||||
@ -105653,7 +105661,11 @@ self.ownerCurrent=NewOwnerCoalition
|
|||||||
if self.drawZone then
|
if self.drawZone then
|
||||||
self.zone:UndrawZone()
|
self.zone:UndrawZone()
|
||||||
local color=self:_GetZoneColor()
|
local color=self:_GetZoneColor()
|
||||||
self.zone:DrawZone(nil,color,1.0,color,0.5)
|
local coalition=nil
|
||||||
|
if self.drawZoneForCoalition then
|
||||||
|
coalition=self.ownerCurrent
|
||||||
|
end
|
||||||
|
self.zone:DrawZone(coalition,color,1.0,color,0.5)
|
||||||
end
|
end
|
||||||
for _,_chief in pairs(self.chiefs)do
|
for _,_chief in pairs(self.chiefs)do
|
||||||
local chief=_chief
|
local chief=_chief
|
||||||
@ -105681,7 +105693,11 @@ self.Tattacked=nil
|
|||||||
if self.drawZone then
|
if self.drawZone then
|
||||||
self.zone:UndrawZone()
|
self.zone:UndrawZone()
|
||||||
local color=self:_GetZoneColor()
|
local color=self:_GetZoneColor()
|
||||||
self.zone:DrawZone(nil,color,1.0,color,0.5)
|
local coalition=nil
|
||||||
|
if self.drawZoneForCoalition then
|
||||||
|
coalition=self.ownerCurrent
|
||||||
|
end
|
||||||
|
self.zone:DrawZone(coalition,color,1.0,color,0.5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -105700,7 +105716,11 @@ end
|
|||||||
if self.drawZone then
|
if self.drawZone then
|
||||||
self.zone:UndrawZone()
|
self.zone:UndrawZone()
|
||||||
local color={1,204/255,204/255}
|
local color={1,204/255,204/255}
|
||||||
self.zone:DrawZone(nil,color,1.0,color,0.5)
|
local coalition=nil
|
||||||
|
if self.drawZoneForCoalition then
|
||||||
|
coalition=self.ownerCurrent
|
||||||
|
end
|
||||||
|
self.zone:DrawZone(coalition,color,1.0,color,0.5)
|
||||||
end
|
end
|
||||||
self:_CleanMissionTable()
|
self:_CleanMissionTable()
|
||||||
end
|
end
|
||||||
@ -105715,7 +105735,11 @@ end
|
|||||||
if self.drawZone then
|
if self.drawZone then
|
||||||
self.zone:UndrawZone()
|
self.zone:UndrawZone()
|
||||||
local color=self:_GetZoneColor()
|
local color=self:_GetZoneColor()
|
||||||
self.zone:DrawZone(nil,color,1.0,color,0.2)
|
local coalition=nil
|
||||||
|
if self.drawZoneForCoalition then
|
||||||
|
coalition=self.ownerCurrent
|
||||||
|
end
|
||||||
|
self.zone:DrawZone(coalition,color,1.0,color,0.2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -110452,7 +110476,7 @@ DEAD="Dead",
|
|||||||
DAMAGED="Damaged",
|
DAMAGED="Damaged",
|
||||||
}
|
}
|
||||||
_TARGETID=0
|
_TARGETID=0
|
||||||
TARGET.version="0.6.0"
|
TARGET.version="0.7.0"
|
||||||
function TARGET:New(TargetObject)
|
function TARGET:New(TargetObject)
|
||||||
local self=BASE:Inherit(self,FSM:New())
|
local self=BASE:Inherit(self,FSM:New())
|
||||||
_TARGETID=_TARGETID+1
|
_TARGETID=_TARGETID+1
|
||||||
@ -110474,7 +110498,7 @@ self:AddTransition("*","ObjectDead","*")
|
|||||||
self:AddTransition("*","Damaged","Damaged")
|
self:AddTransition("*","Damaged","Damaged")
|
||||||
self:AddTransition("*","Destroyed","Dead")
|
self:AddTransition("*","Destroyed","Dead")
|
||||||
self:AddTransition("*","Dead","Dead")
|
self:AddTransition("*","Dead","Dead")
|
||||||
self:__Start(-1)
|
self:__Start(-0.1)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
function TARGET:AddObject(Object)
|
function TARGET:AddObject(Object)
|
||||||
@ -110581,6 +110605,11 @@ function TARGET:IsAlive()
|
|||||||
for _,_target in pairs(self.targets)do
|
for _,_target in pairs(self.targets)do
|
||||||
local target=_target
|
local target=_target
|
||||||
if target.Status~=TARGET.ObjectStatus.DEAD then
|
if target.Status~=TARGET.ObjectStatus.DEAD then
|
||||||
|
if self.isDestroyed then
|
||||||
|
self:E(self.lid..string.format("ERROR: target is DESTROYED but target object status is not DEAD but %s for object %s",target.Status,target.Name))
|
||||||
|
elseif self:IsDead()then
|
||||||
|
self:E(self.lid..string.format("ERROR: target is DEAD but target object status is not DEAD but %s for object %s",target.Status,target.Name))
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -110593,6 +110622,14 @@ function TARGET:IsDead()
|
|||||||
local is=self:Is("Dead")
|
local is=self:Is("Dead")
|
||||||
return is
|
return is
|
||||||
end
|
end
|
||||||
|
function TARGET:IsTargetDead(TargetObject)
|
||||||
|
local isDead=TargetObject.Status==TARGET.ObjectStatus.DEAD
|
||||||
|
return isDead
|
||||||
|
end
|
||||||
|
function TARGET:IsTargetAlive(TargetObject)
|
||||||
|
local isAlive=TargetObject.Status==TARGET.ObjectStatus.ALIVE
|
||||||
|
return isAlive
|
||||||
|
end
|
||||||
function TARGET:onafterStart(From,Event,To)
|
function TARGET:onafterStart(From,Event,To)
|
||||||
self:T({From,Event,To})
|
self:T({From,Event,To})
|
||||||
local text=string.format("Starting Target")
|
local text=string.format("Starting Target")
|
||||||
@ -110604,7 +110641,6 @@ self:__Status(-1)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
function TARGET:onafterStatus(From,Event,To)
|
function TARGET:onafterStatus(From,Event,To)
|
||||||
self:T({From,Event,To})
|
|
||||||
local fsmstate=self:GetState()
|
local fsmstate=self:GetState()
|
||||||
local damaged=false
|
local damaged=false
|
||||||
for i,_target in pairs(self.targets)do
|
for i,_target in pairs(self.targets)do
|
||||||
@ -110618,11 +110654,10 @@ life=target.Life0
|
|||||||
self.life0=self.life0+delta
|
self.life0=self.life0+delta
|
||||||
end
|
end
|
||||||
if target.Life<life then
|
if target.Life<life then
|
||||||
target.Status=TARGET.ObjectStatus.DAMAGED
|
|
||||||
self:ObjectDamaged(target)
|
self:ObjectDamaged(target)
|
||||||
damaged=true
|
damaged=true
|
||||||
end
|
end
|
||||||
if life<1 and(not target.Status==TARGET.ObjectStatus.DEAD)then
|
if target.Life<1 and target.Status~=TARGET.ObjectStatus.DEAD then
|
||||||
self:E(self.lid..string.format("FF life is zero but no object dead event fired ==> object dead now for target object %s!",tostring(target.Name)))
|
self:E(self.lid..string.format("FF life is zero but no object dead event fired ==> object dead now for target object %s!",tostring(target.Name)))
|
||||||
self:ObjectDead(target)
|
self:ObjectDead(target)
|
||||||
damaged=true
|
damaged=true
|
||||||
@ -110632,11 +110667,12 @@ if damaged then
|
|||||||
self:Damaged()
|
self:Damaged()
|
||||||
end
|
end
|
||||||
if self.verbose>=1 then
|
if self.verbose>=1 then
|
||||||
local text=string.format("%s: Targets=%d/%d Life=%.1f/%.1f Damage=%.1f",fsmstate,self:CountTargets(),self.N0,self:GetLife(),self:GetLife0(),self:GetDamage())
|
local text=string.format("%s: Targets=%d/%d [%d, %d], Life=%.1f/%.1f, Damage=%.1f",
|
||||||
|
fsmstate,self:CountTargets(),self.N0,self.Ndestroyed,self.Ndead,self:GetLife(),self:GetLife0(),self:GetDamage())
|
||||||
if self:CountTargets()==0 or self:GetDamage()>=100 then
|
if self:CountTargets()==0 or self:GetDamage()>=100 then
|
||||||
text=text.." Dead!"
|
text=text.." - Dead!"
|
||||||
elseif damaged then
|
elseif damaged then
|
||||||
text=text.." Damaged!"
|
text=text.." - Damaged!"
|
||||||
end
|
end
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
end
|
end
|
||||||
@ -110645,15 +110681,27 @@ local text="Target:"
|
|||||||
for i,_target in pairs(self.targets)do
|
for i,_target in pairs(self.targets)do
|
||||||
local target=_target
|
local target=_target
|
||||||
local damage=(1-target.Life/target.Life0)*100
|
local damage=(1-target.Life/target.Life0)*100
|
||||||
text=text..string.format("\n[%d] %s %s %s: Life=%.1f/%.1f, Damage=%.1f",i,target.Type,target.Name,target.Status,target.Life,target.Life0,damage)
|
text=text..string.format("\n[%d] %s %s %s: Life=%.1f/%.1f, Damage=%.1f, N0=%d, Ndestroyed=%d, Ndead=%d",
|
||||||
|
i,target.Type,target.Name,target.Status,target.Life,target.Life0,damage,target.N0,target.Ndestroyed,target.Ndead)
|
||||||
end
|
end
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
end
|
end
|
||||||
if self:CountTargets()==0 or self:GetDamage()>=100 then
|
if self:IsAlive()and(self:CountTargets()==0 or self:GetDamage()>=100)then
|
||||||
self:Dead()
|
self:Dead()
|
||||||
end
|
end
|
||||||
|
for i,_target in pairs(self.targets)do
|
||||||
|
local target=_target
|
||||||
|
if target.Ndestroyed>target.N0 then
|
||||||
|
self:E(self.lid..string.format("ERROR: Number of destroyed target objects greater than number of initial target objects: %d>%d!",target.Ndestroyed,target.N0))
|
||||||
|
end
|
||||||
|
if target.Ndestroyed>target.N0 then
|
||||||
|
self:E(self.lid..string.format("ERROR: Number of dead target objects greater than number of initial target objects: %d>%d!",target.Ndead,target.N0))
|
||||||
|
end
|
||||||
|
end
|
||||||
if self:IsAlive()then
|
if self:IsAlive()then
|
||||||
self:__Status(-self.TStatus)
|
self:__Status(-self.TStatus)
|
||||||
|
else
|
||||||
|
self:I(self.lid..string.format("Target is not alive any more ==> no further status updates are carried out"))
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -110666,6 +110714,8 @@ function TARGET:onafterObjectDestroyed(From,Event,To,Target)
|
|||||||
self:T({From,Event,To})
|
self:T({From,Event,To})
|
||||||
self:T(self.lid..string.format("Object %s destroyed",Target.Name))
|
self:T(self.lid..string.format("Object %s destroyed",Target.Name))
|
||||||
self.Ndestroyed=self.Ndestroyed+1
|
self.Ndestroyed=self.Ndestroyed+1
|
||||||
|
Target.Ndestroyed=Target.Ndestroyed+1
|
||||||
|
Target.Life=0
|
||||||
self:ObjectDead(Target)
|
self:ObjectDead(Target)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -110673,12 +110723,15 @@ function TARGET:onafterObjectDead(From,Event,To,Target)
|
|||||||
self:T({From,Event,To})
|
self:T({From,Event,To})
|
||||||
self:T(self.lid..string.format("Object %s dead",Target.Name))
|
self:T(self.lid..string.format("Object %s dead",Target.Name))
|
||||||
Target.Status=TARGET.ObjectStatus.DEAD
|
Target.Status=TARGET.ObjectStatus.DEAD
|
||||||
|
Target.Ndead=Target.Ndead+1
|
||||||
|
Target.Life=0
|
||||||
self.Ndead=self.Ndead+1
|
self.Ndead=self.Ndead+1
|
||||||
local dead=true
|
local dead=true
|
||||||
for _,_target in pairs(self.targets)do
|
for _,_target in pairs(self.targets)do
|
||||||
local target=_target
|
local target=_target
|
||||||
if target.Status==TARGET.ObjectStatus.ALIVE then
|
if target.Status==TARGET.ObjectStatus.ALIVE then
|
||||||
dead=false
|
dead=false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if dead then
|
if dead then
|
||||||
@ -110719,14 +110772,16 @@ if not target then
|
|||||||
target=self:GetTargetByName(EventData.IniUnitName)
|
target=self:GetTargetByName(EventData.IniUnitName)
|
||||||
end
|
end
|
||||||
if target then
|
if target then
|
||||||
|
local Ndead=target.Ndead
|
||||||
|
local Ndestroyed=target.Ndestroyed
|
||||||
if EventData.id==EVENTS.RemoveUnit then
|
if EventData.id==EVENTS.RemoveUnit then
|
||||||
target.Ndead=target.Ndead+1
|
Ndead=Ndead+1
|
||||||
else
|
else
|
||||||
target.Ndestroyed=target.Ndestroyed+1
|
Ndestroyed=Ndestroyed+1
|
||||||
target.Ndead=target.Ndead+1
|
Ndead=Ndead+1
|
||||||
end
|
end
|
||||||
if target.Ndead==target.N0 then
|
if Ndead==target.N0 then
|
||||||
if target.Ndestroyed>=target.N0 then
|
if Ndestroyed>=target.N0 then
|
||||||
self:T2(self.lid..string.format("EVENT ID=%d: target %s dead/lost ==> destroyed",EventData.id,tostring(target.Name)))
|
self:T2(self.lid..string.format("EVENT ID=%d: target %s dead/lost ==> destroyed",EventData.id,tostring(target.Name)))
|
||||||
target.Life=0
|
target.Life=0
|
||||||
self:ObjectDestroyed(target)
|
self:ObjectDestroyed(target)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user