Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkSlotBase.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ScenarioFramework/Slot", description: "")]
3 {
4 }
5 
7 {
8  [Attribute(params: "et", desc: "Resource name of the object to be spawned", category: "Asset")]
9  ResourceName m_sObjectToSpawn;
10 
11  [Attribute(desc: "Name of the entity used for identification", category: "Asset")]
12  string m_sID;
13 
14  [Attribute(desc: "This won't spawn new object, but it will rather use the object already existing in the world", category: "Asset")]
15  bool m_bUseExistingWorldAsset;
16 
17  [Attribute(desc: "Overrides display name of the spawned object for task purposes", category: "Asset")]
18  string m_sOverrideObjectDisplayName;
19 
20  [Attribute(defvalue: "1", desc: "If the spawned entity can be garbage-collected", category: "Asset")]
21  bool m_bCanBeGarbageCollected;
22 
23  [Attribute(desc: "Randomize spawned asset(s) per Faction Attribute which needs to be filled as well. Will override Object To Spawn Attribute.", category: "Randomization")]
24  bool m_bRandomizePerFaction;
25 
26  [Attribute("0", UIWidgets.SearchComboBox, "Select Entity Catalog type for random spawn", "", ParamEnumArray.FromEnum(EEntityCatalogType), category: "Randomization")]
27  EEntityCatalogType m_eEntityCatalogType;
28 
29  [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")]
30  ref array<EEditableEntityLabel> m_aIncludedEditableEntityLabels;
31 
32  [Attribute("0", UIWidgets.SearchComboBox, "Select Entity Labels which you want to exclude from random spawn", "", ParamEnumArray.FromEnum(EEditableEntityLabel), category: "Randomization")]
33  ref array<EEditableEntityLabel> m_aExcludedEditableEntityLabels;
34 
35  [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")]
36  bool m_bIncludeOnlySelectedLabels;
37 
38  [Attribute(defvalue: "0", category: "Composition", desc: "When disabled orientation to terrain will be skipped for the next composition")]
39  bool m_bIgnoreOrientChildrenToTerrain;
40 
41  bool m_bSelected = false;
42  ref EntitySpawnParams m_SpawnParams = new EntitySpawnParams();
43  vector m_Size;
44  ResourceName m_sRandomlySpawnedObject;
45  vector m_vPosition;
46 
47  [Attribute(defvalue: "1", desc: "Show the debug shapes in Workbench", category: "Debug")]
48  bool m_bShowDebugShapesInWorkbench;
49 
50 #ifdef WORKBENCH
51  protected IEntity m_PreviewEntity;
52 #endif
53 
54  //------------------------------------------------------------------------------------------------
56  protected void QueryObjectsInRange(float fRange = 2.5)
57  {
58  BaseWorld pWorld = GetGame().GetWorld();
59  if (!pWorld)
60  return;
61 
62  pWorld.QueryEntitiesBySphere(GetOwner().GetOrigin(), fRange, GetEntity, null, EQueryEntitiesFlags.ALL);
63  }
64 
65  //------------------------------------------------------------------------------------------------
68  {
69  if (state != EDamageState.DESTROYED || !m_Entity)
70  return;
71 
72  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(m_Entity.FindComponent(SCR_DamageManagerComponent));
73  if (objectDmgManager)
74  objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
75 
77  {
79  SetIsTerminated(true);
80  }
81  else
82  {
83  SetIsTerminated(true);
84  }
85  }
86 
87  //------------------------------------------------------------------------------------------------
91  {
93  if (!invComp)
94  return;
95 
97  }
98 
99  //------------------------------------------------------------------------------------------------
105  void OnCompartmentEntered(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
106  {
108  }
109 
110  //------------------------------------------------------------------------------------------------
112  // TODO: overridd*en
114  {
115  return m_sOverrideObjectDisplayName;
116  }
117 
118  //------------------------------------------------------------------------------------------------
120  // TODO: overridd*en
122  {
123  m_sOverrideObjectDisplayName = name;
124  }
125 
126  //------------------------------------------------------------------------------------------------
129  {
130  if (!m_Entity)
131  return string.Empty;
132 
133  if (!m_sOverrideObjectDisplayName.IsEmpty())
134  return m_sOverrideObjectDisplayName;
135 
137  if (!editableEntityComp)
138  return string.Empty;
139 
140  return editableEntityComp.GetDisplayName();
141  }
142 
143  //------------------------------------------------------------------------------------------------
145  protected bool GetEntity(notnull IEntity entity)
146  {
147  IEntity pParent = SCR_EntityHelper.GetMainParent(entity, true);
148  EntityPrefabData prefabData = pParent.GetPrefabData();
149  if (!prefabData)
150  return true;
151 
152  ResourceName resource = prefabData.GetPrefabName();
153  if (resource.IsEmpty())
154  {
155  resource = prefabData.GetPrefab().GetAncestor().GetName();
156  if (resource.IsEmpty())
157  {
158  if (!m_sID.IsEmpty())
159  {
160  if (entity.GetName() != m_sID)
161  return true;
162  }
163  else
164  {
165  return true;
166  }
167  }
168  else
169  {
170  if (m_sObjectToSpawn.IsEmpty())
171  return true;
172 
173  TStringArray strs = new TStringArray();
174  resource.Split("/", strs, true);
175  string resourceName = strs[strs.Count() - 1];
176 
177  TStringArray strsObject = new TStringArray();
178  m_sObjectToSpawn.Split("/", strsObject, true);
179  string resourceObject = strsObject[strsObject.Count() - 1];
180 
181  if (resourceName == resourceObject)
182  {
183  m_Entity = entity;
184  return false;
185  }
186  else
187  {
188  return true;
189  }
190  }
191  }
192  else
193  {
194  if (resource != m_sObjectToSpawn)
195  return true;
196  }
197 
198  m_Entity = entity;
199  return false;
200  }
201 
202  //------------------------------------------------------------------------------------------------
205  {
207  IEntity entity = GetOwner().GetParent();
208  while (entity)
209  {
210  area = SCR_ScenarioFrameworkArea.Cast(entity.FindComponent(SCR_ScenarioFrameworkArea));
211  if (area)
212  return area;
213 
214  entity = entity.GetParent();
215  }
216 
217  return area;
218  }
219 
220  //------------------------------------------------------------------------------------------------
223  {
224  return m_sID;
225  }
226 
227  //------------------------------------------------------------------------------------------------
229  ResourceName GetObjectToSpawn()
230  {
231  return m_sObjectToSpawn;
232  }
233 
234  //------------------------------------------------------------------------------------------------
237  {
238  return m_sRandomlySpawnedObject;
239  }
240 
241  //------------------------------------------------------------------------------------------------
243  void SetRandomlySpawnedObject(ResourceName name)
244  {
245  m_sRandomlySpawnedObject = name;
246  }
247 
248  //------------------------------------------------------------------------------------------------
250  override void RestoreToDefault(bool includeChildren = false, bool reinitAfterRestoration = false)
251  {
252  m_sRandomlySpawnedObject = string.Empty;
253  m_vPosition = vector.Zero;
254 
255  super.RestoreToDefault(includeChildren, reinitAfterRestoration);
256  }
257 
258  //------------------------------------------------------------------------------------------------
260  {
262  if (!m_Entity && !SCR_StringHelper.IsEmptyOrWhiteSpace(m_sObjectToSpawn))
263  {
265  return;
266  }
267 
269  return;
270 
271  if (m_Entity)
272  {
273  m_vPosition = m_Entity.GetOrigin();
275  if (invComp)
276  invComp.m_OnParentSlotChangedInvoker.Remove(OnInventoryParentChanged);
277  }
278 
279  m_bInitiated = false;
281  foreach (IEntity entity : m_aSpawnedEntities)
282  {
283  if (!entity)
284  continue;
285 
286  m_vPosition = entity.GetOrigin();
287  SCR_EntityHelper.DeleteEntityAndChildren(entity);
288  }
289 
290  m_aSpawnedEntities.Clear();
291  }
292 
293  //------------------------------------------------------------------------------------------------
294  override void Init(SCR_ScenarioFrameworkArea area = null, SCR_ScenarioFrameworkEActivationType activation = SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
295  {
296  if (m_bIsTerminated)
297  {
298  if (m_ParentLayer)
299  m_ParentLayer.CheckAllChildrenSpawned(this);
300 
301  return;
302  }
303 
306 
307  if (!m_ParentLayer)
308  {
309  IEntity entity = GetOwner().GetParent();
310  if (!entity)
311  return;
312 
314  if (!m_ParentLayer)
315  {
316  Print(string.Format("ScenarioFramework: Slot %1 has no parent layer linked - whole parent hierarchy won't be properly working!", GetName()), LogLevel.ERROR);
317  return;
318  }
319  }
320 
321  if (!m_bDynamicallyDespawned && activation != m_eActivationType)
322  {
323  if (m_ParentLayer)
324  m_ParentLayer.CheckAllChildrenSpawned(this);
325 
326  return;
327  }
328 
330  {
331  //If just one condition is false, we don't continue and interrupt the init
332  if (!activationCondition.Init(GetOwner()))
333  {
334  m_ParentLayer.CheckAllChildrenSpawned(this);
335  return;
336  }
337  }
338 
339  if (m_Entity && !m_bEnableRepeatedSpawn && !m_ParentLayer.GetEnableRepeatedSpawn())
340  {
341  Print(string.Format("ScenarioFramework: Object %1 already exists and won't be spawned for %2, exiting...", m_Entity, GetName()), LogLevel.ERROR);
342  m_ParentLayer.CheckAllChildrenSpawned(this);
343  return;
344  }
345 
346  // Handles inheritance of faction settings from parents
347  if (m_sFactionKey.IsEmpty() && !m_ParentLayer.GetFactionKey().IsEmpty())
348  SetFactionKey(m_ParentLayer.GetFactionKey());
349 
350  if (!m_bUseExistingWorldAsset)
351  {
352  m_Entity = SpawnAsset();
353  }
354  else
355  {
356  QueryObjectsInRange(); //sets the m_Entity in subsequent callback
357  }
358 
360 
361  if (!m_Entity)
362  {
364  return;
365  }
366 
367  if (!m_sID.IsEmpty())
368  m_Entity.SetName(m_sID);
369 
370  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(m_Entity.FindComponent(SCR_DamageManagerComponent));
371  if (objectDmgManager)
372  objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
373 
374  if (Vehicle.Cast(m_Entity))
375  {
376  EventHandlerManagerComponent ehManager = EventHandlerManagerComponent.Cast(m_Entity.FindComponent(EventHandlerManagerComponent));
377  if (ehManager)
378  ehManager.RegisterScriptHandler("OnCompartmentEntered", this, OnCompartmentEntered, true);
379  }
380 
382  if (invComp)
383  invComp.m_OnParentSlotChangedInvoker.Insert(OnInventoryParentChanged);
384 
385  if (!m_bCanBeGarbageCollected)
386  {
387  SCR_GarbageSystem garbageSystem = SCR_GarbageSystem.GetByEntityWorld(m_Entity);
388  if (garbageSystem)
389  garbageSystem.UpdateBlacklist(m_Entity, true);
390  }
391 
392  if (!area)
393  {
394  SCR_GameModeSFManager gameModeComp = SCR_GameModeSFManager.Cast(GetGame().GetGameMode().FindComponent(SCR_GameModeSFManager));
395  if (gameModeComp)
396  area = gameModeComp.GetParentArea(GetOwner());
397  }
398  m_Area = area;
399 
401  }
402 
403  //------------------------------------------------------------------------------------------------
405  {
406  m_bInitiated = true;
407 
408  foreach (SCR_ScenarioFrameworkPlugin plugin : m_aPlugins)
409  {
410  plugin.Init(this);
411  }
412 
413  foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActivationActions)
414  {
415  activationAction.Init(GetOwner());
416  }
417 
418  if (m_ParentLayer)
419  m_ParentLayer.CheckAllChildrenSpawned(this);
420 
422  }
423 
424  //------------------------------------------------------------------------------------------------
427  {
428  BaseGameMode gameMode = GetGame().GetGameMode();
429  if (!gameMode)
430  return null;
431 
432  SCR_GameModeSFManager pGameModeMgr = SCR_GameModeSFManager.Cast(gameMode.FindComponent(SCR_GameModeSFManager));
433  if (!pGameModeMgr)
434  return null;
435 
436  return pGameModeMgr.GetOnAllAreasInitiated();
437  }
438 
439  //------------------------------------------------------------------------------------------------
440  // Slot cannot have children
441  override void SpawnChildren(bool previouslyRandomized = false)
442  {
443  }
444 
445  //------------------------------------------------------------------------------------------------
448  ResourceName GetRandomAsset(out ResourceName prefab)
449  {
450  SCR_EntityCatalog entityCatalog;
451 
452  SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
453 
454  //~ Get data from faction manager
455  if (catalogManager)
456  {
457  //~ Faction set so get catalog from faction
458  if (!m_sFactionKey.IsEmpty())
459  entityCatalog = catalogManager.GetFactionEntityCatalogOfType(m_eEntityCatalogType, m_sFactionKey);
460  //~ No faction set so get factionless list
461  else
462  entityCatalog = catalogManager.GetEntityCatalogOfType(m_eEntityCatalogType);
463  }
464  //~ For some reason catalog manager was not found so get data from faction
465  else
466  {
467  if (m_sFactionKey.IsEmpty())
468  {
469  Print("ScenarioFramework Randomized Spawn: No catalog manager found and faction key is empty!", LogLevel.ERROR);
470  return string.Empty;
471  }
472 
473  FactionManager factionManager = GetGame().GetFactionManager();
474  if (!factionManager)
475  {
476  Print("ScenarioFramework Randomized Spawn: Faction manager not found.", LogLevel.ERROR);
477  return string.Empty;
478  }
479 
480  SCR_Faction faction = SCR_Faction.Cast(factionManager.GetFactionByKey(m_sFactionKey));
481  if (!faction)
482  {
483  Print(string.Format("ScenarioFramework Randomized Spawn: Selected faction not found for %1.", GetOwner().GetName()), LogLevel.ERROR);
484  return string.Empty;
485  }
486 
487  //~ Get entity Catalog from faction
488  entityCatalog = faction.GetFactionEntityCatalogOfType(m_eEntityCatalogType);
489 
490  if (!entityCatalog)
491  {
492  Print(string.Format("ScenarioFramework Randomized Spawn: Faction Entity Catalog (type: %1) not found for %2.", typename.EnumToString(EEntityCatalogType, m_eEntityCatalogType), GetOwner().GetName()), LogLevel.ERROR);
493  return string.Empty;
494  }
495  }
496 
497  //~ No catalog found
498  if (!entityCatalog)
499  {
500  if (!m_sFactionKey.IsEmpty())
501  Print(string.Format("ScenarioFramework Randomized Spawn: Faction Entity Catalog for faction %1 (type %2) not found for %3.", m_sFactionKey, typename.EnumToString(EEntityCatalogType, m_eEntityCatalogType), GetOwner().GetName()), LogLevel.ERROR);
502  else
503  Print(string.Format("ScenarioFramework Randomized Spawn: Non-Faction Entity Catalog (Type: %1) not found for %2.", typename.EnumToString(EEntityCatalogType, m_eEntityCatalogType), GetOwner().GetName()), LogLevel.ERROR);
504 
505  return string.Empty;
506  }
507 
508  array<SCR_EntityCatalogEntry> entityEntries = {};
509  entityCatalog.GetFullFilteredEntityListWithLabels(entityEntries, m_aIncludedEditableEntityLabels, m_aExcludedEditableEntityLabels, m_bIncludeOnlySelectedLabels);
510  if (entityEntries.IsEmpty())
511  {
512  Print(string.Format("ScenarioFramework Randomized Spawn: Applied labels resulted in no viable prefabs to be randomly selected for %1.", GetOwner().GetName()), LogLevel.ERROR);
513  return string.Empty;
514  }
515 
516  Math.Randomize(-1);
517  prefab = entityEntries.GetRandomElement().GetPrefab();
518  m_sRandomlySpawnedObject = prefab;
519  return prefab;
520  }
521 
522  //------------------------------------------------------------------------------------------------
525  IEntity SpawnAsset()
526  {
527  //If Randomization is enabled, it will try to apply settings from Attributes.
528  //If it fails anywhere, original m_sObjectToSpawn will be used.
529  if (m_bRandomizePerFaction)
530  {
531  ResourceName randomAsset;
532  if (SCR_StringHelper.IsEmptyOrWhiteSpace(GetRandomlySpawnedObject()))
533  {
534  GetRandomAsset(randomAsset);
535  if (!SCR_StringHelper.IsEmptyOrWhiteSpace(randomAsset))
536  m_sObjectToSpawn = randomAsset;
537  }
538  else
539  {
540  randomAsset = GetRandomlySpawnedObject();
541  }
542  }
543 
544  Resource resource = Resource.Load(m_sObjectToSpawn);
545  if (!resource)
546  return null;
547 
548  GetOwner().GetWorldTransform(m_SpawnParams.Transform);
549  m_SpawnParams.TransformMode = ETransformMode.WORLD;
550  //--- Apply rotation
551  vector angles = Math3D.MatrixToAngles(m_SpawnParams.Transform);
552  Math3D.AnglesToMatrix(angles, m_SpawnParams.Transform);
553 
554  //--- Spawn the prefab
555  BaseResourceObject resourceObject = resource.GetResource();
556  if (!resourceObject)
557  return null;
558 
559  if (m_bIgnoreOrientChildrenToTerrain)
560  {
561  IEntityComponentSource slotCompositionComponent = SCR_BaseContainerTools.FindComponentSource(resourceObject, SCR_SlotCompositionComponent);
562  if (slotCompositionComponent)
563  {
564  SCR_SlotCompositionComponent.IgnoreOrientChildrenToTerrain();
565  }
566  }
567 
568  IEntity entity = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), m_SpawnParams);
569  SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld());
570  if (aiWorld)
571  aiWorld.RequestNavmeshRebuildEntity(entity);
572 
573  m_aSpawnedEntities.Insert(entity);
574 
575  if (m_vPosition != vector.Zero)
576  {
577  entity.SetOrigin(m_vPosition);
578  entity.Update();
579  }
580 
581  return entity;
582  }
583 
584 #ifdef WORKBENCH
585  //------------------------------------------------------------------------------------------------
586  override void _WB_AfterWorldUpdate(IEntity owner, float timeSlice)
587  {
588  DrawDebugShape(m_bShowDebugShapesInWorkbench);
589  }
590 
591  //------------------------------------------------------------------------------------------------
592  override void _WB_SetTransform(IEntity owner, inout vector mat[4], IEntitySource src)
593  {
594  if (!m_PreviewEntity)
595  return;
596 
597  BaseGameEntity baseGameEntity = BaseGameEntity.Cast(m_PreviewEntity);
598  if (baseGameEntity)
599  baseGameEntity.Teleport(mat);
600  else
601  m_PreviewEntity.SetTransform(mat);
602  }
603 
604  //------------------------------------------------------------------------------------------------
608  void SpawnEntityPreview(IEntity owner, Resource resource)
609  {
610  EntitySpawnParams spawnParams = new EntitySpawnParams();
611  spawnParams.TransformMode = ETransformMode.WORLD;
612  owner.GetWorldTransform(spawnParams.Transform);
613 
614  m_PreviewEntity = GetGame().SpawnEntityPrefab(resource, owner.GetWorld(), spawnParams);
615  }
616 
617  //------------------------------------------------------------------------------------------------
618  override void _WB_OnInit(IEntity owner, inout vector mat[4], IEntitySource src)
619  {
620  SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
621 
622  Resource resource = Resource.Load(m_sObjectToSpawn);
623  if (!resource)
624  return;
625 
626  SpawnEntityPreview(owner, resource);
627  }
628 
629  //------------------------------------------------------------------------------------------------
630  override bool _WB_OnKeyChanged(IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
631  {
632  if (key == "m_bShowDebugShapesInWorkbench")
633  DrawDebugShape(m_bShowDebugShapesInWorkbench);
634 
635  if (key == "coords")
636  {
637  SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
638 
639  Resource resource = Resource.Load(m_sObjectToSpawn);
640  if (!resource)
641  return false;
642 
643  SpawnEntityPreview(owner, resource);
644  return true;
645  }
646  else if (key == "m_sObjectToSpawn")
647  {
648  SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
649  return false;
650  }
651  return false;
652  }
653 
654 #endif
655 
656  //------------------------------------------------------------------------------------------------
657  // constructor
661  void SCR_ScenarioFrameworkSlotBase(IEntityComponentSource src, IEntity ent, IEntity parent)
662  {
663  m_iDebugShapeColor = ARGB(100, 0x99, 0x10, 0xF2);
664  }
665 
666  //------------------------------------------------------------------------------------------------
667  // destructor
669  {
670 #ifdef WORKBENCH
671  SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
672 #endif
673  }
674 }
675 
678 {
679  //------------------------------------------------------------------------------------------------
683  bool Init(IEntity entity);
684 }
685 
687 class SCR_ScenarioFrameworkDayTimeCondition : SCR_ScenarioFrameworkActivationConditionBase
688 {
689  [Attribute(defvalue: "1", desc: "If true, this can be activated only during the day. If false, only during the night.", category: "Time")]
690  protected bool m_bOnlyDuringDay;
691 
692  //------------------------------------------------------------------------------------------------
693  override bool Init(IEntity entity)
694  {
695  ChimeraWorld world = ChimeraWorld.CastFrom(entity.GetWorld());
696  if (!world)
697  return true;
698 
699  TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
700  if (!manager)
701  return true;
702 
703  TimeContainer timeContainer = manager.GetTime();
704  int currentHour = timeContainer.m_iHours;
705 
706  if (m_bOnlyDuringDay)
707  return manager.IsDayHour(currentHour);
708  else
709  return manager.IsNightHour(currentHour);
710  }
711 }
712 
714 class SCR_ScenarioFrameworkDayTimeHourCondition : SCR_ScenarioFrameworkActivationConditionBase
715 {
716  [Attribute(defvalue: "0", desc: "Minimal day time hour", params: "0 24 1", category: "Time")]
717  protected int m_iMinHour;
718 
719  [Attribute(defvalue: "24", desc: "Maximal day time hour", params: "0 24 1", category: "Time")]
720  protected int m_iMaxHour;
721 
722  //------------------------------------------------------------------------------------------------
723  override bool Init(IEntity entity)
724  {
725  ChimeraWorld world = ChimeraWorld.CastFrom(entity.GetWorld());
726  if (!world)
727  return true;
728 
729  TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
730  if (!manager)
731  return true;
732 
733  TimeContainer timeContainer = manager.GetTime();
734  int currentHour = timeContainer.m_iHours;
735 
736  if (currentHour < m_iMinHour || currentHour > m_iMaxHour)
737  return false;
738 
739  return true;
740  }
741 }
742 
744 class SCR_ScenarioFrameworkWeatherCondition : SCR_ScenarioFrameworkActivationConditionBase
745 {
746  [Attribute(defvalue: "0", desc: "Minimal wind speed in meters per second", params: "0 100 0.001", precision: 3, category: "Wind")]
747  protected float m_fMinWindSpeed;
748 
749  [Attribute(defvalue: "20", desc: "Maximal wind speed in meters per second", params: "0 100 0.001", precision: 3, category: "Wind")]
750  protected float m_fMaxWindSpeed;
751 
752  [Attribute(defvalue: "0", desc: "Minimal rain intensity", params: "0 1 0.001", precision: 3, category: "Rain")]
753  protected float m_fMinRainIntensity;
754 
755  [Attribute(defvalue: "1", desc: "Maximal rain intensity", params: "0 1 0.001", precision: 3, category: "Rain")]
756  protected float m_fMaxRainIntensity;
757 
758  //------------------------------------------------------------------------------------------------
759  override bool Init(IEntity entity)
760  {
761  ChimeraWorld world = ChimeraWorld.CastFrom(entity.GetWorld());
762  if (!world)
763  return true;
764 
765  TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
766  if (!manager)
767  return true;
768 
769  float currentWindSpeed = manager.GetWindSpeed();
770  if (currentWindSpeed < m_fMinWindSpeed || currentWindSpeed > m_fMaxWindSpeed)
771  return false;
772 
773  float currentRainIntensity = manager.GetRainIntensity();
774  if (currentRainIntensity < m_fMinRainIntensity || currentRainIntensity > m_fMaxRainIntensity)
775  return false;
776 
777  return true;
778  }
779 }
m_aPlugins
protected ref array< ref SCR_ScenarioFrameworkPlugin > m_aPlugins
Definition: SCR_ScenarioFrameworkLayerBase.c:55
ChimeraWorld
Definition: ChimeraWorld.c:12
EEditableEntityLabel
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
SetOverridenObjectDisplayName
void SetOverridenObjectDisplayName(string name)
Definition: SCR_ScenarioFrameworkSlotBase.c:121
SCR_ScenarioFrameworkActivationConditionBase
Definition: SCR_ScenarioFrameworkSlotBase.c:677
m_eActivationType
protected SCR_ScenarioFrameworkEActivationType m_eActivationType
Definition: SCR_ScenarioFrameworkLayerBase.c:43
SCR_EntityHelper
Definition: SCR_EntityHelper.c:1
Attribute
SCR_ScenarioFrameworkSlotBaseClass SCR_ScenarioFrameworkLayerBaseClass Attribute(params:"et", desc:"Resource name of the object to be spawned", category:"Asset")
Get objects of type defined in m_sObjectToSpawn in the range.
Definition: SCR_ScenarioFrameworkSlotBase.c:8
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_ScenarioFrameworkSlotBaseClass
Definition: SCR_ScenarioFrameworkSlotBase.c:2
GetOverridenObjectDisplayName
string GetOverridenObjectDisplayName()
Definition: SCR_ScenarioFrameworkSlotBase.c:113
GetSpawnedEntityDisplayName
string GetSpawnedEntityDisplayName()
Definition: SCR_ScenarioFrameworkSlotBase.c:128
GetEntity
protected bool GetEntity(notnull IEntity entity)
Get object of type defined in m_sObjectToSpawn.
Definition: SCR_ScenarioFrameworkSlotBase.c:145
InventoryStorageSlot
Definition: InventoryStorageSlot.c:12
GetOnAllAreasInitiatedInvoker
ScriptInvoker GetOnAllAreasInitiatedInvoker()
Definition: SCR_ScenarioFrameworkSlotBase.c:426
DrawDebugShape
protected void DrawDebugShape(bool draw)
Definition: SCR_ScenarioFrameworkLayerBase.c:829
OnInventoryParentChanged
void OnInventoryParentChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
Definition: SCR_ScenarioFrameworkSlotBase.c:90
m_OnAllChildrenSpawned
protected ref ScriptInvokerBase< ScriptInvokerScenarioFrameworkLayerMethod > m_OnAllChildrenSpawned
Definition: SCR_ScenarioFrameworkLayerBase.c:61
GetOnAllChildrenSpawned
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:450
OnCompartmentEntered
void OnCompartmentEntered(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
Definition: SCR_ScenarioFrameworkSlotBase.c:105
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_bEnableRepeatedSpawn
protected bool m_bEnableRepeatedSpawn
Definition: SCR_ScenarioFrameworkLayerBase.c:31
GetSpawnedObjectName
string GetSpawnedObjectName()
Definition: SCR_ScenarioFrameworkSlotBase.c:222
EEntityCatalogType
EEntityCatalogType
Definition: EEntityCatalogType.c:4
m_Area
protected SCR_ScenarioFrameworkArea m_Area
Definition: SCR_ScenarioFrameworkLayerBase.c:64
SpawnChildren
override void SpawnChildren(bool previouslyRandomized=false)
Definition: SCR_ScenarioFrameworkSlotBase.c:441
m_aActivationActions
protected ref array< ref SCR_ScenarioFrameworkActionBase > m_aActivationActions
Definition: SCR_ScenarioFrameworkLayerBase.c:49
SCR_StringHelper
Definition: SCR_StringHelper.c:1
~SCR_ScenarioFrameworkSlotBase
void ~SCR_ScenarioFrameworkSlotBase()
Definition: SCR_ScenarioFrameworkSlotBase.c:668
EDamageState
EDamageState
Definition: EDamageState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_Entity
enum EAITargetInfoCategory m_Entity
m_PreviewEntity
protected IEntity m_PreviewEntity
Definition: SCR_ItemPlacementComponent.c:23
m_sFactionKey
protected FactionKey m_sFactionKey
Definition: SCR_ScenarioFrameworkLayerBase.c:25
InvokeAllChildrenSpawned
void InvokeAllChildrenSpawned()
Definition: SCR_ScenarioFrameworkLayerBase.c:460
m_bExcludeFromDynamicDespawn
protected bool m_bExcludeFromDynamicDespawn
Definition: SCR_ScenarioFrameworkLayerBase.c:52
SetIsTerminated
void SetIsTerminated(bool state)
Definition: SCR_ScenarioFrameworkLayerBase.c:106
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
m_aIncludedEditableEntityLabels
protected ref array< EEditableEntityLabel > m_aIncludedEditableEntityLabels
Definition: SCR_AmbientVehicleSpawnPointComponent.c:11
SCR_AIWorld
Definition: SCR_AIWorld.c:23
GetOrigin
vector GetOrigin()
Definition: SCR_AIUtilityComponent.c:279
m_iRepeatedSpawnNumber
protected int m_iRepeatedSpawnNumber
Definition: SCR_ScenarioFrameworkLayerBase.c:34
SCR_ScenarioFrameworkSlotBase
void SCR_ScenarioFrameworkSlotBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkSlotBase.c:661
GetObjectToSpawn
ResourceName GetObjectToSpawn()
Definition: SCR_ScenarioFrameworkSlotBase.c:229
m_bDynamicallyDespawned
protected bool m_bDynamicallyDespawned
Definition: SCR_ScenarioFrameworkLayerBase.c:74
SCR_ScenarioFrameworkArea
Definition: SCR_ScenarioFrameworkArea.c:24
SetRandomlySpawnedObject
void SetRandomlySpawnedObject(ResourceName name)
Definition: SCR_ScenarioFrameworkSlotBase.c:243
SpawnAsset
IEntity SpawnAsset()
Definition: SCR_ScenarioFrameworkSlotBase.c:525
m_iDebugShapeColor
protected int m_iDebugShapeColor
Definition: SCR_ScenarioFrameworkLayerBase.c:69
SCR_ScenarioFrameworkPlugin
Definition: SCR_ScenarioFrameworkLayerBase.c:888
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
AfterAllChildrenSpawned
override void AfterAllChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotBase.c:404
SCR_GarbageSystem
Script entry for garbage system modding.
Definition: SCR_GarbageSystem.c:2
m_ParentLayer
protected SCR_ScenarioFrameworkLayerBase m_ParentLayer
Definition: SCR_ScenarioFrameworkLayerBase.c:65
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_BaseContainerTools
Definition: SCR_BaseContainerTools.c:3
m_aExcludedEditableEntityLabels
protected ref array< EEditableEntityLabel > m_aExcludedEditableEntityLabels
Definition: SCR_AmbientVehicleSpawnPointComponent.c:14
GetAreaWB
SCR_ScenarioFrameworkArea GetAreaWB()
Get the Layer Task which is parent of this Slot.
Definition: SCR_ScenarioFrameworkSlotBase.c:204
SCR_EntityCatalog
Definition: SCR_EntityCatalog.c:181
m_bIsTerminated
protected bool m_bIsTerminated
Definition: SCR_ScenarioFrameworkLayerBase.c:75
GetRandomAsset
ResourceName GetRandomAsset(out ResourceName prefab)
Definition: SCR_ScenarioFrameworkSlotBase.c:448
m_bSelected
protected bool m_bSelected
Definition: SCR_InventoryHitZonePointUI.c:396
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkLayerBase.c:875
m_SpawnParams
SCR_ScenarioFrameworkLayerTaskDestroyClass m_SpawnParams
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
m_vPosition
vector m_vPosition
Definition: SCR_AITalkRequest.c:23
m_aSpawnedEntities
protected ref array< IEntity > m_aSpawnedEntities
Definition: SCR_ScenarioFrameworkLayerBase.c:62
Init
override void Init(SCR_ScenarioFrameworkArea area=null, SCR_ScenarioFrameworkEActivationType activation=SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
Definition: SCR_ScenarioFrameworkSlotBase.c:294
SCR_SlotCompositionComponent
Entity composition which is supposed to fit into a slot.
Definition: SCR_SlotCompositionComponent.c:44
SetDynamicDespawnExcluded
void SetDynamicDespawnExcluded(bool excluded)
Definition: SCR_ScenarioFrameworkLayerBase.c:326
GetRandomlySpawnedObject
ResourceName GetRandomlySpawnedObject()
Definition: SCR_ScenarioFrameworkSlotBase.c:236
DynamicDespawn
override void DynamicDespawn(SCR_ScenarioFrameworkLayerBase layer)
Definition: SCR_ScenarioFrameworkSlotBase.c:259
SCR_Faction
Definition: SCR_Faction.c:6
RestoreToDefault
override void RestoreToDefault(bool includeChildren=false, bool reinitAfterRestoration=false)
Definition: SCR_ScenarioFrameworkSlotBase.c:250
SCR_ScenarioFrameworkLayerBaseClass
Definition: SCR_ScenarioFrameworkLayerBase.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
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180