Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VerifyItems.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2[WorkbenchPluginAttribute(name: "Verify Items", wbModules: { "WorldEditor" }, awesomeFontCode: 0xF560)]
3class SCR_VerifyItemsPlugin : WorkbenchPlugin
4{
5 [Attribute(uiwidget: UIWidgets.FileNamePicker, desc: "Root directory to search", params:"unregFolders" )]
6 string RootPath;
7
8 override void Run()
9 {
10 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
11 WorldEditorAPI api = worldEditor.GetApi();
12
13 WBProgressDialog progress = new WBProgressDialog("Verifying items...", worldEditor);
14 progress.SetProgress(0.0);
15
17 filter.rootPath = RootPath;
18 filter.fileExtensions = { "et" };
19 filter.recursive = true;
20
21 ref array<ResourceName> resources = {};
22 ResourceDatabase.SearchResources(filter, resources.Insert);
23
24 int n;
25 float prevProgress, currProgress;
26
27 for (int i = 0, count = resources.Count(); i < count; ++i)
28 {
29 Resource resource = Resource.Load(resources[i]);
30 if (!resource.IsValid())
31 continue;
32
33 IEntitySource entitySource = resource.GetResource().ToEntitySource();
34 if (!entitySource)
35 continue;
36
37 IEntityComponentSource inventoryCompSource = SCR_BaseContainerTools.FindComponentSource(entitySource, InventoryItemComponent);
38 if (!inventoryCompSource)
39 continue;
40
41 n++;
42
43 bool enabled;
44 inventoryCompSource.Get("Enabled", enabled);
45 if (!enabled)
46 continue;
47
48 if (entitySource.GetAncestor() && entitySource.GetAncestor().ToEntitySource())
49 {
50 IEntityComponentSource ancestorInventoryCompSource = SCR_BaseContainerTools.FindComponentSource(entitySource.GetAncestor().ToEntitySource(), InventoryItemComponent);
51 if (ancestorInventoryCompSource && ancestorInventoryCompSource == inventoryCompSource)
52 continue;
53 }
54
55 IEntityComponentSource rplCompSource = SCR_BaseContainerTools.FindComponentSource(entitySource, RplComponent);
56 if (!rplCompSource)
57 continue;
58
59 rplCompSource.Get("Enabled", enabled);
60 if (!enabled)
61 continue;
62
63 bool parentNodeFromParentEntity;
64 rplCompSource.Get("Parent Node From Parent Entity", parentNodeFromParentEntity);
65
66 if (parentNodeFromParentEntity)
67 {
68 PrintFormat("%1 \"Parent Node From Parent Entity\" property on RplComponent of the item is set to true", resources[i], level: LogLevel.WARNING);
69 }
70
71 currProgress = i / count;
72 if (currProgress - prevProgress >= 0.01) // min 1%
73 {
74 progress.SetProgress(currProgress); // expensive
75 prevProgress = currProgress;
76 }
77 }
78
79 Print(string.Format("Verify Items: End, %1 items processed", n), LogLevel.DEBUG);
80 }
81}
82#endif // WORKBENCH
GenerateFlowMaps WorkbenchPlugin WorkbenchPluginAttribute("Regenerate river flow-maps", "Generate and save/overwrite river flow-maps", "", "", {"WorldEditor"}, "", 0xf773)
Definition FlowmapTool.c:59
override void Run()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
Object used for holding filtering params for ResourceDatabase.SearchResources() method.
Definition System.c:9
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
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute