3 name:
"MultiPhase Destruction Soundless Prefab Search",
4 description:
"Search Prefabs using multiphase destruction where Material Sound Type is set to NONE",
5 wbModules: {
"ResourceManager" },
7 awesomeFontCode: 0xF7CE)]
8class SCR_MultiPhaseDestructionSoundlessPrefabSearchPlugin : WorkbenchPlugin
10 [
Attribute(
desc:
"Ignore SCR_DestructibleEntity entities that have destruction disabled",
category:
"Options")]
11 protected bool m_bIgnoreDestructibleEntitiesWithDisabledDestruction;
14 protected bool m_bIgnoreDisabledComponents;
16 [
Attribute(
desc:
"Include Prefabs having at least one Small Debris with Material Sound Type set to NONE",
category:
"Options")]
17 protected bool m_bIncludeSilentSmallDebris;
22 if (!Workbench.ScriptDialog(
"MultiPhase Destruction Soundless Prefab Search Options",
string.Empty,
this))
29 protected void DetectPrefabs()
31 Print(
"==================================================",
LogLevel.NORMAL);
32 Print(
"Looking for Prefabs using NONE as Destruction's Material Sound Type",
LogLevel.NORMAL);
34 if (m_bIncludeSilentSmallDebris)
35 Print(
"Also looking for Small Debris under the same conditions",
LogLevel.NORMAL);
37 Print(
"==================================================",
LogLevel.NORMAL);
39 array<string> addonGUIDs = {};
42 array<ResourceName> resourceNames = {};
43 foreach (
string addonGUID : addonGUIDs)
46 Print(
"Looking into " + addonID +
"/Prefabs",
LogLevel.NORMAL);
60 SCR_EMaterialSoundTypeBreak value;
62 bool isComponentEnabled;
63 bool isDestructibleEntity;
64 array<ResourceName> resultsGeneric = {};
65 array<ResourceName> resultsDestructible = {};
66 array<ResourceName> resultsGenericDebris = {};
67 array<ResourceName> resultsDestructibleDestroySpawnObjectDebris = {};
68 array<ResourceName> resultsDestructibleDestructionPhaseDebris = {};
73 if (!resource.IsValid())
79 baseContainer = resource.GetResource().ToBaseContainer();
86 if (baseContainer.GetClassName() ==
"Tree")
89 isDestructibleEntity = baseContainer.GetClassName() ==
"SCR_DestructibleEntity";
90 if (isDestructibleEntity)
92 if (m_bIgnoreDestructibleEntitiesWithDisabledDestruction)
94 if (!baseContainer.Get(
"Enabled", isComponentEnabled) || !isComponentEnabled)
100 baseContainerList = baseContainer.GetObjectArray(
"components");
101 if (!baseContainerList)
104 for (
int i, count = baseContainerList.Count(); i < count; i++)
106 childContainer = baseContainerList.Get(i);
110 if (childContainer.GetClassName() ==
"SCR_DestructionMultiPhaseComponent")
112 baseContainer = childContainer;
120 if (m_bIgnoreDisabledComponents)
122 if (!baseContainer.Get(
"Enabled", isComponentEnabled) || !isComponentEnabled)
127 if (!baseContainer.Get(
"m_eMaterialSoundType", value))
130 if (value == SCR_EMaterialSoundTypeBreak.NONE)
132 if (isDestructibleEntity)
140 if (!m_bIncludeSilentSmallDebris)
145 if (isDestructibleEntity)
148 baseContainerList = baseContainer.GetObjectArray(
"m_aDestroySpawnObjects");
149 if (baseContainerList)
152 for (
int i, count = baseContainerList.Count(); i < count; i++)
154 childContainer = baseContainerList.Get(i);
158 if (childContainer.GetClassName() !=
"SCR_DebrisSpawnable")
161 if (!childContainer.Get(
"m_eMaterialSoundType", value))
164 if (value == SCR_EMaterialSoundTypeBreak.NONE)
166 resultsDestructibleDestroySpawnObjectDebris.Insert(
resourceName);
176 baseContainerList = baseContainer.GetObjectArray(
"DamagePhases");
177 if (!baseContainerList)
182 for (
int i, count = baseContainerList.Count(); i < count; i++)
184 childContainer = baseContainerList.Get(i);
188 if (childContainer.GetClassName() !=
"SCR_BaseDestructionPhase")
191 childContainerList = childContainer.GetObjectArray(
"m_aPhaseDestroySpawnObjects");
192 if (!childContainerList)
196 for (
int j, countJ = childContainerList.Count(); j < countJ; j++)
198 childSubContainer = childContainerList.Get(j);
199 if (!childSubContainer)
202 if (childSubContainer.GetClassName() !=
"SCR_DebrisSpawnable")
205 if (!childSubContainer.Get(
"m_eMaterialSoundType", value))
208 if (value == SCR_EMaterialSoundTypeBreak.NONE)
210 resultsDestructibleDestructionPhaseDebris.Insert(
resourceName);
225 baseContainerList = baseContainer.GetObjectArray(
"m_DestroySpawnObjects");
226 if (!baseContainerList)
231 for (
int i, count = baseContainerList.Count(); i < count; i++)
233 childContainer = baseContainerList.Get(i);
237 if (childContainer.GetClassName() !=
"SCR_DebrisSpawnable")
240 if (!childContainer.Get(
"m_eMaterialSoundType", value))
243 if (value == SCR_EMaterialSoundTypeBreak.NONE)
258 Print(
"GenericEntity: NONE used as Material Sound Type in " + result,
LogLevel.WARNING);
263 Print(
"GenericEntity Debris: NONE used as Material Sound Type in " + result,
LogLevel.WARNING);
268 Print(
"DestructibleEntity: NONE used as Material Sound Type in " + result,
LogLevel.WARNING);
271 foreach (
ResourceName result : resultsDestructibleDestroySpawnObjectDebris)
273 Print(
"DestructibleEntity SpawnObject Debris: NONE used as Material Sound Type in " + result,
LogLevel.WARNING);
276 foreach (
ResourceName result : resultsDestructibleDestructionPhaseDebris)
278 Print(
"DestructibleEntity DestructionPhase Debris: NONE used as Material Sound Type in " + result,
LogLevel.WARNING);
281 int genericCount = resultsGeneric.Count();
282 int genericDebrisCount = resultsGenericDebris.Count();
283 int destructibleCount = resultsDestructible.Count();
284 int destructibleDestroySpawnObjectDebrisCount = resultsDestructibleDestroySpawnObjectDebris.Count();
285 int destructibleDestructionPhaseDebrisCount = resultsDestructibleDestructionPhaseDebris.Count();
287 int total = genericCount +
290 destructibleDestroySpawnObjectDebrisCount +
291 destructibleDestructionPhaseDebrisCount;
293 PrintFormat(
"%1/%2 Prefabs found using NONE as Destruction's Material Sound Type", total, resourceNames.Count(), level:
LogLevel.NORMAL);
295 if (genericCount > 0)
296 Print(
"" + genericCount +
" Generic Entities",
LogLevel.NORMAL);
298 if (genericDebrisCount > 0)
299 Print(
"" + genericDebrisCount +
" Generic Entity Debris",
LogLevel.NORMAL);
301 if (destructibleCount > 0)
302 Print(
"" + destructibleCount +
" Destructible Entities",
LogLevel.NORMAL);
304 if (destructibleDestroySpawnObjectDebrisCount > 0)
305 Print(
"" + destructibleDestroySpawnObjectDebrisCount +
" Destructible Entity SpawnObject Debris",
LogLevel.NORMAL);
307 if (destructibleDestructionPhaseDebrisCount > 0)
308 Print(
"" + destructibleDestructionPhaseDebrisCount +
" Destructible Entity DestructionPhase Debris",
LogLevel.NORMAL);
ResourceName resourceName
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
Object holding reference to resource. In destructor release the resource.
static array< ResourceName > SearchWorkbenchResources(array< string > fileExtensions=null, array< string > searchStrArray=null, string rootPath="", bool recursive=true)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
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