Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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.")]
6
7class SCR_ClockHandComponent : ScriptComponent
8{
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 //------------------------------------------------------------------------------------------------
46 void ClockHandStep()
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}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_ClockHandComponentClass m_TimeManager
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SignalsManagerComponent m_SignalManager
enum EVehicleType IEntity
proto external int ClearEventMask(notnull IEntity owner, int mask)
proto external int SetEventMask(notnull IEntity owner, int mask)
proto external Managed FindComponent(typename typeName)
proto external BaseWorld GetWorld()
void EOnInit(IEntity owner)
EntityEvent
Various entity events.
Definition EntityEvent.c:14