Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AnalyticsDataCollectionTimeAndWeatherModule.c
Go to the documentation of this file.
3{
4 //------------------------------------------------------------------------------------------------
5 protected override void OnPlayerConnected(int playerId)
6 {
7 SetPlayerTimeAndNight(playerId);
8 }
9
10 //------------------------------------------------------------------------------------------------
11 protected override void OnPlayerDisconnected(int playerId, KickCauseCode cause, IEntity controlledEntity)
12 {
13 SetPlayerTimeAndNight(playerId);
14 }
15
16 //------------------------------------------------------------------------------------------------
17 protected void SetPlayerTimeAndNight(int playerId)
18 {
19 if (!m_bIsEnabled)
20 return;
21
22 string timeString;
23 bool isNight;
24 GetTimeAndNight(timeString, isNight);
25
26 if (timeString.IsEmpty())
27 return;
28
29 SCR_PlayerData playerData = SCR_PlayerData.GetPlayerData(playerId);
30 if (!playerData)
31 return;
32
33 playerData.dataEvent.num_daytime = timeString;
34 playerData.dataEvent.is_night = isNight;
35 }
36
37 //------------------------------------------------------------------------------------------------
41 protected void GetTimeAndNight(out string time, out bool isNight)
42 {
43 ChimeraWorld world = ChimeraWorld.CastFrom(GetGame().GetWorld());
44 if (!world)
45 return;
46
47 TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
48 if (!manager)
49 return;
50
51 float timeOfTheDay = manager.GetTimeOfTheDay();
52
53 int hours, minutes, seconds;
54 manager.TimeToHoursMinutesSeconds(timeOfTheDay, hours, minutes, seconds);
55 isNight = manager.IsNightHour(timeOfTheDay);
56 time = string.Format("%1%2", hours.ToString(2), minutes.ToString(2));
57 }
58
59 #ifdef ENABLE_DIAG
60 //------------------------------------------------------------------------------------------------
61 override void DrawContent()
62 {
63 if (!m_bIsEnabled)
64 {
65 DbgUI.Text("Module disabled!");
66 return;
67 }
68
69 DbgUI.Text("This module does not save any data.");
70 }
71 #endif
72
73 //------------------------------------------------------------------------------------------------
78}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition DbgUI.c:66
override void OnPlayerDisconnected(int playerId, KickCauseCode cause, IEntity controlledEntity)
ref SCR_PlayerDataEvent dataEvent
static SCR_PlayerData GetPlayerData(int playerID)