Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkSlotClearArea.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ScenarioFramework/Slot", description: "")]
3 {
4 }
5 
6 class SCR_ScenarioFrameworkSlotClearArea : SCR_ScenarioFrameworkSlotTask
7 {
8  //------------------------------------------------------------------------------------------------
9  override void Init(SCR_ScenarioFrameworkArea area = null, SCR_ScenarioFrameworkEActivationType activation = SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
10  {
11  if (m_bInitiated)
12  return;
13 
14  if (!m_bDynamicallyDespawned && activation != m_eActivationType)
15  return;
16 
18  {
19  //If just one condition is false, we don't continue and interrupt the init
20  if (!activationCondition.Init(GetOwner()))
21  {
23  return;
24  }
25  }
26 
27  bool tempTerminated = m_bIsTerminated;
28  m_bIsTerminated = false;
29 
31  {
32  IEntity entity = GetOwner().GetParent();
33  if (!entity)
34  return;
35 
37  if (!layerBase)
38  return;
39 
40  if (!layerBase.GetEnableRepeatedSpawn())
41  {
42  Print(string.Format("ScenarioFramework: Object %1 already exists and won't be spawned for %2, exiting...", m_Entity, GetOwner().GetName()), LogLevel.ERROR);
43  return;
44  }
45  }
46 
47  // Handles inheritance of faction settings from parents
48  if (m_sFactionKey.IsEmpty() && m_ParentLayer && !m_ParentLayer.GetFactionKey().IsEmpty())
49  SetFactionKey(m_ParentLayer.GetFactionKey());
50 
51  if (!m_bUseExistingWorldAsset)
52  m_Entity = SpawnAsset();
53  else
54  QueryObjectsInRange(); //sets the m_Entity in subsequent callback
55 
57 
58  if (m_Entity)
59  {
60  BaseGameTriggerEntity trigger = BaseGameTriggerEntity.Cast(m_Entity);
61  if (trigger)
62  trigger.EnablePeriodicQueries(false);
63  }
64  else
65  {
67  return;
68  }
69 
70  if (!m_sID.IsEmpty())
71  m_Entity.SetName(m_sID);
72 
73  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(m_Entity);
74  if (objectDmgManager)
75  objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
76 
77  if (Vehicle.Cast(m_Entity))
78  {
79  EventHandlerManagerComponent ehManager = EventHandlerManagerComponent.Cast(m_Entity.FindComponent(EventHandlerManagerComponent));
80  if (ehManager)
81  ehManager.RegisterScriptHandler("OnCompartmentEntered", this, OnCompartmentEntered, false, true);
82  }
83 
85  m_bIsTerminated = tempTerminated;
86 
88  }
89 
90  //------------------------------------------------------------------------------------------------
92  {
93  m_bInitiated = true;
94 
95  if (m_ParentLayer)
96  m_ParentLayer.CheckAllChildrenSpawned(this);
97 
98  if (!m_Area)
100 
101  if (m_Area)
102  {
103  m_Area.GetOnAllChildrenSpawned().Insert(AfterParentAreaChildrenSpawned);
104  m_Area.CheckAllChildrenSpawned(this);
105  }
106 
108  }
109 
110  //------------------------------------------------------------------------------------------------
112  {
113  foreach (SCR_ScenarioFrameworkPlugin plugin : m_aPlugins)
114  {
115  plugin.Init(this);
116  }
117 
118  foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActivationActions)
119  {
120  activationAction.Init(GetOwner());
121  }
122 
123  if (m_Area)
124  m_Area.GetOnAllChildrenSpawned().Remove(AfterParentAreaChildrenSpawned);
125 
126  if (m_Entity)
127  {
128  BaseGameTriggerEntity trigger = BaseGameTriggerEntity.Cast(m_Entity);
129  if (trigger)
130  trigger.EnablePeriodicQueries(true);
131  }
132  }
133 }
m_aPlugins
protected ref array< ref SCR_ScenarioFrameworkPlugin > m_aPlugins
Definition: SCR_ScenarioFrameworkLayerBase.c:55
SCR_ScenarioFrameworkActivationConditionBase
Definition: SCR_ScenarioFrameworkSlotBase.c:677
m_eActivationType
protected SCR_ScenarioFrameworkEActivationType m_eActivationType
Definition: SCR_ScenarioFrameworkLayerBase.c:43
GetName
string GetName()
Definition: SCR_ScenarioFrameworkLayerBase.c:85
m_bInitiated
protected bool m_bInitiated
Definition: SCR_ScenarioFrameworkLayerBase.c:72
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
SCR_ScenarioFrameworkSlotClearAreaClass
Definition: SCR_ScenarioFrameworkSlotClearArea.c:2
GetOnAllChildrenSpawned
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:450
m_bEnableRepeatedSpawn
protected bool m_bEnableRepeatedSpawn
Definition: SCR_ScenarioFrameworkLayerBase.c:31
m_Area
protected SCR_ScenarioFrameworkArea m_Area
Definition: SCR_ScenarioFrameworkLayerBase.c:64
m_aActivationActions
protected ref array< ref SCR_ScenarioFrameworkActionBase > m_aActivationActions
Definition: SCR_ScenarioFrameworkLayerBase.c:49
m_Entity
enum EAITargetInfoCategory m_Entity
AfterAllChildrenSpawned
override void AfterAllChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotClearArea.c:91
OnCompartmentEntered
event protected void OnCompartmentEntered(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
Definition: SCR_CharacterInventoryStorageComponent.c:1248
m_sFactionKey
protected FactionKey m_sFactionKey
Definition: SCR_ScenarioFrameworkLayerBase.c:25
InvokeAllChildrenSpawned
void InvokeAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:460
Init
SCR_ScenarioFrameworkSlotClearAreaClass SCR_ScenarioFrameworkSlotTaskClass Init(SCR_ScenarioFrameworkArea area=null, SCR_ScenarioFrameworkEActivationType activation=SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
Definition: SCR_ScenarioFrameworkSlotClearArea.c:9
m_bDynamicallyDespawned
protected bool m_bDynamicallyDespawned
Definition: SCR_ScenarioFrameworkLayerBase.c:74
SCR_ScenarioFrameworkArea
Definition: SCR_ScenarioFrameworkArea.c:24
SCR_ScenarioFrameworkPlugin
Definition: SCR_ScenarioFrameworkLayerBase.c:888
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
m_ParentLayer
protected SCR_ScenarioFrameworkLayerBase m_ParentLayer
Definition: SCR_ScenarioFrameworkLayerBase.c:65
m_bIsTerminated
protected bool m_bIsTerminated
Definition: SCR_ScenarioFrameworkLayerBase.c:75
GetParentArea
SCR_ScenarioFrameworkArea GetParentArea()
Get parent area the object is nested into.
Definition: SCR_ScenarioFrameworkLayerBase.c:179
AfterParentAreaChildrenSpawned
protected void AfterParentAreaChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotClearArea.c:111
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkLayerBase.c:875
SpawnAsset
IEntity SpawnAsset(string name, ResourceName type, IEntity spawnpoint=null)
Definition: SCR_CampaignTutorialComponentArland.c:1199
StoreTaskSubjectToParentTaskLayer
override void StoreTaskSubjectToParentTaskLayer()
Definition: SCR_ScenarioFrameworkSlotDelivery.c:17
SCR_ScenarioFrameworkSlotTaskClass
Definition: SCR_ScenarioFrameworkSlotTask.c:2
SetFactionKey
protected void SetFactionKey(FactionKey factionKey)
Definition: SCR_ScenarioFrameworkLayerBase.c:242
m_aActivationConditions
protected ref array< ref SCR_ScenarioFrameworkActivationConditionBase > m_aActivationConditions
Definition: SCR_ScenarioFrameworkLayerBase.c:46
OnObjectDamage
void OnObjectDamage(EDamageState state)
Definition: SCR_ScenarioFrameworkSlotBase.c:67
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180