22 changed files with 132 additions and 261 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

-10
View File
@@ -21,9 +21,6 @@
<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>
@@ -62,13 +59,6 @@
<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,14 +168,8 @@ 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,13 +253,6 @@
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/>
+3 -19
View File
@@ -4,14 +4,13 @@ on:
push:
branches:
- main
- develop
paths:
- '.docs/**'
env:
DOCKER_REGISTRY: registry.dutchie031.net
DOCKER_IMAGE: spearhead-docs
DOCKER_TAG: ${{ github.ref_name == 'main' && 'latest' || 'beta' }}
DOCKER_TAG: latest
jobs:
## Run replacements and cleanups on the docs
@@ -37,7 +36,7 @@ jobs:
sed -i '/@@API_CODE@@/d' .docs/web/pages/spearheadapi.html
rm .docs/web/pages/temp_api_code.html
- name: Highlight Config code and update HTML
- name: Highlight API 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
@@ -106,30 +105,15 @@ jobs:
chmod 600 $HOME/.kube/config
cat $HOME/.kube/config
- name: Run Helm upgrade/install spearhead-docs (main)
if: github.ref_name == 'main'
- name: Run Helm upgrade/install
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
@@ -14,4 +14,3 @@ sources:
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 }}
+17 -10
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,21 +22,28 @@ metadata:
spec:
ingressClassName: nginx
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: spearhead.dutchie031.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $.Values.app }}
name: {{ .Values.app }}
port:
number: {{ $.Values.ports.servicePort }}
{{- end }}
number: {{ .Values.ports.servicePort }}
- host: spearhead.rocks
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.app }}
port:
number: {{ .Values.ports.servicePort }}
tls:
- hosts:
{{- range .Values.ingress.hosts }}
- {{ . }}
{{- end }}
secretName: "{{ .Values.app }}-docs-tls"
- spearhead.dutchie031.com
- spearhead.rocks
secretName: spearhead-docs-tls
-9
View File
@@ -1,9 +0,0 @@
app: spearhead-docs-beta
image:
tag: "beta"
ingress:
hosts:
- beta.spearhead.rocks
-5
View File
@@ -8,8 +8,3 @@ image:
ports:
servicePort: 80
containerPort: 80
ingress:
hosts:
- spearhead.dutchie031.com
- spearhead.rocks
-4
View File
@@ -15,10 +15,6 @@
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._routeDrawings = {}
self._routeDrawing = nil
local group = Group.getByName(self._groupName)
if group then
-47
View File
@@ -58,7 +58,6 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
---@class BlueSamData
---@field groups Array<string>
---@field buildingKilos number?
---@field briefing string?
---@class MissionZoneData
---@field ZoneName string
@@ -75,7 +74,6 @@ 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
@@ -618,27 +616,6 @@ 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
@@ -773,31 +750,7 @@ 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, blueSamData.briefing)
BuildableZone.New(self, zone, self._buildableCrateKilos or 0, "SAM_CRATE", self._blueGroups, logger, database)
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, farpData.briefing)
BuildableZone.New(self, zone, farpData.buildingKilos or 0, "FARP_CRATE", self._groups, logger, database)
end
end
self:Deactivate()
@@ -20,8 +20,7 @@ BuildableZone.__index = BuildableZone
---@param database Database
---@param crateType SupplyType
---@param logger Logger
---@param briefing string?
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database, briefing)
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database)
self._targetZone = targetZone
self._requiredKilos = kilosRequired or 0
self._buildableGroups = buildableGroups or {}
@@ -70,7 +69,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, briefing)
self._buildableMission = BuildableMission.new(database, logger, targetZone, noLandingZone, kilosRequired, crateType)
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 _IDs Array<integer>?
---@field protected _id 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._IDs = {} -- initiate IDs as an empty array, when drawn it will be set to the IDs returned by DrawingHelper.Draw
self._id = nil -- initiate ID as nil, when drawn it will be set to the ID returned by DrawingHelper.Draw
self._name = drawingObject.name
return self
end
@@ -110,24 +110,20 @@ function CustomDrawing:GetName()
end
function CustomDrawing:Draw()
drawingLogger:debug("Drawing custom drawing with IDs " .. table.concat(self._IDs, ", "))
drawingLogger:debug("Drawing custom drawing with ID " .. tostring(self._id))
if self._IDs ~= nil then
for _, id in ipairs(self._IDs) do
DrawingHelper.Remove(id)
end
if self._id ~= nil then
DrawingHelper.Remove(self._id)
end
self._IDs = DrawingHelper.Draw(self._drawingObject)
self._id = DrawingHelper.Draw(self._drawingObject)
end
function CustomDrawing:Remove()
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 = {}
if self._id ~= nil then
drawingLogger:debug("Removing custom drawing with ID " .. tostring(self._id))
DrawingHelper.Remove(self._id)
self._id = nil
end
end
@@ -1,45 +1,57 @@
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.New():isDebugEnabled() then
if GlobalConfig:isDebugEnabled() then
level = "DEBUG"
end
local logger = Logger.new("DrawingHelper", level)
local drawingLogger = Logger.new("DrawingHelper", level)
---@class DrawingHelper
local DrawingHelper = {}
DrawingHelper.__index = DrawingHelper
local customDrawingIdIncrementer = 4210
---@param object DrawingObject
---@return Array<integer> id
function DrawingHelper.Draw(object)
---@param logger Logger?
---@return integer? id
function DrawingHelper.Draw(object, logger)
if object == nil then
if logger then
logger:warn("DrawingHelper.Draw called with nil object")
end
return {}
return nil
end
local id = DrawingHelper.GetAndAddId()
if logger then
logger:debug("Drawing object with ID " .. tostring(id) .. " and primitive type: " .. tostring(object.primitiveType))
end
if(object.primitiveType == "Polygon") then
return DrawingHelper.DrawPolygon(object--[[@as Polygon]])
DrawingHelper.DrawPolygon(object--[[@as Polygon]], id, logger)
elseif(object.primitiveType == "Line") then
return DrawingHelper.DrawLine(object--[[@as Line]])
DrawingHelper.DrawLine(object--[[@as Line]], id, logger)
elseif(object.primitiveType == "TextBox") then
return DrawingHelper.DrawTextBox(object--[[@as TextBox]])
DrawingHelper.DrawTextBox(object--[[@as TextBox]], id)
else
if logger then
logger:warn("Unknown primitive type: " .. tostring(object.primitiveType))
end
end
return {}
return id
end
function DrawingHelper.GetAndAddId()
return DcsUtil.GetNextDrawID()
customDrawingIdIncrementer = customDrawingIdIncrementer + 1
return customDrawingIdIncrementer
end
---@private
@@ -50,7 +62,8 @@ end
---@param lineColor table
---@param lineStyle LineType
---@param lineThickness number
local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineStyle, lineThickness)
---@param logger Logger?
local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineStyle, lineThickness, logger)
if lineThickness == nil or lineThickness <= 0 then
lineStyle = 0
@@ -63,19 +76,23 @@ 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
---@diagnostic disable-next-line: deprecated
local f, err = loadstring(functionString)
if f then
f()
else
logger:error("Something failed when drawing complex drawing" .. err)
env.error("Something failed when drawing complex drawing" .. err)
end
if fillColor then
trigger.action.setMarkupColorFill(drawID, fillColor)
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))
end
trigger.action.setMarkupColorFill(drawID, fillColor)
trigger.action.setMarkupColor(drawID, lineColor)
trigger.action.setMarkupTypeLine(drawID, lineStyle)
@@ -83,14 +100,13 @@ end
---@private
---@param object Polygon
---@return Array<integer>
function DrawingHelper.DrawPolygon(object)
---@param id integer
---@param logger Logger?
function DrawingHelper.DrawPolygon(object, id, logger)
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 }
@@ -101,8 +117,8 @@ function DrawingHelper.DrawPolygon(object)
end
---@param oval Oval
---@return integer?, Array<CustomDrawing>?
local function DrawOval(oval)
---@param logger Logger?
local function DrawOval(oval, logger)
---@type Array<Vec3>
local points = {}
local pointsNo = 30
@@ -118,11 +134,12 @@ function DrawingHelper.DrawPolygon(object)
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)
MarkupToAll(7, id, points, fillColor, color, lineStyle, oval.thickness, logger)
end
---@param free Free
local function DrawFree(free)
---@param logger Logger?
local function DrawFree(free, logger)
local fillColor = DrawingHelper.ColorToColorTable(free.fillColorString)
local color = DrawingHelper.ColorToColorTable(free.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(free.style)
@@ -146,7 +163,7 @@ function DrawingHelper.DrawPolygon(object)
end
end
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness)
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness, logger)
end
---@param rect Rect
@@ -158,16 +175,19 @@ function DrawingHelper.DrawPolygon(object)
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
local function DrawArrow(arrow)
---@param logger Logger?
local function DrawArrow(arrow, logger)
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
local endPoint = { x = arrow.mapX, y = 0, z = arrow.mapY }
local rad = math.rad(arrow.angle or 0)
@@ -183,56 +203,44 @@ function DrawingHelper.DrawPolygon(object)
if object.polygonMode == "circle" then
DrawCircle(object--[[@as Circle]])
elseif object.polygonMode == "oval" then
DrawOval(object--[[@as Oval]])
DrawOval(object--[[@as Oval]], logger)
elseif object.polygonMode == "free" then
DrawFree(object--[[@as Free]])
DrawFree(object--[[@as Free]], logger)
elseif object.polygonMode == "rect" then
DrawRect(object--[[@as Rect]])
elseif object.polygonMode == "arrow" then
DrawArrow(object--[[@as Arrow]])
DrawArrow(object--[[@as Arrow]], logger)
end
return {id}
end
---@private
---@param object Line
---@return Array<integer>
function DrawingHelper.DrawLine(object)
---@param id integer
---@param logger Logger?
function DrawingHelper.DrawLine(object, id, logger)
---@type Array<Vec3>
local points = {}
local ids = {}
for _, point in ipairs(object.points) do
table.insert(points, { x = object.mapX + point.x, y = 0, z = object.mapY + point.y } )
table.insert(points, { x = point.x, y = 0, z = point.y } )
end
local color = DrawingHelper.ColorToColorTable(object.colorString)
local lineStyle = DrawingHelper.ToLineStyleInteger(object.style)
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
MarkupToAll(1, id, points, color, color, lineStyle, object.thickness, logger)
end
---@private
---@param object TextBox
---@return Array<integer>
function DrawingHelper.DrawTextBox(object)
local id = DrawingHelper.GetAndAddId()
---@param id integer
function DrawingHelper.DrawTextBox(object, id)
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)
@@ -244,7 +252,7 @@ end
function DrawingHelper.ColorToColorTable(hexStr)
if hexStr == nil then
logger:warn("ColorToColorTable called with nil hexStr, returning default color {0, 0, 0, 0}")
drawingLogger:warn("ColorToColorTable called with nil hexStr, returning default color {0, 0, 0, 0}")
return { 0, 0, 0, 0 }
end
@@ -262,7 +270,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
logger:warn("ColorTableToColorString called with invalid rgba table, returning default color string '0x00000000'")
drawingLogger:warn("ColorTableToColorString called with invalid rgba table, returning default color string '0x00000000'")
return "0x00000000"
end
@@ -285,11 +293,11 @@ function DrawingHelper.ToLineStyleInteger(lineStyle)
return 2
elseif lineStyle == "dotted" then
return 3
elseif lineStyle == "dotdash" then
elseif lineStyle == "dot dash" then
return 4
elseif lineStyle == "longdash" then
elseif lineStyle == "long dash" then
return 5
elseif lineStyle == "twodash" then
elseif lineStyle == "two dash" then
return 6
else
return 0
@@ -306,11 +314,11 @@ function DrawingHelper.ToLineStyleString(lineStyle)
elseif lineStyle == 3 then
return "dotted"
elseif lineStyle == 4 then
return "dotdash"
return "dot dash"
elseif lineStyle == 5 then
return "longdash"
return "long dash"
elseif lineStyle == 6 then
return "twodash"
return "two dash"
else
return "no line"
end
@@ -21,18 +21,9 @@ 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)
@@ -42,8 +33,7 @@ end
---@param requiredCrateType SupplyType
---@param noLandingZone SpearheadTriggerZone?
---@param logger Logger
---@param briefing string?
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType, briefing)
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType)
setmetatable(BuildableMission, Mission)
@@ -53,7 +43,6 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
self._database = database
self._requiredKilos = requiredKilos
self._droppedKilos = 0
self._briefing = briefing
self._noLandingZone = noLandingZone
@@ -75,13 +64,7 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
end
self.code = tostring(database:GetNewMissionCode())
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
@@ -98,6 +81,7 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
self._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate()
self._state = "NEW"
self.location = targetZone.location
self.missionType = "LOGISTICS"
@@ -132,16 +116,11 @@ 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" ..
briefingPart ..
"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" ..
"\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 Array<number>
---@field drawID number?
---@param runway Runway
@@ -172,10 +172,8 @@ function RunwayStrikeMission:Draw()
runwaySection.drawID = DrawingHelper.Draw(drawObject)
else
for _, drawID in pairs(runwaySection.drawID) do
DcsUtil.SetFillColor(drawID, fillColor)
DcsUtil.SetLineColor(drawID, lineColor)
end
DcsUtil.SetFillColor(runwaySection.drawID, fillColor)
DcsUtil.SetLineColor(runwaySection.drawID, lineColor)
end
end
@@ -499,7 +497,6 @@ function RunwayStrikeMission:ToSections(runway, numSections)
corners = corners,
kilosHit = 0,
repairGroups = {},
drawID = {},
}
table.insert(sections, section)
+2 -12
View File
@@ -632,19 +632,13 @@ 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)
local drawID = DCS_UTIL.GetNextDrawID()
drawID = drawID + 1
trigger.action.markToGroup(drawID, text, location, groupID, true, nil)
return drawID
end
@@ -654,7 +648,7 @@ do -- INIT DCS_UTIL
---@param location Vec3
---@return integer
function DCS_UTIL.AddMarkToAll(text, location)
local drawID = DCS_UTIL.GetNextDrawID()
drawID = drawID + 1
trigger.action.markToAll(drawID, text, location, true, nil)
return drawID
end
@@ -683,10 +677,6 @@ 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,