Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FireModeSwitchUserAction.c
Go to the documentation of this file.
2 {
3  override bool CanBeShownScript(IEntity user)
4  {
5  if (!super.CanBeShownScript(user))
6  return false;
7 
8  BaseMuzzleComponent muzzle = m_WeaponComponent.GetCurrentMuzzle();
9  // Only show fire mode selection for current muzzle
10  if (GetOwner() != muzzle.GetOwner())
11  return false;
12  return muzzle && muzzle.GetFireModesCount() > 2;
13  }
14 
15  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
16  {
17  if (!m_WeaponComponent)
18  return;
19  BaseMuzzleComponent muzzle = m_WeaponComponent.GetCurrentMuzzle();
20  if (!muzzle)
21  return;
22 
23  CharacterControllerComponent charComp = CharacterControllerComponent.Cast(pUserEntity.FindComponent(CharacterControllerComponent));
24  charComp.SetSafety(false, false);
25  charComp.SetFireMode(muzzle.GetNextFireModeIndex());
26  }
27 };
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_InspectionUserAction
Definition: SCR_InspectionUserAction.c:1
SCR_FireModeSwitchUserAction
Definition: SCR_FireModeSwitchUserAction.c:1
BaseMuzzleComponent
Definition: BaseMuzzleComponent.c:12