mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
af3dbe2f86
@ -59,7 +59,13 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
||||
|
||||
|
||||
for AirbaseID, Airbase in pairs( self.Airbases ) do
|
||||
Airbase.ZoneBoundary = _DATABASE:FindAirbase( AirbaseID ):GetZone()
|
||||
-- Specified ZoneBoundary is used if setted or Airbase radius by default
|
||||
if Airbase.ZoneBoundary then
|
||||
Airbase.ZoneBoundary = ZONE_POLYGON_BASE:New( "Boundary " .. AirbaseID, Airbase.ZoneBoundary )
|
||||
else
|
||||
Airbase.ZoneBoundary = _DATABASE:FindAirbase( AirbaseID ):GetZone()
|
||||
end
|
||||
|
||||
Airbase.ZoneRunways = {}
|
||||
for PointsRunwayID, PointsRunway in pairs( Airbase.PointsRunways ) do
|
||||
Airbase.ZoneRunways[PointsRunwayID] = ZONE_POLYGON_BASE:New( "Runway " .. PointsRunwayID, PointsRunway )
|
||||
@ -3263,5 +3269,310 @@ function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
||||
end
|
||||
|
||||
|
||||
--- @type ATC_GROUND_MARIANAISLANDS
|
||||
-- @extends #ATC_GROUND
|
||||
|
||||
|
||||
|
||||
--- # ATC\_GROUND\_MARIANA, extends @{#ATC_GROUND}
|
||||
--
|
||||
-- The ATC\_GROUND\_MARIANA class monitors the speed of the airplanes at the airbase during taxi.
|
||||
-- The pilots may not drive faster than the maximum speed for the airbase, or they will be despawned.
|
||||
--
|
||||
-- ---
|
||||
--
|
||||
-- 
|
||||
--
|
||||
-- ---
|
||||
--
|
||||
-- The default maximum speed for the airbases at Persian Gulf is **50 km/h**. Warnings are given if this speed limit is trespassed.
|
||||
-- Players will be immediately kicked when driving faster than **150 km/h** on the taxi way.
|
||||
--
|
||||
-- The ATC\_GROUND\_MARIANA class monitors the speed of the airplanes at the airbase during taxi.
|
||||
-- The pilots may not drive faster than the maximum speed for the airbase, or they will be despawned.
|
||||
--
|
||||
-- The pilot will receive 3 times a warning during speeding. After the 3rd warning, if the pilot is still driving
|
||||
-- faster than the maximum allowed speed, the pilot will be kicked.
|
||||
--
|
||||
-- Different airbases have different maximum speeds, according safety regulations.
|
||||
--
|
||||
-- # Airbases monitored
|
||||
--
|
||||
-- The following airbases are monitored at the Mariana Island region.
|
||||
-- Use the @{Wrapper.Airbase#AIRBASE.MarianaIslands} enumeration to select the airbases to be monitored.
|
||||
--
|
||||
-- * AIRBASE.MarianaIslands.Rota_Intl
|
||||
-- * AIRBASE.MarianaIslands.Andersen_AFB
|
||||
-- * AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl
|
||||
-- * AIRBASE.MarianaIslands.Saipan_Intl
|
||||
-- * AIRBASE.MarianaIslands.Tinian_Intl
|
||||
-- * AIRBASE.MarianaIslands.Olf_Orote
|
||||
--
|
||||
-- # Installation
|
||||
--
|
||||
-- ## In Single Player Missions
|
||||
--
|
||||
-- ATC\_GROUND is fully functional in single player.
|
||||
--
|
||||
-- ## In Multi Player Missions
|
||||
--
|
||||
-- ATC\_GROUND is functional in multi player, however ...
|
||||
--
|
||||
-- Due to a bug in DCS since release 1.5, the despawning of clients are not anymore working in multi player.
|
||||
-- To **work around this problem**, a much better solution has been made, using the **slot blocker** script designed
|
||||
-- by Ciribob.
|
||||
--
|
||||
-- With the help of __Ciribob__, this script has been extended to also kick client players while in flight.
|
||||
-- ATC\_GROUND is communicating with this modified script to kick players!
|
||||
--
|
||||
-- Install the file **SimpleSlotBlockGameGUI.lua** on the server, following the installation instructions described by Ciribob.
|
||||
--
|
||||
-- [Simple Slot Blocker from Ciribob & FlightControl](https://github.com/ciribob/DCS-SimpleSlotBlock)
|
||||
--
|
||||
-- # Script it!
|
||||
--
|
||||
-- ## 1. ATC_GROUND_MARIANAISLANDS Constructor
|
||||
--
|
||||
-- Creates a new ATC_GROUND_MARIANAISLANDS object that will monitor pilots taxiing behaviour.
|
||||
--
|
||||
-- -- This creates a new ATC_GROUND_MARIANAISLANDS object.
|
||||
--
|
||||
-- -- Monitor for these clients the airbases.
|
||||
-- AirbasePoliceCaucasus = ATC_GROUND_MARIANAISLANDS:New()
|
||||
--
|
||||
-- ATC_Ground = ATC_GROUND_MARIANAISLANDS:New(
|
||||
-- { AIRBASE.MarianaIslands.Andersen_AFB,
|
||||
-- AIRBASE.MarianaIslands.Saipan_Intl
|
||||
-- }
|
||||
-- )
|
||||
--
|
||||
--
|
||||
-- ## 2. Set various options
|
||||
--
|
||||
-- There are various methods that you can use to tweak the behaviour of the ATC\_GROUND classes.
|
||||
--
|
||||
-- ### 2.1 Speed limit at an airbase.
|
||||
--
|
||||
-- * @{#ATC_GROUND.SetKickSpeed}(): Set the speed limit allowed at an airbase in meters per second.
|
||||
-- * @{#ATC_GROUND.SetKickSpeedKmph}(): Set the speed limit allowed at an airbase in kilometers per hour.
|
||||
-- * @{#ATC_GROUND.SetKickSpeedMiph}(): Set the speed limit allowed at an airbase in miles per hour.
|
||||
--
|
||||
-- ### 2.2 Prevent Takeoff at an airbase. Players will be kicked immediately.
|
||||
--
|
||||
-- * @{#ATC_GROUND.SetMaximumKickSpeed}(): Set the maximum speed allowed at an airbase in meters per second.
|
||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
||||
--
|
||||
---- @field #ATC_GROUND_MARIANAISLANDS
|
||||
ATC_GROUND_MARIANAISLANDS = {
|
||||
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
||||
Airbases = {
|
||||
|
||||
[AIRBASE.MarianaIslands.Andersen_AFB] = {
|
||||
ZoneBoundary = {
|
||||
[1]={["y"]=16534.138036037,["x"]=11357.42159178,},
|
||||
[2]={["y"]=16193.406442738,["x"]=12080.012957533,},
|
||||
[3]={["y"]=13846.966851869,["x"]=12017.348398727,},
|
||||
[4]={["y"]=13085.815989171,["x"]=11686.317876875,},
|
||||
[5]={["y"]=13157.991797443,["x"]=11307.826209991,},
|
||||
[6]={["y"]=12055.725179065,["x"]=10795.955695916,},
|
||||
[7]={["y"]=12762.455491112,["x"]=8890.9830441032,},
|
||||
[8]={["y"]=15955.829493693,["x"]=10333.527220132,},
|
||||
[9]={["y"]=16537.500532414,["x"]=11302.009499603,},
|
||||
},
|
||||
PointsRunways = {
|
||||
[1]={
|
||||
[1]={["y"]=12586.683049611,["x"]=10224.374497932,},
|
||||
[2]={["y"]=16191.720475696,["x"]=11791.299100017,},
|
||||
[3]={["y"]=16126.93956642,["x"]=11938.855615591,},
|
||||
[4]={["y"]=12520.758127164,["x"]=10385.177131701,},
|
||||
[5]={["y"]=12584.654720512,["x"]=10227.416991581,},
|
||||
},
|
||||
[2]={
|
||||
[1]={["y"]=12663.030391743,["x"]=9661.9623015306,},
|
||||
[2]={["y"]=16478.347303358,["x"]=11328.665745976,},
|
||||
[3]={["y"]=16405.4731048,["x"]=11479.11570429,},
|
||||
[4]={["y"]=12597.277684174,["x"]=9817.9733769647,},
|
||||
[5]={["y"]=12661.894752524,["x"]=9674.4462086962,},
|
||||
},
|
||||
},
|
||||
},
|
||||
[AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl] = {
|
||||
ZoneBoundary = {
|
||||
[1]={["y"]=2288.5182403943,["x"]=1469.0170841716,},
|
||||
[2]={["y"]=1126.2025877996,["x"]=1174.37135631,},
|
||||
[3]={["y"]=-2015.6461924287,["x"]=-484.62000718931,},
|
||||
[4]={["y"]=-2102.1292389114,["x"]=-988.03393750566,},
|
||||
[5]={["y"]=476.03853524366,["x"]=-1220.1783269883,},
|
||||
[6]={["y"]=2059.2220058047,["x"]=78.889693514402,},
|
||||
[7]={["y"]=1898.1396965104,["x"]=705.67531284795,},
|
||||
[8]={["y"]=2760.1768681934,["x"]=1026.0681119777,},
|
||||
[9]={["y"]=2317.2278959994,["x"]=1460.8143254273,},
|
||||
},
|
||||
PointsRunways = {
|
||||
[1]={
|
||||
[1]={["y"]=-1872.6620108821,["x"]=-924.3572605835,},
|
||||
[2]={["y"]=1763.4754603305,["x"]=735.35988877983,},
|
||||
[3]={["y"]=1700.6941677961,["x"]=866.32615476157,},
|
||||
[4]={["y"]=-1934.0078007732,["x"]=-779.8149298453,},
|
||||
[5]={["y"]=-1875.0113982627,["x"]=-914.95971106094,},
|
||||
},
|
||||
[2]={
|
||||
[1]={["y"]=-1512.9403660377,["x"]=-1005.5903386188,},
|
||||
[2]={["y"]=1577.9055714735,["x"]=413.22750176368,},
|
||||
[3]={["y"]=1523.1182807849,["x"]=543.89726442232,},
|
||||
[4]={["y"]=-1572.5102998047,["x"]=-867.04004322806,},
|
||||
[5]={["y"]=-1514.2790162347,["x"]=-1003.5823633233,},
|
||||
},
|
||||
},
|
||||
},
|
||||
[AIRBASE.MarianaIslands.Rota_Intl] = {
|
||||
ZoneBoundary = {
|
||||
[1]={["y"]=47237.615412849,["x"]=76048.890408862,},
|
||||
[2]={["y"]=49938.030053628,["x"]=75921.721582932,},
|
||||
[3]={["y"]=49931.24873272,["x"]=75735.184004851,},
|
||||
[4]={["y"]=49295.999227075,["x"]=75754.716414519,},
|
||||
[5]={["y"]=49286.963307515,["x"]=75510.037806569,},
|
||||
[6]={["y"]=48774.280745707,["x"]=75513.331990155,},
|
||||
[7]={["y"]=48785.021396773,["x"]=75795.691662161,},
|
||||
[8]={["y"]=47232.749278491,["x"]=75839.239059146,},
|
||||
[9]={["y"]=47236.687866223,["x"]=76042.706764692,},
|
||||
},
|
||||
PointsRunways = {
|
||||
[1]={
|
||||
[1]={["y"]=49741.295228062,["x"]=75901.50955922,},
|
||||
[2]={["y"]=49739.033213305,["x"]=75768.333440425,},
|
||||
[3]={["y"]=47448.460520408,["x"]=75857.400271466,},
|
||||
[4]={["y"]=47452.270177742,["x"]=75999.965448133,},
|
||||
[5]={["y"]=49738.502011054,["x"]=75905.338915708,},
|
||||
},
|
||||
},
|
||||
},
|
||||
[AIRBASE.MarianaIslands.Saipan_Intl] = {
|
||||
ZoneBoundary = {
|
||||
[1]={["y"]=100489.08491445,["x"]=179799.05158855,},
|
||||
[2]={["y"]=100869.73415313,["x"]=179948.98719903,},
|
||||
[3]={["y"]=101364.78967515,["x"]=180831.98517043,},
|
||||
[4]={["y"]=101563.85713359,["x"]=180885.21496237,},
|
||||
[5]={["y"]=101733.92591034,["x"]=180457.73296886,},
|
||||
[6]={["y"]=103340.30228775,["x"]=180990.08362622,},
|
||||
[7]={["y"]=103459.55080438,["x"]=180453.77747027,},
|
||||
[8]={["y"]=100406.63048095,["x"]=179266.60983762,},
|
||||
[9]={["y"]=100225.55027532,["x"]=179423.9380961,},
|
||||
[10]={["y"]=100477.48558937,["x"]=179791.9827288,},
|
||||
},
|
||||
PointsRunways = {
|
||||
[1]={
|
||||
[1]={["y"]=103170.38882002,["x"]=180654.56630524,},
|
||||
[2]={["y"]=103235.37868835,["x"]=180497.25368418,},
|
||||
[3]={["y"]=100564.72969504,["x"]=179435.41443498,},
|
||||
[4]={["y"]=100509.30718722,["x"]=179584.65394733,},
|
||||
[5]={["y"]=103163.53918905,["x"]=180651.82645285,},
|
||||
},
|
||||
[2]={
|
||||
[1]={["y"]=103048.83223261,["x"]=180819.94107128,},
|
||||
[2]={["y"]=103087.60579257,["x"]=180720.06315265,},
|
||||
[3]={["y"]=101037.52694966,["x"]=179899.50061624,},
|
||||
[4]={["y"]=100994.61708907,["x"]=180009.33151758,},
|
||||
[5]={["y"]=103043.26643227,["x"]=180820.40488798,},
|
||||
},
|
||||
},
|
||||
},
|
||||
[AIRBASE.MarianaIslands.Tinian_Intl] = {
|
||||
ZoneBoundary = {
|
||||
[1]={["y"]=88393.477575413,["x"]=166704.16076438,},
|
||||
[2]={["y"]=91581.732441809,["x"]=167402.54409276,},
|
||||
[3]={["y"]=91533.451647402,["x"]=166826.23670062,},
|
||||
[4]={["y"]=90827.604136952,["x"]=166699.75590414,},
|
||||
[5]={["y"]=90894.853975623,["x"]=166375.37836304,},
|
||||
[6]={["y"]=89995.027922869,["x"]=166224.92495935,},
|
||||
[7]={["y"]=88937.62899352,["x"]=166244.48573911,},
|
||||
[8]={["y"]=88408.916178231,["x"]=166480.39896864,},
|
||||
[9]={["y"]=88387.745481732,["x"]=166685.82715656,},
|
||||
},
|
||||
PointsRunways = {
|
||||
[1]={
|
||||
[1]={["y"]=91329.480937912,["x"]=167204.44064529,},
|
||||
[2]={["y"]=91363.95475433,["x"]=167038.15603429,},
|
||||
[3]={["y"]=88585.849307337,["x"]=166520.3807647,},
|
||||
[4]={["y"]=88554.422227212,["x"]=166686.49505251,},
|
||||
[5]={["y"]=91318.8152578,["x"]=167203.31794212,},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
--- Creates a new ATC_GROUND_MARIANAISLANDS object.
|
||||
-- @param #ATC_GROUND_MARIANAISLANDS self
|
||||
-- @param AirbaseNames A list {} of airbase names (Use AIRBASE.MarianaIslands enumerator).
|
||||
-- @return #ATC_GROUND_MARIANAISLANDS self
|
||||
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, ATC_GROUND:New( self.Airbases, AirbaseNames ) )
|
||||
|
||||
self:SetKickSpeedKmph( 50 )
|
||||
self:SetMaximumKickSpeedKmph( 150 )
|
||||
|
||||
-- -- Andersen
|
||||
-- local AndersenBoundary = GROUP:FindByName( "Andersen Boundary" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Andersen_AFB].ZoneBoundary = ZONE_POLYGON:New( "Andersen Boundary", AndersenBoundary ):SmokeZone(SMOKECOLOR.White):Flush()
|
||||
--
|
||||
-- local AndersenRunway1 = GROUP:FindByName( "Andersen Runway 1" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Andersen_AFB].ZoneRunways[1] = ZONE_POLYGON:New( "Andersen Runway 1", AndersenRunway1 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
-- local AndersenRunway2 = GROUP:FindByName( "Andersen Runway 2" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Andersen_AFB].ZoneRunways[2] = ZONE_POLYGON:New( "Andersen Runway 2", AndersenRunway2 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
--
|
||||
-- -- Antonio_B_Won_Pat_International_Airport
|
||||
-- local AntonioBoundary = GROUP:FindByName( "Antonio Boundary" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl].ZoneBoundary = ZONE_POLYGON:New( "Antonio Boundary", AntonioBoundary ):SmokeZone(SMOKECOLOR.White):Flush()
|
||||
--
|
||||
-- local AntonioRunway1 = GROUP:FindByName( "Antonio Runway 1" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl].ZoneRunways[1] = ZONE_POLYGON:New( "Antonio Runway 1", AntonioRunway1 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
-- local AntonioRunway2 = GROUP:FindByName( "Antonio Runway 2" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl].ZoneRunways[2] = ZONE_POLYGON:New( "Antonio Runway 2", AntonioRunway2 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
--
|
||||
-- -- Rota_International_Airport
|
||||
-- local RotaBoundary = GROUP:FindByName( "Rota Boundary" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Rota_Intl].ZoneBoundary = ZONE_POLYGON:New( "Rota Boundary", RotaBoundary ):SmokeZone(SMOKECOLOR.White):Flush()
|
||||
--
|
||||
-- local RotaRunway1 = GROUP:FindByName( "Rota Runway 1" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Rota_Intl].ZoneRunways[1] = ZONE_POLYGON:New( "Rota Runway 1", RotaRunway1 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
--
|
||||
-- -- Saipan_International_Airport
|
||||
-- local SaipanBoundary = GROUP:FindByName( "Saipan Boundary" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Saipan_Intl].ZoneBoundary = ZONE_POLYGON:New( "Saipan Boundary", SaipanBoundary ):SmokeZone(SMOKECOLOR.White):Flush()
|
||||
--
|
||||
-- local SaipanRunway1 = GROUP:FindByName( "Saipan Runway 1" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Saipan_Intl].ZoneRunways[1] = ZONE_POLYGON:New( "Saipan Runway 1", SaipanRunway1 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
-- local SaipanRunway2 = GROUP:FindByName( "Saipan Runway 2" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Saipan_Intl].ZoneRunways[2] = ZONE_POLYGON:New( "Saipan Runway 2", SaipanRunway2 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
--
|
||||
--
|
||||
-- -- Tinian_International_Airport
|
||||
-- local TinianBoundary = GROUP:FindByName( "Tinian Boundary" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Tinian_Intl].ZoneBoundary = ZONE_POLYGON:New( "Tinian Boundary", TinianBoundary ):SmokeZone(SMOKECOLOR.White):Flush()
|
||||
--
|
||||
-- local TinianRunway1 = GROUP:FindByName( "Tinian Runway 1" )
|
||||
-- self.Airbases[AIRBASE.MarianaIslands.Tinian_Intl].ZoneRunways[1] = ZONE_POLYGON:New( "Tinian Runway 1", TinianRunway1 ):SmokeZone(SMOKECOLOR.Red):Flush()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Start SCHEDULER for ATC_GROUND_MARIANAISLANDS object.
|
||||
-- @param #ATC_GROUND_MARIANAISLANDS self
|
||||
-- @param RepeatScanSeconds Time in second for defining occurency of alerts.
|
||||
-- @return nothing
|
||||
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||
end
|
||||
|
||||
@ -667,8 +667,6 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
self.Players[PlayerName].ThreatLevel = UnitThreatLevel
|
||||
self.Players[PlayerName].ThreatType = UnitThreatType
|
||||
|
||||
-- TODO: DCS bug concerning Units with skill level client don't get destroyed in multi player. This logic is deactivated until this bug gets fixed.
|
||||
--[[
|
||||
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then
|
||||
if self.Players[PlayerName].PenaltyWarning < 1 then
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
||||
@ -684,8 +682,6 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
):ToAll()
|
||||
UnitData:GetGroup():Destroy()
|
||||
end
|
||||
--]]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1617,6 +1617,30 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
-- Scattered 4
|
||||
clouddens=4
|
||||
elseif cloudspreset:find("RainyPreset") then
|
||||
-- Overcast + Rain
|
||||
clouddens=9
|
||||
if temperature>5 then
|
||||
precepitation=1 -- rain
|
||||
else
|
||||
precepitation=3 -- snow
|
||||
end
|
||||
elseif cloudspreset:find("RainyPreset1") then
|
||||
-- Overcast + Rain
|
||||
clouddens=9
|
||||
if temperature>5 then
|
||||
precepitation=1 -- rain
|
||||
else
|
||||
precepitation=3 -- snow
|
||||
end
|
||||
elseif cloudspreset:find("RainyPreset2") then
|
||||
-- Overcast + Rain
|
||||
clouddens=9
|
||||
if temperature>5 then
|
||||
precepitation=1 -- rain
|
||||
else
|
||||
precepitation=3 -- snow
|
||||
end
|
||||
elseif cloudspreset:find("RainyPreset3") then
|
||||
-- Overcast + Rain
|
||||
clouddens=9
|
||||
if temperature>5 then
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original)
|
||||
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original), Thanks to: Shadowze, Cammel (testing)
|
||||
-- @module Ops.CSAR
|
||||
-- @image OPS_CSAR.jpg
|
||||
|
||||
-- Date: June 2021
|
||||
-- Date: July 2021
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||
@ -70,6 +70,7 @@
|
||||
-- self.allowDownedPilotCAcontrol = false -- Set to false if you don\'t want to allow control by Combined Arms.
|
||||
-- self.allowFARPRescue = true -- allows pilots to be rescued by landing at a FARP or Airbase. Else MASH only!
|
||||
-- self.autosmoke = false -- automatically smoke a downed pilot\'s location when a heli is near.
|
||||
-- self.autosmokedistance = 1000 -- distance for autosmoke
|
||||
-- self.coordtype = 1 -- Use Lat/Long DDM (0), Lat/Long DMS (1), MGRS (2), Bullseye imperial (3) or Bullseye metric (4) for coordinates.
|
||||
-- self.csarOncrash = false -- (WIP) If set to true, will generate a downed pilot when a plane crashes as well.
|
||||
-- self.enableForAI = false -- set to false to disable AI pilots from being rescued.
|
||||
@ -240,7 +241,7 @@ CSAR.AircraftType["Mi-24V"] = 8
|
||||
|
||||
--- CSAR class version.
|
||||
-- @field #string version
|
||||
CSAR.version="0.1.5r3"
|
||||
CSAR.version="0.1.7r2"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@ -290,7 +291,7 @@ function CSAR:New(Coalition, Template, Alias)
|
||||
self.alias="Red Cross"
|
||||
if self.coalition then
|
||||
if self.coalition==coalition.side.RED then
|
||||
self.alias="Спасение"
|
||||
self.alias="IFRC"
|
||||
elseif self.coalition==coalition.side.BLUE then
|
||||
self.alias="CSAR"
|
||||
end
|
||||
@ -356,15 +357,18 @@ function CSAR:New(Coalition, Template, Alias)
|
||||
self.mashprefix = {"MASH"} -- prefixes used to find MASHes
|
||||
self.mash = SET_GROUP:New():FilterCoalitions(self.coalition):FilterPrefixes(self.mashprefix):FilterOnce() -- currently only GROUP objects, maybe support STATICs also?
|
||||
self.autosmoke = false -- automatically smoke location when heli is near
|
||||
self.autosmokedistance = 1000 -- distance for autosmoke
|
||||
-- added 0.1.4
|
||||
self.limitmaxdownedpilots = true
|
||||
self.maxdownedpilots = 25
|
||||
|
||||
-- generate Frequencies
|
||||
self:_GenerateVHFrequencies()
|
||||
|
||||
-- WARNING - here\'ll be dragons
|
||||
-- for this to work you need to de-sanitize your mission environment in <DCS root>\Scripts\MissionScripting.lua
|
||||
-- needs SRS => 1.9.6 to work (works on the *server* side)
|
||||
self.useSRS = false -- Use FF\'s SRS integration
|
||||
self.SRSPath = "E:\\Program Files\\DCS-SimpleRadio-Standalone\\" -- adjust your own path in your server(!)
|
||||
self.SRSPath = "E:\\Progra~1\\DCS-SimpleRadio-Standalone\\" -- adjust your own path in your server(!)
|
||||
self.SRSchannel = 300 -- radio channel
|
||||
self.SRSModulation = radio.modulation.AM -- modulation
|
||||
|
||||
@ -527,15 +531,18 @@ end
|
||||
-- @param #CSAR self
|
||||
-- @param #number country Country for template.
|
||||
-- @param Core.Point#COORDINATE point Coordinate to spawn at.
|
||||
-- @param #number frequency Frequency of the pilot's beacon
|
||||
-- @return Wrapper.Group#GROUP group The #GROUP object.
|
||||
-- @return #string alias The alias name.
|
||||
function CSAR:_SpawnPilotInField(country,point)
|
||||
self:T({country,point})
|
||||
function CSAR:_SpawnPilotInField(country,point,frequency)
|
||||
self:T({country,point,frequency})
|
||||
local freq = frequency or 1000
|
||||
local freq = freq / 1000 -- kHz
|
||||
for i=1,10 do
|
||||
math.random(i,10000)
|
||||
end
|
||||
local template = self.template
|
||||
local alias = string.format("Downed Pilot-%d",math.random(1,10000))
|
||||
local alias = string.format("Pilot %.2fkHz-%d", freq, math.random(1,99))
|
||||
local coalition = self.coalition
|
||||
local pilotcacontrol = self.allowDownedPilotCAcontrol -- Switch AI on/oof - is this really correct for CA?
|
||||
local _spawnedGroup = SPAWN
|
||||
@ -545,7 +552,7 @@ function CSAR:_SpawnPilotInField(country,point)
|
||||
:InitAIOnOff(pilotcacontrol)
|
||||
:InitDelayOff()
|
||||
:SpawnFromCoordinate(point)
|
||||
|
||||
|
||||
return _spawnedGroup, alias -- Wrapper.Group#GROUP object
|
||||
end
|
||||
|
||||
@ -599,19 +606,21 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
||||
self:T({_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description})
|
||||
|
||||
local template = self.template
|
||||
|
||||
local _spawnedGroup, _alias = self:_SpawnPilotInField(_country,_point)
|
||||
|
||||
if not _freq then
|
||||
_freq = self:_GenerateADFFrequency()
|
||||
if not _freq then _freq = 333000 end --noob catch
|
||||
end
|
||||
|
||||
local _spawnedGroup, _alias = self:_SpawnPilotInField(_country,_point,_freq)
|
||||
|
||||
local _typeName = _typeName or "PoW"
|
||||
|
||||
if not noMessage then
|
||||
self:_DisplayToAllSAR("MAYDAY MAYDAY! " .. _typeName .. " is down. ", self.coalition, 10)
|
||||
--local m = MESSAGE:New("MAYDAY MAYDAY! " .. _typeName .. " is down. ",10,"INFO"):ToCoalition(self.coalition)
|
||||
end
|
||||
|
||||
if not _freq then
|
||||
_freq = self:_GenerateADFFrequency()
|
||||
if not _freq then _freq = "333.25" end --noob catch
|
||||
end
|
||||
|
||||
if _freq then
|
||||
self:_AddBeaconToGroup(_spawnedGroup, _freq)
|
||||
end
|
||||
@ -654,7 +663,7 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
||||
return
|
||||
end
|
||||
|
||||
local _description = _description or "none"
|
||||
local _description = _description or "Unknown"
|
||||
|
||||
local pos = {}
|
||||
if _randomPoint then
|
||||
@ -673,7 +682,7 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
||||
_country = country.id.UN_PEACEKEEPERS
|
||||
end
|
||||
|
||||
self:_AddCsar(_coalition, _country, pos, "PoW", "Unknown", nil, freq, _nomessage, _description)
|
||||
self:_AddCsar(_coalition, _country, pos, "PoW", _description, nil, freq, _nomessage, _description)
|
||||
|
||||
return self
|
||||
end
|
||||
@ -813,7 +822,7 @@ function CSAR:_EventHandler(EventData)
|
||||
|
||||
-- all checks passed, get going.
|
||||
local _freq = self:_GenerateADFFrequency()
|
||||
self:_AddCsar(_coalition, _unit:GetCountry(), _unit:GetCoordinate() , _unit:GetTypeName(), _unit:GetName(), _event.IniPlayerName, _freq, false, 0)
|
||||
self:_AddCsar(_coalition, _unit:GetCountry(), _unit:GetCoordinate() , _unit:GetTypeName(), _unit:GetName(), _event.IniPlayerName, _freq, false, "none")
|
||||
|
||||
return true
|
||||
|
||||
@ -980,7 +989,7 @@ function CSAR:_CheckWoundedGroupStatus(heliname,woundedgroupname)
|
||||
_downedpilot.timestamp = timer.getAbsTime()
|
||||
self:__Approach(-5,heliname,woundedgroupname)
|
||||
end
|
||||
else
|
||||
elseif _distance >= 3000 and _distance < 5000 then
|
||||
self.heliVisibleMessage[_lookupKeyHeli] = nil
|
||||
--reschedule as units aren\'t dead yet , schedule for a bit slower though as we\'re far away
|
||||
_downedpilot.timestamp = timer.getAbsTime()
|
||||
@ -1096,7 +1105,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
|
||||
local _reset = true
|
||||
|
||||
if (self.autosmoke == true) and (_distance < 500) then
|
||||
if (self.autosmoke == true) and (_distance < self.autosmokedistance) then
|
||||
self:_PopSmokeForGroup(_woundedGroupName, _woundedLeader)
|
||||
end
|
||||
|
||||
@ -1631,7 +1640,7 @@ function CSAR:_AddMedevacMenuItem()
|
||||
for _key, _group in pairs (_allHeliGroups) do
|
||||
local _unit = _group:GetUnit(1) -- Asume that there is only one unit in the flight for players
|
||||
if _unit then
|
||||
if _unit:IsAlive() then
|
||||
if _unit:IsAlive() and _unit:IsPlayer() then
|
||||
local unitName = _unit:GetName()
|
||||
_UnitList[unitName] = unitName
|
||||
end -- end isAlive
|
||||
@ -1820,10 +1829,11 @@ function CSAR:_RefreshRadioBeacons()
|
||||
if self:_CountActiveDownedPilots() > 0 then
|
||||
local PilotTable = self.downedPilots
|
||||
for _,_pilot in pairs (PilotTable) do
|
||||
self:T({_pilot})
|
||||
local pilot = _pilot -- #CSAR.DownedPilot
|
||||
local group = pilot.group
|
||||
local frequency = pilot.frequency or 0.0 -- thanks to @Thrud
|
||||
if group:IsAlive() and frequency > 0.0 then
|
||||
local frequency = pilot.frequency or 0 -- thanks to @Thrud
|
||||
if group and group:IsAlive() and frequency > 0 then
|
||||
self:_AddBeaconToGroup(group,frequency)
|
||||
end
|
||||
end
|
||||
@ -1880,7 +1890,6 @@ function CSAR:onafterStart(From, Event, To)
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||
self:_GenerateVHFrequencies()
|
||||
if self.useprefix then
|
||||
local prefixes = self.csarPrefix or {}
|
||||
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefixes):FilterCategoryHelicopter():FilterStart()
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original)
|
||||
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original), Thanks to: Shadowze, Cammel (testing)
|
||||
-- @module Ops.CTLD
|
||||
-- @image OPS_CTLD.jpg
|
||||
|
||||
@ -55,10 +55,10 @@ CTLD_CARGO = {
|
||||
-- @type CTLD_CARGO.Enum
|
||||
-- @field #string Type Type of Cargo.
|
||||
CTLD_CARGO.Enum = {
|
||||
VEHICLE = "Vehicle", -- #string vehicles
|
||||
TROOPS = "Troops", -- #string troops
|
||||
FOB = "FOB", -- #string FOB
|
||||
CRATE = "CRATE", -- #string crate
|
||||
["VEHICLE"] = "Vehicle", -- #string vehicles
|
||||
["TROOPS"] = "Troops", -- #string troops
|
||||
["FOB"] = "FOB", -- #string FOB
|
||||
["CRATE"] = "Crate", -- #string crate
|
||||
}
|
||||
|
||||
--- Function to create new CTLD_CARGO object.
|
||||
@ -260,7 +260,7 @@ do
|
||||
--
|
||||
-- The following options are available (with their defaults). Only set the ones you want changed:
|
||||
--
|
||||
-- my_ctld.useprefix = true -- Adjust *before* starting CTLD. If set to false, *all* choppers of the coalition side will be enabled for CTLD.
|
||||
-- my_ctld.useprefix = true -- (DO NOT SWITCH THIS OFF UNLESS YOU KNOW WHAT YOU ARE DOING!) Adjust **before** starting CTLD. If set to false, *all* choppers of the coalition side will be enabled for CTLD.
|
||||
-- my_ctld.CrateDistance = 30 -- List and Load crates in this radius only.
|
||||
-- my_ctld.maximumHoverHeight = 15 -- Hover max this high to load.
|
||||
-- my_ctld.minimumHoverHeight = 4 -- Hover min this low to load.
|
||||
@ -300,12 +300,12 @@ do
|
||||
-- Activate a zone:
|
||||
--
|
||||
-- -- Activate zone called Name of type #CTLD.CargoZoneType ZoneType:
|
||||
-- my_ctld:ActivateZone(Name,ZoneType)
|
||||
-- my_ctld:ActivateZone(Name,CTLD.CargoZoneType.MOVE)
|
||||
--
|
||||
-- Deactivate a zone:
|
||||
--
|
||||
-- -- Deactivate zone called Name of type #CTLD.CargoZoneType ZoneType:
|
||||
-- my_ctld:DeactivateZone(Name,ZoneType)
|
||||
-- my_ctld:DeactivateZone(Name,CTLD.CargoZoneType.DROP)
|
||||
--
|
||||
-- ## 3. Events
|
||||
--
|
||||
@ -316,7 +316,7 @@ do
|
||||
--
|
||||
-- This function is called when a player has loaded Troops:
|
||||
--
|
||||
-- function CTLD:OnAfterTroopsPickedUp(From, Event, To, Group, Unit, Cargo)
|
||||
-- function my_ctld:OnAfterTroopsPickedUp(From, Event, To, Group, Unit, Cargo)
|
||||
-- ... your code here ...
|
||||
-- end
|
||||
--
|
||||
@ -324,7 +324,7 @@ do
|
||||
--
|
||||
-- This function is called when a player has picked up crates:
|
||||
--
|
||||
-- function CTLD:OnAfterCratesPickedUp(From, Event, To, Group, Unit, Cargo)
|
||||
-- function my_ctld:OnAfterCratesPickedUp(From, Event, To, Group, Unit, Cargo)
|
||||
-- ... your code here ...
|
||||
-- end
|
||||
--
|
||||
@ -332,7 +332,7 @@ do
|
||||
--
|
||||
-- This function is called when a player has deployed troops into the field:
|
||||
--
|
||||
-- function CTLD:OnAfterTroopsDeployed(From, Event, To, Group, Unit, Troops)
|
||||
-- function my_ctld:OnAfterTroopsDeployed(From, Event, To, Group, Unit, Troops)
|
||||
-- ... your code here ...
|
||||
-- end
|
||||
--
|
||||
@ -340,7 +340,7 @@ do
|
||||
--
|
||||
-- This function is called when a player has deployed crates to a DROP zone:
|
||||
--
|
||||
-- function CTLD:OnAfterCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
||||
-- function my_ctld:OnAfterCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
||||
-- ... your code here ...
|
||||
-- end
|
||||
--
|
||||
@ -348,9 +348,27 @@ do
|
||||
--
|
||||
-- This function is called when a player has build a vehicle or FOB:
|
||||
--
|
||||
-- function CTLD:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||
-- function my_ctld:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||
-- ... your code here ...
|
||||
-- end
|
||||
--
|
||||
-- ## 3.6 A simple SCORING example:
|
||||
--
|
||||
-- To award player with points, using the SCORING Class (SCORING: my_Scoring, CTLD: CTLD_Cargotransport)
|
||||
--
|
||||
-- function CTLD_Cargotransport:OnAfterCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
||||
-- local points = 10
|
||||
-- local PlayerName = Unit:GetPlayerName()
|
||||
-- my_scoring:_AddPlayerFromUnit( Unit )
|
||||
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for transporting cargo crates!", PlayerName, points), points)
|
||||
-- end
|
||||
--
|
||||
-- function CTLD_Cargotransport:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||
-- local points = 5
|
||||
-- local PlayerName = Unit:GetPlayerName()
|
||||
-- my_scoring:_AddPlayerFromUnit( Unit )
|
||||
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for the construction of Units!", PlayerName, points), points)
|
||||
-- end
|
||||
--
|
||||
-- ## 4. F10 Menu structure
|
||||
--
|
||||
@ -395,7 +413,7 @@ do
|
||||
--
|
||||
-- Also, the following options need to be set to `true`:
|
||||
--
|
||||
-- my_ctld.useprefix = true -- this is true by default
|
||||
-- my_ctld.useprefix = true -- this is true by default and MUST BE ON.
|
||||
--
|
||||
-- Standard transport capabilities as per the real Hercules are:
|
||||
--
|
||||
@ -513,7 +531,7 @@ CTLD.SkipFrequencies = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="0.1.2b1"
|
||||
CTLD.version="0.1.3r2"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@ -745,6 +763,28 @@ end
|
||||
-- Helper and User Functions
|
||||
-------------------------------------------------------------------
|
||||
|
||||
--- (Internal) Function to get capabilities of a chopper
|
||||
-- @param #CTLD self
|
||||
-- @param Wrapper.Unit#UNIT Unit The unit
|
||||
-- @return #table Capabilities Table of caps
|
||||
function CTLD:_GetUnitCapabilities(Unit)
|
||||
self:T(self.lid .. " _GetUnitCapabilities")
|
||||
local _unit = Unit -- Wrapper.Unit#UNIT
|
||||
local unittype = _unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
if not capabilities or capabilities == {} then
|
||||
-- e.g. ["Ka-50"] = {type="Ka-50", crates=false, troops=false, cratelimit = 0, trooplimit = 0},
|
||||
capabilities = {}
|
||||
capabilities.troops = false
|
||||
capabilities.crates = false
|
||||
capabilities.cratelimit = 0
|
||||
capabilities.trooplimit = 0
|
||||
capabilities.type = "generic"
|
||||
end
|
||||
return capabilities
|
||||
end
|
||||
|
||||
|
||||
--- (Internal) Function to generate valid UHF Frequencies
|
||||
-- @param #CTLD self
|
||||
function CTLD:_GenerateUHFrequencies()
|
||||
@ -904,6 +944,8 @@ function CTLD:_EventHandler(EventData)
|
||||
local _unit = event.IniUnit
|
||||
local _group = event.IniGroup
|
||||
if _unit:IsHelicopter() or _group:IsHelicopter() then
|
||||
local unitname = event.IniUnitName or "none"
|
||||
self.Loaded_Cargo[unitname] = nil
|
||||
self:_RefreshF10Menus()
|
||||
end
|
||||
-- Herc support
|
||||
@ -916,6 +958,7 @@ function CTLD:_EventHandler(EventData)
|
||||
-- remove from pilot table
|
||||
local unitname = event.IniUnitName or "none"
|
||||
self.CtldUnits[unitname] = nil
|
||||
self.Loaded_Cargo[unitname] = nil
|
||||
end
|
||||
return self
|
||||
end
|
||||
@ -963,7 +1006,8 @@ function CTLD:_LoadTroops(Group, Unit, Cargotype)
|
||||
--self:Tself.lid .. string.format("Troops %s requested", cratename))
|
||||
-- see if this heli can load troops
|
||||
local unittype = unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit)
|
||||
local cantroops = capabilities.troops -- #boolean
|
||||
local trooplimit = capabilities.trooplimit -- #number
|
||||
local troopsize = cargotype:GetCratesNeeded() -- #number
|
||||
@ -984,8 +1028,11 @@ function CTLD:_LoadTroops(Group, Unit, Cargotype)
|
||||
--local m = MESSAGE:New("Sorry, we\'re crammed already!",10,"CTLD",true):ToGroup(group)
|
||||
return
|
||||
else
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
local loadcargotype = CTLD_CARGO:New(self.CargoCounter, Cargotype.Name, Cargotype.Templates, CTLD_CARGO.Enum.TROOPS, true, true, Cargotype.CratesNeeded)
|
||||
self:T({cargotype=loadcargotype})
|
||||
loaded.Troopsloaded = loaded.Troopsloaded + troopsize
|
||||
table.insert(loaded.Cargo,Cargotype)
|
||||
table.insert(loaded.Cargo,loadcargotype)
|
||||
self.Loaded_Cargo[unitname] = loaded
|
||||
self:_SendMessage("Troops boarded!", 10, false, Group)
|
||||
--local m = MESSAGE:New("Troops boarded!",10,"CTLD",true):ToGroup(group)
|
||||
@ -1006,12 +1053,12 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
||||
local cgoname = Cargo:GetName()
|
||||
--self:T{cgoname, number, drop})
|
||||
-- check if we are in LOAD zone
|
||||
local inzone = true
|
||||
|
||||
if drop then
|
||||
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.DROP)
|
||||
local inzone = false
|
||||
local drop = drop or false
|
||||
if not drop then
|
||||
inzone = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
|
||||
else
|
||||
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)
|
||||
inzone = self:IsUnitInZone(Unit,CTLD.CargoZoneType.DROP)
|
||||
end
|
||||
|
||||
if not inzone then
|
||||
@ -1021,7 +1068,8 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
||||
end
|
||||
|
||||
-- avoid crate spam
|
||||
local capabilities = self.UnitTypes[Unit:GetTypeName()] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[Unit:GetTypeName()] -- #CTLD.UnitCapabilities
|
||||
local canloadcratesno = capabilities.cratelimit
|
||||
local loaddist = self.CrateDistance or 30
|
||||
local nearcrates, numbernearby = self:_FindCratesNearby(Group,Unit,loaddist)
|
||||
@ -1046,11 +1094,14 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
||||
-- loop crates needed
|
||||
for i=1,number do
|
||||
local cratealias = string.format("%s-%d", cratetemplate, math.random(1,100000))
|
||||
local cratedistance = i*4 + 6
|
||||
local cratedistance = i*4 + 8
|
||||
if IsHerc then
|
||||
-- wider radius
|
||||
cratedistance = i*4 + 12
|
||||
end
|
||||
for i=1,50 do
|
||||
math.random(90,270)
|
||||
end
|
||||
local rheading = math.floor(math.random(90,270) * heading + 1 / 360)
|
||||
if not IsHerc then
|
||||
rheading = rheading + 180 -- mirror for Helis
|
||||
@ -1183,7 +1234,8 @@ function CTLD:_LoadCratesNearby(Group, Unit)
|
||||
local unitname = unit:GetName()
|
||||
-- see if this heli can load crates
|
||||
local unittype = unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit)
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local cancrates = capabilities.crates -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
local grounded = not self:IsUnitInAir(Unit)
|
||||
@ -1284,9 +1336,10 @@ function CTLD:_ListCargo(Group, Unit)
|
||||
self:T(self.lid .. " _ListCargo")
|
||||
local unitname = Unit:GetName()
|
||||
local unittype = Unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local trooplimit = capabilities.trooplimit -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #numbe
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
local loadedcargo = self.Loaded_Cargo[unitname] or {} -- #CTLD.LoadedCargo
|
||||
if self.Loaded_Cargo[unitname] then
|
||||
local no_troops = loadedcargo.Troopsloaded or 0
|
||||
@ -1545,13 +1598,13 @@ function CTLD:_BuildCrates(Group, Unit)
|
||||
foundbuilds = true
|
||||
else
|
||||
buildables[name].Found = buildables[name].Found + 1
|
||||
if buildables[name].Found >= buildables[name].Required then
|
||||
buildables[name].CanBuild = true
|
||||
canbuild = true
|
||||
end
|
||||
foundbuilds = true
|
||||
end
|
||||
--self:T{buildables = buildables})
|
||||
if buildables[name].Found >= buildables[name].Required then
|
||||
buildables[name].CanBuild = true
|
||||
canbuild = true
|
||||
end
|
||||
self:T({buildables = buildables})
|
||||
end -- end dropped
|
||||
end -- end crate loop
|
||||
-- ok let\'s list what we have
|
||||
@ -1609,7 +1662,7 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build)
|
||||
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
|
||||
local temptable = Build.Template or {}
|
||||
local zone = ZONE_GROUP:New(string.format("Unload zone-%s",unitname),Group,100)
|
||||
local randomcoord = zone:GetRandomCoordinate(20,50):GetVec2()
|
||||
local randomcoord = zone:GetRandomCoordinate(35):GetVec2()
|
||||
for _,_template in pairs(temptable) do
|
||||
self.TroopCounter = self.TroopCounter + 1
|
||||
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
||||
@ -1715,11 +1768,13 @@ function CTLD:_RefreshF10Menus()
|
||||
-- rebuild units table
|
||||
local _UnitList = {}
|
||||
for _key, _group in pairs (PlayerTable) do
|
||||
local _unit = _group:GetUnit(1) -- Asume that there is only one unit in the flight for players
|
||||
local _unit = _group:GetUnit(1) -- Wrapper.Unit#UNIT Asume that there is only one unit in the flight for players
|
||||
if _unit then
|
||||
if _unit:IsAlive() then
|
||||
local unitName = _unit:GetName()
|
||||
_UnitList[unitName] = unitName
|
||||
if _unit:IsAlive() and _unit:IsPlayer() then
|
||||
if _unit:IsHelicopter() or (_unit:GetTypeName() == "Hercules" and self.enableHercules) then --ensure no stupid unit entries here
|
||||
local unitName = _unit:GetName()
|
||||
_UnitList[unitName] = unitName
|
||||
end
|
||||
end -- end isAlive
|
||||
end -- end if _unit
|
||||
end -- end for
|
||||
@ -1737,7 +1792,8 @@ function CTLD:_RefreshF10Menus()
|
||||
if _group then
|
||||
-- get chopper capabilities
|
||||
local unittype = _unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(_unit) -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local cantroops = capabilities.troops
|
||||
local cancrates = capabilities.crates
|
||||
-- top menu
|
||||
@ -1790,8 +1846,8 @@ function CTLD:_RefreshF10Menus()
|
||||
|
||||
--- User function - Add *generic* troop type loadable as cargo. This type will load directly into the heli without crates.
|
||||
-- @param #CTLD self
|
||||
-- @param #Name Name Unique name of this type of troop. E.g. "Anti-Air Small".
|
||||
-- @param #Table Templates Table of #string names of late activated Wrapper.Group#GROUP making up this troop.
|
||||
-- @param #string Name Unique name of this type of troop. E.g. "Anti-Air Small".
|
||||
-- @param #table Templates Table of #string names of late activated Wrapper.Group#GROUP making up this troop.
|
||||
-- @param #CTLD_CARGO.Enum Type Type of cargo, here TROOPS - these will move to a nearby destination zone when dropped/build.
|
||||
-- @param #number NoTroops Size of the group in number of Units across combined templates (for loading).
|
||||
function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops)
|
||||
@ -1805,8 +1861,8 @@ end
|
||||
|
||||
--- User function - Add *generic* crate-type loadable as cargo. This type will create crates that need to be loaded, moved, dropped and built.
|
||||
-- @param #CTLD self
|
||||
-- @param #Name Name Unique name of this type of cargo. E.g. "Humvee".
|
||||
-- @param #Table Templates Table of #string names of late activated Wrapper.Group#GROUP building this cargo.
|
||||
-- @param #string Name Unique name of this type of cargo. E.g. "Humvee".
|
||||
-- @param #table Templates Table of #string names of late activated Wrapper.Group#GROUP building this cargo.
|
||||
-- @param #CTLD_CARGO.Enum Type Type of cargo. I.e. VEHICLE or FOB. VEHICLE will move to destination zones when dropped/build, FOB stays put.
|
||||
-- @param #number NoCrates Number of crates needed to build this cargo.
|
||||
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates)
|
||||
@ -2315,7 +2371,8 @@ end
|
||||
local unittype = Unit:GetTypeName()
|
||||
local unitname = Unit:GetName()
|
||||
local Group = Unit:GetGroup()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local cancrates = capabilities.crates -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
if cancrates then
|
||||
@ -2360,7 +2417,7 @@ end
|
||||
-- @return #CTLD self
|
||||
function CTLD:onafterStart(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
if self.useprefix then
|
||||
if self.useprefix or self.enableHercules then
|
||||
local prefix = self.prefixes
|
||||
--self:T{prefix=prefix})
|
||||
if self.enableHercules then
|
||||
@ -2368,11 +2425,11 @@ end
|
||||
self.PilotGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterStart()
|
||||
else
|
||||
--self:T("CTLD with prefixes NO Hercules")
|
||||
self.PilotGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterCategoryHelicopter():FilterStart()
|
||||
self.PilotGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterCategories("helicopter"):FilterStart()
|
||||
end
|
||||
else
|
||||
--self:T("CTLD NO prefixes NO Hercules")
|
||||
self.PilotGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart()
|
||||
self.PilotGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategories("helicopter"):FilterStart()
|
||||
end
|
||||
-- Events
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||
@ -2529,4 +2586,4 @@ end
|
||||
end -- end do
|
||||
-------------------------------------------------------------------
|
||||
-- End Ops.CTLD.lua
|
||||
-------------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
|
||||
@ -861,7 +861,7 @@ function FLIGHTGROUP:onafterStatus(From, Event, To)
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
|
||||
-- Update position.
|
||||
self:_UpdatePosition()
|
||||
|
||||
@ -1018,7 +1018,7 @@ function FLIGHTGROUP:onafterStatus(From, Event, To)
|
||||
if self:IsAlive() and self.group:IsAirborne(true) then
|
||||
|
||||
local fuelmin=self:GetFuelMin()
|
||||
|
||||
|
||||
self:I(self.lid..string.format("Fuel state=%d", fuelmin))
|
||||
|
||||
if fuelmin>=self.fuellowthresh then
|
||||
@ -2233,7 +2233,7 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold)
|
||||
allowed=false
|
||||
Tsuspend=-20
|
||||
local groupspeed = self.group:GetVelocityMPS()
|
||||
if groupspeed<=1 and not self:IsParking() then
|
||||
if groupspeed<=1 and not self:IsParking() then
|
||||
self.RTBRecallCount = self.RTBRecallCount+1
|
||||
end
|
||||
if self.RTBRecallCount > 6 then
|
||||
@ -2768,8 +2768,9 @@ function FLIGHTGROUP:onafterFuelLow(From, Event, To)
|
||||
-- Get closest tanker from airwing that can refuel this flight.
|
||||
local tanker=self.airwing:GetTankerForFlight(self)
|
||||
|
||||
if tanker then
|
||||
if tanker and self.fuellowrefuel then
|
||||
|
||||
-- Debug message.
|
||||
self:I(self.lid..string.format("Send to refuel at tanker %s", tanker.flightgroup:GetName()))
|
||||
|
||||
-- Get a coordinate towards the tanker.
|
||||
|
||||
@ -646,7 +646,7 @@ function MARKER:OnEventMarkRemoved(EventData)
|
||||
|
||||
local MarkID=EventData.MarkID
|
||||
|
||||
self:T3(self.lid..string.format("Captured event MarkAdded for Mark ID=%s", tostring(MarkID)))
|
||||
self:T3(self.lid..string.format("Captured event MarkRemoved for Mark ID=%s", tostring(MarkID)))
|
||||
|
||||
if MarkID==self.mid then
|
||||
|
||||
@ -673,9 +673,9 @@ function MARKER:OnEventMarkChange(EventData)
|
||||
|
||||
if MarkID==self.mid then
|
||||
|
||||
self:Changed(EventData)
|
||||
self.text=tostring(EventData.MarkText)
|
||||
|
||||
self:TextChanged(tostring(EventData.MarkText))
|
||||
self:Changed(EventData)
|
||||
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user