ShootingGalleryTarget
Module: shootinggallerytarget.lua
Overview
The ShootingGalleryTarget module is the tiny per-target script for the pop-up targets used by the shooting gallery contract. The target is built as a vehicle-style object with a door: raising it βupβ and lowering it βdownβ are done by opening/closing a door node named "pivot". The whole file is a single engine-invoked state-change callback that maps two specific state hashes to open/close.
Inheritance
- Inherits from:
none β base/utility module - Imports:
none
Instance pattern
This is a stateless utility module (no per-instance table). It does not track any persistent state.
Functions
OnStateChange(uGuid, uiNodeHashName, uiStateHashName)
Engine lifecycle callback fired when the target object changes state. It converts the state-hash argument to a string via Sys.GuidToString and branches on it:
"0x7687DF41"βVehicle.OpenDoor(uGuid, "pivot")(raise the target)."0xACB51200"βVehicle.CloseDoor(uGuid, "pivot")(lower the target).
uiNodeHashName is received but not used. Any state hash other than the two above is a no-op.
Events
This file contains no Event.* calls at all β no Event.Create, no Event.StateChange constant reference. OnStateChange is invoked directly by the engine as a naming-convention callback on the world-object script (the same mechanism that calls OnActivate/OnDeath on other modules without those modules registering anything explicitly), not through an Event.Create registration in this file.
Module constants & tunables
- State hashes (the βopenβ/βcloseβ triggers):
"0x7687DF41"and"0xACB51200". These are hashed state names baked into the targetβs world-object graph β to retarget behavior you change which states map to open vs. close. - Door node name:
"pivot"β the animated node that acts as the door. BothVehicle.OpenDoorandVehicle.CloseDooroperate on it.
Notes for modders
OnStateChangeis a plain global, so you can override it to make targets do something other than raise/lower (e.g. play an effect on hit). See Function override.- The two hashes are the only branches β any other state change silently does nothing, so if a target wonβt move, check that its authored state names hash to exactly these values.
- Scoring/timing lives in the gallery controller and the mission task, not here; this script only animates the physical target.