mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-12 04:31:09 +00:00
Merge branch 'FF/Develop' into FF/Fox2
This commit is contained in:
@@ -76,8 +76,8 @@
|
||||
-- fox=FOX:New()
|
||||
--
|
||||
-- -- Add training zones.
|
||||
-- fox:AddSafeZone(ZONE:New("Training Zone Alpha")
|
||||
-- fox:AddSafeZone(ZONE:New("Training Zone Bravo")
|
||||
-- fox:AddSafeZone(ZONE:New("Training Zone Alpha"))
|
||||
-- fox:AddSafeZone(ZONE:New("Training Zone Bravo"))
|
||||
--
|
||||
-- -- Start missile trainer.
|
||||
-- fox:Start()
|
||||
@@ -90,8 +90,8 @@
|
||||
-- fox=FOX:New()
|
||||
--
|
||||
-- -- Add training zones.
|
||||
-- fox:AddLaunchZone(ZONE:New("Launch Zone SA-10 Krim")
|
||||
-- fox:AddLaunchZone(ZONE:New("Training Zone Bravo")
|
||||
-- fox:AddLaunchZone(ZONE:New("Launch Zone SA-10 Krim"))
|
||||
-- fox:AddLaunchZone(ZONE:New("Training Zone Bravo"))
|
||||
--
|
||||
-- -- Start missile trainer.
|
||||
-- fox:Start()
|
||||
@@ -189,7 +189,7 @@ FOX.MenuF10Root=nil
|
||||
|
||||
--- FOX class version.
|
||||
-- @field #string version
|
||||
FOX.version="0.5.0"
|
||||
FOX.version="0.5.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@@ -444,6 +444,17 @@ function FOX:SetExplosionPower(power)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set missile-player distance when missile is destroyed.
|
||||
-- @param #FOX self
|
||||
-- @param #number distance Distance in meters. Default 100 m.
|
||||
-- @return #FOX self
|
||||
function FOX:SetExplosionDistance(distance)
|
||||
|
||||
self.explosiondist=distance or 100
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Disable F10 menu for all players.
|
||||
-- @param #FOX self
|
||||
@@ -1065,13 +1076,13 @@ function FOX:OnEventShot(EventData)
|
||||
end
|
||||
|
||||
-- Debug info.
|
||||
self:E(FOX.lid.."EVENT SHOT: FOX")
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName)))
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName)))
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon)))
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory)))
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory)))
|
||||
self:E(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange)))
|
||||
self:T2(FOX.lid.."EVENT SHOT: FOX")
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName)))
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName)))
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon)))
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory)))
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory)))
|
||||
self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange)))
|
||||
|
||||
|
||||
-- Check if fired in launch zone.
|
||||
|
||||
@@ -98,7 +98,7 @@ PSEUDOATC.id="PseudoATC | "
|
||||
|
||||
--- PSEUDOATC version.
|
||||
-- @field #number version
|
||||
PSEUDOATC.version="0.9.1"
|
||||
PSEUDOATC.version="0.9.2"
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -807,8 +807,9 @@ function PSEUDOATC:ReportBR(GID, UID, position, location)
|
||||
-- Message text.
|
||||
local text=string.format("%s: Bearing %s, Range %s.", location, Bs, Rs)
|
||||
|
||||
-- Send message to player group.
|
||||
MESSAGE:New(text, self.mdur):ToGroup(self.player[id].group)
|
||||
-- Send message
|
||||
self:_DisplayMessageToGroup(self.group[GID].player[UID].unit, text, self.mdur, true)
|
||||
|
||||
end
|
||||
|
||||
--- Report altitude above ground level of player unit.
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
-- @field #boolean trackrockets If true (default), all rocket types are tracked and impact point to closest bombing target is evaluated.
|
||||
-- @field #boolean trackmissiles If true (default), all missile types are tracked and impact point to closest bombing target is evaluated.
|
||||
-- @field #boolean defaultsmokebomb If true, initialize player settings to smoke bomb.
|
||||
-- @field #boolean autosafe If true, automatically save results every X seconds.
|
||||
-- @field #boolean autosave If true, automatically save results every X seconds.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- Enables a mission designer to easily set up practice ranges in DCS. A new RANGE object can be created with the @{#RANGE.New}(rangename) contructor.
|
||||
@@ -340,7 +340,7 @@ RANGE.MenuF10Root=nil
|
||||
|
||||
--- Range script version.
|
||||
-- @field #string version
|
||||
RANGE.version="2.1.1"
|
||||
RANGE.version="2.1.2"
|
||||
|
||||
--TODO list:
|
||||
--TODO: Verbosity level for messages.
|
||||
@@ -617,19 +617,19 @@ function RANGE:SetMessageTimeDuration(time)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Automatically safe player results to disc.
|
||||
--- Automatically save player results to disc.
|
||||
-- @param #RANGE self
|
||||
-- @return #RANGE self
|
||||
function RANGE:SetAutosafeOn()
|
||||
self.autosafe=true
|
||||
function RANGE:SetAutosaveOn()
|
||||
self.autosave=true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Switch off auto safe player results.
|
||||
--- Switch off auto save player results.
|
||||
-- @param #RANGE self
|
||||
-- @return #RANGE self
|
||||
function RANGE:SetAutosafeOff()
|
||||
self.autosafe=false
|
||||
function RANGE:SetAutosaveOff()
|
||||
self.autosave=false
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -662,7 +662,7 @@ function RANGE:SetRangeRadius(radius)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set player setting whether bomb impact points are smoked or not
|
||||
--- Set player setting whether bomb impact points are smoked or not.
|
||||
-- @param #RANGE self
|
||||
-- @param #boolean switch If true nor nil default is to smoke impact points of bombs.
|
||||
-- @return #RANGE self
|
||||
@@ -1650,7 +1650,7 @@ function RANGE:onafterStatus(From, Event, To)
|
||||
self:_CheckPlayers()
|
||||
|
||||
-- Save results.
|
||||
if self.autosafe then
|
||||
if self.autosave then
|
||||
self:Save()
|
||||
end
|
||||
|
||||
@@ -1725,10 +1725,10 @@ function RANGE:onafterSave(From, Event, To)
|
||||
end
|
||||
|
||||
-- Path.
|
||||
local path=lfs.writedir()
|
||||
local path=lfs.writedir()..[[Logs\]]
|
||||
|
||||
-- Set file name.
|
||||
local filename=path..string.format("\\RANGE-%s_BombingResults.csv", self.rangename)
|
||||
local filename=path..string.format("RANGE-%s_BombingResults.csv", self.rangename)
|
||||
|
||||
-- Header line.
|
||||
local scores="Name,Pass,Target,Distance,Radial,Quality,Weapon,Airframe,Mission Time"
|
||||
@@ -1788,11 +1788,11 @@ function RANGE:onafterLoad(From, Event, To)
|
||||
end
|
||||
end
|
||||
|
||||
-- Path.
|
||||
local path=lfs.writedir()
|
||||
-- Path in DCS log file.
|
||||
local path=lfs.writedir()..[[Logs\]]
|
||||
|
||||
-- Set file name.
|
||||
local filename=path..string.format("\\RANGE-%s_BombingResults.csv", self.rangename)
|
||||
local filename=path..string.format("RANGE-%s_BombingResults.csv", self.rangename)
|
||||
|
||||
-- Info message.
|
||||
local text=string.format("Loading player bomb results from file %s", filename)
|
||||
@@ -2185,15 +2185,16 @@ function RANGE:_DisplayBombTargets(_unitname)
|
||||
local _text="Bomb Target Locations:"
|
||||
|
||||
for _,_bombtarget in pairs(self.bombingTargets) do
|
||||
local _target=_bombtarget.target --Wrapper.Positionable#POSITIONABLE
|
||||
local bombtarget=_bombtarget --#RANGE.BombTarget
|
||||
|
||||
-- Coordinate of bombtarget.
|
||||
local coord=self:_GetBombTargetCoordinate(_bombtarget)
|
||||
local coord=self:_GetBombTargetCoordinate(bombtarget)
|
||||
|
||||
if coord then
|
||||
|
||||
local mycoord=coord:ToStringA2G(_unit, _settings)
|
||||
_text=_text..string.format("\n- %s: %s",_bombtarget.name or "unknown", mycoord)
|
||||
local ca2g=coord:ToStringA2G(_unit, _settings)
|
||||
local lldms=coord:ToStringLLDMS()
|
||||
_text=_text..string.format("\n- %s: %s %s", bombtarget.name or "unknown", ca2g, lldms)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2708,21 +2709,19 @@ function RANGE:_MarkTargetsOnMap(_unitName)
|
||||
self:F(_unitName)
|
||||
|
||||
-- Get group.
|
||||
local group=nil
|
||||
local group=nil --Wrapper.Group#GROUP
|
||||
if _unitName then
|
||||
group=UNIT:FindByName(_unitName):GetGroup()
|
||||
end
|
||||
|
||||
-- Mark bomb targets.
|
||||
for _,_bombtarget in pairs(self.bombingTargets) do
|
||||
local _target=_bombtarget.target --Wrapper.Positionable#POSITIONABLE
|
||||
if _target and _target:IsAlive() then
|
||||
local coord=_target:GetCoordinate() --Core.Point#COORDINATE
|
||||
if group then
|
||||
coord:MarkToGroup("Bomb target ".._bombtarget.name, group)
|
||||
else
|
||||
coord:MarkToAll("Bomb target ".._bombtarget.name)
|
||||
end
|
||||
local bombtarget=_bombtarget --#RANGE.BombTarget
|
||||
local coord=self:_GetBombTargetCoordinate(_bombtarget)
|
||||
if group then
|
||||
coord:MarkToGroup(string.format("Bomb target %s:\n%s\n%s", bombtarget.name, coord:ToStringLLDMS(), coord:ToStringBULLS(group:GetCoalition())), group)
|
||||
else
|
||||
coord:MarkToAll(string.format("Bomb target %s", bombtarget.name))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2733,7 +2732,8 @@ function RANGE:_MarkTargetsOnMap(_unitName)
|
||||
if _target and _target:IsAlive() then
|
||||
local coord=_target:GetCoordinate() --Core.Point#COORDINATE
|
||||
if group then
|
||||
coord:MarkToGroup("Strafe target ".._target:GetName(), group)
|
||||
--coord:MarkToGroup("Strafe target ".._target:GetName(), group)
|
||||
coord:MarkToGroup(string.format("Strafe target %s:\n%s\n%s", _target:GetName(), coord:ToStringLLDMS(), coord:ToStringBULLS(group:GetCoalition())), group)
|
||||
else
|
||||
coord:MarkToAll("Strafe target ".._target:GetName())
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1743,7 +1743,7 @@ _WAREHOUSEDB = {
|
||||
|
||||
--- Warehouse class version.
|
||||
-- @field #string version
|
||||
WAREHOUSE.version="0.9.0"
|
||||
WAREHOUSE.version="0.9.2"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO: Warehouse todo list.
|
||||
@@ -2318,6 +2318,7 @@ function WAREHOUSE:New(warehouse, alias)
|
||||
-- @param #WAREHOUSE self
|
||||
-- @param Wrapper.Group#GROUP group the group that was spawned.
|
||||
-- @param #WAREHOUSE.Assetitem asset The asset that was spawned.
|
||||
-- @param #WAREHOUSE.Pendingitem request The request of the spawned asset.
|
||||
|
||||
--- Triggers the FSM event "AssetSpawned" with a delay when the warehouse has spawned an asset.
|
||||
-- @function [parent=#WAREHOUSE] __AssetSpawned
|
||||
@@ -2325,6 +2326,7 @@ function WAREHOUSE:New(warehouse, alias)
|
||||
-- @param #number delay Delay in seconds.
|
||||
-- @param Wrapper.Group#GROUP group the group that was spawned.
|
||||
-- @param #WAREHOUSE.Assetitem asset The asset that was spawned.
|
||||
-- @param #WAREHOUSE.Pendingitem request The request of the spawned asset.
|
||||
|
||||
--- On after "AssetSpawned" event user function. Called when the warehouse has spawned an asset.
|
||||
-- @function [parent=#WAREHOUSE] OnAfterAssetSpawned
|
||||
@@ -2334,6 +2336,7 @@ function WAREHOUSE:New(warehouse, alias)
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Group#GROUP group the group that was spawned.
|
||||
-- @param #WAREHOUSE.Assetitem asset The asset that was spawned.
|
||||
-- @param #WAREHOUSE.Pendingitem request The request of the spawned asset.
|
||||
|
||||
|
||||
--- Triggers the FSM event "AssetLowFuel" when an asset runs low on fuel
|
||||
@@ -3096,7 +3099,7 @@ function WAREHOUSE:FindAssetInDB(group)
|
||||
if aid~=nil then
|
||||
|
||||
local asset=_WAREHOUSEDB.Assets[aid]
|
||||
self:E({asset=asset})
|
||||
self:T2({asset=asset})
|
||||
if asset==nil then
|
||||
self:_ErrorMessage(string.format("ERROR: Asset for group %s not found in the data base!", group:GetName()), 0)
|
||||
end
|
||||
@@ -3149,7 +3152,7 @@ function WAREHOUSE:onafterStart(From, Event, To)
|
||||
end
|
||||
-- Mark point at road connection.
|
||||
if self.road then
|
||||
self.road:MarkToAll(string.format("%s road connection.", self.alias), true)
|
||||
self.markroad=self.road:MarkToCoalition(string.format("%s road connection.",self.alias), self:GetCoalition(), true)
|
||||
end
|
||||
|
||||
-- Get the closest point on railroad wrt spawnzone of ground assets.
|
||||
@@ -3163,7 +3166,7 @@ function WAREHOUSE:onafterStart(From, Event, To)
|
||||
end
|
||||
-- Mark point at rail connection.
|
||||
if self.rail then
|
||||
self.rail:MarkToAll(string.format("%s rail connection.", self.alias), true)
|
||||
self.markrail=self.rail:MarkToCoalition(string.format("%s rail connection.", self.alias), self:GetCoalition(), true)
|
||||
end
|
||||
|
||||
-- Handle events:
|
||||
@@ -4330,7 +4333,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
|
||||
table.insert(_transportassets,_assetitem)
|
||||
|
||||
-- Asset spawned FSM function.
|
||||
self:__AssetSpawned(1, spawngroup, _assetitem)
|
||||
self:__AssetSpawned(1, spawngroup, _assetitem, Request)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5269,7 +5272,7 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
|
||||
table.insert(_assets, _assetitem)
|
||||
|
||||
-- Call FSM function.
|
||||
self:__AssetSpawned(1,_group,_assetitem)
|
||||
self:__AssetSpawned(1,_group,_assetitem, Request)
|
||||
else
|
||||
self:E(self.wid.."ERROR: Cargo asset could not be spawned!")
|
||||
end
|
||||
@@ -7753,14 +7756,21 @@ function WAREHOUSE:_CheckFuel()
|
||||
local group=_group --Wrapper.Group#GROUP
|
||||
|
||||
if group and group:IsAlive() then
|
||||
|
||||
|
||||
-- Get min fuel of group.
|
||||
local fuel=group:GetFuelMin()
|
||||
|
||||
self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f %%", group:GetName(), fuel))
|
||||
-- Debug info.
|
||||
self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f", group:GetName(), fuel))
|
||||
|
||||
-- Check if fuel is below threshold for first time.
|
||||
if fuel<self.lowfuelthresh and not qitem.lowfuel then
|
||||
self:I(self.wid..string.format("Transport group %s is low on fuel! Min fuel state = %.2f %%", group:GetName(), fuel))
|
||||
|
||||
-- Set low fuel flag.
|
||||
self:I(self.wid..string.format("Transport group %s is low on fuel! Min fuel state = %.2f", group:GetName(), fuel))
|
||||
qitem.lowfuel=true
|
||||
|
||||
-- Trigger low fuel event.
|
||||
local asset=self:FindAssetInDB(group)
|
||||
self:AssetLowFuel(asset, qitem)
|
||||
break
|
||||
@@ -7776,13 +7786,20 @@ function WAREHOUSE:_CheckFuel()
|
||||
|
||||
if group and group:IsAlive() then
|
||||
|
||||
-- Get min fuel of group.
|
||||
local fuel=group:GetFuelMin()
|
||||
|
||||
self:T2(self.wid..string.format("Cargo group %s min fuel state = %.2f %%", group:GetName(), fuel))
|
||||
-- Debug output.
|
||||
self:T2(self.wid..string.format("Cargo group %s min fuel state = %.2f. Threshold = %.2f", group:GetName(), fuel, self.lowfuelthresh))
|
||||
|
||||
if fuel<self.lowfuelthresh and qitem.lowfuel then
|
||||
self:I(self.wid..string.format("Cargo group %s is low on fuel! Min fuel state = %.2f %%", group:GetName(), fuel))
|
||||
-- Check if fuel is below threshold for first time.
|
||||
if fuel<self.lowfuelthresh and not qitem.lowfuel then
|
||||
|
||||
-- Set low fuel flag.
|
||||
self:I(self.wid..string.format("Cargo group %s is low on fuel! Min fuel state = %.2f", group:GetName(), fuel))
|
||||
qitem.lowfuel=true
|
||||
|
||||
-- Trigger low fuel event.
|
||||
local asset=self:FindAssetInDB(group)
|
||||
self:AssetLowFuel(asset, qitem)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user