Tank
Module: tank.lua
Overview
The Tank module represents a tank vehicle in the game. It inherits from VehicleBlippable to add radar blip functionality and manage the tankβs health upon activation.
Inheritance
- Inherits from:
VehicleBlippable(βOrientedBlippableβBlippableβInheritable) - Imports: none
Instance pattern
This is a per-instance object module (keyed by uGuid), but tank.lua itself defines no Create β oPrototype:Create(uGuid, uRuntimeOwner) in Start (line 23) resolves through the inherited chain VehicleBlippable β OrientedBlippable β Blippable β Inheritable, none of which override Create after Inheritable, so it bottoms out at Inheritable.Create: the standard setmetatable/tInstance[uGuid] factory described on Resident Modules. Module-level fields (shared across all tank instances via prototype fallback, not set per-instance in this file):
tFlash: the flash color of the radar blip β{255, 255, 255}.sTexture: the radar blip icon texture β"temp_radar_icon_tank".nSize: the radar blip size β5.
Functions
OnActivate(uGuid, uRuntimeOwner, iArg)
Called when the tank instance is activated. It sets up an event to call Start once the object leaves hibernation.
Start(uGuid, uRuntimeOwner, iArg)
Creates a new per-instance table for the tank using the moduleβs prototype. Logs βTank Startβ and checks if the tankβs health is greater than zero before proceeding with initialization.
Events
- Listens for
Event.ObjectHibernationto callStartwhen the object leaves hibernation.
Notes for modders
OnActivateis the only lifecycle callback defined here β there is no localOnDeactivate; any teardown comes from the inheritedVehicleBlippablechain.- Customize radar blip properties by setting
tFlash,sTexture("temp_radar_icon_tank"), andnSizeβ shared prototype-level globals, so changing one recolors/re-icons every tank instance. - The tankβs blip/instance is only created if
Object.GetHealth(uGuid)is a positive number at the momentStartruns (after it wakes from hibernation) β a dead-on-spawn tank never gets an instance. Watch for the"Tank Start"Debug.Printfline in logs to confirmStartfired.