mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
commit
d1d43c38cd
@ -104,6 +104,7 @@ function ARMYGROUP:New(group)
|
|||||||
self:SetDefaultROE()
|
self:SetDefaultROE()
|
||||||
self:SetDefaultAlarmstate()
|
self:SetDefaultAlarmstate()
|
||||||
self:SetDefaultEPLRS(self.isEPLRS)
|
self:SetDefaultEPLRS(self.isEPLRS)
|
||||||
|
self:SetDefaultEmission()
|
||||||
self:SetDetection()
|
self:SetDetection()
|
||||||
self:SetPatrolAdInfinitum(false)
|
self:SetPatrolAdInfinitum(false)
|
||||||
self:SetRetreatZones()
|
self:SetRetreatZones()
|
||||||
@ -1726,7 +1727,7 @@ function ARMYGROUP:SwitchFormation(Formation, Permanently, NoRouteUpdate)
|
|||||||
self.option.Formation=Formation or "Off road"
|
self.option.Formation=Formation or "Off road"
|
||||||
|
|
||||||
if self:IsInUtero() then
|
if self:IsInUtero() then
|
||||||
self:T(self.lid..string.format("Will switch formation to %s (permanently=%s) when group is spawned", self.option.Formation, tostring(Permanently)))
|
self:T(self.lid..string.format("Will switch formation to %s (permanently=%s) when group is spawned", tostring(self.option.Formation), tostring(Permanently)))
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Update route with the new formation.
|
-- Update route with the new formation.
|
||||||
@ -1736,7 +1737,7 @@ function ARMYGROUP:SwitchFormation(Formation, Permanently, NoRouteUpdate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Switching formation to %s (permanently=%s)", self.option.Formation, tostring(Permanently)))
|
self:T(self.lid..string.format("Switching formation to %s (permanently=%s)", tostring(self.option.Formation), tostring(Permanently)))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -4246,12 +4246,6 @@ function AUFTRAG:_TargetFromObject(Object)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.type == AUFTRAG.Type.ALERT5 then
|
|
||||||
|
|
||||||
self.alert5Target = self.engageTarget
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Target was already specified elsewhere.
|
-- Target was already specified elsewhere.
|
||||||
@ -4379,10 +4373,10 @@ function AUFTRAG:GetTargetCoordinate()
|
|||||||
local coord=self.engageTarget:GetCoordinate()
|
local coord=self.engageTarget:GetCoordinate()
|
||||||
return coord
|
return coord
|
||||||
|
|
||||||
elseif self.alert5Target then
|
elseif self.type==AUFTRAG.Type.ALERT5 then
|
||||||
|
|
||||||
local coord=self.alert5Target:GetCoordinate()
|
-- For example, COMMANDER will not assign a coordiante. This will be done later, when the mission is assigned to an airwing.
|
||||||
return coord
|
return nil
|
||||||
|
|
||||||
else
|
else
|
||||||
self:T(self.lid.."ERROR: Cannot get target coordinate!")
|
self:T(self.lid.."ERROR: Cannot get target coordinate!")
|
||||||
|
|||||||
@ -1752,12 +1752,12 @@ function CHIEF:CheckOpsZoneQueue()
|
|||||||
self:T3(self.lid..string.format("Zone is empty ==> Recruit Patrol zone infantry assets"))
|
self:T3(self.lid..string.format("Zone is empty ==> Recruit Patrol zone infantry assets"))
|
||||||
|
|
||||||
-- Recruit ground assets that
|
-- Recruit ground assets that
|
||||||
local recruited=self:RecruitAssetsForZone(stratzone, AUFTRAG.Type.ONGUARD, 1, 3, {Group.Category.GROUND}, {GROUP.Attribute.GROUND_INFANTRY, GROUP.Attribute.GROUND_TANK})
|
local recruitedI=self:RecruitAssetsForZone(stratzone, AUFTRAG.Type.ONGUARD, 1, 3, {Group.Category.GROUND}, {GROUP.Attribute.GROUND_INFANTRY})
|
||||||
local recruited1=self:RecruitAssetsForZone(stratzone, AUFTRAG.Type.ARMOREDGUARD, 1, 1, {Group.Category.GROUND}, {GROUP.Attribute.GROUND_TANK})
|
local recruitedT=self:RecruitAssetsForZone(stratzone, AUFTRAG.Type.ARMOREDGUARD, 1, 1, {Group.Category.GROUND}, {GROUP.Attribute.GROUND_TANK})
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Zone is empty ==> Recruit Patrol zone infantry assets=%s", tostring(recruited)))
|
self:T(self.lid..string.format("Zone is empty ==> Recruit Patrol zone infantry assets=%s", tostring(recruitedI)))
|
||||||
self:T(self.lid..string.format("Zone is empty ==> Recruit Patrol zone armored assets=%s", tostring(recruited1)))
|
self:T(self.lid..string.format("Zone is empty ==> Recruit Patrol zone armored assets=%s", tostring(recruitedT)))
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -2198,10 +2198,13 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
|
|
||||||
if recruited then
|
if recruited then
|
||||||
|
|
||||||
|
-- Debug messgage.
|
||||||
|
self:T2(self.lid..string.format("Recruited %d assets for %s mission STRATEGIC zone %s", #assets, MissionType, tostring(StratZone.opszone.zoneName)))
|
||||||
|
|
||||||
if MissionType==AUFTRAG.Type.PATROLZONE or MissionType==AUFTRAG.Type.ONGUARD then
|
if MissionType==AUFTRAG.Type.PATROLZONE or MissionType==AUFTRAG.Type.ONGUARD then
|
||||||
|
|
||||||
-- Debug messgage.
|
-- Debug messgage.
|
||||||
self:T2(self.lid..string.format("Recruited %d assets from for PATROL mission", #assets))
|
self:T2(self.lid..string.format("Recruited %d assets for PATROL mission", #assets))
|
||||||
|
|
||||||
local recruitedTrans=true
|
local recruitedTrans=true
|
||||||
local transport=nil
|
local transport=nil
|
||||||
@ -2209,8 +2212,7 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
|
|
||||||
-- Categories. Currently only helicopters are allowed due to problems with ground transports (might get stuck, might not be a land connection.
|
-- Categories. Currently only helicopters are allowed due to problems with ground transports (might get stuck, might not be a land connection.
|
||||||
-- TODO: Check if ground transport is possible. For example, by trying land.getPathOnRoad or something.
|
-- TODO: Check if ground transport is possible. For example, by trying land.getPathOnRoad or something.
|
||||||
local Categories={self.TransportCategories}
|
local Categories=self.TransportCategories
|
||||||
--local Categories={Group.Category.HELICOPTER, Group.Category.GROUND}
|
|
||||||
|
|
||||||
-- Recruit transport assets for infantry.
|
-- Recruit transport assets for infantry.
|
||||||
recruitedTrans, transport=LEGION.AssignAssetsForTransport(self.commander, self.commander.legions, assets, 1, 1, StratZone.opszone.zone, nil, Categories)
|
recruitedTrans, transport=LEGION.AssignAssetsForTransport(self.commander, self.commander.legions, assets, 1, 1, StratZone.opszone.zone, nil, Categories)
|
||||||
@ -2242,8 +2244,6 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
self:MissionAssign(mission, legions)
|
self:MissionAssign(mission, legions)
|
||||||
|
|
||||||
-- Attach mission to ops zone.
|
-- Attach mission to ops zone.
|
||||||
-- TODO: Need a better way!
|
|
||||||
--StratZone.missionPatrol=mission
|
|
||||||
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -2281,8 +2281,6 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
self:MissionAssign(mission, legions)
|
self:MissionAssign(mission, legions)
|
||||||
|
|
||||||
-- Attach mission to ops zone.
|
-- Attach mission to ops zone.
|
||||||
-- TODO: Need a better way!
|
|
||||||
--StratZone.missionCAS=mission
|
|
||||||
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -2303,8 +2301,6 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
self:MissionAssign(mission, legions)
|
self:MissionAssign(mission, legions)
|
||||||
|
|
||||||
-- Attach mission to ops zone.
|
-- Attach mission to ops zone.
|
||||||
-- TODO: Need a better way!
|
|
||||||
--StratZone.missionARTY=mission
|
|
||||||
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -2324,8 +2320,6 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
self:MissionAssign(mission, legions)
|
self:MissionAssign(mission, legions)
|
||||||
|
|
||||||
-- Attach mission to ops zone.
|
-- Attach mission to ops zone.
|
||||||
-- TODO: Need a better way!
|
|
||||||
--StratZone.missionARTY=mission
|
|
||||||
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
StratZone.opszone:_AddMission(self.coalition, MissionType, mission)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -2333,6 +2327,9 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Debug messgage.
|
||||||
|
self:T2(self.lid..string.format("Could NOT recruit assets for %s mission of STRATEGIC zone %s", MissionType, tostring(StratZone.opszone.zoneName)))
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -134,6 +134,7 @@ function NAVYGROUP:New(group)
|
|||||||
self:SetDefaultROE()
|
self:SetDefaultROE()
|
||||||
self:SetDefaultAlarmstate()
|
self:SetDefaultAlarmstate()
|
||||||
self:SetDefaultEPLRS(self.isEPLRS)
|
self:SetDefaultEPLRS(self.isEPLRS)
|
||||||
|
self:SetDefaultEmission()
|
||||||
self:SetDetection()
|
self:SetDetection()
|
||||||
self:SetPatrolAdInfinitum(true)
|
self:SetPatrolAdInfinitum(true)
|
||||||
self:SetPathfinding(false)
|
self:SetPathfinding(false)
|
||||||
|
|||||||
@ -334,6 +334,7 @@ OPSGROUP.TaskType={
|
|||||||
-- @field #number Formation Formation.
|
-- @field #number Formation Formation.
|
||||||
-- @field #boolean EPLRS data link.
|
-- @field #boolean EPLRS data link.
|
||||||
-- @field #boolean Disperse Disperse under fire.
|
-- @field #boolean Disperse Disperse under fire.
|
||||||
|
-- @field #boolen Emission Emission on/off.
|
||||||
|
|
||||||
--- Weapon range data.
|
--- Weapon range data.
|
||||||
-- @type OPSGROUP.WeaponData
|
-- @type OPSGROUP.WeaponData
|
||||||
@ -9651,7 +9652,7 @@ function OPSGROUP:GetAlarmstate()
|
|||||||
return self.option.Alarm or self.optionDefault.Alarm
|
return self.option.Alarm or self.optionDefault.Alarm
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the default Alarm State for the group. This is the state gets when the group is spawned or to which it defaults back after a mission.
|
--- Set the default EPLRS for the group.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #boolean OnOffSwitch If `true`, EPLRS is on by default. If `false` default EPLRS setting is off. If `nil`, default is on if group has EPLRS and off if it does not have a datalink.
|
-- @param #boolean OnOffSwitch If `true`, EPLRS is on by default. If `false` default EPLRS setting is off. If `nil`, default is on if group has EPLRS and off if it does not have a datalink.
|
||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
@ -9693,7 +9694,7 @@ function OPSGROUP:SwitchEPLRS(OnOffSwitch)
|
|||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:T(self.lid.."WARNING: Cannot switch Alarm State! Group is not alive")
|
self:E(self.lid.."WARNING: Cannot switch EPLRS! Group is not alive")
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -9706,6 +9707,61 @@ function OPSGROUP:GetEPLRS()
|
|||||||
return self.option.EPLRS or self.optionDefault.EPLRS
|
return self.option.EPLRS or self.optionDefault.EPLRS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the default EPLRS for the group.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #boolean OnOffSwitch If `true`, EPLRS is on by default. If `false` default EPLRS setting is off. If `nil`, default is on if group has EPLRS and off if it does not have a datalink.
|
||||||
|
-- @return #OPSGROUP self
|
||||||
|
function OPSGROUP:SetDefaultEmission(OnOffSwitch)
|
||||||
|
|
||||||
|
if OnOffSwitch==nil then
|
||||||
|
self.optionDefault.Emission=true
|
||||||
|
else
|
||||||
|
self.optionDefault.EPLRS=OnOffSwitch
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Switch emission on or off.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #boolean OnOffSwitch If `true` or `nil`, switch emission on. If `false` emission switched off.
|
||||||
|
-- @return #OPSGROUP self
|
||||||
|
function OPSGROUP:SwitchEmission(OnOffSwitch)
|
||||||
|
|
||||||
|
if self:IsAlive() or self:IsInUtero() then
|
||||||
|
|
||||||
|
if OnOffSwitch==nil then
|
||||||
|
|
||||||
|
self.option.Emission=self.optionDefault.Emission
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
self.option.Emission=OnOffSwitch
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:IsInUtero() then
|
||||||
|
self:T2(self.lid..string.format("Setting current EMISSION=%s when GROUP is SPAWNED", tostring(self.option.Emission)))
|
||||||
|
else
|
||||||
|
|
||||||
|
self.group:EnableEmission(self.option.Emission)
|
||||||
|
self:T(self.lid..string.format("Setting current EMISSION=%s", tostring(self.option.Emission)))
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:E(self.lid.."WARNING: Cannot switch Emission! Group is not alive")
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get current emission state.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @return #boolean If `true`, emission is on.
|
||||||
|
function OPSGROUP:GetEmission()
|
||||||
|
return self.option.Emission or self.optionDefault.Emission
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- SETTINGS FUNCTIONS
|
-- SETTINGS FUNCTIONS
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -10134,7 +10190,7 @@ function OPSGROUP:SwitchFormation(Formation)
|
|||||||
self.option.Formation=Formation
|
self.option.Formation=Formation
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Switching formation to %d", self.option.Formation))
|
self:T(self.lid..string.format("Switching formation to %s", tostring(self.option.Formation)))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -11157,6 +11213,8 @@ function OPSGROUP:_AddElementByName(unitname)
|
|||||||
element.category=unit:GetUnitCategory()
|
element.category=unit:GetUnitCategory()
|
||||||
element.categoryname=unit:GetCategoryName()
|
element.categoryname=unit:GetCategoryName()
|
||||||
element.typename=unit:GetTypeName()
|
element.typename=unit:GetTypeName()
|
||||||
|
|
||||||
|
|
||||||
--self:I({desc=element.descriptors})
|
--self:I({desc=element.descriptors})
|
||||||
|
|
||||||
-- Ammo.
|
-- Ammo.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user