11 [
Attribute(
desc:
"Selects which object to spawn based on the selected Faction Key",
category:
"Asset")]
12 ref array<ref SCR_ScenarioFrameworkFactionSwitchedObject> m_aFactionSwitchedObjects;
17 [
Attribute(
desc:
"This won't spawn new object, but it will rather use the object already existing in the world",
category:
"Asset")]
18 bool m_bUseExistingWorldAsset;
20 [
Attribute(
desc:
"Overrides display name of the spawned object for task purposes",
category:
"Asset")]
21 string m_sOverrideObjectDisplayName;
24 bool m_bCanBeGarbageCollected;
26 [
Attribute(
desc:
"Randomize spawned asset(s) per Faction Attribute which needs to be filled as well. Will override Object To Spawn Attribute.",
category:
"Randomization")]
27 bool m_bRandomizePerFaction;
32 [
Attribute(
"0",
UIWidgets.SearchComboBox,
"Select Entity Labels which you want to optionally include to random spawn. If you want to spawn everything, you can leave it out empty and also leave Include Only Selected Labels attribute to false.",
"", ParamEnumArray.FromEnum(
EEditableEntityLabel),
category:
"Randomization")]
38 [
Attribute(
desc:
"If true, it will spawn only the entities that are from Included Editable Entity Labels and also do not contain Label to be Excluded.",
category:
"Randomization")]
39 bool m_bIncludeOnlySelectedLabels;
41 [
Attribute(defvalue:
"0",
category:
"Composition",
desc:
"When disabled orientation to terrain will be skipped for the next composition")]
42 bool m_bIgnoreOrientChildrenToTerrain;
53 IEntity m_fallbackEntityByAncestor;
62 protected void QueryObjectsInRange(
float fRange = 2.5)
72 m_fallbackEntityByName = null;
73 m_fallbackEntityByAncestor = null;
79 if (m_fallbackEntityByAncestor)
80 m_Entity = m_fallbackEntityByAncestor;
93 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(
m_Entity);
130 return m_sOverrideObjectDisplayName;
137 m_sOverrideObjectDisplayName = name;
144 if (!
m_Entity || !m_sOverrideObjectDisplayName.IsEmpty())
145 return m_sOverrideObjectDisplayName;
148 if (!editableEntityComp)
167 if (resource == m_sObjectToSpawn)
174 if (!m_fallbackEntityByAncestor)
179 m_fallbackEntityByAncestor = entity;
181 else if (!m_fallbackEntityByName)
186 resource.Split(
"/", strs,
true);
192 m_sObjectToSpawn.Split(
"/", strsObject,
true);
193 string resourceObject;
194 if(strsObject.Count() > 0)
195 resourceObject = strsObject[strsObject.Count() - 1];
199 m_fallbackEntityByName = entity;
236 return m_sObjectToSpawn;
245 if (!m_aFactionSwitchedObjects.IsEmpty())
251 return factionObject.m_sObjectToSpawn;
254 if (m_sObjectToSpawn.IsEmpty())
255 Print(
string.Format(
"ScenarioFramework [SCR_ScenarioFrameworkSlotBase] No faction switch object for \"%1\" FactionKey and no fallback m_sObjectToSpawn.",
m_sFactionKey),
LogLevel.WARNING);
258 return m_sObjectToSpawn;
280 override void RestoreToDefault(
bool includeChildren =
false,
bool reinitAfterRestoration =
false,
bool affectRandomization =
true,
bool deleteSpawnedEntities =
true)
285 super.RestoreToDefault(includeChildren, reinitAfterRestoration, affectRandomization, deleteSpawnedEntities);
361 if (m_bRandomizePerFaction)
363 m_sObjectToSpawn =
"";
377 if (!m_bUseExistingWorldAsset)
383 if (!m_sID.IsEmpty())
389 QueryObjectsInRange();
420 string IDWithSuffix = m_sID;
422 while (
GetGame().GetWorld().FindEntityByName(IDWithSuffix))
425 Print(
string.Format(
"ScenarioFramework Slot: Entity of name %1 was found. The suffix _%2 will be added.", m_sID, suffixNumber),
LogLevel.WARNING);
426 IDWithSuffix = m_sID +
"_" + suffixNumber.ToString();
433 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(
m_Entity);
434 if (objectDmgManager)
435 objectDmgManager.GetOnDamageStateChanged().Insert(
OnObjectDamage);
439 EventHandlerManagerComponent ehManager = EventHandlerManagerComponent.Cast(
m_Entity.FindComponent(EventHandlerManagerComponent));
448 if (!m_bCanBeGarbageCollected)
452 garbageSystem.UpdateBlacklist(
m_Entity,
true);
469 super.Init(area, activation);
507 SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
514 entityCatalog = catalogManager.GetFactionEntityCatalogOfType(m_eEntityCatalogType,
m_sFactionKey);
517 entityCatalog = catalogManager.GetEntityCatalogOfType(m_eEntityCatalogType);
524 Print(
"ScenarioFramework Randomized Spawn: No catalog manager found and faction key is empty!",
LogLevel.ERROR);
528 FactionManager factionManager =
GetGame().GetFactionManager();
531 Print(
"ScenarioFramework Randomized Spawn: Faction manager not found.",
LogLevel.ERROR);
563 array<SCR_EntityCatalogEntry> entityEntries = {};
565 if (entityEntries.IsEmpty())
567 Print(
string.Format(
"ScenarioFramework Randomized Spawn: Applied labels resulted in no viable prefabs to be randomly selected for %1.",
GetOwner().
GetName()),
LogLevel.ERROR);
571 prefab = entityEntries.GetRandomElement().GetPrefab();
583 if (m_bRandomizePerFaction)
590 m_sObjectToSpawn = randomAsset;
608 if (m_bIgnoreOrientChildrenToTerrain)
611 if (slotCompositionComponent)
639 override void _WB_SetTransform(
IEntity owner, inout vector mat[4], IEntitySource src)
646 baseGameEntity.Teleport(mat);
655 void SpawnEntityPreview(
IEntity owner, Resource resource)
658 spawnParams.TransformMode = ETransformMode.WORLD;
674 Resource resource = Resource.Load(m_sObjectToSpawn);
675 if (!resource || !resource.IsValid())
678 SpawnEntityPreview(owner, resource);
688 if (key ==
"m_bShowDebugShapesInWorkbench")
695 Resource resource = Resource.Load(m_sObjectToSpawn);
699 SpawnEntityPreview(owner, resource);
702 else if (key ==
"m_sObjectToSpawn" || key ==
"m_sFactionKey" || key ==
"m_aFactionSwitchedObjects")
ArmaReforgerScripted GetGame()
ref array< string > angles
ResourceName resourceName
enum EAITargetInfoCategory m_Entity
void OnCompartmentEntered(AIAgent agent, IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
ref array< EEditableEntityLabel > m_aExcludedEditableEntityLabels
ref array< EEditableEntityLabel > m_aIncludedEditableEntityLabels
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override void _WB_OnInit(IEntity owner, inout vector mat[4], IEntitySource src)
override bool _WB_OnKeyChanged(IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
Any property value has been changed. You can use editor API here and do some additional edit actions ...
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ScenarioFrameworkEActivationType
bool m_bShowDebugShapesInWorkbench
ref array< IEntity > m_aSpawnedEntities
bool m_bEnableRepeatedSpawn
void SetDynamicDespawnExcluded(bool excluded)
int m_iRepeatedSpawnNumber
void SpawnChildren(bool previouslyRandomized=false)
void InvokeAllChildrenSpawned()
Spawns all children and triggers invoker on completion.
SCR_ScenarioFrameworkLayerBase m_ParentLayer
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
bool m_bExcludeFromDynamicDespawn
FactionKey GetParentFactionKeyRecursive()
void FinishInit()
Initializes children, retrieves them, and spawns them.
void SetIsTerminated(bool state)
ref ScriptInvokerBase< ScriptInvokerScenarioFrameworkLayerMethod > m_OnAllChildrenSpawned
void InitActivationActions()
void AfterAllChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
bool InitAlreadyHappened()
void DrawDebugShape(bool draw)
ref array< ref SCR_ScenarioFrameworkPlugin > m_aPlugins
void DynamicDespawn(SCR_ScenarioFrameworkLayerBase layer)
bool m_bDynamicallyDespawned
bool InitOtherThings()
For situations where some other logic is to be appended in these checks and is to be performed before...
SCR_ScenarioFrameworkLayerTaskDestroyClass m_SpawnParams
void InitSelectedObjectToSpawn()
If m_bRandomizePerFaction, then catalog system will ignore m_sObjectToSpawn if it has a catalog match...
ResourceName GetRandomlySpawnedObject()
void InitSelectedObjectToPreview()
ResourceName GetSelectedObjectToSpawn()
void SCR_ScenarioFrameworkSlotBase(IEntityComponentSource src, IEntity ent, IEntity parent)
bool InitEntitySpawnCheck()
void ~SCR_ScenarioFrameworkSlotBase()
Deletes preview entity in workbench mode, returns if in edit mode, otherwise despawns scenario slot b...
string GetOverriddenObjectDisplayName()
ResourceName GetObjectToSpawn()
void SetRandomlySpawnedObject(ResourceName name)
void OnInventoryParentChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
SCR_ScenarioFrameworkArea GetAreaWB()
string GetSpawnedEntityDisplayName()
void OnObjectDamage(EDamageState state)
string GetSpawnedObjectName()
void SetOverriddenObjectDisplayName(string name)
ResourceName GetRandomAsset(out ResourceName prefab)
SCR_ScenarioFrameworkLayerTaskDefendSave m_sRandomlySpawnedObject
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external void SetOrigin(vector orig)
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
proto external int Update()
proto external BaseWorld GetWorld()
proto external bool SetTransform(vector mat[4])
proto external EntityPrefabData GetPrefabData()
proto external IEntity GetParent()
Object holding reference to resource. In destructor release the resource.
void RequestNavmeshRebuildEntity(IEntity entity)
Get list of entities that all contain all any the included labels and NONE exclude labels Ignores Disabled Entries as well Sometimes it is quicker to get the if false any needs to be true return List size *int GetFullFilteredEntityListWithLabels(notnull out array< SCR_EntityCatalogEntry > filteredEntityList, array< EEditableEntityLabel > includedLabels=null, array< EEditableEntityLabel > excludedLabels=null, bool needsAllIncluded=true)
static IEntity GetMainParent(IEntity entity, bool self=false)
SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, bool printNotFound=true)
Script entry for garbage system modding.
static SCR_GarbageSystem GetByEntityWorld(IEntity entity)
Entity composition which is supposed to fit into a slot.
static void IgnoreOrientChildrenToTerrain()
Bool to disable the terrain snapping for next spawned composition.
static bool IsEmptyOrWhiteSpace(string input)
enum EPhysicsLayerPresets Vehicle
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
proto int ARGB(int a, int r, int g, int b)