Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SetTargetDistanceDownUserAction.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, false);
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  if (m_FiringRangeManager)
35  return m_LineController.GetFiringLineOwnerId() == m_LineController.NO_TARGET_OWNER;
36 
37  return false;
38  }
39 
40  //------------------------------------------------------------------------------------------------
41  override bool CanBePerformedScript(IEntity user)
42  {
43  return m_LineController && !m_LineController.IsLowestDistanceSet();
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  override bool GetActionNameScript(out string outName)
48  {
49  outName = ("#AR-FiringRange_ActionDistanceDown-UC");
50  return true;
51  }
52 
53  //------------------------------------------------------------------------------------------------
54  override bool HasLocalEffectOnlyScript()
55  {
56  return true;
57  }
58 };
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_SetTargetDistanceDownUserAction
Definition: SCR_SetTargetDistanceDownUserAction.c:2
SCR_FiringRangeController
Definition: SCR_FiringRangeController.c:9