Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ModsHandlerLib.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
6//------------------------------------------------------------------------------------------------
8{
9 //------------------------------------------------------------------------------------------------
11 static float GetModListSize(array<Dependency> dependencies)
12 {
13 // Empty array check
14 if (dependencies.IsEmpty())
15 return -1;
16
17 // Size count
18 float size = 0;
19
20 foreach (Dependency dependency : dependencies)
21 {
22 size += dependency.TotalFileSize();
23 }
24
25 // Result
26 return size;
27 }
28
29 //------------------------------------------------------------------------------------------------
31 static float GetModListSize(array<ref SCR_WorkshopItem> items)
32 {
33 // Empty array check
34 if (items.IsEmpty())
35 return -1;
36
37 // Size count
38 float size = 0;
39
40 foreach (SCR_WorkshopItem item : items)
41 {
42 size += item.GetSizeBytes();
43 }
44
45 // Result
46 return size;
47 }
48
49 //------------------------------------------------------------------------------------------------
53 static bool AllItemsCached(array<Dependency> aDependencies, out array<Dependency> aDepsToLoad)
54 {
55 for (int i = 0; i < aDependencies.Count(); i++)
56 {
57 WorkshopItem item = aDependencies[i].GetCachedItem();
58
59 // Is cashed item missing?
60 if(!item)
61 {
62 // Items to load batch
63 aDepsToLoad.Insert(aDependencies[i]);
64 continue;
65 }
66 }
67
68 // Are there dependecies to load
69 if (aDepsToLoad.Count() == 0)
70 return true;
71
72 return false;
73 }
74
75 //------------------------------------------------------------------------------------------------
78 static bool AllModsUpdated(array<Dependency> dependencies)
79 {
80 // No dependencies in list
81 if (dependencies.Count() == 0)
82 return true;
83
84 // Fill items array to check
85 array<WorkshopItem> aRoomItems = new array<WorkshopItem>;
86
87 foreach (Dependency dependency : dependencies)
88 {
89 WorkshopItem item = dependency.GetCachedItem();
90
91 if (item)
92 aRoomItems.Insert(item);
93 }
94
95 // Compare items
96 foreach (WorkshopItem item : aRoomItems)
97 {
98 if (item.GetActiveRevision())
99 continue;
100 else
101 return false;
102 }
103
104 return true;
105 }
106
107 //------------------------------------------------------------------------------------------------
108 // TODO@wernejak - setup this debug when needed data are ready
109 static void SetupDebug()
110 {
111 // Debug menu
112 /*DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_ADDONS_INFO, "Enabled addons", "Addons");
113 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_ADDONS_INFO, "", "Show enabled addons list", "Enabled addons", false);*/
114
115 //SCR_AddonManager.GetAllAddons();
116 }
117
118 //------------------------------------------------------------------------------------------------
121 protected static bool ItemVersionMatch(SCR_WorkshopItem item)
122 {
123 // Check item
124 WorkshopItem wsItem = item.GetWorkshopItem();
125 if (!wsItem)
126 return false;
127
128 // Dependency check
129 Dependency dependency = item.GetDependency();
130 if (!dependency)
131 return false;
132
133 // Does active version match required?
134 return Revision.AreEqual(item.GetCurrentLocalRevision(), dependency.GetRevision());
135 }
136}
int size
static bool ItemVersionMatch(SCR_WorkshopItem item)
Revision GetCurrentLocalRevision()
Returns the revision which we currently have on the local storage.
Dependency GetDependency()
WorkshopItem GetWorkshopItem()
Use these only if absoulutely necessary to intarract with game API.
Workshop Item instance.