Smoke Bunker

Smoke Bunker events

The 11 server events Smoke Bunker triggers, with their arguments and when each fires.

Listen for the 11 server events with AddEventHandler, or in bridge/listeners/server.lua (below). No client events are documented: getInsideSite returns the bunker the local player is in.

Server events#

EventArgumentsFires when
smoke_bunker:Server:Listeners:OnBunkerPurchasedsource, bunkerId, siteKey, modeOrg buys a bunker.
smoke_bunker:Server:Listeners:OnSupplyRunStartedbunkerId, missionSupply run starts.
smoke_bunker:Server:Listeners:OnSupplyRunFinishedbunkerId, mission, unitsSupply run or supply order is delivered.
smoke_bunker:Server:Listeners:OnDeliveryStartedbunkerId, kind, units, payoutStock sale is dispatched.
smoke_bunker:Server:Listeners:OnDeliveryFinishedbunkerId, kind, success, payoutStock sale ends.
smoke_bunker:Server:Listeners:OnResearchCompletebunkerId, projectIdResearch project completes.
smoke_bunker:Server:Listeners:OnMissionStartedbunkerId, kind, riskWorld mission starts.
smoke_bunker:Server:Listeners:OnMissionFinishedbunkerId, kind, success, reasonWorld mission ends.
smoke_bunker:Server:Listeners:OnRaidStartedraidId, attackerId, defenderIdOrg launches a raid.
smoke_bunker:Server:Listeners:OnRaidBreachedraidId, attackerId, defenderIdRaiders breach the entrance keypad.
smoke_bunker:Server:Listeners:OnRaidResolvedraidId, attackerId, defenderId, attackerWon, stolenUnitsRaid ends.

Arguments#

ArgumentTypeWhat it is
sourcenumberBuyer's server id.
bunkerIdnumberBunker id.
siteKeystringSite key in config.sites.
mode'org' or 'gang'How the bunker was bought.
missiontableOnSupplyRunStarted: job from config.missions.list, with name, location, units and seconds (run time in timer mode). OnSupplyRunFinished: finished run.
unitsnumberOnSupplyRunFinished: units delivered. OnDeliveryStarted: units sold.
kindstringSale: 'local' or 'export'. Mission: 'order', 'source' or 'sale'.
payoutnumberSale value; 0 when the sale fails.
successbooleanOnDeliveryFinished: false when the sale failed, for example a hijacked export convoy. OnMissionFinished: whether the mission succeeded.
projectIdstringResearch project id, 'r1' to 'r6'.
riskstring'LOW', 'MED' or 'HIGH'.
reasonstringWhy a mission ended: abandoned, aborted, bunker_gone, delivered, hijacked, no_ground, spawn_failed, timeout or vehicle_destroyed.
raidIdnumberRaid id.
attackerId, defenderIdnumberRaiding and raided bunker ids. attackerId is 0 for a raid simulated with the debug tools.
attackerWonbooleanWhether the raiders took the haul.
stolenUnitsnumberStock units taken from the defender.

OnMissionStarted and OnMissionFinished fire only while missions.mode is 'world' (vehicle mode). A restart cancels running missions without firing OnMissionFinished. OnSupplyRunStarted fires for the jobs on the Supplies page, not for supply orders. OnSupplyRunFinished fires for both, on success only.

Example#

server.lua
AddEventHandler('smoke_bunker:Server:Listeners:OnRaidResolved', function(raidId, attackerId, defenderId, attackerWon, stolenUnits)
    if attackerWon then
        print(('Bunker %s took %s units from bunker %s'):format(attackerId, stolenUnits, defenderId))
    end
end)

Edit the listener file#

bridge/listeners/server.lua has one function per event. Each already logs and triggers the event: keep those lines and add your code below. Do not edit above the line DO NOT EDIT ABOVE THIS LINE.

bridge/listeners/server.lua
function listeners.onResearchComplete(bunkerId, projectId)
    Debug.log('listeners', 'onResearchComplete(%s)', { bunkerId, projectId })
    TriggerEvent('smoke_bunker:Server:Listeners:OnResearchComplete', bunkerId, projectId)
    -- your code here
end