Working pre-activation and overhaul of drawings

This commit is contained in:
2026-08-18 14:46:51 +02:00
parent b429d4a284
commit 8cf41cbf49
13 changed files with 254 additions and 144 deletions
+13 -1
View File
@@ -4,7 +4,8 @@
local briefingMessageTime = nil
---@class GlobalConfig
---@field private _briefingTime number ;
---@field private _briefingTime number
---@field private _debugEnabled boolean
local GlobalConfig = {}
GlobalConfig.__index = GlobalConfig;
@@ -19,6 +20,13 @@ function GlobalConfig.New()
if SpearheadConfig.briefingMessageDuration then
self._briefingTime = SpearheadConfig.briefingMessageDuration
end
if SpearheadConfig.debugEnabled ~= nil then
self._debugEnabled = SpearheadConfig.debugEnabled
else
self._debugEnabled = false
end
end
return self
@@ -28,6 +36,10 @@ function GlobalConfig:getBriefingTime()
return self._briefingTime or 60
end
function GlobalConfig:isDebugEnabled()
return self._debugEnabled or false
end
return GlobalConfig
+18 -6
View File
@@ -9,26 +9,38 @@
--- @field AmountPreactivateStage integer
local StageConfig = {};
local Logger = require("classes.util.Logger")
local _logger = Logger.new("StageConfig", Logger.LogLevel)
---comment
---@return StageConfig
function StageConfig:new()
if SpearheadConfig == nil then SpearheadConfig = {} end
if SpearheadConfig.StageConfig == nil then SpearheadConfig.StageConfig = {} end
if SpearheadConfig == nil then
_logger:warn("SpearheadConfig is nil, creating default SpearheadConfig")
SpearheadConfig = {}
end
if SpearheadConfig.StageConfig == nil then
_logger:warn("SpearheadConfig.StageConfig is nil, creating default StageConfig")
SpearheadConfig.StageConfig = {}
end
---@type StageConfig
local o = {
isEnabled = SpearheadConfig.StageConfig.enabled or true,
isDrawStagesEnabled = SpearheadConfig.StageConfig.drawStages or true,
isAutoStages = SpearheadConfig.StageConfig.autoStages or true,
isEnabled = SpearheadConfig.StageConfig.enabled ~= false,
isDrawStagesEnabled = SpearheadConfig.StageConfig.drawStages ~= false,
isAutoStages = SpearheadConfig.StageConfig.autoStages ~= false,
startingStage = SpearheadConfig.StageConfig.startingStage or 1,
maxMissionsPerStage = SpearheadConfig.StageConfig.maxMissionStage or 10,
isDrawPreActivatedEnabled = SpearheadConfig.StageConfig.drawPreActivated or true,
isDrawPreActivatedEnabled = SpearheadConfig.StageConfig.drawPreActivated ~= false,
AmountPreactivateStage = SpearheadConfig.StageConfig.preactivateStage or 1,
}
setmetatable(o, { __index = self })
_logger:info("Successfully created StageConfig Object")
return o;
end
+1 -1
View File
@@ -231,7 +231,7 @@ function Database.New(Logger)
for key, layer_object in pairs(layer.objects) do
if Util.startswith(layer_object.name, "drawing_", true) then
local object = layer_object --[[@as DrawingObject]]
local customDrawing = CustomDrawing.New(object, nil, self._logger.LogLevel)
local customDrawing = CustomDrawing.New(object)
table.insert(self._tables.CustomDrawings, customDrawing)
end
end
@@ -2,6 +2,8 @@ local Util = require("classes.util.Util")
local DcsUtil = require("classes.util.DcsUtil")
local SupplyUnitsTracker = require("classes.stageClasses.helpers.SupplyUnitsTracker")
local MissionCommandsHelper = require("classes.stageClasses.helpers.MissionCommandsHelper")
local CustomDrawing = require("classes.stageClasses.drawings.CustomDrawing")
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
---@class SupplyHub
---@field private _database Database
@@ -12,7 +14,7 @@ local MissionCommandsHelper = require("classes.stageClasses.helpers.MissionComma
---@field private _isCommmandAdded table<string, boolean>
---@field private _missionCommandsHelper MissionCommandsHelper
---@field private _inZone table<string, boolean>
---@field private _drawID number
---@field private _customDrawing CustomDrawing?
---@field private _cargoInUnits table<table<string, number>>
---@field private _activeAtStart boolean
---@field private _active boolean
@@ -30,6 +32,7 @@ function SupplyHub.new(database, logger, zoneName)
self._database = database
self._logger = logger
self._zoneName = zoneName
self._customDrawing = nil
local split = Util.split_string(zoneName, "_")
if string.lower(split[2]) == "a" then
@@ -72,13 +75,13 @@ function SupplyHub:Activate()
self._logger:debug("Activating Supply Hub zone: " .. self._zoneName)
local zone = DcsUtil.getZoneByName(self._zoneName)
if zone and self._drawID == nil then
---@type DrawColor
local fillColor = { r=0, g=1, b=0, a=0.2 }
---@type DrawColor
local lineColor = { r=0, g=1, b=0, a=1}
if zone and self._customDrawing == nil then
local fillColor = DrawingHelper.ColorTableToColorString({ 0, 1, 0, 0.2 })
local lineColor = DrawingHelper.ColorTableToColorString({ 0, 1, 0, 1})
local lineStyle = 1
self._drawID = DcsUtil.DrawZone(zone, lineColor, fillColor, lineStyle)
self._customDrawing = CustomDrawing.FromZone(zone, lineColor, fillColor, lineStyle, 6)
self._customDrawing:Draw()
end
self._supplyUnitsTracker:RegisterHub(self)
@@ -45,18 +45,15 @@ local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelpe
--- @field zoneName string
--- @field stageName string?
--- @field stageNumber number
--- @field protected _currentStageState CurrentStageState
--- @field protected _missionCommandsHelper MissionCommandsHelper
--- @field protected _isActive boolean
--- @field protected _isComplete boolean
--- @field protected _missionPriority MissionPriority
--- @field protected _database Database
--- @field protected _db StageData
--- @field protected _logger Logger
--- @field protected _preActivated boolean
--- @field protected _activeStage integer
--- @field protected _stageConfig StageConfig
--- @field protected _stageDrawing DrawingObject
--- @field protected _currentDrawingId integer
--- @field protected _customDrawing CustomDrawing
--- @field protected _spawnedGroups Array<string>
--- @field protected _stageCompleteListeners Array<StageCompleteListener>
--- @field protected CheckContinuousAsync fun(self:Stage, time:number) : number?
@@ -66,11 +63,18 @@ local Stage = {}
Stage.__index = Stage
---@enum CurrentStageState
Stage.CurrentStageState = {
INACTIVE = 0,
PREACTIVATED = 1,
ACTIVE = 2,
BLUE = 3
}
Stage.StageColors = {
INVISIBLE = { 0, 0, 0, 0 },
RED_ACTIVE = { 1, 0, 0, 0.15 },
RED_PREACTIVE = { 1, 0, 0, 0.10},
RED_ACTIVE = { 1, 0, 0, 0.20 },
RED_PREACTIVE = { 1, 0, 0, 0.05},
BLUE = { 0, 0, 1, 0.10},
GRAY = { 80/255, 80/255, 80/255, 0.10 }
}
@@ -86,12 +90,11 @@ Stage.StageColors = {
function Stage:superNew(database, stageConfig, logger, initData, missionPriority, spawnManager)
logger:debug("[BaseStage] Initiating stage with name: " .. initData.stageZoneName)
self._currentStageState = Stage.CurrentStageState.INACTIVE
self.zoneName = initData.stageZoneName
self.stageNumber = initData.stageNumber
self._isActive = false
self._isComplete = false
self.stageName = initData.stageDisplayName
self._currentStageState = Stage.CurrentStageState.INACTIVE
self.OnPostStageComplete = nil
self.OnPostBlueActivated = nil
@@ -113,39 +116,18 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
}
self._activeStage = -99
self._preActivated = false
self._stageConfig = stageConfig or {}
self._missionCommandsHelper = MissionCommandsHelper.getOrCreate(logger.LogLevel)
local zone = DcsUtil.getZoneByName(self.zoneName)
if zone then
if zone.zone_type == "Cilinder" then
---@type Circle
local drawing = {
colorString = DrawingHelper.ColorTableToColorString( Stage.StageColors.INVISIBLE),
mapX = zone.location.x,
mapY = zone.location.y,
radius = zone.radius,
name = "DRAWING_" .. zone.name,
polygonMode = "circle",
primitiveType = "Polygon",
thickness = 1,
fillColorString = DrawingHelper.ColorTableToColorString( Stage.StageColors.INVISIBLE),
visible = true,
style = "solid"
}
self._stageDrawing = drawing
else
local verts = {}
---@type Free
local drawing = {
mapX = zone.location.x,
mapY = zone.location.y,
}
local colorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.INVISIBLE)
local fillColorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.INVISIBLE)
local customDrawing = CustomDrawing.FromZone(zone, colorString, fillColorString, 1, 5)
if customDrawing then
self._customDrawing = customDrawing
end
end
@@ -291,7 +273,7 @@ end
---@return boolean
function Stage:IsComplete()
if self._isComplete == true then return true end
if self._currentStageState == Stage.CurrentStageState.BLUE then return true end
for i, mission in pairs(self._db.sams) do
local state = mission:getState()
@@ -307,13 +289,13 @@ function Stage:IsComplete()
end
end
self._isComplete = true
self._currentStageState = Stage.CurrentStageState.BLUE
return true
end
---@return boolean
function Stage:IsActive()
return self._isActive == true
return self._currentStageState == Stage.CurrentStageState.ACTIVE
end
---comment
@@ -399,8 +381,8 @@ end
---Activates all SAMS, Airbase units etc all at once.
function Stage:PreActivate()
if self._preActivated == false then
self._preActivated = true
if self._currentStageState == Stage.CurrentStageState.INACTIVE then
self._currentStageState = Stage.CurrentStageState.PREACTIVATED
for key, mission in pairs(self._db.sams) do
if mission then
mission:SpawnInactive()
@@ -412,40 +394,60 @@ function Stage:PreActivate()
end
end
self:MarkStage(Stage.StageColors.RED_PREACTIVE)
self:MarkStage()
end
---@param stageColor DrawColor
function Stage:MarkStage(stageColor)
local lineColor = { r=stageColor.r, g=stageColor.g, b=stageColor.b, a=stageColor.a }
local fillColor = { r=stageColor.r, g=stageColor.g, b=stageColor.b, a=stageColor.a }
function Stage:MarkStage()
if stageColor.a > 0 then
lineColor.a = 1
self._logger:debug("Marking stage '" .. Util.toString(self.zoneName) .. "' with state: " .. self._currentStageState)
if self._customDrawing then
self._customDrawing:Remove()
end
if stageColor == Stage.StageColors.RED_PREACTIVE then
lineColor.a = 0
if self._stageConfig.isDrawStagesEnabled == false then return end
if self._stageConfig.isDrawPreActivatedEnabled == false and self._currentStageState == Stage.CurrentStageState.PREACTIVATED then
return
end
if self._stageDrawingId and self._stageConfig.isDrawStagesEnabled == true then
DcsUtil.SetLineColor(self._stageDrawingId, lineColor)
DcsUtil.SetFillColor(self._stageDrawingId, fillColor)
if self._customDrawing then
self._customDrawing:UpdateDrawingObject(function(drawingObject)
local drawing = drawingObject --[[@as Polygon]]
if self._currentStageState == Stage.CurrentStageState.ACTIVE then
drawing.fillColorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.RED_ACTIVE)
drawing.colorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.RED_ACTIVE)
drawing.style = "dot dash"
elseif self._currentStageState == Stage.CurrentStageState.PREACTIVATED then
drawing.fillColorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.RED_PREACTIVE)
drawing.colorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.RED_PREACTIVE)
drawing.style = "no line"
elseif self._currentStageState == Stage.CurrentStageState.BLUE then
drawing.fillColorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.BLUE)
drawing.colorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.BLUE)
drawing.style = "two dash"
else
drawing.fillColorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.INVISIBLE)
drawing.colorString = DrawingHelper.ColorTableToColorString(Stage.StageColors.INVISIBLE)
drawing.style = "no line"
end
return drawing
end)
self._customDrawing:Draw()
end
end
function Stage:ActivateStage()
self._isActive = true;
pcall(function()
self:MarkStage(Stage.StageColors.RED_ACTIVE)
end)
self._currentStageState = Stage.CurrentStageState.ACTIVE
self:PreActivate()
pcall(function()
self:MarkStage()
end)
self._logger:debug("Activating Misc groups for zone. Count: " .. Util.tableLength(self._db.miscGroups))
for _, miscGroup in pairs(self._db.miscGroups) do
miscGroup:Spawn()
@@ -589,7 +591,7 @@ end
function Stage:ActivateBlueStage()
self._logger:debug("Setting stage '" .. Util.toString(self.zoneName) .. "' to blue")
self._currentStageState = Stage.CurrentStageState.BLUE
for _, mission in pairs(self._db.missions) do
mission:SpawnPersistedState()
end
@@ -605,7 +607,7 @@ function Stage:ActivateBlueStage()
---@param self Stage
local ActivateBlueAsync = function(self)
pcall(function()
self:MarkStage(Stage.StageColors.BLUE)
self:MarkStage()
end)
self:ActivateBlueGroups()
@@ -23,7 +23,7 @@ function ExtraStage.New(database, stageConfig, logger, initData, spawnManager)
self.OnPostBlueActivated = function (selfStage)
selfStage:MarkStage(Stage.StageColors.GRAY)
selfStage:MarkStage()
end
self.OnPostStageComplete = function (selfStage)
@@ -34,7 +34,7 @@ function ExtraStage.New(database, stageConfig, logger, initData, spawnManager)
end
---comment
---@param self Stage
---@param self ExtraStage
---@param number integer
function ExtraStage:OnStageNumberChanged(number)
@@ -56,7 +56,7 @@ function ExtraStage:OnStageNumberChanged(number)
self:ActivateStage()
end
if self._isComplete == true then
if self._currentStageState == Stage.CurrentStageState.BLUE then
self:ActivateBlueStage()
end
@@ -3,6 +3,9 @@ local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelpe
local Util = require("classes.util.Util")
local Logger = require("classes.util.Logger")
local drawingLogger = Logger.new("CustomDrawing")
---@class CustomDrawing
---@field private _id integer?
---@field private _drawingObject DrawingObject
@@ -14,14 +17,12 @@ CustomDrawing.__index = CustomDrawing
---@param drawingObject DrawingObject
---@param id integer?
---@param loglevel LogLevel
---@return CustomDrawing
function CustomDrawing.New(drawingObject, id, loglevel)
function CustomDrawing.New(drawingObject)
local self = setmetatable({}, CustomDrawing)
self._drawingObject = drawingObject
self._id = id
self._logger = Logger.new("CustomDrawing", loglevel)
self._id = nil -- initiate ID as nil, when drawn it will be set to the ID returned by DrawingHelper.Draw
self._logger = drawingLogger
local name = drawingObject.name
local split = Util.split_string(name or "", "_")
@@ -32,6 +33,58 @@ function CustomDrawing.New(drawingObject, id, loglevel)
return self
end
---@param zone SpearheadTriggerZone
---@param colorString string
---@param fillColorString string
---@param lineStyle LineType
---@param lineThickness number
---@return CustomDrawing?
function CustomDrawing.FromZone(zone, colorString, fillColorString, lineStyle, lineThickness)
if zone == nil then
drawingLogger:warn("CustomDrawing.FromZone called with nil zone")
return nil
end
if zone.zone_type == "Cilinder" then
---@type Circle
local drawingObject = {
mapX = zone.location.x,
mapY = zone.location.y,
radius = zone.radius,
name = zone.name .. "_drawing",
primitiveType = "Polygon",
polygonMode = "circle",
visible = true,
style = DrawingHelper.ToLineStyleString(lineStyle),
colorString = colorString,
fillColorString = fillColorString,
thickness = lineThickness,
}
return CustomDrawing.New(drawingObject)
end
if zone.zone_type == "Polygon" then
---@type Free
local drawingObject = {
mapX = 0,
mapY = 0,
points = zone.verts,
name = zone.name .. "_drawing",
primitiveType = "Polygon",
polygonMode = "free",
visible = true,
style = DrawingHelper.ToLineStyleString(lineStyle),
colorString = colorString,
fillColorString = fillColorString,
thickness = lineThickness,
}
return CustomDrawing.New(drawingObject)
end
end
---@return string
function CustomDrawing:GetName()
return self._drawingObject.name
@@ -61,4 +114,9 @@ function CustomDrawing:Remove()
end
end
---@param updateFunc fun(drawingObject:DrawingObject):DrawingObject
function CustomDrawing:UpdateDrawingObject(updateFunc)
self._drawingObject = updateFunc(self._drawingObject)
end
return CustomDrawing
@@ -1,4 +1,14 @@
local Util = require("classes.util.Util")
local Logger = require("classes.util.Logger")
local GlobalConfig = require("classes.configuration.GlobalConfig")
---@type LogLevel
local level = "INFO"
if GlobalConfig:isDebugEnabled() then
level = "DEBUG"
end
local drawingLogger = Logger.new("DrawingHelper", level)
---@class DrawingHelper
local DrawingHelper = {}
@@ -240,6 +250,13 @@ end
---@param hexStr string
---@return table
function DrawingHelper.ColorToColorTable(hexStr)
if hexStr == nil then
drawingLogger:warn("ColorToColorTable called with nil hexStr, returning default color {0, 0, 0, 0}")
return { 0, 0, 0, 0 }
end
hexStr = hexStr:gsub("0x", "")
local r = tonumber(hexStr:sub(1, 2), 16) / 255
local g = tonumber(hexStr:sub(3, 4), 16) / 255
@@ -282,6 +299,26 @@ function DrawingHelper.ToLineStyleInteger(lineStyle)
end
end
function DrawingHelper.ToLineStyleString(lineStyle)
if lineStyle == 0 then
return "no line"
elseif lineStyle == 1 then
return "solid"
elseif lineStyle == 2 then
return "dashed"
elseif lineStyle == 3 then
return "dotted"
elseif lineStyle == 4 then
return "dot dash"
elseif lineStyle == 5 then
return "long dash"
elseif lineStyle == 6 then
return "two dash"
else
return "no line"
end
end
---@class ARGB
---@field public a number
---@field public r number
@@ -137,10 +137,6 @@ function BattleManager:LetUnitsShoot(groups, targetGroups)
}
}
if debugDrawing == true then
self:DrawDebugLine(point, unit)
end
local controller = unit:getController()
if controller then
controller:setTask(shootTask)
@@ -245,42 +241,8 @@ function BattleManager:GetRandomPoint(origin, groupHulls)
if not hull then return nil end
local shootPoints = Util.GetTangentHullPointsFromOrigin(hull, origin)
if debugDrawing == true then
self:DrawDebugZone({ hull })
end
return Util.randomFromList(shootPoints) --[[@as Vec2]]
end
do --DEBUG
---@param unit Unit
---@param target Vec2
function BattleManager:DrawDebugLine(target, unit)
local color = {r = 1, g = 0, b = 0, a = 1}
if unit:getCoalition() == 2 then
color = {r = 0, g = 0, b = 1, a = 1}
end
DcsUtil.DrawLine(unit:getPoint(), {x = target.x, y = 0, z = target.y}, color, 1)
end
---@param hulls Array<Array<Vec2>>
function BattleManager:DrawDebugZone(hulls)
for _, drawHull in pairs(hulls) do
---@type SpearheadTriggerZone
local zone = {
name = "temp",
zone_type = "Polygon",
radius = 0,
verts = drawHull,
location = { x=drawHull[1].x, y=drawHull[1].y },
}
DcsUtil.DrawZone(zone, {r =0, g=0, b =1, a = 0.5} ,{r =0, g= 0, b =1, a = 0}, 1)
end
end
end --DEBUG
return BattleManager
@@ -5,6 +5,8 @@ local SupplyUnitsTracker = require("classes.stageClasses.helpers.SupplyUnitsTrac
local MissionCommandsHelper = require("classes.stageClasses.helpers.MissionCommandsHelper")
local GlobalConfig = require("classes.configuration.GlobalConfig")
local SupplyConfigHelper = require("classes.stageClasses.helpers.SupplyConfigHelper")
local CustomDrawing = require("classes.stageClasses.drawings.CustomDrawing")
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
---@class BuildableMission : Mission, SupplyUnitEventListener
---@field private _requiredKilos number
@@ -17,8 +19,8 @@ local SupplyConfigHelper = require("classes.stageClasses.helpers.SupplyConfigHel
---@field private _supplyUnitsTracker SupplyUnitsTracker
---@field private _noLandingZone SpearheadTriggerZone?
---@field private _dropOffZone SpearheadTriggerZone?
---@field private _noLandingZoneId number
---@field private _dropOffZoneId number
---@field private _noLandingZoneDrawing CustomDrawing?
---@field private _dropOffZoneDrawing CustomDrawing?
local BuildableMission = {}
BuildableMission.__index = BuildableMission
@@ -164,20 +166,20 @@ function BuildableMission:SpawnActive()
return
end
---@type DrawColor
local lineColor = { r=230/255, g=93/255, b=49/255, a=1}
---@type DrawColor
local fillColor = { r=230/255, g=93/255, b=49/255, a=0.2}
self._noLandingZoneId = DcsUtil.DrawZone(self._noLandingZone, lineColor, fillColor, 6)
local lineColor = DrawingHelper.ColorTableToColorString({ 230/255, 93/255, 49/255, 1})
local fillColor = DrawingHelper.ColorTableToColorString({ 230/255, 93/255, 49/255, 0.2})
self._noLandingZoneDrawing = CustomDrawing.FromZone(self._noLandingZone, lineColor, fillColor, 2, 6)
self._noLandingZoneDrawing:Draw()
if self._dropOffZone == nil then
self._logger:error("No drop off zone found for mission: " .. self.code)
return
end
local lineColor2 = { r=0, g=0, b=1, a=1}
local fillColor2 = { r=0, g=0, b=1, a=0}
self._dropOffZoneId = DcsUtil.DrawZone(self._dropOffZone, lineColor2, fillColor2, 6)
local lineColor2 = DrawingHelper.ColorTableToColorString({ 0, 0, 1, 1})
local fillColor2 = DrawingHelper.ColorTableToColorString({ 0, 0, 1, 0})
self._dropOffZoneDrawing = CustomDrawing.FromZone(self._dropOffZone, lineColor2, fillColor2, 2, 6)
self._dropOffZoneDrawing:Draw()
---@param selfA BuildableMission
---@param time number
@@ -254,8 +256,8 @@ function BuildableMission:CheckCratesInZone()
end
if self._droppedKilos >= self._requiredKilos then
DcsUtil.RemoveMark(self._noLandingZoneId)
DcsUtil.RemoveMark(self._dropOffZoneId)
self._dropOffZoneDrawing:Remove()
self._noLandingZoneDrawing:Remove()
self:NotifyMissionComplete()
self._state = "COMPLETED"
end
@@ -1,6 +1,7 @@
local Mission = require("classes.stageClasses.missions.baseMissions.Mission")
local Util = require("classes.util.Util")
local DcsUtil = require("classes.util.DcsUtil")
local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelper")
---@class RunwayStrikeMission : Mission
---@field runwayBombingTracker RunwayBombingTracker
@@ -153,10 +154,23 @@ function RunwayStrikeMission:Draw()
if runwaySection.drawID == nil then
local zone = self:SectionToSpearheadZone(runwaySection)
---@type Free
local drawObject = {
primitiveType = "Polygon",
polygonMode = "free",
mapX = 0,
mapY = 0,
points = zone.verts,
name = zone.name,
fillColorString = DrawingHelper.ColorTableToColorString(fillColor),
colorString = DrawingHelper.ColorTableToColorString(lineColor),
style = "solid",
thickness = 1,
visible = true,
}
local color = { r=0, g=1, b=0, a=0.5 }
runwaySection.drawID = DcsUtil.DrawZone(zone, color, color, 5)
runwaySection.drawID = DrawingHelper.Draw(drawObject)
else
DcsUtil.SetFillColor(runwaySection.drawID, fillColor)
DcsUtil.SetLineColor(runwaySection.drawID, lineColor)
-4
View File
@@ -173,10 +173,6 @@ do -- INIT DCS_UTIL
verts = enlargedPoints
}
if SpearheadConfig and SpearheadConfig.debugEnabled == true then
DCS_UTIL.DrawZone(triggerZone, { r = 0, g = 1, b = 0, a = 1 }, { a = 0, r = 0, g = 1, b = 0 }, 1)
end
DCS_UTIL.__airbaseZonesByName[name] = triggerZone
end
end
+14 -2
View File
@@ -1,5 +1,17 @@
local Util = require("classes.util.Util")
local SpearheadConfig = require("classes.configuration.GlobalConfig")
---@type LogLevel
local defaultLogLevel = "INFO"
if SpearheadConfig then
if SpearheadConfig:isDebugEnabled() then
defaultLogLevel = "DEBUG"
end
end
--- @class Logger
--- @field LoggerName string the name of the logger
@@ -10,13 +22,13 @@ do
---comment
---@param logger_name any
---@param logLevel LogLevel
---@param logLevel LogLevel? override the default log level
---@return Logger
function LOGGER.new(logger_name, logLevel)
LOGGER.__index = LOGGER
local self = setmetatable({}, LOGGER)
self.LoggerName = logger_name or "(loggername not set)"
self.LogLevel = logLevel or "INFO"
self.LogLevel = logLevel or defaultLogLevel
return self
end