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