fixes: #8Reviewed-on: #28 Co-authored-by: dutchie031 <timrorije@gmail.com>
This commit was merged in pull request #28.
This commit is contained in:
@@ -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
|
||||
@@ -636,71 +632,6 @@ do -- INIT DCS_UTIL
|
||||
---@field b number
|
||||
---@field a number
|
||||
|
||||
local drawID = 400
|
||||
---@param zone SpearheadTriggerZone
|
||||
---@param lineColor DrawColor
|
||||
---@param fillColor DrawColor
|
||||
---@param lineStyle LineType
|
||||
---@return number drawID
|
||||
function DCS_UTIL.DrawZone(zone, lineColor, fillColor, lineStyle)
|
||||
if lineStyle == nil then lineStyle = 4 end
|
||||
drawID = drawID + 1
|
||||
if zone.zone_type == "Cilinder" then
|
||||
trigger.action.circleToAll(-1, drawID, { x = zone.location.x, y = 0, z = zone.location.y }, zone.radius,
|
||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, lineStyle, true)
|
||||
else
|
||||
local functionString = "trigger.action.markupToAll(7, -1, " .. drawID .. ","
|
||||
for _, vecpoint in pairs(zone.verts) do
|
||||
functionString = functionString .. " { x=" .. vecpoint.x .. ", y=0,z=" .. vecpoint.y .. "},"
|
||||
end
|
||||
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, " .. lineStyle .. ")"
|
||||
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
local f, err = loadstring(functionString)
|
||||
if f then
|
||||
f()
|
||||
else
|
||||
env.error("Something failed when drawing complex drawing" .. err)
|
||||
end
|
||||
end
|
||||
local fillColorMapped = {
|
||||
fillColor.r or 0,
|
||||
fillColor.g or 0,
|
||||
fillColor.b or 0,
|
||||
fillColor.a or 0.5
|
||||
}
|
||||
|
||||
local lineColorMapped = {
|
||||
lineColor.r or 0,
|
||||
lineColor.g or 0,
|
||||
lineColor.b or 0,
|
||||
lineColor.a or 1
|
||||
}
|
||||
|
||||
trigger.action.setMarkupColorFill(drawID, fillColorMapped)
|
||||
trigger.action.setMarkupColor(drawID, lineColorMapped)
|
||||
|
||||
return drawID
|
||||
end
|
||||
|
||||
---@param start Vec3
|
||||
---@param finish Vec3
|
||||
---@param lineColor DrawColor
|
||||
---@param lineStyle LineType
|
||||
function DCS_UTIL.DrawLine(start, finish, lineColor, lineStyle)
|
||||
if lineStyle == nil then lineStyle = 4 end
|
||||
drawID = drawID + 1
|
||||
|
||||
local lineColorMapped = {
|
||||
lineColor.r or 0,
|
||||
lineColor.g or 0,
|
||||
lineColor.b or 0,
|
||||
lineColor.a or 1
|
||||
}
|
||||
|
||||
trigger.action.lineToAll(-1, drawID, start, finish, lineColorMapped, lineStyle)
|
||||
return drawID
|
||||
end
|
||||
|
||||
---@param groupID number
|
||||
---@param text string
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user