Skip to content

Construction And CoIn Systems Atlas

rayswaynl edited this page Jun 28, 2026 · 54 revisions

Construction And CoIn Systems Atlas

Page ownership: this page owns the construction/CoIn runtime map, source anchors, request-handler map and safe extension checklist. Commander/HQ lifecycle owns commander selection, HQ deploy/mobilize, HQ destruction, wreck markers and MHQ repair. Deep-review findings DR-6 owns the exact per-handler construction-authority proof, and DR-20 owns the HQ-killed non-idempotency / score-duplication proof; Server authority migration map owns the broader migration design table.

This page maps the build system that turns commander/repair-truck actions into HQ state changes, factories, base defenses, static weapons and repair flows.

All source paths below are relative to Missions/[55-2hc]warfarev2_073v48co.chernarus/ unless a row explicitly names maintained Vanilla Takistan or another branch.

How To Use This Page

Need Start here Then follow
Build/HQ/CoIn orientation High-level flow, Server request handlers, Server construction workers Commander/HQ lifecycle, Factory and purchase systems
Construction authority proof Authority boundary Deep-review findings DR-6, Server authority migration map
Base-area and CoIn guard-order work Construction state ownership synthesis Server authority migration map, Testing workflow
Small/Medium structure cleanup SmallSite / MediumSite Construction logic list cleanup
Commander-built artillery defenses StationaryDefense Support specials and tactical modules, Source fix propagation queue
Salvage payout/authority Salvage, Salvage branch matrix Feature status, Source fix propagation queue

Source Map

Role Files
Client entry actions Client/Action/Action_Build.sqf, Client/Action/Action_BuildRepair.sqf, Client/Action/Action_RepairMHQ.sqf
CoIn data setup Client/Init/Init_Coin.sqf
CoIn runtime UI Client/Module/CoIn/coin_interface.sqf
Client action lifecycle Client/FSM/updateclient.sqf, Client/Functions/Client_PreRespawnHandler.sqf, Client/Functions/Client_OnKilled.sqf
Server PVF entrypoints Server/PVFunctions/RequestStructure.sqf, Server/PVFunctions/RequestDefense.sqf, Server/PVFunctions/RequestMHQRepair.sqf
Server construction workers Server/Construction/Construction_HQSite.sqf, Construction_SmallSite.sqf, Construction_MediumSite.sqf, Construction_StationaryDefense.sqf; patch-ready SmallSite cleanup lives in Construction logic list cleanup.
Structure config Common/Config/Core_Structures/Structures_*.sqf
Server support functions Server_HandleBuildingRepair.sqf, Server_MHQRepair.sqf, Server_OnHQKilled.sqf, Server_HandleDefense.sqf, Server_CreateDefenseTemplate.sqf
Client structure markers Client/Init/Init_BaseStructure.sqf

Current Branch Scope

