Author SHA1 Message Date
dutchie031 95fe7e1058 updated releasenotes 2026-09-07 19:22:52 +02:00
dutchie031 b8fe242c43 merged develop 2026-09-07 19:13:11 +02:00
dutchie031 772397250f Feature/lanes (#40)
Update Docs / prepare-docs (push) Successful in 37s
Publish Release / build (push) Successful in 39s
Update Docs / build-image (push) Successful in 30s
Update Docs / deploy-container (push) Successful in 20s
this fixes #35

does not close but starts work partly on #41

Reviewed-on: #40
Co-authored-by: dutchie031 <timrorije@gmail.com>
2026-09-07 17:08:26 +00:00
dutchie031 61ba4de338 buildable mission updates 2026-08-30 20:24:20 +02:00
dutchie031 674160abbf Update doc slightly 2026-08-30 19:17:35 +02:00
dutchie031 8ff25ffeb0 Merge remote-tracking branch 'origin/develop' into feature/customBriefingSupplyMissions 2026-08-30 19:13:26 +02:00
dutchie031 0a7e8ea977 also added the beta block on home screen
Update Docs / prepare-docs (push) Successful in 21s
Update Docs / build-image (push) Successful in 12s
Update Docs / deploy-container (push) Successful in 12s
2026-08-30 18:25:03 +02:00
dutchie031 96507f1d34 updated the sidebar when it's a beta version
Update Docs / prepare-docs (push) Successful in 22s
Update Docs / build-image (push) Successful in 20s
Update Docs / deploy-container (push) Successful in 16s
2026-08-30 18:17:55 +02:00
dutchie031 96ada242a4 updated to change the release name so two releases can co-exist (#46)
Reviewed-on: #46
Co-authored-by: dutchie031 <timrorije@gmail.com>
2026-08-30 12:16:19 +00:00
dutchie031 2bce1985e2 beta.spearhead.rocks now for the beta branch (#45)
Reviewed-on: #45
Co-authored-by: dutchie031 <timrorije@gmail.com>
2026-08-30 11:49:52 +00:00
dutchie031 428fe75a12 wip 2026-08-29 16:12:43 +02:00
dutchie031 2e5a31faef Custom briefings for BlueSam and FARPS 2026-08-29 15:57:29 +02:00
22 changed files with 261 additions and 132 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

+10
View File
@@ -21,6 +21,9 @@
<main>
<div class="reference-container">
<div class="side-nav">
<div id="beta-box-div"></div>
<h4>Quick Links</h4>
<ul>
<li><a href="/pages/tutorials.html" class="side-nav-h2">Tutorials</a></li>
@@ -59,6 +62,13 @@
<footer>
<p>&copy; 2025 Spearhead Project</p>
</footer>
<script>
if (true || window.location.hostname.toLowerCase() == 'beta.spearhead.rocks') {
betaHtml = '<note-box type="warning" title="Beta Version">You are looking at docs that are released with the beta version.</note-box>';
}
document.getElementById('beta-box-div').innerHTML = betaHtml || '';
</script>
</body>
</html>
+6
View File
@@ -168,8 +168,14 @@ class Sidebar extends HTMLElement {
}
render() {
var betaHtml = '';
if (window.location.hostname.toLowerCase() == 'beta.spearhead.rocks') {
betaHtml = '<note-box type="warning" title="Beta Version">You are looking at docs that are released with the beta version.</note-box>';
}
this.innerHTML = `
<div class="side-nav">
${betaHtml}
<h4 class="side-nav-title"></h4>
<ul>
<!-- Navigation items will be populated automatically -->
+7
View File
@@ -253,6 +253,13 @@
To make an airbase buildable add a text box inside of the trigger zone and name it: <code-inline>buildable_[freeform]</code-inline> <br/>
Then in the text box type amount of kilo's you want to be transfered before the logistisc mission is complete. <br/>
<br>
To add a custom briefing for a buildable zone, include a text box inside the trigger zone and name it: <code-inline>supplybriefing_[freeform]</code-inline>.
<code-inline>{{coords}}</code-inline> is highly recommended so the players can easily find their landing zone.<br>
Additionally, the amount of kilos required and delivered are always shown on the bottom, as well as a note to not land in the construction zone.
<br/>
<br>
The base or zone will slowly build up with each crate giving both a nice view of it happening AND it's good for performance as there's not a big addition of objects at once. <br/>
Right now a crate takes 15 seconds to unpack per 500kg. Meaning 2 crates of 1000kg will be faster than 1 crate of 2000kg. <br/>
+19 -3
View File
@@ -4,13 +4,14 @@ on:
push:
branches:
- main
- develop
paths:
- '.docs/**'
env:
DOCKER_REGISTRY: registry.dutchie031.net
DOCKER_IMAGE: spearhead-docs
DOCKER_TAG: latest
DOCKER_TAG: ${{ github.ref_name == 'main' && 'latest' || 'beta' }}
jobs:
## Run replacements and cleanups on the docs
@@ -36,7 +37,7 @@ jobs:
sed -i '/@@API_CODE@@/d' .docs/web/pages/spearheadapi.html
rm .docs/web/pages/temp_api_code.html
- name: Highlight API code and update HTML
- name: Highlight Config code and update HTML
run: |
pygmentize -f html -l lua -O noclasses,style=monokai ./config.lua > .docs/web/pages/temp_config_code.html
# Insert the highlighted code into the placeholder in spearheadapi.html
@@ -105,15 +106,30 @@ jobs:
chmod 600 $HOME/.kube/config
cat $HOME/.kube/config
- name: Run Helm upgrade/install
- name: Run Helm upgrade/install spearhead-docs (main)
if: github.ref_name == 'main'
run: |
helm upgrade --install spearhead-docs .helm \
--namespace spearhead-docs \
--create-namespace \
-f .helm/values.yaml \
--set image.repository=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} \
--set image.tag=${{ env.DOCKER_TAG }} \
--wait
- name: Run Helm upgrade/install spearhead-docs (develop)
if: github.ref_name == 'develop'
run: |
helm upgrade --install spearhead-docs-beta .helm \
--namespace spearhead-docs \
--create-namespace \
-f .helm/values.yaml \
-f .helm/values.beta.yaml \
--set image.repository=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} \
--set image.tag=${{ env.DOCKER_TAG }} \
--wait
# - name: 'Deploy'
# uses: deliverybot/helm@v1
# with:
+1
View File
@@ -13,4 +13,5 @@ sources:
- https://git.dutchie031.com/Spearhead/Spearhead
maintainers:
- name: Spearhead Team
+1 -1
View File
@@ -25,7 +25,7 @@ spec:
type: RuntimeDefault
containers:
- name: {{ .Values.app }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: Always
ports:
- containerPort: {{ .Values.ports.containerPort }}
+10 -17
View File
@@ -14,7 +14,7 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.app }}-ingress
name: "{{ .Values.app }}-ingress"
namespace: spearhead-docs
annotations:
kubernetes.io/tls-acme: "true"
@@ -22,28 +22,21 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: spearhead.dutchie031.com
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.app }}
name: {{ $.Values.app }}
port:
number: {{ .Values.ports.servicePort }}
- host: spearhead.rocks
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.app }}
port:
number: {{ .Values.ports.servicePort }}
number: {{ $.Values.ports.servicePort }}
{{- end }}
tls:
- hosts:
- spearhead.dutchie031.com
- spearhead.rocks
secretName: spearhead-docs-tls
{{- range .Values.ingress.hosts }}
- {{ . }}
{{- end }}
secretName: "{{ .Values.app }}-docs-tls"
+9
View File
@@ -0,0 +1,9 @@
app: spearhead-docs-beta
image:
tag: "beta"
ingress:
hosts:
- beta.spearhead.rocks
+15 -10
View File
@@ -1,10 +1,15 @@
app: spearhead-docs
image:
repository: registry.dutchie031.net/spearhead-docs
tag: latest
ports:
servicePort: 80
containerPort: 80
app: spearhead-docs
image:
repository: registry.dutchie031.net/spearhead-docs
tag: latest
ports:
servicePort: 80
containerPort: 80
ingress:
hosts:
- spearhead.dutchie031.com
- spearhead.rocks
+4
View File
@@ -15,6 +15,10 @@
These lanes can be used to create different stage progression flows and create different "side-stories".
#40
- Issue: #37
Now enabled the mission editor to add a custom briefing to the "Buildable" missions.
#44
### Bug Fixes
## [0.13.0] 2026-08
@@ -34,7 +34,7 @@ function AirGroup:New(groupName, groupType, config, logger, spawnManager)
self._config = config
self._logger = logger
self._spawnManager = spawnManager
self._routeDrawing = nil
self._routeDrawings = {}
local group = Group.getByName(self._groupName)
if group then
+47
View File
@@ -58,6 +58,7 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
---@class BlueSamData
---@field groups Array<string>
---@field buildingKilos number?
---@field briefing string?
---@class MissionZoneData
---@field ZoneName string
@@ -74,6 +75,7 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
---@field padNames Array<string>
---@field buildingKilos number?
---@field supplyHubNames Array<string>
---@field briefing string?
---@class Database
---@field private _tables DatabaseTables
@@ -616,6 +618,27 @@ function Database:loadBlueSamUnits()
local number = tonumber(kvPair.value)
if number and number > 0 then
samData.buildingKilos = number
if env.mission.drawings and env.mission.drawings.layers then
for i, layer in pairs(env.mission.drawings.layers) do
if string.lower(layer.name) == "author" then
for key, layer_object in pairs(layer.objects) do
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
if triggerZone and Util.is2dPointInZone(vec2, triggerZone) then
if layer_object.name and Util.startswith(layer_object.name, "supplybriefing_", true) then
local description = layer_object.text
if description and description ~= "" then
samData.briefing = description
end
end
end
end
end
end
end
else
MissionEditorWarnings.Add("Buildable number for " .. blueSamZone .. " is invalid")
end
end
end
@@ -750,7 +773,31 @@ function Database:loadFarpData()
local number = tonumber(kvPair.value)
if number and number > 0 then
farpzoneData.buildingKilos = number
-- check briefings
if env.mission.drawings and env.mission.drawings.layers then
for i, layer in pairs(env.mission.drawings.layers) do
if string.lower(layer.name) == "author" then
for key, layer_object in pairs(layer.objects) do
local vec2 = { x = layer_object.mapX, y = layer_object.mapY }
if triggerZone and Util.is2dPointInZone(vec2, triggerZone) then
if layer_object.name and Util.startswith(layer_object.name, "supplybriefing_", true) then
local description = layer_object.text
if description and description ~= "" then
farpzoneData.briefing = description
end
end
end
end
end
end
end
else
MissionEditorWarnings.Add("Buildable number for " .. farpZone .. " is invalid.")
end
end
end
end
@@ -89,7 +89,7 @@ function BlueSam.New(database, logger, zoneName, spawnManager)
local zone = DcsUtil.getZoneByName(zoneName)
if zone then
BuildableZone.New(self, zone, self._buildableCrateKilos or 0, "SAM_CRATE", self._blueGroups, logger, database)
BuildableZone.New(self, zone, self._buildableCrateKilos or 0, "SAM_CRATE", self._blueGroups, logger, database, blueSamData.briefing)
end
return self
@@ -64,7 +64,7 @@ function FarpZone.New(database, logger, zoneName, spawnManager)
local zone = DcsUtil.getZoneByName(zoneName)
if zone then
self._logger:debug("Creating Buildable zone: " .. zoneName .. " with " .. (farpData.buildingKilos or "nil") .. " kilos")
BuildableZone.New(self, zone, farpData.buildingKilos or 0, "FARP_CRATE", self._groups, logger, database)
BuildableZone.New(self, zone, farpData.buildingKilos or 0, "FARP_CRATE", self._groups, logger, database, farpData.briefing)
end
end
self:Deactivate()
@@ -20,7 +20,8 @@ BuildableZone.__index = BuildableZone
---@param database Database
---@param crateType SupplyType
---@param logger Logger
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database)
---@param briefing string?
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database, briefing)
self._targetZone = targetZone
self._requiredKilos = kilosRequired or 0
self._buildableGroups = buildableGroups or {}
@@ -69,7 +70,7 @@ function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroup
local noLandingZone = self:GetNoLandingZone()
if kilosRequired and kilosRequired > 0 then
self._buildableMission = BuildableMission.new(database, logger, targetZone, noLandingZone, kilosRequired, crateType)
self._buildableMission = BuildableMission.new(database, logger, targetZone, noLandingZone, kilosRequired, crateType, briefing)
self._buildableMission:AddOnCrateDroppedOfListener(self)
else
self._buildableMission = nil
@@ -538,14 +538,14 @@ function Stage:OnStageNumberChanged(number, stageLaneIdentifier)
---@return boolean
local needsPreActivation = function()
if self._stageLaneIdentifier == stageLaneIdentifier then
if self.stageNumber - number < self._stageConfig.AmountPreactivateStage then
if self.stageNumber <= number + self._stageConfig.AmountPreactivateStage then
return true
end
elseif self._stageLaneIdentifier == nil then
--main lane
--Check if this stage is a chapter stage
if self._stageRepository:getStageLane(self._stageLaneIdentifier):IsChapterStart(self.stageNumber)
and self.stageNumber - number < self._stageConfig.AmountPreactivateStage
and self.stageNumber < number + self._stageConfig.AmountPreactivateStage
then
return true
end
@@ -568,7 +568,7 @@ function Stage:OnStageNumberChanged(number, stageLaneIdentifier)
---@return boolean
local needsBlueActivation = function()
if self._stageLaneIdentifier == stageLaneIdentifier and self.stageNumber > number then
if self._stageLaneIdentifier == stageLaneIdentifier and self.stageNumber < number then
return true
end
return false
@@ -6,7 +6,7 @@ local drawingLogger = Logger.new("CustomDrawing")
---@class CustomDrawing
---@field protected _id integer?
---@field protected _IDs Array<integer>?
---@field protected _name string?
---@field protected _drawingObject DrawingObject
local CustomDrawing = {}
@@ -18,7 +18,7 @@ CustomDrawing.__index = CustomDrawing
function CustomDrawing.New(drawingObject)
local self = setmetatable({}, CustomDrawing)
self._drawingObject = drawingObject
self._id = nil -- initiate ID as nil, when drawn it will be set to the ID returned by DrawingHelper.Draw
self._IDs = {} -- initiate IDs as an empty array, when drawn it will be set to the IDs returned by DrawingHelper.Draw
self._name = drawingObject.name
return self
end
@@ -110,20 +110,24 @@ function CustomDrawing:GetName()
end
function CustomDrawing:Draw()
drawingLogger:debug("Drawing custom drawing with ID " .. tostring(self._id))
drawingLogger:debug("Drawing custom drawing with IDs " .. table.concat(self._IDs, ", "))
if self._id ~= nil then
DrawingHelper.Remove(self._id)
if self._IDs ~= nil then
for _, id in ipairs(self._IDs) do
DrawingHelper.Remove(id)
end
end
self._id = DrawingHelper.Draw(self._drawingObject)
self._IDs = DrawingHelper.Draw(self._drawingObject)
end
function CustomDrawing:Remove()
if self._id ~= nil then
drawingLogger:debug("Removing custom drawing with ID " .. tostring(self._id))
DrawingHelper.Remove(self._id)
self._id = nil
if self._IDs ~= nil then
for _, id in ipairs(self._IDs) do
drawingLogger:debug("Removing custom drawing with ID " .. tostring(id))
DrawingHelper.Remove(id)
end
self._IDs = {}
end
end
@@ -1,57 +1,45 @@
local Util = require("classes.util.Util")
local DcsUtil = require("classes.util.DcsUtil")
local Logger = require("classes.util.Logger")
local GlobalConfig = require("classes.configuration.GlobalConfig")
---@type LogLevel
local level = "INFO"
if GlobalConfig:isDebugEnabled() then
if GlobalConfig.New():isDebugEnabled() then
level = "DEBUG"
end
local drawingLogger = Logger.new("DrawingHelper", level)
local logger = Logger.new("DrawingHelper", level)
---@class DrawingHelper
local DrawingHelper = {}
DrawingHelper.__index = DrawingHelper
local customDrawingIdIncrementer = 4210
---@param object DrawingObject
---@param logger Logger?
---@return integer? id
function DrawingHelper.Draw(object, logger)
---@return Array<integer> id
function DrawingHelper.Draw(object)
if object == nil then
if logger then
logger:warn("DrawingHelper.Draw called with nil object")
end
return nil
end
local id = DrawingHelper.GetAndAddId()
if logger then
logger:debug("Drawing object with ID " .. tostring(id) .. " and primitive type: " .. tostring(object.primitiveType))
return {}
end
if(object.primitiveType == "Polygon") then
DrawingHelper.DrawPolygon(object--[[@as Polygon]], id, logger)
return DrawingHelper.DrawPolygon(object--[[@as Polygon]])
elseif(object.primitiveType == "Line") then
DrawingHelper.DrawLine(object--[[@as Line]], id, logger)
return DrawingHelper.DrawLine(object--[[@as Line]])
elseif(object.primitiveType == "TextBox") then
DrawingHelper.DrawTextBox(object--[[@as TextBox]], id)
return DrawingHelper.DrawTextBox(object--[[@as TextBox]])
else
if logger then
logger:warn("Unknown primitive type: " .. tostring(object.primitiveType))
end
logger:warn("Unknown primitive type: " .. tostring(object.primitiveType))
end
return id
return {}
end
function DrawingHelper.GetAndAddId()
customDrawingIdIncrementer = customDrawingIdIncrementer + 1
return customDrawingIdIncrementer
return DcsUtil.GetNextDrawID()
end
---@private
@@ -62,8 +50,7 @@ end
---@param lineColor table
---@param lineStyle LineType
---@param lineThickness number
---@param logger Logger?
local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineStyle, lineThickness, logger)
local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineStyle, lineThickness)
if lineThickness == nil or lineThickness <= 0 then
lineStyle = 0
@@ -76,23 +63,19 @@ local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineS
end
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, " .. lineStyle .. ")"
if logger then
logger:debug("Drawing complex drawing with ID " .. tostring(drawID) .. " and function string: " .. functionString)
end
logger:debug("Drawing complex drawing with ID " .. tostring(drawID) .. " and function string: " .. functionString)
---@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
if logger then
logger:debug("Drawing with fill color: " .. table.concat(fillColor, ",") .. " and line color: " .. table.concat(lineColor, ",") .. " and line style: " .. tostring(lineStyle) .. " and line thickness: " .. tostring(lineThickness))
logger:error("Something failed when drawing complex drawing" .. err)
end
trigger.action.setMarkupColorFill(drawID, fillColor)
if fillColor then
trigger.action.setMarkupColorFill(drawID, fillColor)
end
trigger.action.setMarkupColor(drawID, lineColor)
trigger.action.setMarkupTypeLine(drawID, lineStyle)
@@ -100,13 +83,14 @@ end
---@private
---@param object Polygon
---@param id integer
---@param logger Logger?
function DrawingHelper.DrawPolygon(object, id, logger)
---@return Array<integer>
function DrawingHelper.DrawPolygon(object)
if object == nil then
return
return {}
end
local id = DrawingHelper.GetAndAddId()
---@param circle Circle
local function DrawCircle(circle)
local vec3 = { x = circle.mapX, y = 0, z = circle.mapY }
@@ -115,15 +99,15 @@ function DrawingHelper.DrawPolygon(object, id, logger)
local style = DrawingHelper.ToLineStyleInteger(circle.style)
trigger.action.circleToAll(-1, id, vec3, circle.radius, colorString, fillColor, style, true)
end
---@param oval Oval
---@param logger Logger?
local function DrawOval(oval, logger)
---@return integer?, Array<CustomDrawing>?
local function DrawOval(oval)
---@type Array<Vec3>
local points = {}
local pointsNo = 30
local angleStep = (2 * math.pi) / pointsNo
local fillColor = DrawingHelper.ColorToColorTable(oval.fillColorString)
local color = DrawingHelper.ColorToColorTable(oval.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(oval.style)
@@ -134,12 +118,11 @@ function DrawingHelper.DrawPolygon(object, id, logger)
local y = oval.mapY + (oval.r2 * math.sin(angle))
table.insert(points, { x = x, y = 0, z = y } )
end
MarkupToAll(7, id, points, fillColor, color, lineStyle, oval.thickness, logger)
MarkupToAll(7, id, points, fillColor, color, lineStyle, oval.thickness)
end
---@param free Free
---@param logger Logger?
local function DrawFree(free, logger)
local function DrawFree(free)
local fillColor = DrawingHelper.ColorToColorTable(free.fillColorString)
local color = DrawingHelper.ColorToColorTable(free.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(free.style)
@@ -163,7 +146,7 @@ function DrawingHelper.DrawPolygon(object, id, logger)
end
end
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness, logger)
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness)
end
---@param rect Rect
@@ -175,19 +158,16 @@ function DrawingHelper.DrawPolygon(object, id, logger)
local pointA = { x = rect.mapX, y = 0, z = rect.mapY }
local pointB = { x = rect.mapX + rect.width, y = 0, z = rect.mapY + rect.height }
trigger.action.rectToAll(-1, id, pointA, pointB, color, fillColor, lineStyle, true)
end
---@param arrow Arrow
---@param logger Logger?
local function DrawArrow(arrow, logger)
local function DrawArrow(arrow)
local fillColor = DrawingHelper.ColorToColorTable(arrow.fillColorString)
local color = DrawingHelper.ColorToColorTable(arrow.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(arrow.style)
if logger then
logger:debug("Drawing arrow with start point: " .. tostring(arrow.mapX) .. ", " .. tostring(arrow.mapY) .. " and angle: " .. tostring(arrow.angle) .. " and length: " .. tostring(arrow.length))
end
logger:debug("Drawing arrow with start point: " .. tostring(arrow.mapX) .. ", " .. tostring(arrow.mapY) .. " and angle: " .. tostring(arrow.angle) .. " and length: " .. tostring(arrow.length))
local endPoint = { x = arrow.mapX, y = 0, z = arrow.mapY }
local rad = math.rad(arrow.angle or 0)
@@ -203,44 +183,56 @@ function DrawingHelper.DrawPolygon(object, id, logger)
if object.polygonMode == "circle" then
DrawCircle(object--[[@as Circle]])
elseif object.polygonMode == "oval" then
DrawOval(object--[[@as Oval]], logger)
DrawOval(object--[[@as Oval]])
elseif object.polygonMode == "free" then
DrawFree(object--[[@as Free]], logger)
DrawFree(object--[[@as Free]])
elseif object.polygonMode == "rect" then
DrawRect(object--[[@as Rect]])
elseif object.polygonMode == "arrow" then
DrawArrow(object--[[@as Arrow]], logger)
DrawArrow(object--[[@as Arrow]])
end
return {id}
end
---@private
---@param object Line
---@param id integer
---@param logger Logger?
function DrawingHelper.DrawLine(object, id, logger)
---@return Array<integer>
function DrawingHelper.DrawLine(object)
---@type Array<Vec3>
local points = {}
local ids = {}
for _, point in ipairs(object.points) do
table.insert(points, { x = point.x, y = 0, z = point.y } )
table.insert(points, { x = object.mapX + point.x, y = 0, z = object.mapY + point.y } )
end
local color = DrawingHelper.ColorToColorTable(object.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(object.style)
MarkupToAll(1, id, points, color, color, lineStyle, object.thickness, logger)
for i = 1, #points - 1 do
local id = DrawingHelper.GetAndAddId()
trigger.action.lineToAll(-1, id, points[i], points[i + 1], color, lineStyle, true)
table.insert(ids, id)
end
return ids
end
---@private
---@param object TextBox
---@param id integer
function DrawingHelper.DrawTextBox(object, id)
---@return Array<integer>
function DrawingHelper.DrawTextBox(object)
local id = DrawingHelper.GetAndAddId()
trigger.action.textToAll(-1, id, { x= object.mapX, y = 0, z = object.mapY },
DrawingHelper.ColorToColorTable(object.colorString),
DrawingHelper.ColorToColorTable(object.fillColorString),
object.fontSize or 12,
true,
object.text or "")
return {id}
end
function DrawingHelper.Remove(id)
@@ -252,7 +244,7 @@ end
function DrawingHelper.ColorToColorTable(hexStr)
if hexStr == nil then
drawingLogger:warn("ColorToColorTable called with nil hexStr, returning default color {0, 0, 0, 0}")
logger:warn("ColorToColorTable called with nil hexStr, returning default color {0, 0, 0, 0}")
return { 0, 0, 0, 0 }
end
@@ -270,7 +262,7 @@ end
---@return string
function DrawingHelper.ColorTableToColorString(rgba)
if rgba == nil or #rgba < 4 or rgba[1] == nil or rgba[2] == nil or rgba[3] == nil or rgba[4] == nil then
drawingLogger:warn("ColorTableToColorString called with invalid rgba table, returning default color string '0x00000000'")
logger:warn("ColorTableToColorString called with invalid rgba table, returning default color string '0x00000000'")
return "0x00000000"
end
@@ -293,11 +285,11 @@ function DrawingHelper.ToLineStyleInteger(lineStyle)
return 2
elseif lineStyle == "dotted" then
return 3
elseif lineStyle == "dot dash" then
elseif lineStyle == "dotdash" then
return 4
elseif lineStyle == "long dash" then
elseif lineStyle == "longdash" then
return 5
elseif lineStyle == "two dash" then
elseif lineStyle == "twodash" then
return 6
else
return 0
@@ -314,11 +306,11 @@ function DrawingHelper.ToLineStyleString(lineStyle)
elseif lineStyle == 3 then
return "dotted"
elseif lineStyle == 4 then
return "dot dash"
return "dotdash"
elseif lineStyle == 5 then
return "long dash"
return "longdash"
elseif lineStyle == 6 then
return "two dash"
return "twodash"
else
return "no line"
end
@@ -21,9 +21,18 @@ local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelpe
---@field private _dropOffZone SpearheadTriggerZone?
---@field private _noLandingZoneDrawing CustomDrawing?
---@field private _dropOffZoneDrawing CustomDrawing?
---@field private _briefing string?
local BuildableMission = {}
BuildableMission.__index = BuildableMission
local function getDefaultBriefing(siteType, coords)
return "We've dispatched forward units to find a proper spot for a new " .. siteType .. "." ..
"\nYou will need to drop off supplies so they can start building." ..
"\nThe coords are: " .. coords ..
"\n\n"
end
---@class OnCrateDroppedListener
---@field OnCrateDroppedOff fun(self:OnCrateDroppedListener, mission:BuildableMission, kilos:number)
@@ -33,7 +42,8 @@ BuildableMission.__index = BuildableMission
---@param requiredCrateType SupplyType
---@param noLandingZone SpearheadTriggerZone?
---@param logger Logger
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType)
---@param briefing string?
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType, briefing)
setmetatable(BuildableMission, Mission)
@@ -43,6 +53,7 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
self._database = database
self._requiredKilos = requiredKilos
self._droppedKilos = 0
self._briefing = briefing
self._noLandingZone = noLandingZone
@@ -64,7 +75,13 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
end
self.code = tostring(database:GetNewMissionCode())
self.name = "Resupply"
local splitTargetZoneName = Util.split_string(targetZone.name, "_")
if splitTargetZoneName and splitTargetZoneName[3] and splitTargetZoneName[3] ~= "" then
self.name = splitTargetZoneName[3]
else
self.name = "Resupply"
end
local type = "site"
if requiredCrateType == "SAM_CRATE" then
@@ -81,7 +98,6 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
self._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate()
self._state = "NEW"
self.location = targetZone.location
self.missionType = "LOGISTICS"
@@ -116,11 +132,16 @@ function BuildableMission:ShowBriefing(groupID)
siteType = "airbase"
end
local briefingPart = self._briefing
if briefingPart then
briefingPart = Util.replaceString(briefingPart, "{{coords}}", coords)
else
briefingPart = getDefaultBriefing(siteType, coords)
end
local briefing = "Mission [" .. self.code .. "] " .. self.name ..
"\n \n" ..
"We've dispatched forward units to find a proper spot for a new " .. siteType .. "." ..
"\nYou will need to drop off supplies so they can start building." ..
"\nThe coords are: " .. coords ..
briefingPart ..
"\n\n" ..
"\nKilos still required: " .. self._requiredKilos - self._droppedKilos ..
"\n\n" ..
@@ -18,7 +18,7 @@ local RunwayStrikeMission = {}
---@field corners Array<Vec2>
---@field kilosHit number
---@field repairGroups Array<string>
---@field drawID number?
---@field drawID Array<number>
---@param runway Runway
@@ -172,8 +172,10 @@ function RunwayStrikeMission:Draw()
runwaySection.drawID = DrawingHelper.Draw(drawObject)
else
DcsUtil.SetFillColor(runwaySection.drawID, fillColor)
DcsUtil.SetLineColor(runwaySection.drawID, lineColor)
for _, drawID in pairs(runwaySection.drawID) do
DcsUtil.SetFillColor(drawID, fillColor)
DcsUtil.SetLineColor(drawID, lineColor)
end
end
end
@@ -497,6 +499,7 @@ function RunwayStrikeMission:ToSections(runway, numSections)
corners = corners,
kilosHit = 0,
repairGroups = {},
drawID = {},
}
table.insert(sections, section)
+12 -2
View File
@@ -632,13 +632,19 @@ do -- INIT DCS_UTIL
---@field b number
---@field a number
local drawID = 4210
function DCS_UTIL.GetNextDrawID()
drawID = drawID + 1
return drawID
end
---@param groupID number
---@param text string
---@param location Vec3
---@return number markID
function DCS_UTIL.AddMarkToGroup(groupID, text, location)
drawID = drawID + 1
local drawID = DCS_UTIL.GetNextDrawID()
trigger.action.markToGroup(drawID, text, location, groupID, true, nil)
return drawID
end
@@ -648,7 +654,7 @@ do -- INIT DCS_UTIL
---@param location Vec3
---@return integer
function DCS_UTIL.AddMarkToAll(text, location)
drawID = drawID + 1
local drawID = DCS_UTIL.GetNextDrawID()
trigger.action.markToAll(drawID, text, location, true, nil)
return drawID
end
@@ -677,6 +683,10 @@ do -- INIT DCS_UTIL
---@param drawID number
---@param fillColor DrawColor
function DCS_UTIL.SetFillColor(drawID, fillColor)
if fillColor == nil then
return
end
local lineColorMapped = {
fillColor.r or 0,
fillColor.g or 0,