Developer
Overview
Integrate through the open/ folder, where server, client and shared handlers let you hook the drop lifecycle without touching the core. Two server exports let other resources trigger drops and read the active ones.
Server Exports
TriggerAirdrop(spec?): starts a drop and returns its uid, ornilplus a reason. The calling resource must be listed inConfig.AdminExportResources.GetActiveDrops(): returns the list of active drops with their state and coordinates.
server.lua
1-- spec fields are all optional
2local uid, reason = exports.ml_airdrop:TriggerAirdrop({
3 crateId = 'military', -- omit for the default or a random crate
4 planeId = 'cargobob_titan',
5 zoneId = 'downtown', -- omit for a random zone
6 contested = true, -- false locks the drop to the caller
7})Server Handlers
Located in open/server.lua. Return false from a Before handler to block that step.
open/server.lua
1function OpenServer.BeforeTrigger(src, triggerKind, opts) return true end
2function OpenServer.OnDropSpawned(drop) end
3function OpenServer.OnDropLanded(drop) end
4function OpenServer.ModifyLoot(drop, stock) return stock end
5function OpenServer.BeforeGiveLoot(src, drop, entry) return true end
6function OpenServer.OnLootGiven(src, drop, entry) end
7function OpenServer.BeforeVehicleClaim(src, drop, model) return true end
8function OpenServer.OnVehicleClaimed(src, payload) end
9function OpenServer.CanCallFlare(src) return true end
10function OpenServer.OnDropDespawned(drop, reason) endBeforeTrigger: fires before a drop starts.triggerKindisauto,admin,flareorexport.OnDropSpawned/OnDropLanded- fire as the drop goes inbound and when it lands.ModifyLoot: mutate and return the rolled loot before it is locked in.BeforeGiveLoot/OnLootGiven- gate and observe each captured slot.BeforeVehicleClaim/OnVehicleClaimed- gate and observe a vehicle claim. Register ownership here.CanCallFlare: gate whether a player may call a drop with a flare item.OnDropDespawned: fires on cleanup.reasonisemptied,expiredorforced.
Client Handlers
Located in open/client.lua.
open/client.lua
1function OpenClient.Notify(message, type) Bridge.Notify(message, type) end
2function OpenClient.BeforeOpenLoot(drop) return true end
3function OpenClient.AfterLanded(drop) end
4function OpenClient.AfterOpened(drop) end
5function OpenClient.AfterCaptureItem(drop, item, count) endNotify: route notifications through your own HUD.BeforeOpenLoot: returnfalseto block the loot panel from opening.AfterLanded/AfterOpened/AfterCaptureItem- observe the lifecycle on this client.
Shared Handlers
Located in open/shared.lua.
open/shared.lua
1function OpenShared.ResolveId(kind, id) return id endResolveId: remap a crate, loot, plane or zone id before it is used, for example a seasonal swap.
Minigames
Crate open minigames are adapters in open/minigames. Each returns whether the player passed, and registers itself into Config.AirdropMiniGames.
open/minigames/_template.lua
1Config.AirdropMiniGames['my_game'] = {
2 label = 'My Minigame',
3 Start = function()
4 -- run your minigame, return true on success
5 return true
6 end,
7}Examples
List your resource in Config.AdminExportResources, then:
server.lua
1exports.ml_airdrop:TriggerAirdrop({ crateId = 'military', contested = true })open/server.lua
1function OpenServer.BeforeTrigger(src, triggerKind, opts)
2 if MyEvent and MyEvent.active then return false end
3 return true
4endopen/server.lua
1function OpenServer.OnLootGiven(src, drop, entry)
2 -- runs once per captured slot
3end