mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'FF/Ops' into FF/OpsDev
This commit is contained in:
@@ -38,11 +38,13 @@
|
||||
-- @type BEACON
|
||||
-- @field #string ClassName Name of the class "BEACON".
|
||||
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{Wrapper.Controllable#CONTROLLABLE} that will receive radio capabilities.
|
||||
-- @field #number UniqueName Counter to make the unique naming work.
|
||||
-- @extends Core.Base#BASE
|
||||
BEACON = {
|
||||
ClassName = "BEACON",
|
||||
Positionable = nil,
|
||||
name = nil,
|
||||
UniqueName = 0,
|
||||
}
|
||||
|
||||
--- Beacon types supported by DCS.
|
||||
@@ -384,7 +386,9 @@ end
|
||||
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
||||
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
||||
local IsValid = false
|
||||
|
||||
|
||||
Modulation = Modulation or radio.modulation.AM
|
||||
|
||||
-- Check the filename
|
||||
if type(FileName) == "string" then
|
||||
if FileName:find(".ogg") or FileName:find(".wav") then
|
||||
@@ -395,7 +399,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
end
|
||||
end
|
||||
if not IsValid then
|
||||
self:E({"File name invalid. Maybe something wrong with the extension ? ", FileName})
|
||||
self:E({"File name invalid. Maybe something wrong with the extension? ", FileName})
|
||||
end
|
||||
|
||||
-- Check the Frequency
|
||||
@@ -421,7 +425,9 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
if IsValid then
|
||||
self:T2({"Activating Beacon on ", Frequency, Modulation})
|
||||
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
|
||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
||||
BEACON.UniqueName = BEACON.UniqueName + 1
|
||||
self.BeaconName = "MooseBeacon"..tostring(BEACON.UniqueName)
|
||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, self.BeaconName)
|
||||
|
||||
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||
SCHEDULER:New( nil,
|
||||
@@ -429,7 +435,8 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
self:StopRadioBeacon()
|
||||
end, {}, BeaconDuration)
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Stops the Radio Beacon
|
||||
@@ -438,7 +445,7 @@ end
|
||||
function BEACON:StopRadioBeacon()
|
||||
self:F()
|
||||
-- The unique name of the transmission is the class ID
|
||||
trigger.action.stopRadioTransmission(tostring(self.ID))
|
||||
trigger.action.stopRadioTransmission(self.BeaconName)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
--
|
||||
-- @module Core.ClientMenu
|
||||
-- @image Core_Menu.JPG
|
||||
-- last change: Apr 2024
|
||||
-- last change: May 2024
|
||||
|
||||
-- TODO
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
@@ -691,7 +691,7 @@ function CLIENTMENUMANAGER:Propagate(Client)
|
||||
local client = _client -- Wrapper.Client#CLIENT
|
||||
if client and client:IsAlive() then
|
||||
local playerunit = client:GetName()
|
||||
local playergroup = client:GetGroup()
|
||||
--local playergroup = client:GetGroup()
|
||||
local playername = client:GetPlayerName() or "none"
|
||||
if not knownunits[playerunit] then
|
||||
knownunits[playerunit] = true
|
||||
|
||||
@@ -1147,10 +1147,13 @@ end
|
||||
-- @param #string GroupName Group name.
|
||||
-- @return #table Group template table.
|
||||
function DATABASE:GetGroupTemplate( GroupName )
|
||||
local GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||
local GroupTemplate=nil
|
||||
if self.Templates.Groups[GroupName] then
|
||||
GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||
end
|
||||
return GroupTemplate
|
||||
end
|
||||
|
||||
|
||||
@@ -1301,7 +1301,7 @@ function EVENT:onEvent( Event )
|
||||
-- STATIC
|
||||
---
|
||||
Event.TgtDCSUnit = Event.target
|
||||
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
|
||||
if Event.target.isExist and Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object, check that isExist exists (Kiowa Hellfire issue, Special K)
|
||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||
-- Workaround for borked target info on cruise missiles
|
||||
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -516,10 +516,10 @@ function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,G
|
||||
end
|
||||
|
||||
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
||||
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
||||
_MESSAGESRS.MSRS:SetLabel(_MESSAGESRS.label)
|
||||
|
||||
_MESSAGESRS.port = Port or MSRS.port or 5002
|
||||
_MESSAGESRS.MSRS:SetPort(Port or 5002)
|
||||
_MESSAGESRS.MSRS:SetPort(_MESSAGESRS.port)
|
||||
|
||||
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
||||
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||
|
||||
@@ -1516,6 +1516,7 @@ do
|
||||
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
||||
self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnDeadOrCrash )
|
||||
if self.Filter.Zones then
|
||||
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
||||
local timing = self.ZoneTimerInterval or 30
|
||||
@@ -3477,7 +3478,7 @@ do -- SET_STATIC
|
||||
|
||||
--- Add STATIC(s) to SET_STATIC.
|
||||
-- @param #SET_STATIC self
|
||||
-- @param #string AddStatic A single STATIC.
|
||||
-- @param Wrapper.Static#STATIC AddStatic A single STATIC.
|
||||
-- @return #SET_STATIC self
|
||||
function SET_STATIC:AddStatic( AddStatic )
|
||||
self:F2( AddStatic:GetName() )
|
||||
|
||||
@@ -202,19 +202,19 @@
|
||||
--
|
||||
-- ### Link-16 Datalink STN and SADL IDs (limited at the moment to F15/16/18/AWACS/Tanker/B1B, but not the F15E for clients, SADL A10CII only)
|
||||
--
|
||||
-- *{#SPAWN.InitSTN}(): Set the STN of the first unit in the group. All other units will have consecutive STNs, provided they have not been used yet.
|
||||
-- *{#SPAWN.InitSADL}(): Set the SADL of the first unit in the group. All other units will have consecutive SADLs, provided they have not been used yet.
|
||||
-- * @{#SPAWN.InitSTN}(): Set the STN of the first unit in the group. All other units will have consecutive STNs, provided they have not been used yet.
|
||||
-- * @{#SPAWN.InitSADL}(): Set the SADL of the first unit in the group. All other units will have consecutive SADLs, provided they have not been used yet.
|
||||
--
|
||||
-- ### Callsigns
|
||||
--
|
||||
-- *{#SPAWN.InitRandomizeCallsign}(): Set a random callsign name per spawn.
|
||||
-- *{#SPAWN.SpawnInitCallSign}(): Set a specific callsign for a spawned group.
|
||||
-- * @{#SPAWN.InitRandomizeCallsign}(): Set a random callsign name per spawn.
|
||||
-- * @{#SPAWN.SpawnInitCallSign}(): Set a specific callsign for a spawned group.
|
||||
--
|
||||
-- ### Speed
|
||||
--
|
||||
-- *{#SPAWN.InitSpeedMps}(): Set the initial speed on spawning in meters per second.
|
||||
-- *{#SPAWN.InitSpeedKph}(): Set the initial speed on spawning in kilometers per hour.
|
||||
-- *{#SPAWN.InitSpeedKnots}(): Set the initial speed on spawning in knots.
|
||||
-- * @{#SPAWN.InitSpeedMps}(): Set the initial speed on spawning in meters per second.
|
||||
-- * @{#SPAWN.InitSpeedKph}(): Set the initial speed on spawning in kilometers per hour.
|
||||
-- * @{#SPAWN.InitSpeedKnots}(): Set the initial speed on spawning in knots.
|
||||
--
|
||||
-- ## SPAWN **Spawn** methods
|
||||
--
|
||||
@@ -620,12 +620,14 @@ end
|
||||
-- and any spaces before and after the resulting name are removed.
|
||||
-- IMPORTANT! This method MUST be the first used after :New !!!
|
||||
-- @param #SPAWN self
|
||||
-- @param #boolean KeepUnitNames (optional) If true, the unit names are kept, false or not provided to make new unit names.
|
||||
-- @param #boolean KeepUnitNames (optional) If true, the unit names are kept, false or not provided create new unit names.
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitKeepUnitNames( KeepUnitNames )
|
||||
self:F()
|
||||
|
||||
self.SpawnInitKeepUnitNames = KeepUnitNames or true
|
||||
self.SpawnInitKeepUnitNames = false
|
||||
|
||||
if KeepUnitNames == true then self.SpawnInitKeepUnitNames = true end
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -1209,11 +1211,12 @@ end
|
||||
-- @param #number Major Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitCallSign(ID,Name,Minor,Major)
|
||||
local Name = Name or "Enfield"
|
||||
self.SpawnInitCallSign = true
|
||||
self.SpawnInitCallSignID = ID or 1
|
||||
self.SpawnInitCallSignMinor = Minor or 1
|
||||
self.SpawnInitCallSignMajor = Major or 1
|
||||
self.SpawnInitCallSignName = string.lower(Name) or "enfield"
|
||||
self.SpawnInitCallSignName=string.lower(Name):gsub("^%l", string.upper)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -1609,8 +1612,8 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||
numTries = numTries + 1
|
||||
inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||
self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
|
||||
self:I(SpawnZone)
|
||||
--self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
|
||||
--self:I(SpawnZone)
|
||||
end
|
||||
end
|
||||
if (not inZone) then
|
||||
@@ -3436,24 +3439,28 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
end
|
||||
|
||||
if self.SpawnInitKeepUnitNames == false then
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
if not string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
|
||||
end
|
||||
SpawnTemplate.units[UnitID].unitId = nil
|
||||
end
|
||||
else
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
local SpawnInitKeepUnitIFF = false
|
||||
if string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||
SpawnInitKeepUnitIFF = true
|
||||
end
|
||||
local UnitPrefix, Rest
|
||||
if SpawnInitKeepUnitIFF == false then
|
||||
UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
||||
self:T( { UnitPrefix, Rest } )
|
||||
else
|
||||
UnitPrefix=SpawnTemplate.units[UnitID].name
|
||||
local SpawnInitKeepUnitIFF = false
|
||||
if string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||
SpawnInitKeepUnitIFF = true
|
||||
end
|
||||
SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||
local UnitPrefix, Rest
|
||||
if SpawnInitKeepUnitIFF == false then
|
||||
UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
||||
SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||
self:T( { UnitPrefix, Rest } )
|
||||
--else
|
||||
--UnitPrefix=SpawnTemplate.units[UnitID].name
|
||||
end
|
||||
--SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||
|
||||
SpawnTemplate.units[UnitID].unitId = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3090,9 +3090,25 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
|
||||
-- points for the drawings are saved in local space, so add the object's map x and y coordinates to get
|
||||
-- world space points we can use
|
||||
for _, point in UTILS.spairs(object["points"]) do
|
||||
-- check if we want to skip adding a point
|
||||
local skip = false
|
||||
local p = {x = object["mapX"] + point["x"],
|
||||
y = object["mapY"] + point["y"] }
|
||||
table.add(points, p)
|
||||
|
||||
-- Check if the same coordinates already exist in the list, skip if they do
|
||||
-- This can happen when drawing a Polygon in Free mode, DCS adds points on
|
||||
-- top of each other that are in the `mission` file, but not visible in the
|
||||
-- Mission Editor
|
||||
for _, pt in pairs(points) do
|
||||
if pt.x == p.x and pt.y == p.y then
|
||||
skip = true
|
||||
end
|
||||
end
|
||||
|
||||
-- if it's a unique point, add it
|
||||
if not skip then
|
||||
table.add(points, p)
|
||||
end
|
||||
end
|
||||
elseif object["polygonMode"] == "rect" then
|
||||
-- the points for a rect are saved as local coordinates with an angle. To get the world space points from this
|
||||
@@ -3110,6 +3126,7 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
|
||||
|
||||
points = {p1, p2, p3, p4}
|
||||
else
|
||||
-- bring the Arrow code over from Shape/Polygon
|
||||
-- something else that might be added in the future
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user