✅ Verified in-game β€” deeper pass: re-confirmed the whole file (9 lines) β€” one OnStateChange callback, no Event.* calls; documented the two exact state hashes, the "pivot" door node, and that the target is driven as a Vehicle door (Vehicle.OpenDoor/CloseDoor); cross-linked Vehicle/Sys namespaces + MrxShootingGallery.

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:

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. Both Vehicle.OpenDoor and Vehicle.CloseDoor operate on it.

Notes for modders

  • OnStateChange is 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.

Back to top

This site uses Just the Docs, a documentation theme for Jekyll.