pebble_airdrops · v1.0.0

Exports & events

All exports and events are server-side.

Exports

local airdrops = exports.pebble_airdrops
Export Returns
StartAirdrop(zone?, typeId?) The drop id, or nil, { code, message }.
StopAirdrop() boolean: whether a drop was active.
GetAirdropPhase() "none", "inbound", "falling", "locked", "unlocking" or "open".
GetAirdropCoords() The landing spot of the active drop (vector3), or nil.

StartAirdrop

  • zone: a zone id from the admin panel, or { coords = vector3, label? } for any spot. Leave it out for a random enabled zone.
  • typeId: a drop type id. Leave it out for the zone's own type, or a random enabled one when the zone has none.
-- Random zone and type
local id, err = airdrops:StartAirdrop()

-- Zone 3 from the admin panel, drop type 2
airdrops:StartAirdrop(3, 2)

-- A custom spot
local id, err = airdrops:StartAirdrop({ coords = vec3(1043.1, 2411.6, 53.4), label = "Quarry" })
if not id then
    print(("airdrop not started: %s (%s)"):format(err.message, err.code))
end

Only one drop can be active at a time. StartAirdrop also fails while pebble_airdrops is still loading.

Events

Event Payload
pebble_airdrops:server:started id, coords
pebble_airdrops:server:landed id, coords
pebble_airdrops:server:hacked id, source (the player who finished the hack)
pebble_airdrops:server:opened source, id
pebble_airdrops:server:ended id, reason

reason is one of expired, emptied, looted, staff, api, spawn_failed or resource_stopped.

AddEventHandler("pebble_airdrops:server:hacked", function(id, source)
    -- e.g. reward the hacker with XP in your own skill system
end)

AddEventHandler("pebble_airdrops:server:ended", function(id, reason)
    print(("airdrop %d ended: %s"):format(id, reason))
end)