Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RadioToggleUserAction.c
Go to the documentation of this file.
2 {
3  protected SCR_RadioComponent m_RadioComp;
4 
5  //------------------------------------------------------------------------------------------------
6  override bool CanBeShownScript(IEntity user)
7  {
8  if (!m_RadioComp)
9  return false;
10 
11  CharacterControllerComponent charComp = CharacterControllerComponent.Cast(user.FindComponent(CharacterControllerComponent));
12  return charComp.GetInspect();
13  }
14 
15  protected override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
16  {
17  if (CanBePerformed(pUserEntity))
18  m_RadioComp.RadioToggle();
19 
20  SCR_SoundManagerEntity soundMan = GetGame().GetSoundManagerEntity();
21  if (!soundMan)
22  return;
23 
24  if (!m_RadioComp.GetRadioComponent().IsPowered())
25  soundMan.CreateAndPlayAudioSource(pOwnerEntity,SCR_SoundEvent.SOUND_ITEM_RADIO_TOGGLE_ON);
26  else
27  soundMan.CreateAndPlayAudioSource(pOwnerEntity,SCR_SoundEvent.SOUND_ITEM_RADIO_TOGGLE_OFF);
28  }
29 
30  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
31  {
32  m_RadioComp = SCR_RadioComponent.Cast(pOwnerEntity.FindComponent(SCR_RadioComponent));
33  }
34 
35  override bool HasLocalEffectOnlyScript()
36  {
37  return false;
38  }
39 
40  override bool GetActionNameScript(out string outName)
41  {
42  if (m_RadioComp.GetRadioComponent().IsPowered())
43  outName = "#AR-UserAction_TurnOff";
44  else
45  outName = "#AR-UserAction_TurnOn";
46 
47  return true;
48  }
49 };
SCR_InventoryAction
modded version for to be used with the inventory 2.0
Definition: SCR_InventoryAction.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
SCR_RadioToggleUserAction
Definition: SCR_RadioToggleUserAction.c:1
SCR_SoundManagerEntity
Definition: SCR_SoundManagerEntity.c:17