added StageOverview elements

This commit is contained in:
2025-05-09 10:49:24 +02:00
parent d0bd36ea4e
commit b50657902f
6 changed files with 60 additions and 4 deletions
Binary file not shown.
@@ -198,9 +198,38 @@ function GlobalStageManager:NewAndStart(database, stageConfig, logLevel)
end
end
return o
end
GlobalStageManager.printFullOverview = function ()
local logger = Spearhead.LoggerTemplate.new("StageOverview", "INFO")
logger:info("Stage overview:")
for stageIndex, stages in pairs(StagesByIndex) do
local totalStrike = 0
local totalbai = 0
local totaldead = 0
local totalMissions = 0
for _, stage in pairs(stages) do
local strike, dead, bai = stage:GetStageStats()
totalStrike = totalStrike + strike
totalbai = totalbai + bai
totaldead = totaldead + dead
totalMissions = totalMissions + strike + dead + bai
end
logger:info("Stage# " .. tostring(stageIndex).. " | " .. totalStrike .. " strikes | " .. totaldead .. " dead | " .. totalbai .. " BAI | Total:" .. totalMissions)
end
end
---comment
---@param stageNumber number
---@return boolean | nil
@@ -124,6 +124,7 @@ function Stage:superNew(database, stageConfig, logger, initData, missionPriority
return time + 20
end
do -- load tables
local missionZones = database:getMissionsForStage(self.zoneName)
@@ -450,6 +451,29 @@ function Stage:ActivateBlueGroups()
end
end
---@return number strike
---@return number dead
---@return number bai
function Stage:GetStageStats()
local strike = 0
local dead = 0
local bai = 0
for _, mission in pairs(self._db.missions) do
if mission.missionType == "STRIKE" then
strike = strike + 1
elseif mission.missionType == "DEAD" then
dead = dead + 1
elseif mission.missionType == "BAI" then
bai = bai + 1
end
end
return strike, dead, bai
end
function Stage:ActivateBlueStage()
self._logger:debug("Setting stage '" .. Spearhead.Util.toString(self.zoneName) .. "' to blue")
+2
View File
@@ -1,6 +1,8 @@
SpearheadConfig = {
debugEnabled = false, -- default false
CapConfig = {
--quickly enable of disable the entire CAP Logic
--(you can also just rename all units to not be named "CAP_")
+1
View File
@@ -1,6 +1,7 @@
SpearheadConfig = {
debugEnabled = false,
CapConfig = {
--quickly enable of disable the entire CAP Logic
--(you can also just rename all units to not be named "CAP_")
+4 -4
View File
@@ -2,10 +2,8 @@
--Single player purpose
local defaultLogLevel = "INFO"
local debug = false
local id = net.get_my_player_id()
if id == 0 then
debug = true
if SpearheadConfig and SpearheadConfig.debugEnabled == true then
defaultLogLevel = "DEBUG"
end
@@ -53,6 +51,8 @@ standardLogger:info("Spearhead Initialisation duration: " .. tostring(duration)
Spearhead.LoadingDone()
Spearhead.internal.GlobalStageManager:printFullOverview()
--Check lines of code in directory per file:
-- Get-ChildItem . -Include *.lua -Recurse | foreach {""+(Get-Content $_).Count + " => " + $_.name }; && GCI . -Include *.lua* -Recurse | foreach{(GC $_).Count} | measure-object -sum | % Sum
-- find . -name '*.lua' | xargs wc -l