Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FiringRangeController.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/FiringRange", description: "Controller of firing line, handles behaviour of targets.", color: "0 0 255 255", dynamicBox: true)]
2
3
4class SCR_FiringRangeControllerClass: GenericEntityClass
5{
6};
7
8//------------------------------------------------------------------------------------------------
10{
11 const static int NO_TARGET_OWNER = -1;
12 const static int RESET_COUNTER_TIME = 1500;
13 const static int POWER_LIGHT_DELAY = 1000;
14 const static int INDICATOR_MAX_VALUE = 9999;
15
16 // Digits cone rotatioin value
17 const static int DIGIT_ZERO = 0;
18 const static int DIGIT_ONE = 315;
19 const static int DIGIT_TWO = 280;
20 const static int DIGIT_THREE = 245;
21 const static int DIGIT_FOUR = 210;
22 const static int DIGIT_FIVE = 175;
23 const static int DIGIT_SIX = 140;
24 const static int DIGIT_SEVEN = 105;
25 const static int DIGIT_EIGHT = 70;
26 const static int DIGIT_NINE = 35;
27
28 const static string LIGHT_POWER = "light_001_power";
29 const static string LIGHT_SEQUENCE = "light_002_sequence";
30 const static string LIGHT_MALFUNCTION = "light_003_malfunction";
31
32 const static int LIGHT_EMISSIVITY_ON = 1;
33 const static int LIGHT_EMISSIVITY_OFF = 0;
34
35 const static bool LIGHT_ON = true;
36 const static bool LIGHT_OFF = false;
37
38 private ParametricMaterialInstanceComponent m_LightPower;
39 private ParametricMaterialInstanceComponent m_LightSequence;
40 private ParametricMaterialInstanceComponent m_LightMalfunction;
41
42 // Variable used for JIP synchronization. Because Power light don't change it's state and Malfunction light blink only for one sec, only this worht of synchronization.
43 // Todo: Replace this with EmissiveMultiplier getter (ParametricMaterialInstanceComponent).
44 private bool m_bRoundLightState = false;
45 private int m_iDistanceIndicatorValue;
46 private int m_iNumberOfTargetsIndicatorValue;
47
48 // Time for how long warning light should be on when player leaves the area
49 const static int ERROR_LIGHT_DURATION = 1000;
50
52 [Attribute("4", UIWidgets.Slider, "For how long target stays in erected position in seconds.", "1 100 1")]
53 protected int m_iErectTargetTime;
54
56 [Attribute("{F2E83D562703F861}Assets/Decals/Impact/DecalHitIndicator.emat", UIWidgets.ResourceNamePicker, "Material used for target hit indicator", "emat")]
57 private ResourceName m_PreviewDecal;
58
59 [Attribute("", UIWidgets.ResourceNamePicker, "Power light entity", "et")]
60 private ResourceName m_LightPowerRes;
61
62 [Attribute("", UIWidgets.ResourceNamePicker, "Sequence light entity", "et")]
63 private ResourceName m_LightSequenceRes;
64
65 [Attribute("", UIWidgets.ResourceNamePicker, "Malfunction light entity", "et")]
66 private ResourceName m_LightMalfunctionRes;
67
68 [Attribute("1", UIWidgets.Slider, "Targets in one round", "1 20 10")]
69 private int m_iTargetsInRound;
70
71 [RplProp()]
72 private int m_iCountShots = 0;
73
74 [RplProp()]
75 private int m_iTargetSetDistance;
76
77 // owner of the firing line PlayerController (player)
78 [RplProp()]
79 private int m_iFiringLineOwner = NO_TARGET_OWNER;
80
81 private SCR_FiringRangeTarget m_LastSelectedTarget;
82 private SCR_FiringRangeTarget m_CurrentSelectedTarget;
83
84 private int m_iElementInArray = 0;
85 private int m_iValuePos;
86 private int m_iHighestPossibleDistance;
87
88 private static ref array<SCR_FiringRangeController> s_aInstances = {};
89 private ref array<SCR_FiringRangeTarget> m_aAllTargetsArray = {};
90 private ref array<int> m_aDistances = {};
91 private ref array<Decal> m_aIndicators = {};
92
93 // Arrays with saved coordinates and vectors of decals
94 private ref array<vector> m_aIndicatorsCoords = {};
95 private ref array<vector> m_aIndicatorsVector = {};
96
97 // time for how long target stays erected
98 private float m_fTargetErectedDuration;
99
100 // target which serves as an indicators
101 private IEntity m_Indicator;
102
103 // components
104 private RplComponent m_RplComponent;
105 private SignalsManagerComponent m_SignalManager;
106
107 private SCR_FiringRangeManager m_FiringRangeManager;
108
109 //------------------------------------------------------------------------------------------------
110 override void EOnInit(IEntity owner)
111 {
112 m_SignalManager = SignalsManagerComponent.Cast(owner.FindComponent(SignalsManagerComponent));
113
114 array<EntitySlotInfo> slots = {}; EntitySlotInfo.GetSlotInfos(owner, slots);
115 IEntity slotEntity;
116 string slotBone;
117
118 foreach (EntitySlotInfo slot: slots)
119 {
120 if (!slot)
121 continue;
122
123 IEntity ent = slot.GetAttachedEntity();
124 if (!ent)
125 continue;
126
127 slotBone = slot.GetBoneName();
128 if (!slotBone.IsEmpty())
129 {
130 switch (slotBone)
131 {
132 case LIGHT_POWER: {m_LightPower = ParametricMaterialInstanceComponent.Cast(ent.FindComponent(ParametricMaterialInstanceComponent)); break;};
133 case LIGHT_SEQUENCE: {m_LightSequence = ParametricMaterialInstanceComponent.Cast(ent.FindComponent(ParametricMaterialInstanceComponent)); break;};
134 case LIGHT_MALFUNCTION: {m_LightMalfunction = ParametricMaterialInstanceComponent.Cast(ent.FindComponent(ParametricMaterialInstanceComponent)); break;};
135 }
136 }
137 }
138
139 // get an array of all distances of targets
140 CollectAllDistances(owner);
141 SetControllerLight(ControllerLightType.LIGHT_POWER, LIGHT_ON)
142
143 }
144
145 //------------------------------------------------------------------------------------------------
147 void AnimateTargets(IEntity pOwnerEntity,int playerID)
148 {
149 #ifdef ENABLE_DIAG
150 // safe check this method should be executed only on server
151 if (!CheckMasterOnlyMethod("AnimateTargets()"))
152 return;
153 #endif
154
155 if (!pOwnerEntity)
156 return;
157
158 SCR_SoundManagerModule.CreateAndPlayAudioSource(pOwnerEntity, SCR_SoundEvent.SOUND_RANGECP_STARTBUTTON);
159
160 // Gets all child targets in the fire line
161 IEntity child = pOwnerEntity.GetChildren();
162 array<SCR_FiringRangeTarget> targetArray = new array<SCR_FiringRangeTarget>();
163
164 // Set the owner of firing Line
165 m_iFiringLineOwner = playerID;
166 Replication.BumpMe();
167
168 while (child)
169 {
170 SCR_FiringRangeTarget target = SCR_FiringRangeTarget.Cast(child);
171 if (target)
172 {
173 if (!target.IsIndicator())
174 {
175 // array of all targets in line. Not just those which were selected.
176 m_aAllTargetsArray.Insert(target);
177
178 if ((target.GetSetDistance() == m_iTargetSetDistance) || m_iTargetSetDistance == -1)
179 {
180 targetArray.Insert(target);
181 };
182
183 // Reset All targets into folded position
184 target.SetState(ETargetState.TARGET_DOWN);
185 target.SetAutoResetTarget(false); // The BumpMe is called in SetState!
186
187 // Set target owner and target mode
188 target.SetTargetOwner(playerID);
189 target.SetTargetMode(ETargetMode.COMPETITION);
190 }
191 }
192
193 child = child.GetSibling();
194 };
195
196 // Sound of starting round
197 SCR_SoundManagerModule.CreateAndPlayAudioSource(pOwnerEntity, SCR_SoundEvent.SOUND_RANGECP_ROUNDSTART);
198
199 GetGame().GetCallqueue().CallLater(ResetCountPopUpTargets, RESET_COUNTER_TIME, false);
200 GetGame().GetCallqueue().CallLater(ErectRandomTarget, m_iErectTargetTime * 1000, true, targetArray, m_aAllTargetsArray);
201
202 if (m_FiringRangeManager)
203 m_FiringRangeManager.ControllerLight(this, ControllerLightType.LIGHT_SEQUENCE, LIGHT_ON);
204 }
205
206 //------------------------------------------------------------------------------------------------
208 void ErectRandomTarget(array<SCR_FiringRangeTarget> targetArray)
209 {
210 // if the round finished, reset targets back to default behaviour
211 if (m_iCountShots >= m_iTargetsInRound)
212 {
213 BackToDefaultTarget();
214 return;
215 }
216
217 m_LastSelectedTarget = m_CurrentSelectedTarget;
218 while (m_LastSelectedTarget == m_CurrentSelectedTarget && targetArray.Count() > 1)
219 {
220 m_CurrentSelectedTarget = targetArray.GetRandomElement();
221 };
222
223 if (m_CurrentSelectedTarget)
224 {
225 m_fTargetErectedDuration = m_CurrentSelectedTarget.GetErectedDuration();
226 m_CurrentSelectedTarget.SetState(ETargetState.TARGET_UP);
227 GetGame().GetCallqueue().CallLater(FoldTarget, m_fTargetErectedDuration, false, m_CurrentSelectedTarget);
228 }
229 }
230
231 //------------------------------------------------------------------------------------------------
233 void FoldTarget(SCR_FiringRangeTarget selectedTarget)
234 {
235 if (m_fTargetErectedDuration == 0)
236 return;
237
238 if (selectedTarget)
239 {
240 float TargetState = selectedTarget.GetState();
241 if (TargetState == 0)
242 selectedTarget.SetState(ETargetState.TARGET_DOWN);
243 }
244 }
245
246 //------------------------------------------------------------------------------------------------
248 void BackToDefaultTarget()
249 {
250 #ifdef ENABLE_DIAG
251 // safe check this method should be executed only on server
252 if (!CheckMasterOnlyMethod("BackToDefaultTarget()"))
253 return;
254 #endif
255
256 // Reset the owner of firing Line
257 m_iFiringLineOwner = NO_TARGET_OWNER;
258 Replication.BumpMe();
259
260 GetGame().GetCallqueue().Remove(ErectRandomTarget);
261
262 foreach (SCR_FiringRangeTarget target : m_aAllTargetsArray)
263 {
264 if (!target)
265 continue;
266
267 target.SetState(ETargetState.TARGET_UP);
268 target.SetAutoResetTarget(true); // The BumpMe is called in SetState!
269 target.SetTargetMode(ETargetMode.TRAINING);
270 target.SetTargetOwner(NO_TARGET_OWNER);
271 }
272
273 m_aAllTargetsArray.Clear();
274 if (m_FiringRangeManager)
275 m_FiringRangeManager.ControllerLight(this, ControllerLightType.LIGHT_SEQUENCE, LIGHT_OFF);
276 }
277
278 //------------------------------------------------------------------------------------------------
279 void SetIndicator(IEntity indicator)
280 {
281 m_Indicator = indicator;
282 }
283
284 //------------------------------------------------------------------------------------------------
286 void BackToDefaultTargetsFromLineArea()
287 {
288 // set the time for how long the target should be in erected position to zero.
289 m_fTargetErectedDuration = 0;
290
291 // Find local player controller
292 PlayerController playerController = GetGame().GetPlayerController();
293 if (!playerController)
294 return;
295
296 // Find firing range network entity to send RPC to server
297 SCR_FiringRangeNetworkEntity firingRangeNetworkEntity = SCR_FiringRangeNetworkEntity.GetInstance();
298 if (!firingRangeNetworkEntity)
299 return;
300
301 firingRangeNetworkEntity.BackToDefaultTarget(this);
302 if (m_FiringRangeManager)
303 {
304 m_FiringRangeManager.ControllerLight(this, ControllerLightType.LIGHT_MALFUNCTION, LIGHT_ON);
305 m_FiringRangeManager.ControllerLight(this, ControllerLightType.LIGHT_SEQUENCE, LIGHT_OFF);
306 GetGame().GetCallqueue().CallLater(m_FiringRangeManager.ControllerLight, ERROR_LIGHT_DURATION, false, this, ControllerLightType.LIGHT_MALFUNCTION, LIGHT_OFF);
307 }
308
309 // Sound of presed button
310 SCR_SoundManagerModule.CreateAndPlayAudioSource(this, SCR_SoundEvent.SOUND_RANGECP_ROUNDABORT);
311 }
312
313 //------------------------------------------------------------------------------------------------
315 void CollectAllDistances(IEntity owner)
316 {
317 IEntity child = owner.GetChildren();
318 while (child)
319 {
320 SCR_FiringRangeTarget target = SCR_FiringRangeTarget.Cast(child);
321 if (target && !target.IsIndicator())
322 {
323 int distance = target.GetSetDistance();
324 if (m_aDistances.Find(distance) == -1)
325 m_aDistances.Insert(distance);
326 }
327
328 child = child.GetSibling();
329 };
330
331 if (m_aDistances.IsEmpty())
332 return;
333
334 m_aDistances.Sort();
335 m_iTargetSetDistance = m_aDistances[0];
336 if (m_SignalManager)
337 {
338 SetControllerCounter(EControlerSection.DISTANCE, GetTargetDistance());
339 SetControllerCounter(EControlerSection.NUMBER_OF_TARGETS ,GetTargetsInRound());
340 }
341
342 Replication.BumpMe();
343 }
344
345 //------------------------------------------------------------------------------------------------
347 array<int> GetAllDistances()
348 {
349 return m_aDistances;
350 }
351
352 //------------------------------------------------------------------------------------------------
354 int GetFiringLineOwnerId()
355 {
356 return m_iFiringLineOwner;
357 }
358
359 //------------------------------------------------------------------------------------------------
360 bool IsLowestDistanceSet()
361 {
362 return GetTargetDistance() == m_aDistances[0];
363 }
364
365 //------------------------------------------------------------------------------------------------
366 bool IsHighestDistanceSet()
367 {
368 return GetTargetDistance() == m_aDistances[m_aDistances.Count()-1];
369 }
370
371 //------------------------------------------------------------------------------------------------
373 int CalculateTargetDistance(bool increase)
374 {
375 #ifdef ENABLE_DIAG
376 // safe check this method should be executed only on server
377 if (!CheckMasterOnlyMethod("CalculateTargetDistance()"))
378 return -1;
379 #endif
380
381 // get the current set distance
382 int currentDistance = m_iTargetSetDistance;
383
384 // if the last state was last, lets go back to the beginning of the row
385 if (m_iTargetSetDistance == -1)
386 {
387 m_iTargetSetDistance = 0;
388 Replication.BumpMe();
389 }
390
391 // check if it's highest possible distance in current row. If so, select all targets (-1) or go to the next element in row
392 m_iHighestPossibleDistance = m_aDistances.Count()-1;
393
394 m_iValuePos = m_aDistances.Find(m_iTargetSetDistance);
395 if (increase)
396 {
397 m_iValuePos++;
398 }
399 else
400 {
401 m_iValuePos--;
402 }
403 m_iTargetSetDistance = m_aDistances[m_iValuePos];
404 Replication.BumpMe();
405
406
407 // Entity has a signal manager, try to set up the value on counter
408 if (m_SignalManager && m_FiringRangeManager)
409 m_FiringRangeManager.SetControllerCounter(this, EControlerSection.DISTANCE, m_iTargetSetDistance);
410
411 // Sound of presed button
412 SCR_SoundManagerModule.CreateAndPlayAudioSource(this, SCR_SoundEvent.SOUND_RANGECP_CHANGEDISTANCE);
413
414 return m_iTargetSetDistance;
415 }
416
417 //------------------------------------------------------------------------------------------------
418 // Increase or decrease a number of targets in one round.
419 void UpdateNumberOfTargets(bool increase)
420 {
421 if (increase)
422 {
423 m_iTargetsInRound++;
424 }
425 else
426 {
427 m_iTargetsInRound--;
428 }
429
430 // Entity has a signal manager, try to set up the value on counter
431 if (m_SignalManager)
432 m_FiringRangeManager.SetControllerCounter(this, EControlerSection.NUMBER_OF_TARGETS, m_iTargetsInRound);
433
434 // Sound of presed button
435 SCR_SoundManagerModule.CreateAndPlayAudioSource(this, SCR_SoundEvent.SOUND_RANGECP_CHANGETARGET);
436 }
437
438 //------------------------------------------------------------------------------------------------
440 void SetControllerCounter(EControlerSection indicator, int value)
441 {
442 // Prepare signals
443 int digitOneIndex;
444 int digitTenIndex;
445 int digitHundredIndex;
446 int digitThousandIndex;
447
448 switch (indicator)
449 {
450 case EControlerSection.DISTANCE :
451 {
452
453 digitOneIndex = m_SignalManager.FindSignal("DistanceOne");
454 digitTenIndex = m_SignalManager.FindSignal("DistanceTen");
455 digitHundredIndex = m_SignalManager.FindSignal("DistanceHundred");
456 digitThousandIndex = m_SignalManager.FindSignal("DistanceThousand");
457 m_iDistanceIndicatorValue = value;
458 break;
459 }
460 case EControlerSection.NUMBER_OF_TARGETS :
461 {
462 digitOneIndex = m_SignalManager.FindSignal("RoundOne");
463 digitTenIndex = m_SignalManager.FindSignal("RoundTen");
464 digitHundredIndex = m_SignalManager.FindSignal("RoundHundred");
465 digitThousandIndex = m_SignalManager.FindSignal("RoundThousand");
466 m_iNumberOfTargetsIndicatorValue = value;
467 break;
468 }
469 }
470
471 // Calculate value
472 array<int> digits = {0,0,0,0};
473 int i = 0;
474 while (value != 0)
475 {
476 int m = value % 10;
477 digits.Set(i,m);
478 i++;
479 value = value / 10;
480 }
481
482 // Set signals
483 for (int y = digits.Count() - 1; y >= 0; y--)
484 {
485 float signalVal = GetSignalValue(digits[y]);
486 switch (y)
487 {
488 case EDigit.DIGIT_ONE: {m_SignalManager.SetSignalValue(digitOneIndex,signalVal); break;};
489 case EDigit.DIGIT_TEN: {m_SignalManager.SetSignalValue(digitTenIndex,signalVal); break;};
490 case EDigit.DIGIT_HUNDRED: {m_SignalManager.SetSignalValue(digitHundredIndex,signalVal); break;};
491 case EDigit.DIGIT_THOUSAND: {m_SignalManager.SetSignalValue(digitThousandIndex,signalVal); break;};
492 }
493 }
494 }
495
496 //------------------------------------------------------------------------------------------------
498 float GetSignalValue(int num)
499 {
500 switch (num)
501 {
502 case 0: {return DIGIT_ZERO; break;};
503 case 1: {return DIGIT_ONE; break;};
504 case 2: {return DIGIT_TWO; break;};
505 case 3: {return DIGIT_THREE; break;};
506 case 4: {return DIGIT_FOUR; break;};
507 case 5: {return DIGIT_FIVE; break;};
508 case 6: {return DIGIT_SIX; break;};
509 case 7: {return DIGIT_SEVEN; break;};
510 case 8: {return DIGIT_EIGHT; break;};
511 case 9: {return DIGIT_NINE; break;};
512 }
513 return 0;
514 }
515
516 //------------------------------------------------------------------------------------------------
518 void CountPopUpTargets()
519 {
520 m_iCountShots++;
521 Replication.BumpMe();
522 }
523
524 //------------------------------------------------------------------------------------------------
526 void ResetCountPopUpTargets()
527 {
528 m_iCountShots = 0;
529 Replication.BumpMe();
530 }
531
532 //------------------------------------------------------------------------------------------------
534 void AddIndicator(vector localCoordOfHit, vector localVectorOfHit)
535 {
536 // Check if the indicator exist
537 if (!m_Indicator)
538 return;
539
540 World world = GetWorld();
541 Decal decal = world.CreateDecal(
542 m_Indicator, // Entity
543 m_Indicator.CoordToParent(localCoordOfHit), // origin vector (position)
544 m_Indicator.VectorToParent(localVectorOfHit), // project vector
545 0.0, // nearclip
546 0.2, // farclip
547 0, // angle
548 0.1, // size
549 1, // stretch
550 m_PreviewDecal, //emat path
551 -1,// lifetime, if <= 0 the decal is created as static
552 0xFFFFFFFF); //color of decal
553
554 if (!decal)
555 return;
556
557
558 m_aIndicators.Insert(decal);
559 Replication.BumpMe();
560
561 m_aIndicatorsCoords.Insert(localCoordOfHit);
562 m_aIndicatorsVector.Insert(localVectorOfHit);
563 }
564
565 //------------------------------------------------------------------------------------------------
567 IEntity GetIndicator()
568 {
569 return m_Indicator;
570 }
571
572 //------------------------------------------------------------------------------------------------
574 void RemoveIndicators()
575 {
576 World world = GetWorld();
577 while (m_aIndicators.Count() > 0)
578 {
579 Decal decal = m_aIndicators.Get(0);
580 if (decal)
581 {
582 world.RemoveDecal(decal);
583 m_aIndicators.Remove(0);
584 }
585 }
586
587 m_aIndicatorsVector.Clear();
588 m_aIndicatorsCoords.Clear();
589 }
590
591 //------------------------------------------------------------------------------------------------
593 {
594 return m_iTargetSetDistance;
595 }
596
597 //------------------------------------------------------------------------------------------------
598 int GetTargetsInRound()
599 {
600 return m_iTargetsInRound;
601 }
602 //------------------------------------------------------------------------------------------------
604 float GetMaxScoreInRound()
605 {
606 return m_iTargetsInRound * SCR_FiringRangeTarget.SCORE_CENTER;
607 }
608
609 //------------------------------------------------------------------------------------------------
610 protected bool CheckMasterOnlyMethod(string methodName)
611 {
612 if (IsProxy())
613 {
614 Print("Master-only method (SCR_FiringRangeController." + methodName + ") called on proxy. Some functionality might be broekn!", LogLevel.WARNING);
615 return false;
616 }
617 return true;
618 }
619
620 //------------------------------------------------------------------------------------------------
622 {
623 switch (light)
624 {
625 case ControllerLightType.LIGHT_POWER: {SetEmissivity(m_LightPower, mode); break;};
626 case ControllerLightType.LIGHT_SEQUENCE: {SetEmissivity(m_LightSequence, mode); m_bRoundLightState = mode; break;};
627 case ControllerLightType.LIGHT_MALFUNCTION: {SetEmissivity(m_LightMalfunction, mode); break;};
628 }
629 }
630
631 //------------------------------------------------------------------------------------------------
633 {
634 if (!light)
635 return;
636
637 if (on)
638 {
639 light.SetEmissiveMultiplier(LIGHT_EMISSIVITY_ON);
640 }
641 else
642 {
643 light.SetEmissiveMultiplier(LIGHT_EMISSIVITY_OFF);
644 }
645 }
646
647 //------------------------------------------------------------------------------------------------
649 protected bool IsProxy()
650 {
651 if (!m_RplComponent)
652 m_RplComponent = RplComponent.Cast(FindComponent(RplComponent));
653
654 return (m_RplComponent && m_RplComponent.IsProxy());
655 }
656
657 //------------------------------------------------------------------------------------------------
658 override bool RplSave(ScriptBitWriter writer)
659 {
660 // Counters on the controller
661 writer.WriteIntRange(m_iDistanceIndicatorValue, 0, INDICATOR_MAX_VALUE);
662 writer.WriteIntRange(m_iNumberOfTargetsIndicatorValue, 0, INDICATOR_MAX_VALUE);
663
664 // Sequence light indicator status
665 writer.WriteBool(m_bRoundLightState);
666
667 // Decals on hit indicator
668 int count = m_aIndicatorsCoords.Count();
669 writer.WriteInt(count);
670
671 for (int i = 0; i < count; i++)
672 {
673 writer.WriteVector(m_aIndicatorsCoords[i]);
674 writer.WriteVector(m_aIndicatorsVector[i]);
675 }
676
677 return true;
678 }
679
680 //------------------------------------------------------------------------------------------------
681 override bool RplLoad(ScriptBitReader reader)
682 {
683 // Counters on the controller
684 reader.ReadIntRange(m_iDistanceIndicatorValue, 0, INDICATOR_MAX_VALUE);
685 reader.ReadIntRange(m_iNumberOfTargetsIndicatorValue, 0, INDICATOR_MAX_VALUE);
686
687 // Sequence light indicator status
688 reader.ReadBool(m_bRoundLightState);
689
690 // Hit indicator
691 int count;
692 reader.ReadInt(count);
693
694 for (int i = 0; i < count; i++)
695 {
698 reader.ReadVector(position);
699 reader.ReadVector(rotation);
700
701 AddIndicator(position, rotation);
702 }
703
704 SetControllerLight(ControllerLightType.LIGHT_SEQUENCE, m_bRoundLightState);
705 SetControllerCounter(EControlerSection.DISTANCE ,m_iDistanceIndicatorValue);
706 SetControllerCounter(EControlerSection.NUMBER_OF_TARGETS ,m_iNumberOfTargetsIndicatorValue);
707 return true;
708 }
709
710 //------------------------------------------------------------------------------------------------
711 // Constructor
713 {
715
716 if (s_aInstances)
717 s_aInstances.Insert(this);
718
719 m_FiringRangeManager = SCR_FiringRangeManager.Cast(parent);
720
721 if (m_FiringRangeManager)
722 m_FiringRangeManager.RegisterFiringRangeController(this);
723 }
724
725 //------------------------------------------------------------------------------------------------
727 {
728 if (s_aInstances)
729 s_aInstances.RemoveItem(this);
730 }
731};
732
738
746
ArmaReforgerScripted GetGame()
Definition game.c:1398
override float GetTargetDistance()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
float distance
vector position
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external Managed FindComponent(typename typeName)
proto external IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external IEntity GetSibling()
bool CheckMasterOnlyMethod(string methodName)
bool IsProxy()
Return if is proxy or not.
void SetControllerLight(ControllerLightType light, bool mode)
void SCR_FiringRangeController(IEntitySource src, IEntity parent)
override bool RplSave(ScriptBitWriter writer)
int m_iErectTargetTime
For how long target stays in erected position.
override bool RplLoad(ScriptBitReader reader)
void SetEmissivity(ParametricMaterialInstanceComponent light, bool on)
void BackToDefaultTarget(notnull IEntity pOwnerEntity)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
RespawnSystemComponentClass GameComponentClass vector vector rotation