Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkSlotDelivery.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ScenarioFramework/Slot", description: "")]
3 {
4 }
5 
6 class SCR_ScenarioFrameworkSlotDelivery : SCR_ScenarioFrameworkSlotTask
7 {
8  [Attribute(desc: "Name of the task layer associated with this deliver point, Doesn't need to be set if nested under task layer Deliver.", category: "Task")];
9  protected ref array<string> m_aAssociatedTaskLayers;
10 
11  /*
12  [Attribute(defvalue: "", desc: "Name of the entity to be delivered")];
13  protected string m_sIDToDeliver;
14  */
15 
16  //------------------------------------------------------------------------------------------------
18  {
19  if (m_aAssociatedTaskLayers.IsEmpty())
20  {
21  //the Associated layer task attribute is empty, lets check if the parent layer of this delivery slot is Task Deliver
22  //if yes, the user didn't need to fill the mentioned attribute since it's nested the layer
23  //Not every time is the delivery slot nested under the Layer task Deliver since it can be created later.
24  m_TaskLayer = GetParentTaskLayer();
25  if (m_TaskLayer && SCR_ScenarioFrameworkLayerTaskDeliver.Cast(m_TaskLayer))
26  SCR_ScenarioFrameworkLayerTaskDeliver.Cast(m_TaskLayer).SetDeliveryPointEntity(m_Entity);
27  else
28  Print(string.Format("ScenarioFramework: ->Task->Delivery point %1 doesn't have associated layer attribute set (and is nested outside of its layer task delivery)", GetOwner().GetName()), LogLevel.ERROR);
29  }
30  else
31  {
32  IEntity entity;
33  foreach (string sLayerName : m_aAssociatedTaskLayers)
34  {
35  entity = GetGame().GetWorld().FindEntityByName(sLayerName);
36  if (entity)
37  m_TaskLayer = SCR_ScenarioFrameworkLayerTaskDeliver.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTaskDeliver));
38 
39  if (m_TaskLayer)
40  {
41  if (m_Entity)
42  SCR_ScenarioFrameworkLayerTaskDeliver.Cast(m_TaskLayer).SetDeliveryPointEntity(m_Entity);
43  }
44  else
45  {
46  Print(string.Format("ScenarioFramework: ->Task->Delivery point: Task Layer %1 doesn't exist.", sLayerName), LogLevel.ERROR);
47  }
48  }
49  }
50  }
51 
52  //------------------------------------------------------------------------------------------------
53  override void Init(SCR_ScenarioFrameworkArea area = null, SCR_ScenarioFrameworkEActivationType activation = SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
54  {
55  if (!m_bDynamicallyDespawned && activation != m_eActivationType)
56  return;
57 
58  super.Init(area, activation);
59 
60  if (!m_TaskLayer)
61  {
62  if (m_ParentLayer)
63  m_ParentLayer.CheckAllChildrenSpawned(this);
64 
65  return;
66  }
67 
68  SCR_BaseTriggerEntity trigger = SCR_BaseTriggerEntity.Cast(m_Entity);
69  if (!trigger)
70  return;
71 
73  {
74  //If just one condition is false, we don't continue and interrupt the init
75  if (!activationCondition.Init(GetOwner()))
76  {
78  return;
79  }
80  }
81 
82  SCR_TaskDeliver task = SCR_TaskDeliver.Cast(m_TaskLayer.GetTask());
83  if (task)
84  {
85  task.SetLayerTask(m_TaskLayer);
86  task.SetDeliveryTrigger(trigger);
87  task.UpdateTaskTitleAndDescription();
88  }
89  else
90  {
91  if (m_aAssociatedTaskLayers.IsEmpty())
92  {
93  Print(string.Format("ScenarioFramework: ->Task->Delivery point: Associated Task Layers are empty"), LogLevel.ERROR);
94  return;
95  }
96 
97  IEntity entity;
98  foreach (string sLayerName : m_aAssociatedTaskLayers)
99  {
100  entity = GetGame().GetWorld().FindEntityByName(sLayerName);
101  if (entity)
102  m_TaskLayer = SCR_ScenarioFrameworkLayerTaskDeliver.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTaskDeliver));
103 
104  if (m_TaskLayer)
105  {
106  task = SCR_TaskDeliver.Cast(m_TaskLayer.GetTask());
107  if (task)
108  {
109  task.SetLayerTask(m_TaskLayer);
110  task.SetDeliveryTrigger(trigger);
111  task.UpdateTaskTitleAndDescription();
112  }
113  }
114  else
115  {
116  Print(string.Format("ScenarioFramework: ->Task->Delivery point: Task Delivery does not exist for Layer %1", sLayerName), LogLevel.ERROR);
117  }
118  }
119  }
120 
123  }
124 
125  //------------------------------------------------------------------------------------------------
127  {
128  }
129 
130  //------------------------------------------------------------------------------------------------
133  {
134  m_bInitiated = true;
135 
136  foreach (SCR_ScenarioFrameworkPlugin plugin : m_aPlugins)
137  {
138  plugin.Init(this);
139  }
140 
141  if (m_ParentLayer)
142  m_ParentLayer.CheckAllChildrenSpawned(this);
143 
145  }
146 }
m_aPlugins
protected ref array< ref SCR_ScenarioFrameworkPlugin > m_aPlugins
Definition: SCR_ScenarioFrameworkLayerBase.c:55
m_aAssociatedTaskLayers
protected ref array< string > m_aAssociatedTaskLayers
Definition: SCR_ScenarioFrameworkSlotDelivery.c:9
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_ScenarioFrameworkLayerTaskDeliver
void SCR_ScenarioFrameworkLayerTaskDeliver(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkLayerTaskDeliver.c:93
Init
override void Init(SCR_ScenarioFrameworkArea area=null, SCR_ScenarioFrameworkEActivationType activation=SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
Definition: SCR_ScenarioFrameworkSlotDelivery.c:53
GetOnAllChildrenSpawned
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:450
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_Entity
enum EAITargetInfoCategory m_Entity
InvokeAllChildrenSpawned
void InvokeAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:460
m_bDynamicallyDespawned
protected bool m_bDynamicallyDespawned
Definition: SCR_ScenarioFrameworkLayerBase.c:74
SCR_ScenarioFrameworkArea
Definition: SCR_ScenarioFrameworkArea.c:24
SCR_ScenarioFrameworkSlotDeliveryClass
Definition: SCR_ScenarioFrameworkSlotDelivery.c:2
SCR_TaskDeliver
Definition: SCR_ScenarioFrameworkTaskDeliver.c:27
AfterAllChildrenSpawned
override void AfterAllChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotDelivery.c:126
SCR_ScenarioFrameworkPlugin
Definition: SCR_ScenarioFrameworkLayerBase.c:888
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
AfterAllChildrenSpawnedDelivery
void AfterAllChildrenSpawnedDelivery(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotDelivery.c:132
m_ParentLayer
protected SCR_ScenarioFrameworkLayerBase m_ParentLayer
Definition: SCR_ScenarioFrameworkLayerBase.c:65
Attribute
SCR_ScenarioFrameworkSlotDeliveryClass SCR_ScenarioFrameworkSlotTaskClass Attribute(desc:"Name of the task layer associated with this deliver point, Doesn't need to be set if nested under task layer Deliver.", category:"Task")]
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkLayerBase.c:875
GetParentTaskLayer
SCR_ScenarioFrameworkLayerTask GetParentTaskLayer()
Get the Layer Task which is parent of this Slot.
Definition: SCR_ScenarioFrameworkSlotTask.c:127
StoreTaskSubjectToParentTaskLayer
override void StoreTaskSubjectToParentTaskLayer()
Definition: SCR_ScenarioFrameworkSlotDelivery.c:17
SCR_ScenarioFrameworkSlotTaskClass
Definition: SCR_ScenarioFrameworkSlotTask.c:2
m_aActivationConditions
protected ref array< ref SCR_ScenarioFrameworkActivationConditionBase > m_aActivationConditions
Definition: SCR_ScenarioFrameworkLayerBase.c:46
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180