Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a7febfa4d | ||
|
|
e8e12cf892 | ||
|
|
1b46b828a6 | ||
|
|
4b1ec92235 | ||
|
|
368310d026 | ||
|
|
4de9e91efd | ||
|
|
c10c743fe8 | ||
|
|
51bed10822 | ||
|
|
27548d69bb | ||
|
|
b9068a7ac8 |
Binary file not shown.
|
Before Width: | Height: | Size: 345 KiB |
@@ -21,9 +21,6 @@
|
|||||||
<main>
|
<main>
|
||||||
<div class="reference-container">
|
<div class="reference-container">
|
||||||
<div class="side-nav">
|
<div class="side-nav">
|
||||||
|
|
||||||
<div id="beta-box-div"></div>
|
|
||||||
|
|
||||||
<h4>Quick Links</h4>
|
<h4>Quick Links</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/pages/tutorials.html" class="side-nav-h2">Tutorials</a></li>
|
<li><a href="/pages/tutorials.html" class="side-nav-h2">Tutorials</a></li>
|
||||||
@@ -62,13 +59,6 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>© 2025 Spearhead Project</p>
|
<p>© 2025 Spearhead Project</p>
|
||||||
</footer>
|
</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>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -168,14 +168,8 @@ class Sidebar extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
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 = `
|
this.innerHTML = `
|
||||||
<div class="side-nav">
|
<div class="side-nav">
|
||||||
${betaHtml}
|
|
||||||
<h4 class="side-nav-title"></h4>
|
<h4 class="side-nav-title"></h4>
|
||||||
<ul>
|
<ul>
|
||||||
<!-- Navigation items will be populated automatically -->
|
<!-- Navigation items will be populated automatically -->
|
||||||
|
|||||||
@@ -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/>
|
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/>
|
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>
|
<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/>
|
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/>
|
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/>
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
|
||||||
paths:
|
paths:
|
||||||
- '.docs/**'
|
- '.docs/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: registry.dutchie031.net
|
DOCKER_REGISTRY: registry.dutchie031.net
|
||||||
DOCKER_IMAGE: spearhead-docs
|
DOCKER_IMAGE: spearhead-docs
|
||||||
DOCKER_TAG: ${{ github.ref_name == 'main' && 'latest' || 'beta' }}
|
DOCKER_TAG: latest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
## Run replacements and cleanups on the docs
|
## Run replacements and cleanups on the docs
|
||||||
@@ -37,7 +36,7 @@ jobs:
|
|||||||
sed -i '/@@API_CODE@@/d' .docs/web/pages/spearheadapi.html
|
sed -i '/@@API_CODE@@/d' .docs/web/pages/spearheadapi.html
|
||||||
rm .docs/web/pages/temp_api_code.html
|
rm .docs/web/pages/temp_api_code.html
|
||||||
|
|
||||||
- name: Highlight Config code and update HTML
|
- name: Highlight API code and update HTML
|
||||||
run: |
|
run: |
|
||||||
pygmentize -f html -l lua -O noclasses,style=monokai ./config.lua > .docs/web/pages/temp_config_code.html
|
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
|
# Insert the highlighted code into the placeholder in spearheadapi.html
|
||||||
@@ -106,30 +105,15 @@ jobs:
|
|||||||
chmod 600 $HOME/.kube/config
|
chmod 600 $HOME/.kube/config
|
||||||
cat $HOME/.kube/config
|
cat $HOME/.kube/config
|
||||||
|
|
||||||
- name: Run Helm upgrade/install spearhead-docs (main)
|
- name: Run Helm upgrade/install
|
||||||
if: github.ref_name == 'main'
|
|
||||||
run: |
|
run: |
|
||||||
helm upgrade --install spearhead-docs .helm \
|
helm upgrade --install spearhead-docs .helm \
|
||||||
--namespace spearhead-docs \
|
--namespace spearhead-docs \
|
||||||
--create-namespace \
|
--create-namespace \
|
||||||
-f .helm/values.yaml \
|
|
||||||
--set image.repository=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} \
|
--set image.repository=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} \
|
||||||
--set image.tag=${{ env.DOCKER_TAG }} \
|
--set image.tag=${{ env.DOCKER_TAG }} \
|
||||||
--wait
|
--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'
|
# - name: 'Deploy'
|
||||||
# uses: deliverybot/helm@v1
|
# uses: deliverybot/helm@v1
|
||||||
# with:
|
# with:
|
||||||
|
|||||||
@@ -13,5 +13,4 @@ sources:
|
|||||||
- https://git.dutchie031.com/Spearhead/Spearhead
|
- https://git.dutchie031.com/Spearhead/Spearhead
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: Spearhead Team
|
- name: Spearhead Team
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ spec:
|
|||||||
type: RuntimeDefault
|
type: RuntimeDefault
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Values.app }}
|
- name: {{ .Values.app }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.ports.containerPort }}
|
- containerPort: {{ .Values.ports.containerPort }}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ spec:
|
|||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: "{{ .Values.app }}-ingress"
|
name: {{ .Values.app }}-ingress
|
||||||
namespace: spearhead-docs
|
namespace: spearhead-docs
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/tls-acme: "true"
|
kubernetes.io/tls-acme: "true"
|
||||||
@@ -22,21 +22,28 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
ingressClassName: nginx
|
ingressClassName: nginx
|
||||||
rules:
|
rules:
|
||||||
{{- range .Values.ingress.hosts }}
|
- host: spearhead.dutchie031.com
|
||||||
- host: {{ . }}
|
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: {{ $.Values.app }}
|
name: {{ .Values.app }}
|
||||||
port:
|
port:
|
||||||
number: {{ $.Values.ports.servicePort }}
|
number: {{ .Values.ports.servicePort }}
|
||||||
{{- end }}
|
- host: spearhead.rocks
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ .Values.app }}
|
||||||
|
port:
|
||||||
|
number: {{ .Values.ports.servicePort }}
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
{{- range .Values.ingress.hosts }}
|
- spearhead.dutchie031.com
|
||||||
- {{ . }}
|
- spearhead.rocks
|
||||||
{{- end }}
|
secretName: spearhead-docs-tls
|
||||||
secretName: "{{ .Values.app }}-docs-tls"
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
app: spearhead-docs-beta
|
|
||||||
|
|
||||||
image:
|
|
||||||
tag: "beta"
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
hosts:
|
|
||||||
- beta.spearhead.rocks
|
|
||||||
+10
-15
@@ -1,15 +1,10 @@
|
|||||||
|
|
||||||
app: spearhead-docs
|
app: spearhead-docs
|
||||||
|
|
||||||
image:
|
image:
|
||||||
repository: registry.dutchie031.net/spearhead-docs
|
repository: registry.dutchie031.net/spearhead-docs
|
||||||
tag: latest
|
tag: latest
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
servicePort: 80
|
servicePort: 80
|
||||||
containerPort: 80
|
containerPort: 80
|
||||||
|
|
||||||
ingress:
|
|
||||||
hosts:
|
|
||||||
- spearhead.dutchie031.com
|
|
||||||
- spearhead.rocks
|
|
||||||
@@ -15,10 +15,6 @@
|
|||||||
These lanes can be used to create different stage progression flows and create different "side-stories".
|
These lanes can be used to create different stage progression flows and create different "side-stories".
|
||||||
#40
|
#40
|
||||||
|
|
||||||
- Issue: #37
|
|
||||||
Now enabled the mission editor to add a custom briefing to the "Buildable" missions.
|
|
||||||
#44
|
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
## [0.13.0] 2026-08
|
## [0.13.0] 2026-08
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function AirGroup:New(groupName, groupType, config, logger, spawnManager)
|
|||||||
self._config = config
|
self._config = config
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._spawnManager = spawnManager
|
self._spawnManager = spawnManager
|
||||||
self._routeDrawings = {}
|
self._routeDrawing = nil
|
||||||
|
|
||||||
local group = Group.getByName(self._groupName)
|
local group = Group.getByName(self._groupName)
|
||||||
if group then
|
if group then
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
|
|||||||
---@class BlueSamData
|
---@class BlueSamData
|
||||||
---@field groups Array<string>
|
---@field groups Array<string>
|
||||||
---@field buildingKilos number?
|
---@field buildingKilos number?
|
||||||
---@field briefing string?
|
|
||||||
|
|
||||||
---@class MissionZoneData
|
---@class MissionZoneData
|
||||||
---@field ZoneName string
|
---@field ZoneName string
|
||||||
@@ -75,7 +74,6 @@ local StageDrawing = require("classes.stageClasses.drawings.StageDrawing")
|
|||||||
---@field padNames Array<string>
|
---@field padNames Array<string>
|
||||||
---@field buildingKilos number?
|
---@field buildingKilos number?
|
||||||
---@field supplyHubNames Array<string>
|
---@field supplyHubNames Array<string>
|
||||||
---@field briefing string?
|
|
||||||
|
|
||||||
---@class Database
|
---@class Database
|
||||||
---@field private _tables DatabaseTables
|
---@field private _tables DatabaseTables
|
||||||
@@ -618,27 +616,6 @@ function Database:loadBlueSamUnits()
|
|||||||
local number = tonumber(kvPair.value)
|
local number = tonumber(kvPair.value)
|
||||||
if number and number > 0 then
|
if number and number > 0 then
|
||||||
samData.buildingKilos = number
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -773,31 +750,7 @@ function Database:loadFarpData()
|
|||||||
local number = tonumber(kvPair.value)
|
local number = tonumber(kvPair.value)
|
||||||
if number and number > 0 then
|
if number and number > 0 then
|
||||||
farpzoneData.buildingKilos = number
|
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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ function BlueSam.New(database, logger, zoneName, spawnManager)
|
|||||||
|
|
||||||
local zone = DcsUtil.getZoneByName(zoneName)
|
local zone = DcsUtil.getZoneByName(zoneName)
|
||||||
if zone then
|
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
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ function FarpZone.New(database, logger, zoneName, spawnManager)
|
|||||||
local zone = DcsUtil.getZoneByName(zoneName)
|
local zone = DcsUtil.getZoneByName(zoneName)
|
||||||
if zone then
|
if zone then
|
||||||
self._logger:debug("Creating Buildable zone: " .. zoneName .. " with " .. (farpData.buildingKilos or "nil") .. " kilos")
|
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
|
||||||
end
|
end
|
||||||
self:Deactivate()
|
self:Deactivate()
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ BuildableZone.__index = BuildableZone
|
|||||||
---@param database Database
|
---@param database Database
|
||||||
---@param crateType SupplyType
|
---@param crateType SupplyType
|
||||||
---@param logger Logger
|
---@param logger Logger
|
||||||
---@param briefing string?
|
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database)
|
||||||
function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroups, logger, database, briefing)
|
|
||||||
self._targetZone = targetZone
|
self._targetZone = targetZone
|
||||||
self._requiredKilos = kilosRequired or 0
|
self._requiredKilos = kilosRequired or 0
|
||||||
self._buildableGroups = buildableGroups or {}
|
self._buildableGroups = buildableGroups or {}
|
||||||
@@ -70,7 +69,7 @@ function BuildableZone:New(targetZone, kilosRequired, crateType, buildableGroup
|
|||||||
|
|
||||||
local noLandingZone = self:GetNoLandingZone()
|
local noLandingZone = self:GetNoLandingZone()
|
||||||
if kilosRequired and kilosRequired > 0 then
|
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)
|
self._buildableMission:AddOnCrateDroppedOfListener(self)
|
||||||
else
|
else
|
||||||
self._buildableMission = nil
|
self._buildableMission = nil
|
||||||
|
|||||||
@@ -538,14 +538,14 @@ function Stage:OnStageNumberChanged(number, stageLaneIdentifier)
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
local needsPreActivation = function()
|
local needsPreActivation = function()
|
||||||
if self._stageLaneIdentifier == stageLaneIdentifier then
|
if self._stageLaneIdentifier == stageLaneIdentifier then
|
||||||
if self.stageNumber <= number + self._stageConfig.AmountPreactivateStage then
|
if self.stageNumber - number < self._stageConfig.AmountPreactivateStage then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
elseif self._stageLaneIdentifier == nil then
|
elseif self._stageLaneIdentifier == nil then
|
||||||
--main lane
|
--main lane
|
||||||
--Check if this stage is a chapter stage
|
--Check if this stage is a chapter stage
|
||||||
if self._stageRepository:getStageLane(self._stageLaneIdentifier):IsChapterStart(self.stageNumber)
|
if self._stageRepository:getStageLane(self._stageLaneIdentifier):IsChapterStart(self.stageNumber)
|
||||||
and self.stageNumber < number + self._stageConfig.AmountPreactivateStage
|
and self.stageNumber - number < self._stageConfig.AmountPreactivateStage
|
||||||
then
|
then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -568,7 +568,7 @@ function Stage:OnStageNumberChanged(number, stageLaneIdentifier)
|
|||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
local needsBlueActivation = function()
|
local needsBlueActivation = function()
|
||||||
if self._stageLaneIdentifier == stageLaneIdentifier and self.stageNumber < number then
|
if self._stageLaneIdentifier == stageLaneIdentifier and self.stageNumber > number then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ local drawingLogger = Logger.new("CustomDrawing")
|
|||||||
|
|
||||||
|
|
||||||
---@class CustomDrawing
|
---@class CustomDrawing
|
||||||
---@field protected _IDs Array<integer>?
|
---@field protected _id integer?
|
||||||
---@field protected _name string?
|
---@field protected _name string?
|
||||||
---@field protected _drawingObject DrawingObject
|
---@field protected _drawingObject DrawingObject
|
||||||
local CustomDrawing = {}
|
local CustomDrawing = {}
|
||||||
@@ -18,7 +18,7 @@ CustomDrawing.__index = CustomDrawing
|
|||||||
function CustomDrawing.New(drawingObject)
|
function CustomDrawing.New(drawingObject)
|
||||||
local self = setmetatable({}, CustomDrawing)
|
local self = setmetatable({}, CustomDrawing)
|
||||||
self._drawingObject = drawingObject
|
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
|
self._name = drawingObject.name
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -110,24 +110,20 @@ function CustomDrawing:GetName()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CustomDrawing:Draw()
|
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
|
if self._id ~= nil then
|
||||||
for _, id in ipairs(self._IDs) do
|
DrawingHelper.Remove(self._id)
|
||||||
DrawingHelper.Remove(id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self._IDs = DrawingHelper.Draw(self._drawingObject)
|
self._id = DrawingHelper.Draw(self._drawingObject)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CustomDrawing:Remove()
|
function CustomDrawing:Remove()
|
||||||
if self._IDs ~= nil then
|
if self._id ~= nil then
|
||||||
for _, id in ipairs(self._IDs) do
|
drawingLogger:debug("Removing custom drawing with ID " .. tostring(self._id))
|
||||||
drawingLogger:debug("Removing custom drawing with ID " .. tostring(id))
|
DrawingHelper.Remove(self._id)
|
||||||
DrawingHelper.Remove(id)
|
self._id = nil
|
||||||
end
|
|
||||||
self._IDs = {}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,57 @@
|
|||||||
local Util = require("classes.util.Util")
|
local Util = require("classes.util.Util")
|
||||||
local DcsUtil = require("classes.util.DcsUtil")
|
|
||||||
local Logger = require("classes.util.Logger")
|
local Logger = require("classes.util.Logger")
|
||||||
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
local GlobalConfig = require("classes.configuration.GlobalConfig")
|
||||||
|
|
||||||
---@type LogLevel
|
---@type LogLevel
|
||||||
local level = "INFO"
|
local level = "INFO"
|
||||||
if GlobalConfig.New():isDebugEnabled() then
|
if GlobalConfig:isDebugEnabled() then
|
||||||
level = "DEBUG"
|
level = "DEBUG"
|
||||||
end
|
end
|
||||||
|
|
||||||
local logger = Logger.new("DrawingHelper", level)
|
local drawingLogger = Logger.new("DrawingHelper", level)
|
||||||
|
|
||||||
---@class DrawingHelper
|
---@class DrawingHelper
|
||||||
local DrawingHelper = {}
|
local DrawingHelper = {}
|
||||||
DrawingHelper.__index = DrawingHelper
|
DrawingHelper.__index = DrawingHelper
|
||||||
|
|
||||||
|
|
||||||
|
local customDrawingIdIncrementer = 4210
|
||||||
|
|
||||||
---@param object DrawingObject
|
---@param object DrawingObject
|
||||||
---@return Array<integer> id
|
---@param logger Logger?
|
||||||
function DrawingHelper.Draw(object)
|
---@return integer? id
|
||||||
|
function DrawingHelper.Draw(object, logger)
|
||||||
if object == nil then
|
if object == nil then
|
||||||
if logger then
|
if logger then
|
||||||
logger:warn("DrawingHelper.Draw called with nil object")
|
logger:warn("DrawingHelper.Draw called with nil object")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
if(object.primitiveType == "Polygon") then
|
if(object.primitiveType == "Polygon") then
|
||||||
return DrawingHelper.DrawPolygon(object--[[@as Polygon]])
|
DrawingHelper.DrawPolygon(object--[[@as Polygon]], id, logger)
|
||||||
elseif(object.primitiveType == "Line") then
|
elseif(object.primitiveType == "Line") then
|
||||||
return DrawingHelper.DrawLine(object--[[@as Line]])
|
DrawingHelper.DrawLine(object--[[@as Line]], id, logger)
|
||||||
elseif(object.primitiveType == "TextBox") then
|
elseif(object.primitiveType == "TextBox") then
|
||||||
return DrawingHelper.DrawTextBox(object--[[@as TextBox]])
|
DrawingHelper.DrawTextBox(object--[[@as TextBox]], id)
|
||||||
else
|
else
|
||||||
logger:warn("Unknown primitive type: " .. tostring(object.primitiveType))
|
if logger then
|
||||||
|
logger:warn("Unknown primitive type: " .. tostring(object.primitiveType))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {}
|
return id
|
||||||
end
|
end
|
||||||
|
|
||||||
function DrawingHelper.GetAndAddId()
|
function DrawingHelper.GetAndAddId()
|
||||||
return DcsUtil.GetNextDrawID()
|
customDrawingIdIncrementer = customDrawingIdIncrementer + 1
|
||||||
|
return customDrawingIdIncrementer
|
||||||
end
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
@@ -50,7 +62,8 @@ end
|
|||||||
---@param lineColor table
|
---@param lineColor table
|
||||||
---@param lineStyle LineType
|
---@param lineStyle LineType
|
||||||
---@param lineThickness number
|
---@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
|
if lineThickness == nil or lineThickness <= 0 then
|
||||||
lineStyle = 0
|
lineStyle = 0
|
||||||
@@ -63,19 +76,23 @@ local function MarkupToAll(shapeID, drawID, points, fillColor, lineColor, lineS
|
|||||||
end
|
end
|
||||||
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, " .. lineStyle .. ")"
|
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, " .. lineStyle .. ")"
|
||||||
|
|
||||||
logger:debug("Drawing complex drawing with ID " .. tostring(drawID) .. " and function string: " .. functionString)
|
if logger then
|
||||||
|
logger:debug("Drawing complex drawing with ID " .. tostring(drawID) .. " and function string: " .. functionString)
|
||||||
|
end
|
||||||
|
|
||||||
---@diagnostic disable-next-line: deprecated
|
---@diagnostic disable-next-line: deprecated
|
||||||
local f, err = loadstring(functionString)
|
local f, err = loadstring(functionString)
|
||||||
if f then
|
if f then
|
||||||
f()
|
f()
|
||||||
else
|
else
|
||||||
logger:error("Something failed when drawing complex drawing" .. err)
|
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))
|
||||||
end
|
end
|
||||||
|
|
||||||
if fillColor then
|
trigger.action.setMarkupColorFill(drawID, fillColor)
|
||||||
trigger.action.setMarkupColorFill(drawID, fillColor)
|
|
||||||
end
|
|
||||||
trigger.action.setMarkupColor(drawID, lineColor)
|
trigger.action.setMarkupColor(drawID, lineColor)
|
||||||
trigger.action.setMarkupTypeLine(drawID, lineStyle)
|
trigger.action.setMarkupTypeLine(drawID, lineStyle)
|
||||||
|
|
||||||
@@ -83,14 +100,13 @@ end
|
|||||||
|
|
||||||
---@private
|
---@private
|
||||||
---@param object Polygon
|
---@param object Polygon
|
||||||
---@return Array<integer>
|
---@param id integer
|
||||||
function DrawingHelper.DrawPolygon(object)
|
---@param logger Logger?
|
||||||
|
function DrawingHelper.DrawPolygon(object, id, logger)
|
||||||
if object == nil then
|
if object == nil then
|
||||||
return {}
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = DrawingHelper.GetAndAddId()
|
|
||||||
|
|
||||||
---@param circle Circle
|
---@param circle Circle
|
||||||
local function DrawCircle(circle)
|
local function DrawCircle(circle)
|
||||||
local vec3 = { x = circle.mapX, y = 0, z = circle.mapY }
|
local vec3 = { x = circle.mapX, y = 0, z = circle.mapY }
|
||||||
@@ -99,15 +115,15 @@ function DrawingHelper.DrawPolygon(object)
|
|||||||
local style = DrawingHelper.ToLineStyleInteger(circle.style)
|
local style = DrawingHelper.ToLineStyleInteger(circle.style)
|
||||||
trigger.action.circleToAll(-1, id, vec3, circle.radius, colorString, fillColor, style, true)
|
trigger.action.circleToAll(-1, id, vec3, circle.radius, colorString, fillColor, style, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param oval Oval
|
---@param oval Oval
|
||||||
---@return integer?, Array<CustomDrawing>?
|
---@param logger Logger?
|
||||||
local function DrawOval(oval)
|
local function DrawOval(oval, logger)
|
||||||
---@type Array<Vec3>
|
---@type Array<Vec3>
|
||||||
local points = {}
|
local points = {}
|
||||||
local pointsNo = 30
|
local pointsNo = 30
|
||||||
local angleStep = (2 * math.pi) / pointsNo
|
local angleStep = (2 * math.pi) / pointsNo
|
||||||
|
|
||||||
local fillColor = DrawingHelper.ColorToColorTable(oval.fillColorString)
|
local fillColor = DrawingHelper.ColorToColorTable(oval.fillColorString)
|
||||||
local color = DrawingHelper.ColorToColorTable(oval.colorString)
|
local color = DrawingHelper.ColorToColorTable(oval.colorString)
|
||||||
local lineStyle = DrawingHelper.ToLineStyleInteger(oval.style)
|
local lineStyle = DrawingHelper.ToLineStyleInteger(oval.style)
|
||||||
@@ -118,11 +134,12 @@ function DrawingHelper.DrawPolygon(object)
|
|||||||
local y = oval.mapY + (oval.r2 * math.sin(angle))
|
local y = oval.mapY + (oval.r2 * math.sin(angle))
|
||||||
table.insert(points, { x = x, y = 0, z = y } )
|
table.insert(points, { x = x, y = 0, z = y } )
|
||||||
end
|
end
|
||||||
MarkupToAll(7, id, points, fillColor, color, lineStyle, oval.thickness)
|
MarkupToAll(7, id, points, fillColor, color, lineStyle, oval.thickness, logger)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param free Free
|
---@param free Free
|
||||||
local function DrawFree(free)
|
---@param logger Logger?
|
||||||
|
local function DrawFree(free, logger)
|
||||||
local fillColor = DrawingHelper.ColorToColorTable(free.fillColorString)
|
local fillColor = DrawingHelper.ColorToColorTable(free.fillColorString)
|
||||||
local color = DrawingHelper.ColorToColorTable(free.colorString)
|
local color = DrawingHelper.ColorToColorTable(free.colorString)
|
||||||
local lineStyle = DrawingHelper.ToLineStyleInteger(free.style)
|
local lineStyle = DrawingHelper.ToLineStyleInteger(free.style)
|
||||||
@@ -146,7 +163,7 @@ function DrawingHelper.DrawPolygon(object)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness)
|
MarkupToAll(7, id, points, fillColor, color, lineStyle, free.thickness, logger)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param rect Rect
|
---@param rect Rect
|
||||||
@@ -158,16 +175,19 @@ function DrawingHelper.DrawPolygon(object)
|
|||||||
local pointA = { x = rect.mapX, y = 0, z = rect.mapY }
|
local pointA = { x = rect.mapX, y = 0, z = rect.mapY }
|
||||||
local pointB = { x = rect.mapX + rect.width, y = 0, z = rect.mapY + rect.height }
|
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)
|
trigger.action.rectToAll(-1, id, pointA, pointB, color, fillColor, lineStyle, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param arrow Arrow
|
---@param arrow Arrow
|
||||||
local function DrawArrow(arrow)
|
---@param logger Logger?
|
||||||
|
local function DrawArrow(arrow, logger)
|
||||||
local fillColor = DrawingHelper.ColorToColorTable(arrow.fillColorString)
|
local fillColor = DrawingHelper.ColorToColorTable(arrow.fillColorString)
|
||||||
local color = DrawingHelper.ColorToColorTable(arrow.colorString)
|
local color = DrawingHelper.ColorToColorTable(arrow.colorString)
|
||||||
local lineStyle = DrawingHelper.ToLineStyleInteger(arrow.style)
|
local lineStyle = DrawingHelper.ToLineStyleInteger(arrow.style)
|
||||||
|
|
||||||
logger:debug("Drawing arrow with start point: " .. tostring(arrow.mapX) .. ", " .. tostring(arrow.mapY) .. " and angle: " .. tostring(arrow.angle) .. " and length: " .. tostring(arrow.length))
|
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 endPoint = { x = arrow.mapX, y = 0, z = arrow.mapY }
|
||||||
local rad = math.rad(arrow.angle or 0)
|
local rad = math.rad(arrow.angle or 0)
|
||||||
@@ -183,56 +203,44 @@ function DrawingHelper.DrawPolygon(object)
|
|||||||
if object.polygonMode == "circle" then
|
if object.polygonMode == "circle" then
|
||||||
DrawCircle(object--[[@as Circle]])
|
DrawCircle(object--[[@as Circle]])
|
||||||
elseif object.polygonMode == "oval" then
|
elseif object.polygonMode == "oval" then
|
||||||
DrawOval(object--[[@as Oval]])
|
DrawOval(object--[[@as Oval]], logger)
|
||||||
elseif object.polygonMode == "free" then
|
elseif object.polygonMode == "free" then
|
||||||
DrawFree(object--[[@as Free]])
|
DrawFree(object--[[@as Free]], logger)
|
||||||
elseif object.polygonMode == "rect" then
|
elseif object.polygonMode == "rect" then
|
||||||
DrawRect(object--[[@as Rect]])
|
DrawRect(object--[[@as Rect]])
|
||||||
elseif object.polygonMode == "arrow" then
|
elseif object.polygonMode == "arrow" then
|
||||||
DrawArrow(object--[[@as Arrow]])
|
DrawArrow(object--[[@as Arrow]], logger)
|
||||||
end
|
end
|
||||||
return {id}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
---@param object Line
|
---@param object Line
|
||||||
---@return Array<integer>
|
---@param id integer
|
||||||
function DrawingHelper.DrawLine(object)
|
---@param logger Logger?
|
||||||
|
function DrawingHelper.DrawLine(object, id, logger)
|
||||||
|
|
||||||
---@type Array<Vec3>
|
---@type Array<Vec3>
|
||||||
local points = {}
|
local points = {}
|
||||||
local ids = {}
|
|
||||||
|
|
||||||
for _, point in ipairs(object.points) do
|
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
|
end
|
||||||
|
|
||||||
local color = DrawingHelper.ColorToColorTable(object.colorString)
|
local color = DrawingHelper.ColorToColorTable(object.colorString)
|
||||||
local lineStyle = DrawingHelper.ToLineStyleInteger(object.style)
|
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
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
---@param object TextBox
|
---@param object TextBox
|
||||||
---@return Array<integer>
|
---@param id integer
|
||||||
function DrawingHelper.DrawTextBox(object)
|
function DrawingHelper.DrawTextBox(object, id)
|
||||||
|
|
||||||
local id = DrawingHelper.GetAndAddId()
|
|
||||||
|
|
||||||
trigger.action.textToAll(-1, id, { x= object.mapX, y = 0, z = object.mapY },
|
trigger.action.textToAll(-1, id, { x= object.mapX, y = 0, z = object.mapY },
|
||||||
DrawingHelper.ColorToColorTable(object.colorString),
|
DrawingHelper.ColorToColorTable(object.colorString),
|
||||||
DrawingHelper.ColorToColorTable(object.fillColorString),
|
DrawingHelper.ColorToColorTable(object.fillColorString),
|
||||||
object.fontSize or 12,
|
object.fontSize or 12,
|
||||||
true,
|
true,
|
||||||
object.text or "")
|
object.text or "")
|
||||||
|
|
||||||
return {id}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DrawingHelper.Remove(id)
|
function DrawingHelper.Remove(id)
|
||||||
@@ -244,7 +252,7 @@ end
|
|||||||
function DrawingHelper.ColorToColorTable(hexStr)
|
function DrawingHelper.ColorToColorTable(hexStr)
|
||||||
|
|
||||||
if hexStr == nil then
|
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 }
|
return { 0, 0, 0, 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -262,7 +270,7 @@ end
|
|||||||
---@return string
|
---@return string
|
||||||
function DrawingHelper.ColorTableToColorString(rgba)
|
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
|
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"
|
return "0x00000000"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -285,11 +293,11 @@ function DrawingHelper.ToLineStyleInteger(lineStyle)
|
|||||||
return 2
|
return 2
|
||||||
elseif lineStyle == "dotted" then
|
elseif lineStyle == "dotted" then
|
||||||
return 3
|
return 3
|
||||||
elseif lineStyle == "dotdash" then
|
elseif lineStyle == "dot dash" then
|
||||||
return 4
|
return 4
|
||||||
elseif lineStyle == "longdash" then
|
elseif lineStyle == "long dash" then
|
||||||
return 5
|
return 5
|
||||||
elseif lineStyle == "twodash" then
|
elseif lineStyle == "two dash" then
|
||||||
return 6
|
return 6
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@@ -306,11 +314,11 @@ function DrawingHelper.ToLineStyleString(lineStyle)
|
|||||||
elseif lineStyle == 3 then
|
elseif lineStyle == 3 then
|
||||||
return "dotted"
|
return "dotted"
|
||||||
elseif lineStyle == 4 then
|
elseif lineStyle == 4 then
|
||||||
return "dotdash"
|
return "dot dash"
|
||||||
elseif lineStyle == 5 then
|
elseif lineStyle == 5 then
|
||||||
return "longdash"
|
return "long dash"
|
||||||
elseif lineStyle == 6 then
|
elseif lineStyle == 6 then
|
||||||
return "twodash"
|
return "two dash"
|
||||||
else
|
else
|
||||||
return "no line"
|
return "no line"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,18 +21,9 @@ local DrawingHelper = require("classes.stageClasses.drawings.helper.DrawingHelpe
|
|||||||
---@field private _dropOffZone SpearheadTriggerZone?
|
---@field private _dropOffZone SpearheadTriggerZone?
|
||||||
---@field private _noLandingZoneDrawing CustomDrawing?
|
---@field private _noLandingZoneDrawing CustomDrawing?
|
||||||
---@field private _dropOffZoneDrawing CustomDrawing?
|
---@field private _dropOffZoneDrawing CustomDrawing?
|
||||||
---@field private _briefing string?
|
|
||||||
local BuildableMission = {}
|
local BuildableMission = {}
|
||||||
BuildableMission.__index = 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
|
---@class OnCrateDroppedListener
|
||||||
---@field OnCrateDroppedOff fun(self:OnCrateDroppedListener, mission:BuildableMission, kilos:number)
|
---@field OnCrateDroppedOff fun(self:OnCrateDroppedListener, mission:BuildableMission, kilos:number)
|
||||||
|
|
||||||
@@ -42,8 +33,7 @@ end
|
|||||||
---@param requiredCrateType SupplyType
|
---@param requiredCrateType SupplyType
|
||||||
---@param noLandingZone SpearheadTriggerZone?
|
---@param noLandingZone SpearheadTriggerZone?
|
||||||
---@param logger Logger
|
---@param logger Logger
|
||||||
---@param briefing string?
|
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType)
|
||||||
function BuildableMission.new(database, logger, targetZone, noLandingZone, requiredKilos, requiredCrateType, briefing)
|
|
||||||
|
|
||||||
setmetatable(BuildableMission, Mission)
|
setmetatable(BuildableMission, Mission)
|
||||||
|
|
||||||
@@ -53,7 +43,6 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
|
|||||||
self._database = database
|
self._database = database
|
||||||
self._requiredKilos = requiredKilos
|
self._requiredKilos = requiredKilos
|
||||||
self._droppedKilos = 0
|
self._droppedKilos = 0
|
||||||
self._briefing = briefing
|
|
||||||
|
|
||||||
self._noLandingZone = noLandingZone
|
self._noLandingZone = noLandingZone
|
||||||
|
|
||||||
@@ -75,13 +64,7 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.code = tostring(database:GetNewMissionCode())
|
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"
|
local type = "site"
|
||||||
if requiredCrateType == "SAM_CRATE" then
|
if requiredCrateType == "SAM_CRATE" then
|
||||||
@@ -98,6 +81,7 @@ function BuildableMission.new(database, logger, targetZone, noLandingZone, requi
|
|||||||
self._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate()
|
self._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate()
|
||||||
self._state = "NEW"
|
self._state = "NEW"
|
||||||
|
|
||||||
|
|
||||||
self.location = targetZone.location
|
self.location = targetZone.location
|
||||||
|
|
||||||
self.missionType = "LOGISTICS"
|
self.missionType = "LOGISTICS"
|
||||||
@@ -132,16 +116,11 @@ function BuildableMission:ShowBriefing(groupID)
|
|||||||
siteType = "airbase"
|
siteType = "airbase"
|
||||||
end
|
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 ..
|
local briefing = "Mission [" .. self.code .. "] " .. self.name ..
|
||||||
"\n \n" ..
|
"\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" ..
|
"\n\n" ..
|
||||||
"\nKilos still required: " .. self._requiredKilos - self._droppedKilos ..
|
"\nKilos still required: " .. self._requiredKilos - self._droppedKilos ..
|
||||||
"\n\n" ..
|
"\n\n" ..
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ local RunwayStrikeMission = {}
|
|||||||
---@field corners Array<Vec2>
|
---@field corners Array<Vec2>
|
||||||
---@field kilosHit number
|
---@field kilosHit number
|
||||||
---@field repairGroups Array<string>
|
---@field repairGroups Array<string>
|
||||||
---@field drawID Array<number>
|
---@field drawID number?
|
||||||
|
|
||||||
|
|
||||||
---@param runway Runway
|
---@param runway Runway
|
||||||
@@ -172,10 +172,8 @@ function RunwayStrikeMission:Draw()
|
|||||||
|
|
||||||
runwaySection.drawID = DrawingHelper.Draw(drawObject)
|
runwaySection.drawID = DrawingHelper.Draw(drawObject)
|
||||||
else
|
else
|
||||||
for _, drawID in pairs(runwaySection.drawID) do
|
DcsUtil.SetFillColor(runwaySection.drawID, fillColor)
|
||||||
DcsUtil.SetFillColor(drawID, fillColor)
|
DcsUtil.SetLineColor(runwaySection.drawID, lineColor)
|
||||||
DcsUtil.SetLineColor(drawID, lineColor)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -499,7 +497,6 @@ function RunwayStrikeMission:ToSections(runway, numSections)
|
|||||||
corners = corners,
|
corners = corners,
|
||||||
kilosHit = 0,
|
kilosHit = 0,
|
||||||
repairGroups = {},
|
repairGroups = {},
|
||||||
drawID = {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table.insert(sections, section)
|
table.insert(sections, section)
|
||||||
|
|||||||
@@ -632,19 +632,13 @@ do -- INIT DCS_UTIL
|
|||||||
---@field b number
|
---@field b number
|
||||||
---@field a number
|
---@field a number
|
||||||
|
|
||||||
local drawID = 4210
|
|
||||||
|
|
||||||
function DCS_UTIL.GetNextDrawID()
|
|
||||||
drawID = drawID + 1
|
|
||||||
return drawID
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param groupID number
|
---@param groupID number
|
||||||
---@param text string
|
---@param text string
|
||||||
---@param location Vec3
|
---@param location Vec3
|
||||||
---@return number markID
|
---@return number markID
|
||||||
function DCS_UTIL.AddMarkToGroup(groupID, text, location)
|
function DCS_UTIL.AddMarkToGroup(groupID, text, location)
|
||||||
local drawID = DCS_UTIL.GetNextDrawID()
|
drawID = drawID + 1
|
||||||
trigger.action.markToGroup(drawID, text, location, groupID, true, nil)
|
trigger.action.markToGroup(drawID, text, location, groupID, true, nil)
|
||||||
return drawID
|
return drawID
|
||||||
end
|
end
|
||||||
@@ -654,7 +648,7 @@ do -- INIT DCS_UTIL
|
|||||||
---@param location Vec3
|
---@param location Vec3
|
||||||
---@return integer
|
---@return integer
|
||||||
function DCS_UTIL.AddMarkToAll(text, location)
|
function DCS_UTIL.AddMarkToAll(text, location)
|
||||||
local drawID = DCS_UTIL.GetNextDrawID()
|
drawID = drawID + 1
|
||||||
trigger.action.markToAll(drawID, text, location, true, nil)
|
trigger.action.markToAll(drawID, text, location, true, nil)
|
||||||
return drawID
|
return drawID
|
||||||
end
|
end
|
||||||
@@ -683,10 +677,6 @@ do -- INIT DCS_UTIL
|
|||||||
---@param drawID number
|
---@param drawID number
|
||||||
---@param fillColor DrawColor
|
---@param fillColor DrawColor
|
||||||
function DCS_UTIL.SetFillColor(drawID, fillColor)
|
function DCS_UTIL.SetFillColor(drawID, fillColor)
|
||||||
if fillColor == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local lineColorMapped = {
|
local lineColorMapped = {
|
||||||
fillColor.r or 0,
|
fillColor.r or 0,
|
||||||
fillColor.g or 0,
|
fillColor.g or 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user