Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDayNightTest.c
Go to the documentation of this file.
2{
4 protected float m_fSunriseTime;
5 protected float m_fSunsetTime;
6
7 //-------------------------------------------------------------------
8 protected static override string GetOnHoverDescription()
9 {
10 return "Returns true during daytime, false otherwise.";
11 }
12
13 //-------------------------------------------------------------------
14 override void OnInit(AIAgent owner)
15 {
16 ChimeraWorld world = owner.GetWorld();
17 m_TimeManager = world.GetTimeAndWeatherManager();
18 if( !m_TimeManager )
19 {
20 Print("SCR_AIDayNightTest: Could not find a TimeAndWeatherManagerEntity", LogLevel.WARNING);
21 return;
22 }
23
24 if (!m_TimeManager.GetSunriseHour(m_fSunriseTime) || !m_TimeManager.GetSunsetHour(m_fSunsetTime))
25 m_TimeManager = null; // Set it to null to indicate that we failed to initialize this decorator
26 }
27
28 //-------------------------------------------------------------------
29 protected override bool TestFunction(AIAgent owner)
30 {
31 if (!m_TimeManager)
32 return false;
33
34 float currentTime = m_TimeManager.GetTimeOfTheDay();
35
36 return currentTime > m_fSunriseTime && currentTime < m_fSunsetTime;
37 }
38};
TimeAndWeatherManagerEntity m_TimeManager
override bool TestFunction(AIAgent owner)
override void OnInit(AIAgent owner)
static override string GetOnHoverDescription()
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