Smoke Bunker

Smoke Bunker exports

Server and client exports for your own resources, with arguments, return values and an example for each.

Call the 15 server exports and 1 client export as exports.smoke_bunker:<name>(...). A bunker id, server id or amount of the wrong type or outside the range returns false or nil and changes nothing.

Server#

ExportReturns
getBunker(bunkerId)Snapshot table, or nil
getPlayerBunker(source)Bunker id of the player's org, or nil
getBunkerBySite(siteKey)Bunker id, or nil
getInsideBunker(source)Bunker id the player stands in, or nil
hasResearch(bunkerId, projectId)boolean
getPerks(bunkerId)Perk table, or nil
hasPerk(bunkerId, perk)boolean
addSupplies(bunkerId, units)boolean
addStock(bunkerId, units, stockType?)boolean
breakCamera(bunkerId, camId)boolean
repairCamera(bunkerId, camId)boolean
finishSupplyRun(bunkerId, success?)boolean
getMission(bunkerId, slot)Mission table, or nil
abortMission(bunkerId, slot)boolean
openBuyerTerminal(source)boolean

getBunker#

The snapshot is advanced to the current time first, so supplies, stock and research progress are current.

ArgumentTypeWhat it is
bunkerIdnumberBunker id. /bunkeradmin list prints the ids.

Top-level snapshot fields in 0.10.1:

FieldWhat it holds
id, name, orgName, orgMode, gangNameBunker id, site label and org name (both in capitals), 'org' or 'gang', gang name of a gang bunker.
tierFacility level: 1 plus business upgrades bought.
balanceOrg funds in whole dollars.
suppliesCurrent supplies.
stockTotal stock of all lines. Fractional: use math.floor for whole units.
stockLines, lineOne entry per stock type, and the key of the active line. An entry holds the type's key, its fields from config.stock.types (label, requires, cap, speed, supplyMult, local, export, cargo), unlocked (bunker can produce it) and units (current stock).
ratesproduction, producing, drain, running, researching, wagesPerHour, researchSpeed, slots and unitsPerHour.
upgrades, custom, perks, dailyFeeBusiness upgrades (equipment, staff, security; 2 means bought), customizations, perk table, daily upkeep.
keypad, blastOpen, breach, alertsCurrent keypad code, blast doors open, breach alert active, unread alert count.
rep, repDealsBuyer reputation 0 to 100, clean deal count.
camsDown, camCountIds of destroyed cameras, camera count.
blueprints, projectsResearch blueprints (name, qty), one entry per research project (id, status, progress, perHour).
staff, candidatesOperatives, hire candidates.
members, whitelist, orgOnlineOrg members, access list, members online.
run, delivery, missionIdxActive supply run, active sale, index of the job shown on the Supplies page.
unpaid, wagesOwedWages overdue flag, amount owed.
audit, logs, incomeAudit trail, recent log lines, daily income of the last 7 days.
opId, rangeBest, serverTimeTerminal operator id, best shooting range score, server time in ms.
server.lua
local bunker = exports.smoke_bunker:getBunker(bunkerId)
if bunker then
    print(('%s has $%s and %s supplies'):format(bunker.orgName, bunker.balance, math.floor(bunker.supplies)))
end

getPlayerBunker#

ArgumentTypeWhat it is
sourcenumberPlayer's server id.
server.lua
local bunkerId = exports.smoke_bunker:getPlayerBunker(source)
if not bunkerId then return end

getBunkerBySite#

Returns nil when nobody owns the site or siteKey is not a string.

ArgumentTypeWhat it is
siteKeystringSite key in config.sites, for example 'route68'.
server.lua
local bunkerId = exports.smoke_bunker:getBunkerBySite('route68')

getInsideBunker#

ArgumentTypeWhat it is
sourcenumberPlayer's server id.
server.lua
local bunkerId = exports.smoke_bunker:getInsideBunker(source)

hasResearch#

Returns true when the research project is complete.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
projectIdstringid of a project in config.research.projects, 'r1' to 'r6'.
server.lua
if exports.smoke_bunker:hasResearch(bunkerId, 'r4') then
    -- the MK2 Suppressor project is done
end

getPerks and hasPerk#

