Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SetTargetDistanceUpUserAction.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4  private SCR_FiringRangeController m_LineController;
5  private SCR_FiringRangeManager m_FiringRangeManager;
6 
7  //------------------------------------------------------------------------------------------------
8  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
9  {
10  m_LineController = SCR_FiringRangeController.Cast(pOwnerEntity);
11  m_FiringRangeManager = SCR_FiringRangeManager.Cast(pOwnerEntity.GetParent());
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
16  {
17  // Find local player controller
18  PlayerController playerController = GetGame().GetPlayerController();
19  if (!playerController)
20  return;
21 
22  // Find firing range network entity to send RPC to server
23  SCR_FiringRangeNetworkEntity firingRangeNetworkEntity = SCR_FiringRangeNetworkEntity.GetInstance();
24  if (!firingRangeNetworkEntity)
25  return;
26 
27  // Select targets distance
28  firingRangeNetworkEntity.CalculateTargetDistance(pOwnerEntity, true);
29  }
30  //------------------------------------------------------------------------------------------------
31  override bool CanBeShownScript(IEntity user)
32  {
33  // Check if the firing line is currently assigned to any player. If so, other players can't interact with this firing range controller.
34  return m_FiringRangeManager && m_LineController.GetFiringLineOwnerId() == m_LineController.NO_TARGET_OWNER;
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  override bool CanBePerformedScript(IEntity user)
39  {
40  return m_LineController && !m_LineController.IsHighestDistanceSet();
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override bool GetActionNameScript(out string outName)
45  {
46  outName = ("#AR-FiringRange_ActionDistanceUp-UC");
47  return true;
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  override bool HasLocalEffectOnlyScript()
52  {
53  return true;
54  }
55 
56 };
SCR_SetTargetDistanceUpUserAction
Definition: SCR_SetTargetDistanceUpUserAction.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ScriptedUserAction
Definition: ScriptedUserAction.c:12
SCR_FiringRangeManager
Definition: SCR_FiringRangeManager.c:7
SCR_FiringRangeNetworkEntity
Definition: SCR_FiringRangeNetworkEntity.c:7
SCR_FiringRangeController
Definition: SCR_FiringRangeController.c:9