wip
This commit is contained in:
+19
-7
@@ -4,17 +4,26 @@
|
|||||||
"version": "Lua 5.1"
|
"version": "Lua 5.1"
|
||||||
},
|
},
|
||||||
"workspace": {
|
"workspace": {
|
||||||
"checkThirdParty": false
|
"checkThirdParty": false,
|
||||||
|
"maxPreload": 1600,
|
||||||
|
"preloadFileSize": 1000
|
||||||
},
|
},
|
||||||
"diagnostics": {
|
"diagnostics": {
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"globals": [
|
"globals": [
|
||||||
"lfs"
|
"lfs"
|
||||||
],
|
],
|
||||||
"severity": {
|
"groupSeverity": {
|
||||||
"undefined-field": "Warning",
|
"duplicate": "Warning",
|
||||||
"unused-local": "Warning",
|
"global":"Warning",
|
||||||
"unused-function": "Warning"
|
"luadoc": "Warning",
|
||||||
|
"redefined": "Warning",
|
||||||
|
"strong": "Warning",
|
||||||
|
"type-check": "Warning",
|
||||||
|
"unbalanced" : "Warning",
|
||||||
|
"ambiguity": "Warning",
|
||||||
|
"strict": "Warning",
|
||||||
|
"unused": "Warning"
|
||||||
},
|
},
|
||||||
"groupFileStatus": {
|
"groupFileStatus": {
|
||||||
"ambiguity": "Any",
|
"ambiguity": "Any",
|
||||||
@@ -26,8 +35,11 @@
|
|||||||
"strict": "Any",
|
"strict": "Any",
|
||||||
"type-check": "Any",
|
"type-check": "Any",
|
||||||
"unbalanced": "Any",
|
"unbalanced": "Any",
|
||||||
"unused": "Any"
|
"unused": "Any",
|
||||||
}
|
"strong": "Any"
|
||||||
|
},
|
||||||
|
"ignoredFiles": "Opened",
|
||||||
|
"libraryFiles": "Opened"
|
||||||
},
|
},
|
||||||
"hint": {
|
"hint": {
|
||||||
"enable": false
|
"enable": false
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
---@class Queue
|
|
||||||
---@field private _items Array
|
|
||||||
---@field private _first number
|
|
||||||
---@field private _last number
|
|
||||||
local Queue = {}
|
|
||||||
Queue.__index = Queue
|
|
||||||
|
|
||||||
---@return Queue
|
|
||||||
function Queue.new()
|
|
||||||
|
|
||||||
local self = setmetatable({}, Queue)
|
|
||||||
self._items = {}
|
|
||||||
self._first = 1
|
|
||||||
self._last = 0
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
---@return nil
|
|
||||||
function Queue:push(item)
|
|
||||||
self._last = self._last + 1
|
|
||||||
self._items[self._last] = item
|
|
||||||
end
|
|
||||||
|
|
||||||
---@return any?
|
|
||||||
function Queue:pop()
|
|
||||||
if self._first > self._last then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local item = self._items[self._first]
|
|
||||||
self._items[self._first] = nil
|
|
||||||
self._first = self._first + 1
|
|
||||||
return item
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
---@return Array<any>
|
|
||||||
function Queue:toList()
|
|
||||||
local items = {}
|
|
||||||
for i = self._first, self._last do
|
|
||||||
items[#items + 1] = self._items[i]
|
|
||||||
end
|
|
||||||
return items
|
|
||||||
end
|
|
||||||
|
|
||||||
return Queue
|
|
||||||
@@ -107,8 +107,9 @@ function AirGroup:SetMissionPrivate(mission)
|
|||||||
|
|
||||||
local points = {}
|
local points = {}
|
||||||
if mission and mission.params and mission.params.route and mission.params.route.points then
|
if mission and mission.params and mission.params.route and mission.params.route.points then
|
||||||
for _, wp in pairs(mission.params.route.points) do
|
local routePoints = mission.params.route.points --[[@as Array<Vec2> ]]
|
||||||
if wp.x and wp.y then
|
for _, wp in pairs(routePoints) do
|
||||||
|
if wp and wp.x and wp.y then
|
||||||
table.insert(points, { x = wp.x, y = wp.y })
|
table.insert(points, { x = wp.x, y = wp.y })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -198,6 +199,8 @@ function AirGroup:SpawnInternal(force, withoutLoadout)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param selfA AirGroup
|
---@param selfA AirGroup
|
||||||
|
---@param time number
|
||||||
|
---@return number?
|
||||||
local function CheckLivenessTask(selfA, time)
|
local function CheckLivenessTask(selfA, time)
|
||||||
local interval = selfA:CheckLiveness()
|
local interval = selfA:CheckLiveness()
|
||||||
if not interval then return end
|
if not interval then return end
|
||||||
@@ -263,6 +266,7 @@ function AirGroup:OnLastUnitLanded()
|
|||||||
|
|
||||||
---@param data CheckGroupForRestartData
|
---@param data CheckGroupForRestartData
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@return number?
|
||||||
local checkGroupForRestart = function(data, time)
|
local checkGroupForRestart = function(data, time)
|
||||||
local group = Group.getByName(data.self:GetName())
|
local group = Group.getByName(data.self:GetName())
|
||||||
if not group then
|
if not group then
|
||||||
|
|||||||
@@ -34,9 +34,10 @@ function CapGroup:IsBackup()
|
|||||||
return self._isBackup
|
return self._isBackup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param stageID string
|
||||||
---@return string?
|
---@return string?
|
||||||
function CapGroup:GetZoneIDWhenStageID(stageID)
|
function CapGroup:GetZoneIDWhenStageID(stageID)
|
||||||
return self._targetZoneIdPerStage[stageID]
|
return self._targetZoneIdPerStage[tostring(stageID)]
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return string?
|
---@return string?
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ end
|
|||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param units Array<string>
|
---@param units Array<string>
|
||||||
|
---@param zoneName string
|
||||||
---@param homeAirbase Airbase
|
---@param homeAirbase Airbase
|
||||||
function InterceptGroup:SendToInterceptUnits(units, zoneName, homeAirbase)
|
function InterceptGroup:SendToInterceptUnits(units, zoneName, homeAirbase)
|
||||||
|
|
||||||
@@ -68,9 +69,10 @@ function InterceptGroup:SendToInterceptUnits(units, zoneName, homeAirbase)
|
|||||||
self:SetTargetUnits(units)
|
self:SetTargetUnits(units)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param stageID string
|
||||||
---@return string?
|
---@return string?
|
||||||
function InterceptGroup:GetZoneIDWhenStageID(stageID)
|
function InterceptGroup:GetZoneIDWhenStageID(stageID)
|
||||||
return self._targetZoneIdPerStage[stageID]
|
return self._targetZoneIdPerStage[tostring(stageID)]
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return string?
|
---@return string?
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ function SweepGroup.New(groupName, config, logger, spawnManager)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param stageID string
|
||||||
---@return string?
|
---@return string?
|
||||||
function SweepGroup:GetZoneIDWhenStageID(stageID)
|
function SweepGroup:GetZoneIDWhenStageID(stageID)
|
||||||
return self._targetZoneIdPerStage[stageID]
|
return self._targetZoneIdPerStage[tostring(stageID)]
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return string?
|
---@return string?
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ DetectionManager.__index = DetectionManager
|
|||||||
|
|
||||||
|
|
||||||
---@param logger Logger
|
---@param logger Logger
|
||||||
|
---@return DetectionManager
|
||||||
function DetectionManager.New(logger)
|
function DetectionManager.New(logger)
|
||||||
local self = setmetatable({}, DetectionManager)
|
local self = setmetatable({}, DetectionManager)
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ function DetectionManager.New(logger)
|
|||||||
|
|
||||||
---@param selfA DetectionManager
|
---@param selfA DetectionManager
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@return number?
|
||||||
local updateDetectingUnitsTask = function(selfA, time)
|
local updateDetectingUnitsTask = function(selfA, time)
|
||||||
selfA:UpdateDetectingUnits()
|
selfA:UpdateDetectingUnits()
|
||||||
return time + 120
|
return time + 120
|
||||||
@@ -32,6 +34,7 @@ function DetectionManager.New(logger)
|
|||||||
|
|
||||||
---@param selfA DetectionManager
|
---@param selfA DetectionManager
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@return number?
|
||||||
local updateDetected = function(selfA, time)
|
local updateDetected = function(selfA, time)
|
||||||
selfA:UpdateDetectedUnits()
|
selfA:UpdateDetectedUnits()
|
||||||
return time + 10
|
return time + 10
|
||||||
@@ -43,6 +46,7 @@ end
|
|||||||
|
|
||||||
---@param unitName string
|
---@param unitName string
|
||||||
---@param coalitionSide CoalitionSide
|
---@param coalitionSide CoalitionSide
|
||||||
|
---@return boolean
|
||||||
function DetectionManager:IsUnitDetectedBy(unitName, coalitionSide)
|
function DetectionManager:IsUnitDetectedBy(unitName, coalitionSide)
|
||||||
local coalitionString = tostring(coalitionSide)
|
local coalitionString = tostring(coalitionSide)
|
||||||
if not self._detectedUnits[coalitionString] then
|
if not self._detectedUnits[coalitionString] then
|
||||||
@@ -56,7 +60,8 @@ function DetectionManager:IsUnitDetectedBy(unitName, coalitionSide)
|
|||||||
return timer.getTime() - self._detectedUnits[coalitionString][unitName] < 20
|
return timer.getTime() - self._detectedUnits[coalitionString][unitName] < 20
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return Array<string>
|
---@param coalitionSide CoalitionSide
|
||||||
|
---@return Array<string> detectedUnits
|
||||||
function DetectionManager:GetDetectedUnitsBy(coalitionSide)
|
function DetectionManager:GetDetectedUnitsBy(coalitionSide)
|
||||||
local coalitionString = tostring(coalitionSide)
|
local coalitionString = tostring(coalitionSide)
|
||||||
if not self._detectedUnits[coalitionString] then
|
if not self._detectedUnits[coalitionString] then
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ end
|
|||||||
---@field self RunwayBombingTracker
|
---@field self RunwayBombingTracker
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
|
---@param time number
|
||||||
---@param weaponTrackingArgs WeaponTrackingArgs
|
---@param weaponTrackingArgs WeaponTrackingArgs
|
||||||
|
---@return number?
|
||||||
function RunwayBombingTracker.trackWeaponTask(weaponTrackingArgs, time)
|
function RunwayBombingTracker.trackWeaponTask(weaponTrackingArgs, time)
|
||||||
|
|
||||||
local weapon = weaponTrackingArgs.weapon
|
local weapon = weaponTrackingArgs.weapon
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ end
|
|||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param capZone SpearheadTriggerZone
|
---@param capZone SpearheadTriggerZone
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
|
---@return table
|
||||||
local GetOutboundTask = function(airbase, capZone, capConfig)
|
local GetOutboundTask = function(airbase, capZone, capConfig)
|
||||||
local airbaseVec3 = airbase:getPoint()
|
local airbaseVec3 = airbase:getPoint()
|
||||||
local airbaseVec2 = { x = airbaseVec3.x, y = airbaseVec3.z }
|
local airbaseVec2 = { x = airbaseVec3.x, y = airbaseVec3.z }
|
||||||
@@ -125,6 +126,7 @@ end
|
|||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param capZone SpearheadTriggerZone
|
---@param capZone SpearheadTriggerZone
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
|
---@return table
|
||||||
function CAP.getAsMissionFromAirbase(groupName, airbase, capZone, capConfig)
|
function CAP.getAsMissionFromAirbase(groupName, airbase, capZone, capConfig)
|
||||||
local points = {
|
local points = {
|
||||||
[1] = GetOutboundTask(airbase, capZone, capConfig),
|
[1] = GetOutboundTask(airbase, capZone, capConfig),
|
||||||
@@ -152,6 +154,7 @@ end
|
|||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param capZone SpearheadTriggerZone
|
---@param capZone SpearheadTriggerZone
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
|
---@return table
|
||||||
function CAP.getAsMission(groupName, airbase, capZone, capConfig)
|
function CAP.getAsMission(groupName, airbase, capZone, capConfig)
|
||||||
local points = {
|
local points = {
|
||||||
[1] = CAP.getAsTasking(groupName, airbase, capZone, capConfig),
|
[1] = CAP.getAsTasking(groupName, airbase, capZone, capConfig),
|
||||||
@@ -178,6 +181,7 @@ end
|
|||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param capZone SpearheadTriggerZone
|
---@param capZone SpearheadTriggerZone
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
|
---@return table
|
||||||
function CAP.getAsTasking(groupName, airbase, capZone, capConfig)
|
function CAP.getAsTasking(groupName, airbase, capZone, capConfig)
|
||||||
local duration = math.random(capConfig:getMinDurationOnStation(), capConfig:getMaxDurationOnStation()) or 1500
|
local duration = math.random(capConfig:getMinDurationOnStation(), capConfig:getMaxDurationOnStation()) or 1500
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local INTERCEPT = {}
|
|||||||
---@param speed number?
|
---@param speed number?
|
||||||
---@param alt number?
|
---@param alt number?
|
||||||
---@param config CapConfig
|
---@param config CapConfig
|
||||||
|
---@return table
|
||||||
function INTERCEPT.getMissionFromAirbase(groupName, interceptPoint, airbase, config, speed, alt)
|
function INTERCEPT.getMissionFromAirbase(groupName, interceptPoint, airbase, config, speed, alt)
|
||||||
|
|
||||||
local airbaseVec3 = airbase:getPoint()
|
local airbaseVec3 = airbase:getPoint()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ local RTB = {}
|
|||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param missionPoint Vec2
|
---@param missionPoint Vec2
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
|
---@return table
|
||||||
function RTB.getAsMission(airbase, missionPoint, capConfig)
|
function RTB.getAsMission(airbase, missionPoint, capConfig)
|
||||||
return {
|
return {
|
||||||
id = "Mission",
|
id = "Mission",
|
||||||
@@ -113,6 +114,7 @@ end
|
|||||||
---comment
|
---comment
|
||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
---@param missionPoint Vec2
|
---@param missionPoint Vec2
|
||||||
|
---@return table
|
||||||
---@param capConfig CapConfig
|
---@param capConfig CapConfig
|
||||||
function RTB.getApproachPoint(airbase, missionPoint, capConfig)
|
function RTB.getApproachPoint(airbase, missionPoint, capConfig)
|
||||||
|
|
||||||
@@ -147,6 +149,7 @@ function RTB.getApproachPoint(airbase, missionPoint, capConfig)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param airbase Airbase
|
---@param airbase Airbase
|
||||||
|
---@return table
|
||||||
function RTB.getInitialPoint(airbase)
|
function RTB.getInitialPoint(airbase)
|
||||||
local point = calcInitialPoint(airbase)
|
local point = calcInitialPoint(airbase)
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -210,6 +210,10 @@ do
|
|||||||
|
|
||||||
local lastFile = getLastFileOrDefault(dir--[[@as string]], matchingPart, fileName)
|
local lastFile = getLastFileOrDefault(dir--[[@as string]], matchingPart, fileName)
|
||||||
|
|
||||||
|
if lastFile == nil then
|
||||||
|
lastFile = fileName
|
||||||
|
end
|
||||||
|
|
||||||
local fileSplit = Util.split_string(lastFile, ".")
|
local fileSplit = Util.split_string(lastFile, ".")
|
||||||
fileSplit[#fileSplit-1] = tostring(tonumber(fileSplit[#fileSplit-1]) + 1)
|
fileSplit[#fileSplit-1] = tostring(tonumber(fileSplit[#fileSplit-1]) + 1)
|
||||||
fileName = table.concat(fileSplit, ".")
|
fileName = table.concat(fileSplit, ".")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ do -- INIT UTIL
|
|||||||
---splits a string in sub parts by seperator
|
---splits a string in sub parts by seperator
|
||||||
---@param input string
|
---@param input string
|
||||||
---@param seperator string
|
---@param seperator string
|
||||||
---@return table result list of strings
|
---@return Array<string> result list of strings
|
||||||
function UTIL.split_string(input, seperator)
|
function UTIL.split_string(input, seperator)
|
||||||
if seperator == nil then
|
if seperator == nil then
|
||||||
seperator = " "
|
seperator = " "
|
||||||
@@ -237,7 +237,7 @@ do -- INIT UTIL
|
|||||||
|
|
||||||
return ((vec1Norm.x * vec2Norm.x) + (vec1Norm.y * vec2Norm.y) + (vec1Norm.z * vec2Norm.z))
|
return ((vec1Norm.x * vec2Norm.x) + (vec1Norm.y * vec2Norm.y) + (vec1Norm.z * vec2Norm.z))
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param polygon Array<Vec2> of pairs { x, y }
|
---@param polygon Array<Vec2> of pairs { x, y }
|
||||||
---@param x number X location
|
---@param x number X location
|
||||||
---@param y number Y location
|
---@param y number Y location
|
||||||
|
|||||||
Reference in New Issue
Block a user