mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPSGROUP v1.0.3
- fixes for (naval) teleporting
This commit is contained in:
@@ -68,7 +68,7 @@ ARMYGROUP = {
|
|||||||
|
|
||||||
--- Army Group version.
|
--- Army Group version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARMYGROUP.version="1.0.1"
|
ARMYGROUP.version="1.0.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -2106,59 +2106,13 @@ function ARMYGROUP:_InitGroup(Template, Delay)
|
|||||||
-- Set default formation to "on road".
|
-- Set default formation to "on road".
|
||||||
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
||||||
|
|
||||||
-- First check if group was already initialized.
|
|
||||||
if self.groupinitialized then
|
|
||||||
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
self:T(self.lid.."FF Initializing Group")
|
|
||||||
|
|
||||||
-- Get template of group.
|
|
||||||
local template=Template or self:_GetTemplate()
|
|
||||||
|
|
||||||
-- Ground are always AI.
|
|
||||||
self.isAI=true
|
|
||||||
|
|
||||||
-- Is (template) group late activated.
|
|
||||||
self.isLateActivated=template.lateActivation
|
|
||||||
|
|
||||||
-- Ground groups cannot be uncontrolled.
|
|
||||||
self.isUncontrolled=false
|
|
||||||
|
|
||||||
-- Max speed in km/h.
|
|
||||||
self.speedMax=self.group:GetSpeedMax()
|
|
||||||
|
|
||||||
-- Is group mobile?
|
|
||||||
if self.speedMax>3.6 then
|
|
||||||
self.isMobile=true
|
|
||||||
else
|
|
||||||
self.isMobile=false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Cruise speed in km/h
|
|
||||||
self.speedCruise=self.speedMax*0.7
|
|
||||||
|
|
||||||
-- Group ammo.
|
|
||||||
self.ammo=self:GetAmmoTot()
|
|
||||||
|
|
||||||
-- Radio parameters from template.
|
|
||||||
self.radio.On=false -- Radio is always OFF for ground.
|
|
||||||
self.radio.Freq=133
|
|
||||||
self.radio.Modu=radio.modulation.AM
|
|
||||||
|
|
||||||
-- Set default radio.
|
|
||||||
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, self.radio.On)
|
|
||||||
|
|
||||||
-- Get current formation from first waypoint.
|
|
||||||
self.option.Formation=template.route.points[1].action
|
|
||||||
|
|
||||||
-- Set default formation to "on road".
|
|
||||||
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
|
||||||
|
|
||||||
-- Default TACAN off.
|
-- Default TACAN off.
|
||||||
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
if not self.tacanDefault then
|
||||||
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
||||||
|
end
|
||||||
|
if not self.tacan then
|
||||||
|
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
||||||
|
end
|
||||||
|
|
||||||
-- Units of the group.
|
-- Units of the group.
|
||||||
local units=self.group:GetUnits()
|
local units=self.group:GetUnits()
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ FLIGHTGROUP.Players={}
|
|||||||
|
|
||||||
--- FLIGHTGROUP class version.
|
--- FLIGHTGROUP class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
FLIGHTGROUP.version="1.0.2"
|
FLIGHTGROUP.version="1.0.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -3883,8 +3883,12 @@ function FLIGHTGROUP:_InitGroup(Template, Delay)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Default TACAN off.
|
-- Default TACAN off.
|
||||||
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
if not self.tacanDefault then
|
||||||
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
||||||
|
end
|
||||||
|
if not self.tacan then
|
||||||
|
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
||||||
|
end
|
||||||
|
|
||||||
-- Is this purely AI?
|
-- Is this purely AI?
|
||||||
self.isAI=not self:_IsHuman(group)
|
self.isAI=not self:_IsHuman(group)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ NAVYGROUP = {
|
|||||||
|
|
||||||
--- NavyGroup version.
|
--- NavyGroup version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
NAVYGROUP.version="1.0.2"
|
NAVYGROUP.version="1.0.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -395,7 +395,7 @@ function NAVYGROUP:New(group)
|
|||||||
self:HandleEvent(EVENTS.Birth, self.OnEventBirth)
|
self:HandleEvent(EVENTS.Birth, self.OnEventBirth)
|
||||||
self:HandleEvent(EVENTS.Dead, self.OnEventDead)
|
self:HandleEvent(EVENTS.Dead, self.OnEventDead)
|
||||||
self:HandleEvent(EVENTS.RemoveUnit, self.OnEventRemoveUnit)
|
self:HandleEvent(EVENTS.RemoveUnit, self.OnEventRemoveUnit)
|
||||||
self:HandleEvent(EVENTS.UnitLost, self.OnEventRemoveUnit)
|
self:HandleEvent(EVENTS.UnitLost, self.OnEventRemoveUnit)
|
||||||
|
|
||||||
-- Start the status monitoring.
|
-- Start the status monitoring.
|
||||||
self.timerStatus=TIMER:New(self.Status, self):Start(1, 30)
|
self.timerStatus=TIMER:New(self.Status, self):Start(1, 30)
|
||||||
@@ -775,7 +775,7 @@ end
|
|||||||
|
|
||||||
--- Update status.
|
--- Update status.
|
||||||
-- @param #NAVYGROUP self
|
-- @param #NAVYGROUP self
|
||||||
function NAVYGROUP:Status(From, Event, To)
|
function NAVYGROUP:Status()
|
||||||
|
|
||||||
-- FSM state.
|
-- FSM state.
|
||||||
local fsmstate=self:GetState()
|
local fsmstate=self:GetState()
|
||||||
@@ -978,6 +978,35 @@ function NAVYGROUP:Status(From, Event, To)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Elements
|
||||||
|
---
|
||||||
|
|
||||||
|
if self.verbose>=2 then
|
||||||
|
local text="Elements:"
|
||||||
|
for i,_element in pairs(self.elements) do
|
||||||
|
local element=_element --Ops.OpsGroup#OPSGROUP.Element
|
||||||
|
|
||||||
|
local name=element.name
|
||||||
|
local status=element.status
|
||||||
|
local unit=element.unit
|
||||||
|
local life,life0=self:GetLifePoints(element)
|
||||||
|
|
||||||
|
local life0=element.life0
|
||||||
|
|
||||||
|
-- Get ammo.
|
||||||
|
local ammo=self:GetAmmoElement(element)
|
||||||
|
|
||||||
|
-- Output text for element.
|
||||||
|
text=text..string.format("\n[%d] %s: status=%s, life=%.1f/%.1f, guns=%d, rockets=%d, bombs=%d, missiles=%d, cargo=%d/%d kg",
|
||||||
|
i, name, status, life, life0, ammo.Guns, ammo.Rockets, ammo.Bombs, ammo.Missiles, element.weightCargo, element.weightMaxCargo)
|
||||||
|
end
|
||||||
|
if #self.elements==0 then
|
||||||
|
text=text.." none!"
|
||||||
|
end
|
||||||
|
self:I(self.lid..text)
|
||||||
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Engage Detected Targets
|
-- Engage Detected Targets
|
||||||
---
|
---
|
||||||
@@ -1041,7 +1070,7 @@ function NAVYGROUP:onafterSpawned(From, Event, To)
|
|||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
if self.verbose>=1 then
|
if self.verbose>=1 then
|
||||||
local text=string.format("Initialized Navy Group %s:\n", self.groupname)
|
local text=string.format("Initialized Navy Group %s [GID=%d]:\n", self.groupname, self.group:GetID())
|
||||||
text=text..string.format("Unit type = %s\n", self.actype)
|
text=text..string.format("Unit type = %s\n", self.actype)
|
||||||
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
||||||
text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise))
|
text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise))
|
||||||
@@ -1894,13 +1923,21 @@ function NAVYGROUP:_InitGroup(Template, Delay)
|
|||||||
self.optionDefault.Formation="Off Road"
|
self.optionDefault.Formation="Off Road"
|
||||||
self.option.Formation=self.optionDefault.Formation
|
self.option.Formation=self.optionDefault.Formation
|
||||||
|
|
||||||
-- Default TACAN off.
|
-- Default TACAN off (we check if something is set already to keep those values in case of respawn)
|
||||||
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
if not self.tacanDefault then
|
||||||
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
||||||
|
end
|
||||||
|
if not self.tacan then
|
||||||
|
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
||||||
|
end
|
||||||
|
|
||||||
-- Default ICLS off.
|
-- Default ICLS off.
|
||||||
self:SetDefaultICLS(nil, nil, nil, true)
|
if not self.iclsDefault then
|
||||||
self.icls=UTILS.DeepCopy(self.iclsDefault)
|
self:SetDefaultICLS(nil, nil, nil, true)
|
||||||
|
end
|
||||||
|
if not self.icls then
|
||||||
|
self.icls=UTILS.DeepCopy(self.iclsDefault)
|
||||||
|
end
|
||||||
|
|
||||||
-- Get all units of the group.
|
-- Get all units of the group.
|
||||||
local units=self.group:GetUnits()
|
local units=self.group:GetUnits()
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ OPSGROUP.CargoStatus={
|
|||||||
|
|
||||||
--- OpsGroup version.
|
--- OpsGroup version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
OPSGROUP.version="1.0.1"
|
OPSGROUP.version="1.0.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -7819,7 +7819,7 @@ function OPSGROUP:_Spawn(Delay, Template)
|
|||||||
self:_InitWaypoints()
|
self:_InitWaypoints()
|
||||||
|
|
||||||
-- Init Group. This call is delayed because NAVY groups did not like to be initialized just yet (group did not contain any units).
|
-- Init Group. This call is delayed because NAVY groups did not like to be initialized just yet (group did not contain any units).
|
||||||
self:_InitGroup(Template)
|
self:_InitGroup(Template, 0.001)
|
||||||
|
|
||||||
-- Reset events.
|
-- Reset events.
|
||||||
--self:ResetEvents()
|
--self:ResetEvents()
|
||||||
|
|||||||
Reference in New Issue
Block a user