Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WorldSetupPluginBase.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2class SCR_WorldSetupPluginBasePlugin : WorkbenchPlugin
3{
4 //------------------------------------------------------------------------------------------------
10 protected ResourceName CreatePrefabChildInAddon(ResourceName prefab, int addon, string fileName = string.Empty)
11 {
12 string prefabFilePath = prefab.GetPath();
13 string relativePrefabDirPath = FilePath.StripFileName(prefab.GetPath());
14 if (!relativePrefabDirPath.EndsWith("/"))
15 relativePrefabDirPath += "/";
16
17 if (fileName.IsEmpty())
18 {
19 string extension;
20 FilePath.StripExtension(prefab, extension);
21 fileName = SCR_StringHelper.Filter(fileName, "/\\;", true) + extension;
22 }
23 else
24 {
25 fileName = FilePath.StripPath(prefabFilePath);
26 }
27
28 string destinationAbsolutePath;
29 if (!SCR_AddonTool.GetAddonAbsolutePath(addon, relativePrefabDirPath + fileName, destinationAbsolutePath, false))
30 {
31 Print("Could not create child Prefab; using the provided one", LogLevel.WARNING);
32 return string.Empty;
33 }
34
35 if (FileIO.FileExists(destinationAbsolutePath))
36 {
37 Print("Prefab destination already exists " + destinationAbsolutePath, LogLevel.WARNING);
38 return string.Empty;
39 }
40
41 return SCR_PrefabHelper.CreateChildPrefab(prefab, destinationAbsolutePath);
42 }
43}
44#endif // WORKBENCH
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