3 protected static const int CORE_MODULE_COUNT = 2;
15 static ParamEnumArray FromEnum(
int titleFormat = 2,
int hideCoreModules = 0)
17 ParamEnumArray
params =
new ParamEnumArray();
18 array<string> addonGUIDs = {};
19 GameProject.GetLoadedAddons(addonGUIDs);
21 for (
int i, count = addonGUIDs.Count(); i < count; i++)
23 string addonGUID = addonGUIDs[i];
25 if (hideCoreModules == 1 && GameProject.IsVanillaAddon(addonGUID))
28 if (hideCoreModules == 2 && count > CORE_MODULE_COUNT && GameProject.IsVanillaAddon(addonGUID))
34 case 0: title = GameProject.GetAddonID(addonGUID);
break;
35 case 1: title = GameProject.GetAddonTitle(addonGUID);
break;
37 case 2: title =
string.Format(
"%1 (%2)", GameProject.GetAddonTitle(addonGUID), GameProject.GetAddonID(addonGUID));
break;
39 params.Insert(
new ParamEnum(title, i.ToString()));
49 protected static const ref array<string>
CORE_ADDONS = {
"core",
"ArmaReforger" };
56 static array<string> GetResourceAddons(ResourceName prefab,
bool ignoreCoreAddons =
false)
58 array<string> addonNames = {};
63 Resource prefabResource = BaseContainerTools.LoadContainer(prefab);
67 BaseResourceObject configContainer;
68 configContainer = prefabResource.GetResource();
72 BaseContainer configBase = configContainer.ToBaseContainer();
76 configBase.GetSourceAddons(addonNames);
78 if (ignoreCoreAddons && !addonNames.IsEmpty())
82 addonNames.RemoveItem(item);
93 static string GetResourceLastAddon(ResourceName prefab)
95 array<string> addonNames = GetResourceAddons(prefab);
96 if (addonNames.IsEmpty())
99 return addonNames[addonNames.Count() - 1];
107 static string GetAddonIndex(
int index)
109 array<string> addons = {};
110 GameProject.GetLoadedAddons(addons);
112 return GameProject.GetAddonID(addons[
index]);
124 static string StripFileSystem(
string fileSystemPath)
126 int length = fileSystemPath.Length();
127 if (fileSystemPath.IsEmpty())
128 return fileSystemPath;
130 if (!fileSystemPath.StartsWith(
"$"))
131 return fileSystemPath;
133 int colonIndex = fileSystemPath.IndexOf(
":");
135 return fileSystemPath;
138 if (colonIndex == length)
141 return fileSystemPath.Substring(colonIndex, length - colonIndex);
149 static string ToFileSystem(
string addon)
151 return "$" + addon +
":";
159 static bool GetAddonAbsolutePath(
int addonId,
string relativeDirPath, out
string result,
bool mustExist =
true)
161 return Workbench.GetAbsolutePath(ToFileSystem(GetAddonIndex(addonId)) + relativeDirPath, result, mustExist);
169 static bool GetAddonAbsolutePath(
int addonId, ResourceName directory, out
string result,
bool mustExist =
true)
171 return Workbench.GetAbsolutePath(ToFileSystem(GetAddonIndex(addonId)) + directory.GetPath(), result, mustExist);