BountyCopter
Module: bountycopter.lua
Overview
The BountyCopter module is a world-spawn helper that drops supply crates via winch. It supports three types of cargo: Blueprints, Treasure, and Light MG. The copter identifies the type based on labels and spawns the appropriate supply drop.
Inheritance
- Inherits from:
VehicleBlippable - Imports:
none
Instance pattern
This is a per-instance object module (keyed by uGuid). It tracks the following key fields:
tFlash: The flash color of the radar blip.sTexture: Texture used for the radar blip.nSize: Size of the radar blip.
Functions
OnActivate(uGuid, uRuntimeOwner, iArg)
Called when the object instance is activated. It logs a debug message and sets up an event to call Start once the object leaves hibernation.
Start(uGuid, uRuntimeOwner, iArg)
Determines the type of cargo based on labels (Blueprints, Treasure) and spawns the corresponding supply drop at a position above the copter. Sets up an event to deploy the winch and attach the cargo.
_DeployWinch(uGuid, uCargo)
Deploys the winch on the copter and sets up an event to attach the cargo after a short delay.
AttachCargo(uGuid, uCargo)
Attaches the supply drop to the deployed winch.
Events
- Listens for
Event.ObjectHibernationto callStartwhen the object leaves hibernation. - Listens for
Event.TimerRelativeto call_DeployWinchafter a short delay to deploy the winch. - Listens for
Event.TimerRelativeto callAttachCargoafter another short delay to attach the cargo.
Notes for modders
- Ensure that
OnActivateis called appropriately to manage the copterβs lifecycle. - Customize the cargo type by adding or removing labels (
Blueprints,Treasure) on the copter instance. - Be aware of the winch deployment and attachment delays, which may need adjustment for different scenarios.