Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RemoveTarget.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, false);
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  // Don't allow player to set less then 1 target in round
46  if (m_LineController.GetTargetsInRound() == 1)
47  return false;
48 
49  return true;
50  }
51 
52  //------------------------------------------------------------------------------------------------
53  override bool GetActionNameScript(out string outName)
54  {
55  outName = ("#AR-FiringRange_ActionRemoveTarget-UC");
56  return true;
57  }
58 
59  //------------------------------------------------------------------------------------------------
60  override bool HasLocalEffectOnlyScript()
61  {
62  return true;
63  }
64  //------------------------------------------------------------------------------------------------
65  void SCR_RemoveTarget()
66  {
67  }
68 
69  //------------------------------------------------------------------------------------------------
70  void ~SCR_RemoveTarget()
71  {
72  }
73 
74 };
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ScriptedUserAction
Definition: ScriptedUserAction.c:12
SCR_RemoveTarget
Definition: SCR_RemoveTarget.c:3
SCR_FiringRangeManager
Definition: SCR_FiringRangeManager.c:7
SCR_FiringRangeNetworkEntity
Definition: SCR_FiringRangeNetworkEntity.c:7
SCR_FiringRangeController
Definition: SCR_FiringRangeController.c:9