Developers
config.lua, client/bridge_client.lua and server/bridge_server.lua are the readable files. Custom inventories, targets, dispatch and phone scripts connect through the exports below.
Client exports
exports['gs-airdrop']:openControlCenter() -- admin control center
exports['gs-airdrop']:openTacticalTablet() -- the tablet
exports['gs-airdrop']:openPhoneApp() -- the compact phone view
Phone scripts can also trigger the gs-airdrop:client:openPhone event. To use your phone's own event instead, set Config.Integrations.phone.
Server exports
local profiles = exports['gs-airdrop']:getProfiles() -- saved events
local ok, reason = exports['gs-airdrop']:spawnProfile('profile_id')
local caps = exports['gs-airdrop']:getBridgeCapabilities() -- the active framework / inventory / target
Custom inventory
Set Config.Inventory = "custom" and register an adapter after gs-airdrop starts. Register it again whenever gs-airdrop restarts.
exports['gs-airdrop']:registerIntegration('inventory', 'my_inventory', function(action, data)
if action == 'addItem' then
return exports.my_inventory:AddItem(data.source, data.item, data.count, data.metadata)
elseif action == 'removeItem' then
return exports.my_inventory:RemoveItem(data.source, data.item, data.count, data.slot, data.metadata)
elseif action == 'canCarryItem' then
return exports.my_inventory:CanCarry(data.source, data.item, data.count)
elseif action == 'canCarryBundle' then
return exports.my_inventory:CanCarryBundle(data.source, data.items)
elseif action == 'hasItem' then
return exports.my_inventory:HasItem(data.source, data.item, data.count)
elseif action == 'listItems' then
return exports.my_inventory:GetItemDefinitions()
end
end)
Add, remove and capacity actions must return true or false. If the adapter can't answer a capacity check, the payout is refused to keep items safe.
Custom target
Set Config.Target = "custom" and register a client adapter:
exports['gs-airdrop']:registerClientIntegration('target', 'my_target', function(action, data)
if action == 'add' then
exports.my_target:AddEntity(data.entity, {
label = data.label,
distance = data.distance,
onSelect = function() TriggerEvent(data.event, { dropId = data.dropId }) end,
})
elseif action == 'remove' then
exports.my_target:RemoveEntity(data.entity)
end
return true
end)
Dispatch and analytics
These adapters are told about drop events but can't change them:
exports['gs-airdrop']:registerIntegration('dispatch', 'my_dispatch', function(action, payload)
if action == 'dropCreated' then
exports.my_dispatch:CreateCall({
code = 'AIR-1',
coords = payload.coords,
message = ('%s supply aircraft reported'):format(payload.type),
})
end
return true
end)
You can also set Config.Integrations.dispatch.event to an event name; it receives action, payload. Set side to server or client.