mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS
**OPSZONE** - Added `:SetTimeCapture()` function to set time interval until a zone is captured. **FLIGHTCONTROL** - Added coalition to tower and pilot msrs.
This commit is contained in:
parent
6d187f0d9a
commit
ea8cf7b62a
@ -327,7 +327,7 @@ FLIGHTCONTROL.FlightStatus={
|
||||
|
||||
--- FlightControl class version.
|
||||
-- @field #string version
|
||||
FLIGHTCONTROL.version="0.7.1"
|
||||
FLIGHTCONTROL.version="0.7.2"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -591,6 +591,7 @@ function FLIGHTCONTROL:_SetSRSOptions(msrs, Gender, Culture, Voice, Volume, Labe
|
||||
msrs:SetVolume(Volume)
|
||||
msrs:SetLabel(Label)
|
||||
msrs:SetGoogle(PathToGoogleCredentials)
|
||||
msrs:SetCoalition(self:GetCoalition())
|
||||
end
|
||||
|
||||
return self
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
-- @field #number Nred Number of red units in the zone.
|
||||
-- @field #number Nblu Number of blue units in the zone.
|
||||
-- @field #number Nnut Number of neutral units in the zone.
|
||||
-- @field #number TminCaptured Time interval in seconds how long an attacker must have troops inside the zone to capture.
|
||||
-- @field #number Tcaptured Time stamp (abs.) when the attacker destroyed all owning troops.
|
||||
-- @field #table ObjectCategories Object categories for the scan.
|
||||
-- @field #table UnitCategories Unit categories for the scan.
|
||||
-- @field #number Tattacked Abs. mission time stamp when an attack was started.
|
||||
@ -74,7 +76,7 @@ OPSZONE = {
|
||||
|
||||
--- OPSZONE class version.
|
||||
-- @field #string version
|
||||
OPSZONE.version="0.3.0"
|
||||
OPSZONE.version="0.3.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@ -163,6 +165,9 @@ function OPSZONE:New(Zone, CoalitionOwner)
|
||||
self.ownerPrevious=self.airbase:GetCoalition()
|
||||
end
|
||||
|
||||
-- Set time to capture.
|
||||
self:SetTimeCapture()
|
||||
|
||||
-- Set object categories.
|
||||
self:SetObjectCategories()
|
||||
self:SetUnitCategories()
|
||||
@ -390,6 +395,18 @@ function OPSZONE:SetThreatlevelOffending(Threatlevel)
|
||||
end
|
||||
|
||||
|
||||
--- Set time how long an attacking coalition must have troops inside a zone before it captures the zone.
|
||||
-- @param #OPSZONE self
|
||||
-- @param #number Tcapture Time in seconds. Default 0.
|
||||
-- @return #OPSZONE self
|
||||
function OPSZONE:SetTimeCapture(Tcapture)
|
||||
|
||||
self.TminCaptured=Tcapture or 0
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set whether *neutral* units can capture the zone.
|
||||
-- @param #OPSZONE self
|
||||
-- @param #boolean CanCapture If `true`, neutral units can.
|
||||
@ -680,6 +697,23 @@ end
|
||||
-- FSM Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On before "Captured" event.
|
||||
-- @param #OPSZONE self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #number NewOwnerCoalition Coalition of the new owner.
|
||||
function OPSZONE:onbeforeCaptured(From, Event, To, NewOwnerCoalition)
|
||||
|
||||
-- Check if owner changed.
|
||||
|
||||
if self.ownerCurrent==NewOwnerCoalition then
|
||||
self:T(self.lid.."")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--- On after "Captured" event.
|
||||
-- @param #OPSZONE self
|
||||
-- @param #string From From state.
|
||||
@ -1004,12 +1038,34 @@ function OPSZONE:EvaluateZone()
|
||||
if Nblu>0 then
|
||||
-- Blue captured red zone.
|
||||
if not self.airbase then
|
||||
self:Captured(coalition.side.BLUE)
|
||||
local Tnow=timer.getAbsTime()
|
||||
|
||||
-- Set time stamp if it does not exist.
|
||||
if not self.Tcaptured then
|
||||
self.Tcaptured=Tnow
|
||||
end
|
||||
|
||||
-- Check if enough time elapsed.
|
||||
if Tnow-self.Tcaptured>=self.TminCaptured then
|
||||
self:Captured(coalition.side.BLUE)
|
||||
self.Tcaptured=nil
|
||||
end
|
||||
end
|
||||
elseif Nnut>0 and self.neutralCanCapture then
|
||||
-- Neutral captured red zone.
|
||||
if not self.airbase then
|
||||
self:Captured(coalition.side.NEUTRAL)
|
||||
local Tnow=timer.getAbsTime()
|
||||
|
||||
-- Set time stamp if it does not exist.
|
||||
if not self.Tcaptured then
|
||||
self.Tcaptured=Tnow
|
||||
end
|
||||
|
||||
-- Check if enough time elapsed.
|
||||
if Tnow-self.Tcaptured>=self.TminCaptured then
|
||||
self:Captured(coalition.side.NEUTRAL)
|
||||
self.Tcaptured=nil
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Red zone is now empty (but will remain red).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user