Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MetaStruct.c
Go to the documentation of this file.
3 {
4  protected string bV; //--- Build version
5  protected int cT; //--- Creation time
6  protected string hR; //--- Header resource GUID
7  protected ref array<string> ad = {}; //--- Addon GUIDs
8 
9  //----------------------------------------------------------------------------------------
10  bool IsVersionCompatible(out string versionName = string.Empty)
11  {
12  //--- Compare only major version, ignore the build number (otherwise even the slightes build increase would invalidate saves)
13  versionName = GetGame().GetBuildVersion();
14 
15  return bV.StartsWith(versionName);
16  }
17 
18  //----------------------------------------------------------------------------------------
19  string GetHeaderResource()
20  {
21  return hR;
22  }
23 
24  //----------------------------------------------------------------------------------------
25  void GetDateAndTime(out int year, out int month, out int day, out int hour, out int minute)
26  {
27  SCR_DateTimeHelper.ConvertMinutesIntoDate(cT, year, month, day, hour, minute);
28  }
29 
30  //----------------------------------------------------------------------------------------
31  bool AreAddonsCompatible()
32  {
33  array<string> currentAddons = {};
34  GameProject.GetLoadedAddons(currentAddons);
35 
36  foreach (string addon: ad)
37  {
38  if (!currentAddons.Contains(addon))
39  return false;
40  }
41  return true;
42  }
43 
44  //----------------------------------------------------------------------------------------
45  bool IsValid()
46  {
47  return cT != 0 && !bV.IsEmpty() && !hR.IsEmpty();
48  }
49 
50  //----------------------------------------------------------------------------------------
51  override bool Serialize()
52  {
53  //--- Build version (ToDo)
54  bV = GetGame().GetBuildVersion();
55 
56  //--- Creation time
57  int y, m, d, hh, mm, ss;
58  System.GetYearMonthDay(y, m, d);
59  System.GetHourMinuteSecond(hh, mm, ss);
60  cT = SCR_DateTimeHelper.ConvertDateIntoMinutes(y, m, d, hh, mm);
61 
62  //--- Header resource GUID
63  MissionHeader header = GetGame().GetMissionHeader();
64  if (header)
65  hR = SCR_ConfigHelper.GetGUID(header.GetHeaderResourceName());
66  else if (SCR_SaveLoadComponent.GetInstance())
67  hR = SCR_ConfigHelper.GetGUID(SCR_SaveLoadComponent.GetInstance().GetDebugHeaderResourceName());
68 
69  //--- Addons GUIDs
70  GameProject.GetLoadedAddons(ad);
71 
72  return true;
73  }
74 
75  //----------------------------------------------------------------------------------------
76  override bool Deserialize()
77  {
78  return true;
79  }
80 
81  //----------------------------------------------------------------------------------------
82  override void ClearCache()
83  {
84  bV = string.Empty;
85  cT = 0;
86  hR = string.Empty;
87  ad.Clear();
88  }
89 
90  //----------------------------------------------------------------------------------------
91  override void Log()
92  {
93  int y, m, d, hh, mm;
94  SCR_DateTimeHelper.ConvertMinutesIntoDate(cT, y, m, d, hh, mm);
95 
96  Print("--- SCR_MetaStruct --------------------------");
97  PrintFormat("Build version = %1", bV);
98  PrintFormat("Creation time = %1", SCR_FormatHelper.FormatDateTime(y, m, d, hh, mm, 0));
99  PrintFormat("Header resource GUID = %1", hR);
100  Print("Addons:");
101  foreach (string guid: ad)
102  {
103  string addonTitle = GameProject.GetAddonTitle(guid);
104  if (addonTitle.IsEmpty())
105  addonTitle = string.Format("Unknown addon (%1)", guid);
106  Print(" " + addonTitle);
107  }
108  Print("---------------------------------------------");
109  }
110 
111  //----------------------------------------------------------------------------------------
112  void SCR_MetaStruct()
113  {
114  RegAll();
115  }
116 }
SCR_FormatHelper
Definition: SCR_FormatHelper.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
MissionHeader
Definition: MissionHeader.c:32
SCR_DateTimeHelper
Definition: SCR_DateTimeHelper.c:1
SCR_MetaStruct
Definition: SCR_MetaStruct.c:2
SCR_JsonApiStruct
Definition: SCR_JsonApiStruct.c:5
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
SCR_ConfigHelper
Definition: SCR_ConfigHelper.c:1