getPerks returns a boolean for each perk in config.perks, or nil for an unknown bunker. hasPerk returns one of them. config.perks sets what grants each perk:

Perktrue when the bunker has
workshop, exportContracts, garageEquipment upgrade
blastDoorsSecurity upgrade
rangeShooting Range customization
lockerGun Locker customization
quartersPersonal Quarters customization
caddyTransportation customization
ArgumentTypeWhat it is
bunkerIdnumberBunker id.
perkstringA key of config.perks.
server.lua
if exports.smoke_bunker:hasPerk(bunkerId, 'workshop') then
    -- the bunker has the Equipment upgrade
end

addSupplies#

Adds supplies up to the cap in supplies.max. Returns false for an unknown bunker or an invalid amount.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
unitsnumberWhole number from 1 to 1000000. A decimal is rounded down.
server.lua
exports.smoke_bunker:addSupplies(bunkerId, 25)

addStock#

Adds units to a stock line, never above its cap. Still returns true when some or all units do not fit; false for an unknown bunker, an invalid amount or an unknown stock type.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
unitsnumberWhole number from 1 to 1000000. A decimal is rounded down.
stockTypestring, optionalA key of config.stock.types: 'ammo', 'parts', 'precision' or 'heavy'. Default: the bunker's active line.
server.lua
exports.smoke_bunker:addStock(bunkerId, 10, 'parts')

breakCamera and repairCamera#

breakCamera destroys a camera. It returns false when the bunker does not have that camera or it is already destroyed. Without the Security upgrade a bunker has the first upgrades.security.baseCams cameras (2 by default), with it upgrades.security.cams (4).

repairCamera restores a destroyed camera without using a camera_part. It returns false when that camera is not destroyed.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
camIdstringid of a camera in config.interior.cams, for example 'CAM-01'.
server.lua
exports.smoke_bunker:breakCamera(bunkerId, 'CAM-01')
exports.smoke_bunker:repairCamera(bunkerId, 'CAM-01')

finishSupplyRun#

Completes the active supply run. It returns false unless missions.externalRuns is true, and it refuses world mission runs, so it works only with missions.mode = 'timer', the countdown mode with no vehicle. With externalRuns on, the built-in timer never completes a run: start your own mission from OnSupplyRunStarted and finish it with this export.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
successboolean, optionalfalse fails the run. Any other value, including leaving it out, completes it.
server.lua
exports.smoke_bunker:finishSupplyRun(bunkerId, true)

getMission and abortMission#

getMission returns a copy of the active world mission in a slot, or nil. abortMission aborts it and returns true when there was a mission to abort.

ArgumentTypeWhat it is
bunkerIdnumberBunker id.
slotstring'run' for a supply run or supply order, 'sale' for a sale.

The getMission table:

FieldWhat it holds
idMission id.
kind'order', 'source' or 'sale'.
risk'LOW', 'MED' or 'HIGH'.
phase'TRAVEL', 'PICKUP', 'SEARCH', 'FOUND', 'LOAD', 'DELIVER' or 'ARRIVE'.
deadlineUnix time the mission ends.
controllerServer id of the member whose client spawns the guards.
netIdNetwork id of the mission vehicle, once it exists.
server.lua
local mission = exports.smoke_bunker:getMission(bunkerId, 'sale')
if mission and mission.risk == 'HIGH' then
    exports.smoke_bunker:abortMission(bunkerId, 'sale')
end

openBuyerTerminal#

Opens the dealer terminal for a player and returns true when it opened. The player must be within buyer.maxDistance of a dealer point, unless buyer.allowAnywhere is true. Returns false for a source that is not a number or has no character.

ArgumentTypeWhat it is
sourcenumberPlayer's server id.
server.lua
exports.smoke_bunker:openBuyerTerminal(source)

Item use#

smoke_bunker.usePlaceable is the server.export of the four placeable items in install/items_ox.lua. The inventory calls it when a player uses one; it is not for your own scripts.

Client#

ExportReturns
getInsideSite()Site key of the bunker the local player is in, or nil

getInsideSite#

getInsideSite() takes no arguments.

client.lua
local siteKey = exports.smoke_bunker:getInsideSite()
if siteKey then
    -- the player is inside a bunker
end