Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerHubAreaTriggerEnity.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "Editor", description: "Trigger entity for Player Hub.", color: "0 0 255 255")]
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
7 class SCR_PlayerHubAreaTriggerEntity : ScriptedGameTriggerEntity
8 {
9  protected int m_iWarningTimerDuration = 5;
10 
11  //Todo: Kill and trigger only works on server side and doesn't properly check if the entity that left the trigger was the player!
12  //======================== TIMER COMPLETED/CANCELED ========================\\
13  void TimerDone(IEntity playerToKill, bool canceled = false)
14  {
15  if (!canceled)
16  {
17  GenericEntity genericEntity = GenericEntity.Cast(playerToKill);
18  if (genericEntity)
19  {
20  SCR_CharacterControllerComponent characterController = SCR_CharacterControllerComponent.Cast(genericEntity.FindComponent(SCR_CharacterControllerComponent));
21  if (characterController)
22  characterController.ForceDeath();
23  }
24  }
25  }
26 
27 
28 
29 
30  //****************//
31  //OVERRIDE METHODS//
32  //****************//
33 
34  //------------------------------------------------------------------------------------------------
36  override void OnActivate(IEntity ent)
37  {
38  //Always canceles timer no matter which hub is entered
39  SCR_PlayerHubWarningEditorUIComponent.CancelWarningTimer(this);
40  }
41 
43  override void OnDeactivate(IEntity ent)
44  {
45  //Always start timer if leaving hub (Todo: Breaks if trigger in hub overlaps)
46  SCR_PlayerHubWarningEditorUIComponent.SetWarningTimer(m_iWarningTimerDuration, this, ent);
47  }
48 
49 
50 
51  //************************//
52  //CONSTRUCTOR / DESTRUCTOR//
53  //************************//
54 
55  //------------------------------------------------------------------------------------------------
56  void SCR_PlayerHubAreaTriggerEntity(IEntitySource src, IEntity parent)
57  {
58  //SetEventMask(EntityEvent.INIT);
59  }
60 
61  //------------------------------------------------------------------------------------------------
63  {
64  //Canceles timer (If current timer is from this hub)
65  SCR_PlayerHubWarningEditorUIComponent.CancelWarningTimer(this, true);
66  }
67 
68 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
SCR_PlayerHubAreaTriggerEntity
Definition: SCR_PlayerHubAreaTriggerEnity.c:7
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
OnDeactivate
override void OnDeactivate()
Definition: SCR_CharacterCommandLoiter.c:37
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
SCR_PlayerHubAreaTriggerEntityClass
Definition: SCR_PlayerHubAreaTriggerEnity.c:2
OnActivate
override void OnActivate()
Definition: SCR_CharacterCommandLoiter.c:23
ScriptedGameTriggerEntityClass
Definition: ScriptedGameTriggerEntity.c:12
SCR_PlayerHubWarningEditorUIComponent
Definition: SCR_PlayerHubWarningEditorUIComponent.c:1
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180