Custom briefings for BlueSam and FARPS #44
@@ -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/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,6 @@ local logger = Logger.new("DrawingHelper", level)
|
||||
local DrawingHelper = {}
|
||||
DrawingHelper.__index = DrawingHelper
|
||||
|
||||
|
||||
---@param object DrawingObject
|
||||
---@return Array<integer> id
|
||||
function DrawingHelper.Draw(object)
|
||||
|
||||
@@ -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" ..
|
||||
|
||||
@@ -644,7 +644,7 @@ do -- INIT DCS_UTIL
|
||||
---@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
|
||||
@@ -654,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
|
||||
|
||||
Reference in New Issue
Block a user