Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FiringRangeNetworkEntity.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/FiringRange", description: "Entity handling communication player to server.")]
2 class SCR_FiringRangeNetworkEntityClass : GenericEntityClass
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
8 {
9 
10  protected static SCR_FiringRangeNetworkEntity s_CommEnt;
11 
12  //------------------------------------------------------------------------------------------------
13  static SCR_FiringRangeNetworkEntity GetInstance()
14  {
15  return s_CommEnt;
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  void CalculateTargetDistance(notnull IEntity pOwnerEntity, bool increase)
20  {
21  Rpc(RpcAsk_CalculateTargetDistance, Replication.FindId(pOwnerEntity), increase);
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  void ClearPlayerScore(int playerID, SCR_FiringRangeManager firingRangeManager)
26  {
27  Rpc(RpcAsk_ClearPlayerScore, playerID, Replication.FindId(firingRangeManager));
28  }
29 
30  //------------------------------------------------------------------------------------------------
31  void SetPlayerScoreMax(int playerID, int maxScore, SCR_FiringRangeManager firingRangeManager)
32 
33  {
34  Rpc(RpcAsk_SetMaxLineScore, playerID, maxScore, Replication.FindId(firingRangeManager));
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  void ErectRandomTargets(notnull IEntity pOwnerEntity, int playerID)
39  {
40  Rpc(RpcAsk_ErectRandomTargets, Replication.FindId(pOwnerEntity), playerID);
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  void BackToDefaultTarget(notnull IEntity pOwnerEntity)
45  {
46  Rpc(RpcAsk_BackToDefaultTarget, Replication.FindId(pOwnerEntity));
47  }
48 
49  //------------------------------------------------------------------------------------------------
50  void RemoveIndicators(IEntity pOwnerEntity, SCR_FiringRangeManager firingRangeManager)
51  {
52  if (!pOwnerEntity)
53  return;
54 
55  Rpc(RpcAsk_RemoveIndicatorsServer, Replication.FindId(pOwnerEntity), Replication.FindId(firingRangeManager));
56  }
57 
58  //------------------------------------------------------------------------------------------------
59  void RegisterCommEntity(RplId comEntID)
60  {
61  Rpc(RpcAsk_RegisterCommEntity, comEntID);
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  void AddTarget(notnull IEntity pOwnerEntity, bool increase)
66  {
67  Rpc(RpcAsk_AddTarget, Replication.FindId(pOwnerEntity), increase);
68  }
69 
70  //------------------------------------------------------------------------------------------------
71  [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
72  protected void RpcAsk_RegisterCommEntity(RplId comEntID)
73  {
74  IEntity ent = IEntity.Cast(Replication.FindItem(comEntID));
75  if (!ent)
76  return;
77 
78  s_CommEnt = SCR_FiringRangeNetworkEntity.Cast(ent);
79  }
80 
81  //------------------------------------------------------------------------------------------------
82  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
83  protected void RpcAsk_RemoveIndicatorsServer(RplId controllerReplicationId, RplId firingRangeManager)
84  {
85  SCR_FiringRangeManager manager = SCR_FiringRangeManager.Cast(Replication.FindItem(firingRangeManager));
86  if (manager)
87  manager.RemoveIndicators(controllerReplicationId);
88  }
89 
90  //------------------------------------------------------------------------------------------------
91  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
92  protected void RpcAsk_CalculateTargetDistance(RplId controllerReplicationId, bool increase)
93  {
94  SCR_FiringRangeController lineController = SCR_FiringRangeController.Cast(Replication.FindItem(controllerReplicationId));
95  if (lineController)
96  lineController.CalculateTargetDistance(increase);
97  }
98 
99  //------------------------------------------------------------------------------------------------
100  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
101  protected void RpcAsk_ClearPlayerScore(int playerID, RplId firingRangeManager)
102  {
103  SCR_FiringRangeManager manager = SCR_FiringRangeManager.Cast(Replication.FindItem(firingRangeManager));
104  if (manager)
105  manager.ClearPlayerScore(playerID);
106  }
107 
108  //------------------------------------------------------------------------------------------------
109  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
110  protected void RpcAsk_ErectRandomTargets(RplId targetReplicationId, int playerID)
111  {
112  IEntity pOwnerEntity = IEntity.Cast(Replication.FindItem(targetReplicationId));
113  SCR_FiringRangeController lineController = SCR_FiringRangeController.Cast(pOwnerEntity);
114  if (lineController)
115  lineController.AnimateTargets(pOwnerEntity,playerID);
116  }
117 
118  //------------------------------------------------------------------------------------------------
119  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
120  protected void RpcAsk_BackToDefaultTarget(RplId targetReplicationId)
121  {
122  SCR_FiringRangeController lineController = SCR_FiringRangeController.Cast(Replication.FindItem(targetReplicationId));
123  if (lineController)
124  lineController.BackToDefaultTarget();
125  }
126 
127  //------------------------------------------------------------------------------------------------
128  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
129  protected void RpcAsk_SetMaxLineScore(int playerID, int maxScore, RplId firingRangeManager)
130  {
131  SCR_FiringRangeManager manager = SCR_FiringRangeManager.Cast(Replication.FindItem(firingRangeManager));
132  if (manager)
133  manager.SetPlayerScoreMax(playerID, maxScore);
134  }
135 
136  //------------------------------------------------------------------------------------------------
137  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
138  protected void RpcAsk_CountPlayerScore(int playerID, int hitValue, RplId firingRangeManager)
139  {
140  SCR_FiringRangeManager manager = SCR_FiringRangeManager.Cast(Replication.FindItem(firingRangeManager));
141  if (manager)
142  manager.CountPlayerScore(playerID, hitValue);
143  }
144 
145  //------------------------------------------------------------------------------------------------
146  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
147  protected void RpcAsk_AddTarget(RplId controllerReplicationId, bool increase)
148  {
149  SCR_FiringRangeController lineController = SCR_FiringRangeController.Cast(Replication.FindItem(controllerReplicationId));
150  if (lineController)
151  lineController.UpdateNumberOfTargets(increase);
152  }
153 
154  //------------------------------------------------------------------------------------------------
155  void SCR_FiringRangeNetworkEntity(IEntitySource src, IEntity parent)
156  {
157  SetEventMask(EntityEvent.INIT | EntityEvent.FRAME);
158  SetFlags(EntityFlags.NO_TREE | EntityFlags.NO_LINK);
159  }
160 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_FiringRangeManager
Definition: SCR_FiringRangeManager.c:7
SCR_FiringRangeNetworkEntityClass
Definition: SCR_FiringRangeNetworkEntity.c:2
SCR_FiringRangeNetworkEntity
Definition: SCR_FiringRangeNetworkEntity.c:7
SCR_FiringRangeController
Definition: SCR_FiringRangeController.c:9
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180