Checked 2026-06-14 against docs head docs/developer-wiki-index 7d248610, stable origin/master cf2a6d6a, Miksuu b8389e74, origin/perf/quick-wins 0076040f and release origin/release/2026-06-feature-bundle a96fdda2 in Chernarus plus maintained Vanilla Takistan where present. Targeted diffs from both the earlier construction docs checkpoint 4bd37b98 and the source-line anchor snapshot 1aa178f8 to HEAD over checked construction/CoIn, base-area, structure-config, commander ARTY and salvage paths returned no source changes. Older hashes remain line-anchor provenance; 7d248610 is the visible docs-head source-continuity checkpoint. Salvage was refreshed again on 2026-06-24 in Salvage branch matrix against docs/source HEAD@408479a914c7 (unchanged from 795cdbbf0 for checked salvage paths), current stable/B74.1 origin/master@f8a76de34 / origin/claude/b74.1-aicom@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, current B69 8d465fce, adjacent B74 b23f557f, current Miksuu b8389e748243, origin/perf/quick-wins@0076040f, historical a96fdda2 and live salvage branches; the checked d472da6a..21b62b04 salvage-adjacent delta only touches unrelated source-Chernarus Init_Client.sqf client-init code. SmallSite logic-list cleanup was refreshed again on 2026-06-24 against docs/source HEAD@7a7d8c48021f, current stable/B74.1 origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, current B69/B74, current Miksuu, perf and historical a96fdda2; d472da6a..21b62b04 is empty for checked construction paths, current stable/B74.2 touch source-Chernarus construction files for unrelated bank/stat work only, and no checked ref changes the SmallSite add/add versus MediumSite add/remove logic-list lines. Auto-wall scope was refreshed again on 2026-06-24 against docs/source HEAD@de471ea5ba96 (source-unchanged from eca0e4a7, f3896116 and 89aadf8c for checked auto-wall paths), current stable/B74.1 origin/master@f8a76de34 / origin/claude/b74.1-aicom@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, current B69 8d465fce, adjacent B74 b23f557f, current Miksuu b8389e748243, origin/perf/quick-wins 0076040f, live origin/feat/oa-auto-countermeasures@2015a632 and historical release commit a96fdda2; checked d472da6a..21b62b04, B69..B74, B74..B74.1 and B74.1..B74.2 auto-wall path deltas show no wall-gate/request-scope rescue. The live auto-countermeasures head keeps the same global request path, defaults true at Init_Common.sqf:202 and only adds AARadar gates at SmallSite/MediumSite :110/:125. Commander ARTY was refreshed again on 2026-06-24 against docs/source HEAD@3dc43a3dca7d (source-unchanged from f5bcaf91 for checked ARTY paths), current stable/B74.1 origin/master@f8a76de34 / origin/claude/b74.1-aicom@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, current B69 origin/claude/b69@8d465fce, adjacent B74 origin/claude/b74-aicom-spend@b23f557f, current Miksuu b8389e748243, perf 0076040f and historical a96fdda2 / 7ff18c49; checked f5bcaf91..HEAD, origin/master..origin/claude/b74.2-aicom, d472da6a..21b62b04 and origin/claude/b69..origin/claude/b74-aicom-spend diffs are empty for checked ARTY ownership/discovery paths, while 0139a3468609..origin/master only adds unrelated fast-travel Tactical GUI text among checked paths. Current origin exposed no live release/* or commander-built ARTY ownership rescue head; Trello artillery heads checked in this pass are UI-only for this ownership lane.

Branch/root Construction shape Development meaning
Docs/source HEAD@3dc43a3dca7d Source-unchanged from f5bcaf91 and 4bd37b98 for checked commander ARTY paths: Chernarus and maintained Vanilla carry the Construction_StationaryDefense.sqf:12-15 _availweapons null guard and commander-team ARTY gunner handoff at :91-94; Common_GetTeamArtillery.sqf:10-30 scans the player's group vehicles. This is the current docs/source shape for patch carry-forward, but it still needs Arma smoke for grouped-base and Tactical fire-mission behavior.
Current stable/B74.1 origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, B69 8d465fce and B74 b23f557f Chernarus and maintained Vanilla use marker-based commander ARTY discovery: non-repair-truck artillery defenses set WFBE_CommanderArtillery* at Construction_StationaryDefense.sqf:166-168, and Common_GetTeamArtillery.sqf:46-78 scans same-side marked guns near HQ/base areas (WFBE_CommanderArtillerySide read at :56). They still read _area getVariable "weapons" before a null guard at Construction_StationaryDefense.sqf:26. Tactical fire mission spawn line is GUI_Menu_Tactical.sqf:559 on these marker-shaped refs. Treat current stable/B74.1/B74.2/B69/B74 ARTY as a different implementation, not proof that the docs/source gunner handoff has landed there. Checked B74.2 and B69/B74 scoped diffs do not change the ARTY ownership/discovery paths; the base-area null-guard lane remains open on those branches.
Historical release evidence a96fdda2 / 7ff18c49 Chernarus and maintained Vanilla carry the older marker-based shape: WFBE_CommanderArtillery* at Construction_StationaryDefense.sqf:133-135, same-side marked-gun scanning in Common_GetTeamArtillery.sqf:46-78, and the pre-guard _area getVariable "weapons" read at Construction_StationaryDefense.sqf:15. Historical only until a live release head is restored or rechecked; smoke the marker path and repair-truck exclusion before release-ready wording.
Miksuu b8389e74 and perf/quick-wins 0076040f Chernarus and maintained Vanilla keep the older DefenseTeam manning shape, no WFBE_CommanderArtillery* marker discovery, and the pre-guard _area getVariable "weapons" read at Construction_StationaryDefense.sqf:13. No ARTY or null-guard rescue candidate was found in these heads.
Auto-wall B74.2 current-head follow-up 2026-06-24 All checked refs still keep one mission-global isAutoWallConstructingEnabled, registered as RequestAutoWallConstructinChange at Init_PublicVariables.sqf:21 and toggled from User14 / coin_interface.sqf:180,207-217. Docs/source HEAD@de471ea5ba96 is unchanged from eca0e4a7, f3896116 and 89aadf8c for checked auto-wall paths; docs/source, current Miksuu b8389e748243 and perf 0076040f initialize it false at Init_Common.sqf:201 and consume it without structure exclusions at SmallSite :110 / MediumSite :125. Current stable/B74.1 origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, B69 8d465fce and B74 b23f557f initialize it true at :214, consume it at SmallSite :123 with AARadar/CBRadar exclusions and at MediumSite Chernarus :163 / maintained Vanilla :160 with AARadar, Bank, Reserve and ArtilleryRadar exclusions. Historical a96fdda2 and live origin/feat/oa-auto-countermeasures@2015a632 initialize true and only guard AARadar at SmallSite/MediumSite (a96fdda2 :110/:125; auto-countermeasures :110/:125 with default at Init_Common.sqf:202). Checked deltas 89aadf8c..HEAD, f3896116..HEAD, eca0e4a7..HEAD, d472da6a..origin/claude/b74.2-aicom, origin/claude/b69..origin/claude/b74-aicom-spend, origin/claude/b74-aicom-spend..origin/master and origin/master..origin/claude/b74.2-aicom are empty for auto-wall paths. origin/master..origin/claude/b74.2-aicom only adds source-Chernarus structure-built stats attribution among construction paths. The live auto-countermeasures head changes default/gates but not side/requester scope. No checked branch keys the state by player, side or requester, so the global-vs-preference decision remains open until source Chernarus plus maintained Vanilla are changed and smoke-tested with two players/sides.
Trello #97 nuke/build-logic branch candidate origin/claude/trello-base-integrity-fixes@66d80160 is branch-only evidence on current stable base f8a76de34. It does not touch construction workers, but its Nuke damage payload deletes nearby LocationLogicStart logics with WFBE_B_Type at branch Client/Module/Nuke/damage.sqf:33-42 in source Chernarus plus maintained Vanilla. Current stable SmallSite and MediumSite create those logics at Construction_SmallSite.sqf:34 / Construction_MediumSite.sqf:34, set WFBE_B_Type at :47/:67, wait on WFBE_B_Completion, then create the real structure at SmallSite:104 / MediumSite:119. Branch-only blast-integrity candidate. If ported, smoke unfinished SmallSite/MediumSite inside a nuke blast, completed structures as control and maintained Vanilla parity. Keep this separate from construction request authority and ICBM RequestSpecial authority.
Trello #80 HQ build-area marker branch candidate origin/claude/trello-map-radius-circles@77dd71ba / draft PR #78 is branch-only evidence on current stable base f8a76de34; payload is six maintained-root files / +192 / -4 and git diff --check clean. In source Chernarus, Init_BaseStructure.sqf:54-68 adds a second local HQ/UAV-terminal Ellipse/Border marker named HQBuildRange%1, colored by side, with radius (WFBE_C_BASE_AREA_RANGE + WFBE_C_BASE_HQ_BUILD_RANGE); :151-158 removes it with the CC marker when the structure dies. Maintained Vanilla Takistan carries the same branch behavior at Init_BaseStructure.sqf:35-49 and :132-139. Current stable already uses the same radius sum in Common_GetClosestEntity2.sqf:14, Construction_HQSite.sqf:49 and basearea.sqf:3-13, and defines the constants at Chernarus Init_CommonConstants.sqf:455-456 / Vanilla :277-278, but it has no HQBuildRange marker. Branch-only construction/map UX candidate, not a construction-authority fix. If promoted, smoke commander HQ deploy, local own-side marker visibility, radius alignment with placement rejection, HQ mobilize/death cleanup, map/GPS open/close, JIP after HQ exists and maintained Vanilla Takistan parity before stable/release wording.
Other checked construction debt SmallSite still appends _nearLogic after construction while MediumSite removes it. 2026-06-24 B74.2 current-head follow-up: docs/source HEAD@7a7d8c48021f is unchanged from d81580cfbe61, 7562c803, 6b8eba5e and 3406ffa0 for checked construction paths, and current stable/B74.1 origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, Miksuu b8389e748243, perf 0076040f, historical release a96fdda2, current B69 8d465fce and adjacent B74 b23f557f all keep SmallSite add/add at Construction_SmallSite.sqf:70,99 and MediumSite add/remove at Construction_MediumSite.sqf:70,114 in both maintained roots. d472da6a..21b62b04 is empty for checked construction files; 0139a3468609..origin/master only adds source-Chernarus MediumSite bank pending-reservation cleanup, while origin/master..origin/claude/b74.2-aicom only adds source-Chernarus SmallSite/MediumSite structure-built stats attribution. Neither branch rescues the logic-list cleanup. Salvage recheck 2026-06-24 keeps lowercase ChangePlayerfunds, the updatesalvage.sqf:10 `

High-Level Flow

flowchart TD
  A["Commander gets HQAction"] --> B["Action_Build.sqf"]
  C["Repair truck gets repair build action"] --> D["Action_BuildRepair.sqf"]
  B --> E["coin_interface.sqf with MCoin"]
  D --> E2["coin_interface.sqf with RCoin"]
  E --> F["Client-side cost, preview, placement checks"]
  E2 --> F
  F --> G["RequestStructure PVF"]
  F --> H["RequestDefense PVF"]
  G --> I["Server/Construction/Construction_*.sqf"]
  H --> J["ConstructDefense -> Construction_StationaryDefense.sqf"]
  I --> K["Server creates real object, vars, EHs, markers init"]
  J --> L["Server creates defense, optional AI gunner/artillery setup"]
  K --> M["Client Init_BaseStructure.sqf local markers"]
Loading

Structure Configuration

Each side/faction structure file builds the same parallel arrays. Structures_CO_US.sqf is a representative example:

Array Meaning Example source
WFBE_<side>STRUCTURES Logical structure labels such as Headquarters, Barracks, Light, CommandCenter, Heavy, Aircraft, ServicePoint, AARadar. Lines 23, 32, 41, 50, 59, 68, 77, 86.
WFBE_<side>STRUCTURENAMES Actual classnames used by CoIn and server creation. Lines 24, 33, 42, 51, 60, 69, 78, 88.
WFBE_<side>STRUCTURECOSTS Build/deploy costs. Lines 26, 35, 44, 53, 62, 71, 80, 90.
WFBE_<side>STRUCTURETIMES Build time, 1 in debug, otherwise mostly 30/60. Lines 27, 36, 45, 54, 63, 72, 81, 91.
WFBE_<side>STRUCTURESCRIPTS Server construction worker: HQSite, SmallSite, MediumSite. Lines 28, 37, 46, 55, 64, 73, 82, 92.
WFBE_<side>STRUCTUREDISTANCES / DIRECTIONS Placement offsets used by nearby-building logic and defense auto-manning. Lines 29-30, 38-39, 47-48.
WFBE_<side>DEFENSENAMES Defense, fortification, MASH, spawn marker, ammo and service objects. Lines 115-166.

After the arrays are built, the script stores them into missionNamespace at lines 105-113. In money-only mode, Common/Init/Init_Common.sqf:350-356 multiplies all structure costs by five.

Client CoIn Initialization

Client/Init/Init_Coin.sqf is the adapter between Warfare data and the BIS CoIn UI.

Behavior Evidence
Sets build area and funds labels on the CoIn logic. Lines 8-12.
Shows only HQ deploy/mobilize when HQ is not deployed. Lines 20-31.
Shows all structures and defenses once HQ is deployed. Lines 30-40.
Repair-truck mode uses only defenses and player cash. Line 31 and lines 51-55.
Builds CoIn categories and item arrays from structure/defense config. Lines 57-81.
Assigns a BIS_coin_<id> vehicle variable and stores params. Lines 83-91.

CoIn is reinitialized from several lifecycle points:

Trigger Source
Initial client boot waits for wfbe_hq_deployed, then initializes MCoin based on deployed/undeployed HQ state. Client/Init/Init_Client.sqf:489-497.
Repair-truck CoIn initializes RCoin with "REPAIR" mode. Client/Init/Init_Client.sqf:738-739.
Becoming commander refreshes MCoin and adds HQAction. Client/FSM/updateclient.sqf:214-220.
Server/client special message hq-setstatus refreshes MCoin. Client/Functions/Client_FNC_Special.sqf:70-75.

Player Entry Points

Entry Behavior
Client/Action/Action_Build.sqf Runs CoIn from player/HQ context: [player, player, 2, MCoin, getpos player, (sideJoined) Call WFBE_CO_FNC_GetSideHQ] ExecVM "Client\Module\CoIn\coin_interface.sqf".
Client/Action/Action_BuildRepair.sqf Runs CoIn from a repair truck using RCoin.
Common/Init/Init_Unit.sqf:56-68 Adds repair-truck build and MHQ repair actions to repair trucks.
Client/FSM/updateclient.sqf:220 Adds commander build menu action only for the commander, gated by hqInRange, canBuildWHQ and target player.
Client/Functions/Client_PreRespawnHandler.sqf:36 Re-adds commander HQAction after respawn.
Client/Functions/Client_OnKilled.sqf:27-28 Removes HQAction from the dead body.

Client/Functions/Client_HandleHQAction.sqf is a small lag guard: it keeps canBuildWHQ = false while an HQ object still exists and flips it back once the object is gone.

CoIn Runtime Behavior

Client/Module/CoIn/coin_interface.sqf is a large customized BIS CoIn controller.

Area Evidence
Aborts if the source object is dead. Line 5.
Distinguishes HQ vs repair root and resets lastBuilt when switching roots. Lines 8-24.
Enforces base-area limit client-side before opening the UI. Lines 13-26.
Opens custom construction title resources and camera controls. Lines 29-56.
Maintains command-menu reopen loop. Lines 98-112 and 920-937.
Border is temporary and only auto-refreshes on area-size changes. coin_interface.sqf:114-158 creates a local transparent-wall border from the initial logic/start position; :419-425 recreates it when BIS_COIN_areasize changes and refreshes camera limits. The TODO is specifically about logic-position movement, not a proven generic border break. Branch continuity is summarized in Current Branch Scope; stable/release line drift moves the refresh to :420-426.
Allows quick-repeat of last built defense with User15. Lines 220-228.
Allows toggling defense manning with User16. Lines 231-236.
Lets commander sell/delete a pointed defense and refund player cash. Lines 238-265.
Handles HQ mobilize/deploy specially for item index 0. Lines 485-503.
Deducts structure/defense cost client-side before sending the server request. Lines 658-695.
Sends RequestStructure / RequestDefense to the server. Lines 718-723.
Decrements local base-area availability when placing defenses. Lines 724-730.
Clears the custom title layer when closing. Line 938.

Placement Rules

Client/Init/Init_Client.sqf:599-728 defines WFBE_C_STRUCTURES_PLACEMENT_METHOD when WFBE_C_STRUCTURES_COLLIDING == 1.

Important checks:

Check Source
Base-area availability can force red preview. Lines 611-613.
Water placement is rejected. Line 614.
Structures avoid nearby houses/factories by bounding-box distance. Lines 616-662.
Defenses avoid duplicate nearby defenses and enemy entities. Lines 631-642.
Non-HQ structures avoid enemy base structures. Lines 664-670.
Minefields are blocked inside base areas. Lines 684-687.
Structures cannot be placed within 600m of hostile towns or inside enemy base areas. Lines 694-703.
Enemy units near base block non-base placement. Lines 705-722.

These are preview/client rules. The server creation handlers do not repeat most of them.

Server Request Handlers

Common/Init/Init_PublicVariables.sqf:14-17 registers RequestStructure, RequestDefense and RequestMHQRepair as server PVF commands.

Request Server behavior
RequestStructure Reads side, classname, position and direction from the client payload; maps classname to logical structure and construction script; sends building-started messages for major structures; executes Server\Construction\Construction_<script>.sqf if the classname exists. See Server/PVFunctions/RequestStructure.sqf:3-21.
RequestDefense Looks up the classname in WFBE_<side>DEFENSENAMES; for WDDM composition anchors (classnames in WFBE_POSITION_ANCHOR_NAMES) calls Server_ConstructPosition; for single defenses calls ConstructDefense. A defense-budget gate (WFBE_C_DEFENSE_BUDGET) may reject and refund before either call. See Server/PVFunctions/RequestDefense.sqf.
RequestMHQRepair Spawns MHQRepair with the received side. See Server/PVFunctions/RequestMHQRepair.sqf:1.

PR #72 / origin/claude/trello-antibasetrap@b79c5cee6adba9c571275a8ed7d558189ad1c091 is branch-only evidence for a focused RequestDefense anti-base-trap gate. It is GitHub-clean but stale-base after B751b: base/merge-base f8a76de349da6f8b871d079c828436c10afb221c, current master origin/master@f39665d7950ddf14cb0bbfacb7ee1e40121e93b4, local counts 80 1, and base-relative diff 8 maintained-root files / +296 / -2 with clean git diff --check.

On the branch, source Chernarus and maintained Vanilla add WFBE_C_BASE_DEFENSE_BUILD_BLOCK_RANGE / WFBE_C_BASE_DEFENSE_BUILD_BLOCK_ENEMYCOUNT (Init_CommonConstants.sqf:816-817 Chernarus, :618-619 Vanilla), BaseDefenseTrapGate refund/localization (LocalizeMessage.sqf:181-193; stringtable Chernarus :9537, Vanilla :9561) and an _atReject wrapper in RequestDefense.sqf. The wrapper resolves WDDM anchor children (:48-72), fires only for STATICS category classes (:75-81), checks nearest own base/HQ and enemy ground units (:99-110), refunds/messages the requester (:117-121) and skips the later create path with if (!_atReject) (:134, :424). Current master already has the older budget/threat gate (RequestDefense.sqf:20-24,137,256,269; constants Init_CommonConstants.sqf:887,889) but has no WFBE_C_BASE_DEFENSE_BUILD_BLOCK_* or BaseDefenseTrapGate symbols.

Scope caveat: this is not DR-6 construction-authority closure. It adds a server-side rejection rule for a specific static-defense trap scenario, but broader side/commander/funds/dead-HQ/base-area payload validation still belongs to Deep-review findings DR-6 and the Server authority migration map. Promotion smoke should include budget gate on/off, constants set to 0, WDDM static-child anchors, non-static defenses/fortifications/mines, refund text, and source Chernarus plus maintained Vanilla parity.

Authority Boundary

DR-6 confirms the authority boundary: the client pays cost and enforces most placement/role checks before sending the request, while server-side request handlers mainly check that the requested class exists in the side arrays. They do not re-check commander ownership, funds, build radius, base-area restrictions, hostile-town distance or most collision checks.

This atlas keeps the system map and checklist. For exact forged payload examples and the validation sketch, use Deep-review findings DR-6; for migration sequencing across other economy authority paths, use Economy authority first cut and Server authority migration map.

Server Construction Workers

HQSite

Server/Construction/Construction_HQSite.sqf toggles between deployed HQ structure and mobile HQ vehicle.

When deploying:

  • Sets wfbe_hqinuse true.
  • Creates the deployed HQ structure, sets wfbe_side and wfbe_structure_type = "Headquarters".
  • Sets wfbe_hq_deployed = true and wfbe_hq to the new site.
  • Initializes client-side base marker via Client\Init\Init_BaseStructure.sqf.
  • Adds killed, hit and damage handlers.
  • Sends side message/logging.
  • Deletes the old mobile HQ.

When mobilizing:

  • Creates the side-specific MHQ vehicle from WFBE_<side>MHQNAME.
  • Sets taxi/trash/side/type vars.
  • Sets wfbe_hq_deployed = false and wfbe_hq to the vehicle.
  • Sends a client HandleSpecial message so clients add killed EH to the mobile HQ.
  • Locks/unlocks commander interaction and logs the change.
  • Deletes the deployed HQ structure.

Base-area support is present but partly broken. Server/Init/Init_Server.sqf:380 initializes each side logic wfbe_basearea to [] when grouped base areas are enabled. During HQ deploy, the server creates a LocationLogicStart, sets DefenseTeam and weapons, then sends RequestBaseArea to clients (Construction_HQSite.sqf:50-54). The older direct server-side avail, side and wfbe_basearea updates are inside a commented block at Construction_HQSite.sqf:55-58, while Client/PVFunctions/RequestBaseArea.sqf:1-4 performs the append on the receiving client. Server/FSM/basearea.sqf:55-77 only prunes an existing server list; no source path in this pass was found that appends the new base-area logic back into the server-side list. Treat server-side base-area consumers as operating from an empty or stale list until the server seeding path is restored and smoked.

The CoIn defense path mirrors the same fragility on the client side. Client/Module/CoIn/coin_interface.sqf:721-730 reads base-area availability from the nearest _area before proving the base-area object is valid. The commander defense-sale path has the same guard-order shape: coin_interface.sqf:256-263 finds the closest base-area logic, reads _area getVariable "avail" first, and only checks !isNull _area afterwards. Pair any server-side Construction_StationaryDefense null-guard fix with a CoIn UI smoke pass for stale/empty base-area lists, grouped-base placement and commander defense selling.

SmallSite / MediumSite

Construction_SmallSite.sqf and Construction_MediumSite.sqf are near twins. They:

  • Resolve side logic, side ID, build time, construction-site classname and logical structure type.
  • Optionally create construction-site objects and a logic with WFBE_B_* completion variables.
  • Wait through construction steps, with different completion ratios and timing.
  • Delete temporary construction objects.
  • Create the real structure object.
  • Set wfbe_side and wfbe_structure_type.
  • Create wall/defense templates with CreateDefenseTemplate.
  • Send Constructed side message.
  • Add the site to wfbe_structures.
  • Run Client\Init\Init_BaseStructure.sqf on clients via setVehicleInit.
  • Add hit, damage and killed event handlers.

Medium sites use a lower completion ratio (0.6) and more staged waiting than small sites.

Auto-wall state is per-side (WFBE_AUTOWALL_%1), keyed by the requesting player's side (fixed in master bef714aa5 via 1ad62bf4a). The legacy global isAutoWallConstructingEnabled is kept in sync at RequestAutoWallConstructinChange.sqf:10 for any stray reader, but the operative write and read are both per-side. The source anchors are the User14 client toggle at coin_interface.sqf:180,207-217, the thin server write at Server/PVFunctions/RequestAutoWallConstructinChange.sqf:3-7, the server-command registration at Init_PublicVariables.sqf:21, and SmallSite/MediumSite consumers. Current Branch Scope owns the branch comparison: docs/source HEAD@de471ea5ba96, current Miksuu b8389e748243 and perf 0076040f consume it at SmallSite :110 / MediumSite :125 without exclusions; current stable/B74.1 f8a76de34, current B74.2 21b62b04, B69 8d465fce and B74 b23f557f keep the same global but add structure exclusions at SmallSite :123 and MediumSite :160 / Chernarus :163; historical a96fdda2 plus live origin/feat/oa-auto-countermeasures@2015a632 only guard AARadar. No checked branch keys the state by player, side or requester. One user's toggle can therefore affect later small/medium construction globally.

Future code work should decide whether this is an intentional match-wide switch or a player/side preference, then either label the UI behavior or key the state by side/requester and smoke two players/sides toggling before small and medium construction. The branch matrix above owns current refs for this path.

Focused construction review found a source asymmetry worth treating as a bug candidate rather than a vague TODO:

  • Construction_SmallSite.sqf:70 adds _nearLogic to wfbe_structures_logic; :99 now correctly removes it (fixed in master bef714aa5 via 1ad62bf4a — comment reads 'wiki-wins: was + (double-append)').
  • Construction_MediumSite.sqf:70 adds _nearLogic, then :113-114 removes it after construction.
  • 2026-06-24 B74.2 current-head follow-up found no rescue in docs/source HEAD@7a7d8c48021f (unchanged from d81580cfbe61 / 7562c803 / 6b8eba5e / 3406ffa0 for checked construction paths), current stable/B74.1 origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, Miksuu b8389e748243, perf 0076040f, historical release a96fdda2, current B69 8d465fce or adjacent B74 b23f557f: SmallSite remains add/add at :70,99, while MediumSite remains add/remove at :70,114 in both maintained roots. d472da6a..21b62b04 is empty for checked construction files, and current stable/B74.2 construction-file deltas are unrelated source-Chernarus bank/stat changes. Current source continuity is summarized in Current Branch Scope, and the exact patch route lives in Construction logic list cleanup. Treat this as a real patch candidate, not merely an old comment mismatch.
  • No source initializer for wfbe_structures_logic was found in the server init path; Init_Server.sqf initializes wfbe_structures and wfbe_structures_live, while wfbe_structures_logic appears only in SmallSite/MediumSite/repair-handler code.
  • Wave P confirmed the same SmallSite add/add and MediumSite add/remove shape in maintained Vanilla Takistan and the main modded Eden/Napf copies. Server_HandleBuildingRepair.sqf:81,99 removes repair logic entries, but no active source caller for HandleBuildingRepair was found beyond compile/init text, so repair cleanup does not prove SmallSite stale entries are cleared in live play.

Patch shape is now captured in Construction logic list cleanup: source Chernarus should change only the post-completion SmallSite line from append to remove, then propagate maintained Vanilla with Tools/LoadoutManager and smoke small/medium construction before claiming runtime impact.

StationaryDefense

Construction_StationaryDefense.sqf creates defenses, fortifications, minefields and static weapons.

Notable paths:

  • Creates the defense and sets side plus wfbe_defense.
  • Special-cases Sign_Danger into a minefield and deletes the sign.
  • Adds killed/damage handlers.
  • If manning is requested and defense AI is enabled, finds a nearby barracks and spawns HandleDefense.
  • Server_HandleDefense.sqf either delegates static defense crew creation to headless clients or creates a side soldier locally and moves it into the gunner seat.
  • Artillery defenses can receive BIS ARTY interface initialization and EquipArtillery. Docs/source HEAD@3dc43a3dca7d is unchanged from f5bcaf91 for checked commander-built artillery paths: artillery-class defenses inside a valid base area use the current commander team as their gunner group when a commander team exists (Construction_StationaryDefense.sqf:91-94). That matches the docs/source Tactical discovery shape, which scans units group player for occupied non-player artillery (Common_GetTeamArtillery.sqf:10-30). Non-artillery defenses still use the base area's DefenseTeam; unmanned artillery remains unmanned if the CoIn manning toggle is off. Current stable/B74.1/B74.2/B69/B74 and historical release evidence use marker-based ARTY discovery instead, while Miksuu/perf keep the older DefenseTeam path; keep those branch differences in Current Branch Scope and the Source fix propagation queue instead of repeating the full matrix here.

Focused construction scout 2026-06-04 found a small guard-order bug here. Docs/source HEAD@3dc43a3dca7d Chernarus and maintained Vanilla Takistan are unchanged from f5bcaf91: they default _availweapons to 0 and read _area getVariable "weapons" only after !isNull _area (Construction_StationaryDefense.sqf:12-15). Current stable/B74.1/B74.2/B69/B74, historical release evidence and Miksuu/perf still carry the pre-guard read as noted in Current Branch Scope. Arma smoke is still needed for defense placement with grouped-base mode on and off, and this does not close broader DR-6 construction authority hardening.

Client-side CoIn placement and sale have the companion risks noted above (coin_interface.sqf:721-730 and :256-263). Do not call the guard fixed until the server construction worker, server base-area seeding, client placement availability/decrement and commander sale/refund path all handle missing/stale base-area logics.

Construction State Ownership Synthesis

The 2026-06-04 fallback construction scout confirmed that several separate-looking issues share the same owner: base/construction state is split across client-visible logic objects, server-side side logic arrays and dormant repair helpers.

Symptom Evidence Development meaning
Base areas are client-seeded but not clearly server-reseeded after HQ deploy. Server/Init/Init_Server.sqf:380, Construction_HQSite.sqf:50-58, Client/PVFunctions/RequestBaseArea.sqf:1-4, Server/FSM/basearea.sqf:55-77. Treat wfbe_basearea as a partial feature until server ownership is explicit. Patch grouped-base placement, cleanup and JIP as one lane.
Base-area avail / weapons reads can happen before null guards. coin_interface.sqf:256-263, :721-730; docs/source HEAD@f5bcaf91 server-side Construction_StationaryDefense.sqf:12-15 is patched in source Chernarus and maintained Vanilla Takistan, while branch drift remains summarized in Current Branch Scope. Client CoIn placement/sale still need guard-order cleanup; smoke empty, stale and race-pruned base-area lists before closing the whole base-area availability lane.
Small and medium construction disagree on repair logic cleanup. Construction_SmallSite.sqf:69-70,98-99; Construction_MediumSite.sqf:69-70,113-114. Keep Construction logic list cleanup separate from authority hardening; it is a one-line correctness patch with propagation/smoke gates.
Damage/killed handlers are live, while progressive building repair is compiled but not reached by static search. EH attachment in Construction_SmallSite.sqf:123-129, Construction_MediumSite.sqf:138-144, Construction_HQSite.sqf:36-38,78-93; repair compile at Init_Server.sqf:26; latent helper in Server_HandleBuildingRepair.sqf. Do not call progressive building repair working until a live caller, parameter path and smoke evidence exist. Keep WASP base repair separate.

Repair Flows

MHQ Repair

Client side:

  • Action_RepairMHQ.sqf requires a dead HQ within 30m of the repair vehicle.
  • It checks wfbe_hq_repairing, repair count/price, and currency.
  • It deducts side supply or player funds on the client, sends RequestMHQRepair, sets repair flags and increments the local count.

Server side:

  • Server_MHQRepair.sqf creates a new MHQ at the wreck position, sets wfbe_side, wfbe_structure_type, trash/taxi vars and killed/hit handlers.
  • It sets wfbe_hq, wfbe_hq_deployed = false, wfbe_hq_repairing = false and increments server wfbe_hq_repair_count.
  • It sends SetMHQLock to the commander and broadcasts HQ-alive marker variables (IS_WEST_HQ_ALIVE, HQ_WEST_MARKER_INFOS, equivalent east values).
  • It deletes the wreck and logs repair.

Building Repair

Server_HandleBuildingRepair.sqf uses a repair logic with WFBE_B_Completion. It creates ruins, waits for completion, recreates the site if structure live limits allow it, re-adds init/event handlers and subtracts half the building cost from side supply in currency system 0. If completion stalls, it degrades over time and eventually deletes the repair logic.

Current status is latent/uncalled by static search: Server_HandleBuildingRepair.sqf is compiled, but no active caller was found in the source mission. Do not confuse this with the WASP base-repair flow, which is live and separate in WASP/baserep/viem.sqf and WASP/baserep/repair.sqf.

Salvage

The engineer salvage flow is client-led. In docs/source HEAD@408479a914c7, checked salvage paths are source-unchanged from 795cdbbf0: Client/Module/Skill/Skill_Salvage.sqf:20-38 and Client/FSM/updatesalvage.sqf:46-50 own wreck deletion and cash payout locally. Both payout paths call ChangePlayerfunds with a lowercase f (Skill_Salvage.sqf:38, updatesalvage.sqf:50), while the compiled client function is ChangePlayerFunds in Client/Init/Init_Client.sqf:53,91. Current stable/B74.1 origin/master@f8a76de34 / origin/claude/b74.1-aicom@f8a76de34 keeps the same behavior with line drift: Skill_Salvage.sqf:38, updatesalvage.sqf:46,51, Init_Client.sqf:97,135, source Chernarus salvage-truck launch at Client_BuildUnit.sqf:388 and maintained Vanilla launch at :343. Current B74.2 origin/claude/b74.2-aicom@21b62b04 keeps the same salvage anchors; its checked d472da6a..21b62b04 delta touches only source-Chernarus Init_Client.sqf for vehicle-tint resource guarding, join/connect ACK failover and the intro-music hook, not manual/truck salvage payout, loop or authority. Current B69 origin/claude/b69@8d465fce, adjacent B74 origin/claude/b74-aicom-spend@b23f557f, current Miksuu master@b8389e748243, origin/perf/quick-wins@0076040f and historical a96fdda2 keep the same issue in both maintained roots. The update loop condition in updatesalvage.sqf:10-18 uses while {!gameOver || !(alive _vehicle)}, which keeps the loop alive while the game is running even if the vehicle state changes in surprising ways.

Do not confuse the live branch origin/claude/salvage-w10-manfilter@2e0242b3 with a payout fix. That branch is based on older B39/GUER merge-base 8fac20df and changes only Server/Functions/AI_Commander_Wildcard.sqf in both maintained roots, adding !(_wk isKindOf "Man") to the inert W10 lucky-salvage apply filter (AI_Commander_Wildcard.sqf:794). It still keeps lowercase ChangePlayerfunds in Skill_Salvage.sqf:38 and updatesalvage.sqf:51, the updatesalvage.sqf:10 OR loop and the client-local delete/reward shape.

Also keep origin/claude/trello-salvage-truck-interlock@9e75c736e separate from payout closure. That branch is one commit on current stable f8a76de34, changes only Skill_Apply.sqf, Skill_Salvage.sqf and stringtable.xml in source Chernarus plus maintained Vanilla, and git diff --check f8a76de34..9e75c736e is clean. It greys out or exits manual engineer salvage when a friendly salvage truck is inside WFBE_C_UNITS_SALVAGER_SCAVENGE_RANGE (Skill_Apply.sqf:35, Skill_Salvage.sqf:5,11-12) but leaves the truck FSM and both payout calls lowercase (Skill_Salvage.sqf:45, updatesalvage.sqf:51). Treat manual/truck salvage as a small correctness + authority lane before increasing rewards or adding new salvage targets.

Salvage Branch Matrix

Root / branch Payout casing Loop / authority shape Status
Docs/source HEAD@408479a914c7 Chernarus and maintained Vanilla Checked salvage paths are unchanged from 795cdbbf0; Skill_Salvage.sqf:38 and updatesalvage.sqf:50 call lowercase ChangePlayerfunds; Init_Client.sqf:53,91 compiles ChangePlayerFunds; Client_BuildUnit.sqf:267 starts Client\FSM\updatesalvage.sqf for salvage trucks. updatesalvage.sqf:10 uses `while {!gameOver
Current stable/B74.1 origin/master@f8a76de34 / origin/claude/b74.1-aicom@f8a76de34 Chernarus and maintained Vanilla Same casing mismatch with current line drift: Skill_Salvage.sqf:38, updatesalvage.sqf:51, Init_Client.sqf:97,135; source Chernarus Client_BuildUnit.sqf:388 and maintained Vanilla :343 start the salvage-truck FSM. Same updatesalvage.sqf:10 `
Current B74.2 origin/claude/b74.2-aicom@21b62b04 Same manual/truck salvage anchors as current stable/B74.1: Skill_Salvage.sqf:38, updatesalvage.sqf:51, Init_Client.sqf:97,135, Chernarus Client_BuildUnit.sqf:388 and Vanilla :343. Same updatesalvage.sqf:10 `
Current B69 origin/claude/b69@8d465fce and adjacent B74 origin/claude/b74-aicom-spend@b23f557f Same casing mismatch in both maintained roots: Skill_Salvage.sqf:38, updatesalvage.sqf:51, Init_Client.sqf:97,135. Chernarus salvage-truck launch drifts to Client_BuildUnit.sqf:388; maintained Vanilla remains :343. Same updatesalvage.sqf:10 `
Live W10 branch origin/claude/salvage-w10-manfilter@2e0242b3 Manual/truck salvage still has lowercase ChangePlayerfunds at Skill_Salvage.sqf:38 and updatesalvage.sqf:51; Init_Client.sqf:72,110 compiles uppercase ChangePlayerFunds. Branch commit changes only Server/Functions/AI_Commander_Wildcard.sqf in both maintained roots, adding !(_wk isKindOf "Man") to the W10 apply filter at :794; the branch is based on older merge-base 8fac20df and W10 remains weight-zero/inert branch evidence. Branch-only W10 corpse-filter fix; not a manual/truck payout or authority fix.
Trello #15 interlock branch origin/claude/trello-salvage-truck-interlock@9e75c736e Branch still keeps lowercase payout calls at Skill_Salvage.sqf:45 and updatesalvage.sqf:51 in both maintained roots. Branch adds a manual-salvage UI/action guard and early localized exit near friendly salvage trucks (Skill_Apply.sqf:35; Skill_Salvage.sqf:5,11-12), changes six maintained-root files / +46 / -16 and leaves the truck FSM untouched. Branch-only UX/interlock candidate; not payout casing, truck loop or authority closure.
Current Miksuu master@b8389e748243 and origin/perf/quick-wins@0076040f Same lowercase payout calls and uppercase compile name in both maintained roots; both use the docs-shaped updatesalvage.sqf:50, Init_Client.sqf:53,91 and Client_BuildUnit.sqf:267 anchors. Miksuu master was verified by git ls-remote on 2026-06-22. Same updatesalvage.sqf:10 `
Historical release commit a96fdda2 Same lowercase payout call in both maintained roots at Skill_Salvage.sqf:38 and updatesalvage.sqf:50; Init_Client.sqf:53,91 compiles uppercase ChangePlayerFunds; salvage-truck launch line drifts to Client_BuildUnit.sqf:270 after adjacent refund code. Current origin exposes no release/* or feat/*salvage* heads on 2026-06-24. Same updatesalvage.sqf:10 `
Historical Miksuu salvage branches (EngineerSalvageAbility 99bfaeb8, SalvageRuTranslationFix 291c6cb4) Same lowercase payout call existed when the feature landed / translation changed. Same `

Practical patch rule: fix the casing first in source Chernarus and maintained Vanilla, then smoke manual engineer salvage and salvage-truck salvage for one valid wreck. Review the update loop and move final payout/deletion server-side as the larger authority pass; do not bundle that authority rewrite into a tiny casing-only fix unless a code owner explicitly claims it.

Sale And Deletion Flows

There are two sale paths:

Path Behavior
Economy menu structure sale Client/GUI/GUI_Menu_Economy.sqf:105-151 lets commanders pick a nearby structure on the map, marks WFBE_SOLD, waits WFBE_C_STRUCTURES_SALE_DELAY, refunds WFBE_C_STRUCTURES_SALE_PERCENT, sends localized messages and damages the structure to 1.
CoIn defense sale coin_interface.sqf:238-265 lets commanders point at a nearby defense, checks side and prior sold state, refunds roughly price / 2.5 to player funds, increments base-area avail and deletes the defense.

Both are client-initiated. Future server hardening should be careful not to break the current UX but should move final authority for sale/refund/delete to the server.

Client Markers

Client/Init/Init_BaseStructure.sqf waits for common/client init, ignores enemy structures, creates local markers for allied structures and deletes them when the structure dies. Command centers also create a local range ellipse.

The server reaches this script by setVehicleInit in construction scripts (Construction_HQSite.sqf, SmallSite, MediumSite) and repair flows.

Current Risks And Safe Extension Points

Area Risk Safer path
Server request validation RequestStructure / RequestDefense trust client-side payment and placement checks; see Deep-review findings DR-6. Add server-side validation of side, commander/repair-truck authority, class membership, funds, radius, base-area availability and collision restrictions before creating objects. Start in request handlers, not in CoIn UI.
PVF dispatch Construction uses generic PVF channels; DR-1 already shows dispatch hardening is needed. Validate PVF function strings and then validate construction payloads.
Base-area availability avail/weapons are updated through client-visible logic and direct client CoIn mutations. Before changing limits, trace RequestBaseArea, coin_interface, Construction_StationaryDefense and JIP behavior together.
Stationary defense base-area null guard Docs/source HEAD@f5bcaf91 Construction_StationaryDefense.sqf:12-15 reads base-area weapons only after a non-null area check; Current Branch Scope owns current stable/B69/B74, historical release and Miksuu/perf drift. Source Chernarus and maintained Vanilla Takistan are patched only in the docs/source head; smoke grouped-base defense placement and non-base defense placement before carrying forward.
Auto-wall toggle is global RequestAutoWallConstructinChange.sqf:3-7 writes global isAutoWallConstructingEnabled; SmallSite/MediumSite consume that same global. Current Branch Scope owns current refs: docs/current-Miksuu/perf old shape at :110 / :125, current stable/B74.1/B74.2/B69/B74 global shape with broader exclusions at SmallSite :123 and MediumSite Chernarus :163 / maintained Vanilla :160, and historical release a96fdda2 plus live origin/feat/oa-auto-countermeasures@2015a632 with only the AARadar guard. If auto-wall should be a player/commander preference, key it by side or requester and validate the sender. If global behavior is intentional, label it in UI/docs and smoke two players toggling it from opposite sides.
SmallSite/MediumSite repair logic asymmetry SmallSite adds _nearLogic where its comment says remove; MediumSite removes it. wfbe_structures_logic has no obvious source initializer. Use Construction logic list cleanup for the exact one-line patch, Vanilla propagation and smoke checklist; keep this separate from construction authority hardening.
Progressive repair/construction path appears dormant Progressive mode code remains in construction scripts and economy UI, but Rsc/Parameters.hpp exposes only construction-time mode 0. Do not expand progressive repair UI until the mission parameter and live caller model are restored intentionally.
Cost deduction Normal build/MHQ repair/sale costs are deducted client-side. Server should become the final authority for final debits/refunds; client can keep previews and immediate feedback.
B74.5 AI commander structure recycling is branch-only Current origin/claude/b745@712a7a668 still includes the B74.5 source-Chernarus AI base-sell evidence, and the later B74.6 b996bcb3..712a7a668 delta does not touch the checked base-sell paths. The B74.5 payload adds AI_Commander_BaseSell.sqf:1-69, compiles it at Init_Server.sqf:36-37, gates it from AI_Commander.sqf:279-283 and configures it at Init_CommonConstants.sqf:295-302. It is absent from checked current stable origin/master@f8a76de34, current B74.2 origin/claude/b74.2-aicom@21b62b04, Miksuu b8389e74 and B74.5 maintained Vanilla Takistan. The worker protects Headquarters and CommandCenter, skips during wfbe_mhqreloc_active, refunds side supply and mutates wfbe_structures_live / wfbe_structures. Treat it as an AI-only branch soak candidate, not proof that human commander sell/refund authority is solved. If ported, smoke redundant-structure sale, refunds, build-slot reuse, base-area/CoIn UI state, JIP clients, HQ/CC protection and no sale during MHQ relocation.
Salvage payout and deletion Salvage Branch Matrix owns the casing, loop and client-local deletion/reward branch proof. Fix the ChangePlayerFunds casing first, propagate Vanilla, and smoke manual/truck salvage; handle server-owned salvage payout/deletion as a separate authority hardening lane.
HQ killed EH locality Mobile HQ killed EH fires locally, so server sends clients set-hq-killed-eh. Preserve dedicated/JIP handling when touching HQ mobilize/repair/deploy.
HQ killed idempotency Deep-review findings DR-20 confirms multiple client-held HQ killed EHs can all send process-killed-hq; Server_OnHQKilled.sqf:46-50 and :74-81 award score without a done guard. Keep redundant detection for locality/JIP, but make the server consumer idempotent before changing HQ destruction or score handling.
setVehicleInit usage Construction relies on legacy Arma 2 init broadcast patterns for client markers and artillery UI. Avoid replacing without testing dedicated, hosted and JIP cases.
CoIn performance CoIn uses camera/menu loops with sleep 0.01 and rich nearest-object checks. Keep new checks cached or server-side; avoid adding expensive per-frame scans to coin_interface.sqf.

Implementation Checklist

When changing construction:

  1. Edit the Chernarus source mission first.
  2. Identify whether the change is client preview, server authority, common config or generated tooling.
  3. If adding a structure, update every relevant Common/Config/Core_Structures/Structures_*.sqf array in lockstep: logical label, classname, description, cost, time, script, distance and direction.
  4. If adding a defense, update side defense configs and check repair-truck CoIn categories.
  5. If adding a new server request, register it in Common/Init/Init_PublicVariables.sqf and document the PVF payload.
  6. For authority changes, keep the existing client CoIn UX but make the server reject invalid payloads and send a clear message.
  7. Run Tools/LoadoutManager after gameplay edits; remember the skip-list trap in Tools and build workflow.
  8. Update this page, Feature status and agent-context.json when changing ownership or authority.

Continue Reading

Previous: Gameplay atlas | Next: Factory and purchase systems

Main map: Home | Fast path: Quickstart | Agent file: agent-context.json

Sidebar

Clone this wiki locally