Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ClockHandComponent.c
Go to the documentation of this file.
1 #define ENABLE_BASE_DESTRUCTION
2 [EntityEditorProps(category: "Components/SCR_ClockHandComponentClass", description: "Component handlinng move of clock hands.")]
3 class SCR_ClockHandComponentClass : ScriptComponentClass
4 {
5 }
6 
7 class SCR_ClockHandComponent : ScriptComponent
8 {
9  private TimeAndWeatherManagerEntity m_TimeManager;
10  private SignalsManagerComponent m_SignalManager;
11  private SCR_DestructionMultiPhaseComponent m_MultiPhaseDestComp;
12  private int m_iClockSignalIndex;
13 
14  //------------------------------------------------------------------------------------------------
15  override void OnPostInit(IEntity owner)
16  {
17  SetEventMask(owner, EntityEvent.INIT);
18  }
19 
20  //------------------------------------------------------------------------------------------------
21  override void EOnInit(IEntity owner)
22  {
23  ChimeraWorld world = ChimeraWorld.CastFrom(owner.GetWorld());
24  if (!world)
25  return;
26 
27  m_TimeManager = world.GetTimeAndWeatherManager();
28  if (!m_TimeManager)
29  return;
30 
31  m_SignalManager = SignalsManagerComponent.Cast(owner.FindComponent(SignalsManagerComponent));
32  if (!m_SignalManager)
33  return;
34 
35  m_iClockSignalIndex = m_SignalManager.AddOrFindSignal("ClockHand");
36  m_MultiPhaseDestComp = SCR_DestructionMultiPhaseComponent.Cast(owner.FindComponent(SCR_DestructionMultiPhaseComponent));
37 
38  if (m_iClockSignalIndex != -1)
39  GetGame().GetCallqueue().CallLater(ClockHandStep, 1000, true);
40 
41  ClearEventMask(owner,EntityEvent.INIT);
42  }
43 
44  //------------------------------------------------------------------------------------------------
47  {
48 #ifdef ENABLE_BASE_DESTRUCTION
49  if (m_MultiPhaseDestComp && m_MultiPhaseDestComp.GetDestroyed())
50  GetGame().GetCallqueue().Remove(ClockHandStep);
51 #endif
52 
53  m_SignalManager.SetSignalValue(m_iClockSignalIndex, m_TimeManager.GetTimeOfTheDay());
54  }
55 }
SCR_ClockHandComponentClass
Definition: SCR_ClockHandComponent.c:3
ChimeraWorld
Definition: ChimeraWorld.c:12
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
m_SignalManager
private SignalsManagerComponent m_SignalManager
Definition: SCR_ClockHandComponent.c:10
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_TimeManager
SCR_ClockHandComponentClass m_TimeManager
m_MultiPhaseDestComp
private SCR_DestructionMultiPhaseComponent m_MultiPhaseDestComp
Definition: SCR_ClockHandComponent.c:11
ClockHandStep
void ClockHandStep()
Definition: SCR_ClockHandComponent.c:46
m_iClockSignalIndex
private int m_iClockSignalIndex
Definition: SCR_ClockHandComponent.c:12
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_ClockHandComponent.c:15
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_ClockHandComponent.c:21
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180