WifTutorialC4
Overview
Teaches basic C4 usage. Activates when the player equips a C4 charge that actually has reserve ammo, cancels if they stow it again, and β unlike most tutorials in this category β has a real gameplay completion condition (pulling the detonator trigger) layered on top of the inherited timeout fallback.
Inheritance
- Inherits from:
MrxTutorial(src/resident/mrxtutorial.lua) β a real corpus module, already documented under Resident Modules, not an opaque native-only engine class despite this file living insrc/vz/. - Imports: none (uses the engineβs
Human.Inventory,Weapon, andObjectnamespaces directly)
Instance pattern
A subclass of the corpusβs MrxTutorial task-framework base class β self-based lifecycle overrides, not the Inheritable/uGuid object pattern used in resident/. No module-level or per-instance state beyond what the base class itself tracks (_tEvents).
Functions
GetMessage()
Returns the fixed message key "[Tutorial.C4]".
SetupActivationCriteria(self)
Registers an Event.WeaponEvent listener for the player equipping "c4" that calls self.ActivateTutorial2(self).
ActivateTutorial2(self)
Re-checks the equip: iterates Human.Inventory.GetAllWeapons(uPlayer), and if any weapon both Object.HasLabel(weapon, "c4") and has Weapon.GetReserveAmmo(weapon) > 0, activates the tutorial. Otherwise (no C4 with reserve ammo found), re-arms by calling self:SetupActivationCriteria() again to wait for the next equip.
SetupCancellationCriteria(self)
Registers an Event.WeaponEvent listener for the player stowing "weapon.c4" that calls self.EndTutorial(self, false).
SetupCompletionCriteria(self)
Registers an Event.HumanStateTransition listener (any state β "Upright.TriggerDetonator") that calls self.EndTutorial(self, true) β a real gameplay completion signal. It then also explicitly calls MrxTutorial.SetupCompletionCriteria(self), the base classβs own 20-second fallback timer, as an explicit βsuperβ call β so both completion paths are armed simultaneously.
Events
Event.WeaponEvent(x2) β equipping"c4"triggers the reserve-ammo re-check; stowing"weapon.c4"cancels.Event.HumanStateTransitionβ transitioning into"Upright.TriggerDetonator"completes the tutorial.Event.TimerRelativeβ the inherited 20-second fallback from the explicitMrxTutorial. SetupCompletionCriteria(self)super-call.
Notes for modders
- Trigger key:
"C4". Self-arms viaSetupActivationCriteria. - Completion here is layered, unlike most of this category: it ends on whichever comes first β the player actually triggering the detonator, or the inherited 20-second timeout.
- Equipping C4 alone isnβt sufficient to activate β
ActivateTutorial2double-checks reserve ammo viaWeapon.GetReserveAmmo, so equipping an empty charge re-arms instead of activating.