Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EntityCatalog.c
Go to the documentation of this file.
1  /*
2  //~ USE CASE EXAMPLE
3  protected void Example()
4  {
5  //-------- Get from manager --------\\
6 
7  //~ The SCR_EntityCatalogManagerComponent on the GameMode can get general catalogs as well as faction catalogs
8  // It also allows to get Entry from Prefab with extensive functions
9 
10  SCR_EntityCatalogManagerComponent entityCatalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
11  if (!entityCatalogManager)
12  return;
13 
14  SCR_EntityCatalog entityCatalog = entityCatalogManager.GetEntityCatalogOfType(EEntityCatalogType.VEHICLE);
15  if (!entityCatalog)
16  return;
17 
18  //~ Can also get it from faction (Though getting it directly from faction is slighty cheaper)
19  SCR_EntityCatalog entityCatalog = entityCatalogManager.GetFactionEntityCatalogOfType(EEntityCatalogType.VEHICLE, "US");
20  if (!entityCatalog)
21  return;
22 
23  //~ There area also many direct search functions if you have the prefab. (Note that it can be quite performance intensive so use when needed)
24  //~ See below for more info about SCR_EntityCatalogEntry
25  //~ Faction can be given if you first want to check a specific faction as it is more likly it is in there (To save an more extensive search)
26  SCR_EntityCatalogEntry entry = entityCatalogManager.GetEntryWithPrefabFromAnyCatalog(EEntityCatalogType.VEHICLE, ResourceName prefabToFind, SCR_Faction);
27 
28  //-------
29 
30  //-------- Get directly from faction --------\\
31 
32  //~ You can get the catalog from faction
33  FactionManager factionManager = GetGame().GetFactionManager();
34  if (!factionManager)
35  return;
36 
37  SCR_Faction faction = SCR_Faction.Cast(factionManager.GetFactionByKey("US"));
38  if (!faction)
39  return;
40 
41  SCR_EntityCatalog entityCatalog = faction.GetFactionEntityCatalogOfType(EEntityCatalogType.VEHICLE);
42  if (!entityCatalog)
43  return;
44 
45  //-------
46 
47  //-------- Get list of entity data --------\\
48 
49  //~ You can simply get all entries regardless if they have any specific data class
50  array<SCR_EntityCatalogEntry> entityList = {};
51  int count = entityCatalog.GetEntityList(entityList);
52  Print(count);
53 
54  //-------
55 
56  //-------- Filtering Entries list - Specific Labels --------\\
57  The system is compatible with Editable Entities and it is possible to get the name of the entity as well as lables
58  (For non-editable entities you can set the same variables using the SCR_EntityCatalogEntryNonEditable class)
59 
60 
61  //~ Get a list of all entries within catalog that have the given Label
62  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
63  int count = entityCatalog.GetEntityListWithLabel(EEditableEntityLabel.FACTION_US, filteredSpawnerEntityList);
64  Print(count);
65 
66  //~ Get a list of all entries within catalog that do not have the given Label
67  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
68  int count = entityCatalog.GetEntityListExcludingLabel(EEditableEntityLabel.FACTION_USSR, filteredSpawnerEntityList);
69  Print(count);
70 
71  //~You can also do a full filter. This will get you all the enties that have all/any of the include labels and none of the exclude labels.
72  array<EEditableEntityLabel> includedLabels = {}; //~ Note: Inclusive can be null if exclusive is filled
73  includedLabels.Insert(EEditableEntityLabel.FACTION_US);
74 
75  array<EEditableEntityLabel> excludedLabels = {}; //~ Note: exclusive can be null if Inclusive is filled
76  excludedLabels.Insert(EEditableEntityLabel.FACTION_USSR);
77 
78  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
79  int count = entityCatalog.GetFullFilteredEntityListWithLabels(filteredSpawnerEntityList, includedLabels, excludedLabels);
80  Print(count);
81 
82  //-------
83 
84  //-------- Filtering Entries list - Specific Data types --------\\
85  The system is also able to filter entries on specific data type in the data array (Data needs to be inherented from SCR_BaseEntityCatalogData)
86 
87  //~ Get a list of all entries within catalog that have the given data class (In this cause it is the SCR_EntityCatalogSpawnerData class)
88  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
89  int count = entityCatalog.GetEntityListWithData(SCR_EntityCatalogSpawnerData, filteredSpawnerEntityList);
90  Print(count);
91 
92  //~ You can get a list that excludes a specific data class
93  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
94  int count = entityCatalog.GetEntityListExcludingLabel(SCR_EntityCatalogSpawnerData, filteredSpawnerEntityList);
95  Print(count);
96 
97  //~You can also do a full filter. This will get you all the enties that have all/any of the include data type and none of the exclude Data type.
98  array<typename> includedDataClasses = {}; //~ Note: Inclusive can be null if exclusive is filled
99  includedDataClasses.Insert(SCR_EntityCatalogSpawnerData);
100 
101  array<typename> excludedDataClasses = {}; //~ Note: exclusive can be null if Inclusive is filled
102  excludedDataClasses.Insert(SCR_EntityCatalogLoadoutData);
103 
104  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
105  int count = entityCatalog.GetFullFilteredEntityListWithData(filteredSpawnerEntityList, includedDataClasses, excludedDataClasses);
106  Print(count);
107 
108 
109  //-------
110 
111  //-------- Filtering Entries list - Labels and data --------\\
112  Lastly you can do an ultimate filter with both labels and data.
113 
114  array<EEditableEntityLabel> includedLabels = {}; //~ Note: Inclusive can be null if exclusive is filled
115  includedLabels.Insert(EEditableEntityLabel.FACTION_US);
116 
117  array<EEditableEntityLabel> excludedLabels = {}; //~ Note: exclusive can be null if Inclusive is filled
118  excludedLabels.Insert(EEditableEntityLabel.FACTION_USSR);
119 
120  array<typename> includedDataClasses = {}; //~ Note: Inclusive can be null if exclusive is filled
121  includedDataClasses.Insert(SCR_EntityCatalogSpawnerData);
122 
123  array<typename> excludedDataClasses = {}; //~ Note: exclusive can be null if Inclusive is filled
124  excludedDataClasses.Insert(SCR_EntityCatalogLoadoutData);
125 
126  array<SCR_EntityCatalogEntry> filteredSpawnerEntityList = {};
127  int count = entityCatalog.GetFullFilteredEntityList(filteredSpawnerEntityList, includedLabels, excludedLabels, includedDataClasses, excludedDataClasses);
128  Print(count);
129 
130  //-------
131 
132 
133  //-------- Entry Entity Functions --------\\
134  In the example we simply get the index from the list above. With it we can quicly obtain the information we want
135 
136  //~ Getting the Catalog Index from filtered entity
137  int catalogIndex = filteredSpawnerEntityList[someIndex].GetCatalogIndex();
138 
139  //~ You now got the entry directly from the catalog
140  SCR_EntityCatalogEntry catalogEntry = entityCatalog.GetCatalogEntry(catalogIndex);
141 
142  //~ This allows you to Get the prefab
143  ResourceName prefab = catalogEntry.GetPrefab();
144  Print(prefab);
145 
146  //~ Get Data
147  SCR_EntityCatalogSpawnerData entitySpawnerData = SCR_EntityCatalogSpawnerData.Cast(catalogEntry.GetEntityDataOfType(SCR_EntityCatalogSpawnerData)); //~ Cast to Desired Type
148  Print(entitySpawnerData);
149 
150  //~ Get Entity UI Info
151  SCR_UIInfo uiInfo = catalogEntry.GetEntityUiInfo();
152  Print(uiInfo);
153 
154  //~ Get Entity Name
155  LocalizedString name = catalogEntry.GetEntityName();
156  Print(name);
157 
158  //~ Get Entity Labels
159  array<EEditableEntityLabel> labels = {};
160  int count = catalogEntry.GetEditableEntityLabels(labels);
161 
162  //~ Do various label functions
163  catalogEntry.HasEditableEntityLabel();
164  catalogEntry.HasAnyEditableEntityLabels();
165  catalogEntry.HasAllEditableEntityLabels();
166 
167  //~ Do various Data functions
168  catalogEntry.GetEntityDataOfType();
169  catalogEntry.HasEntityDataOfType();
170  catalogEntry.HasAllEntityDataOfTypes();
171  catalogEntry.HasAnyEntityDataOfTypes();
172 
173  //-------
174  */
175 
176 
180 [BaseContainerProps(configRoot: true), SCR_BaseContainerCustomEntityCatalogCatalog(EEntityCatalogType, "m_eEntityCatalogType", "m_aEntityEntryList", "m_aMultiLists")]
182 {
183  [Attribute("0", desc: "Type of the Catalog", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EEntityCatalogType))]
184  protected EEntityCatalogType m_eEntityCatalogType;
185 
186  [Attribute(desc: "List of all entities of the given type (Note that this list can still be used if using the 'SCR_EntityCatalogMultiList' Class. All entries in the multi lists will be merged into this one on init including the entries already in it)")]
187  protected ref array<ref SCR_EntityCatalogEntry> m_aEntityEntryList;
188 
189  //======================================== TYPE ========================================\\
190 
194  EEntityCatalogType GetCatalogType()
195  {
196  return m_eEntityCatalogType;
197  }
198 
199  //======================================== ENTITY ENTRY GETTER ========================================\\
200  //--------------------------------- Get Entity List ---------------------------------\\
201 
208  int GetEntityList(notnull out array<SCR_EntityCatalogEntry> entityList)
209  {
210  //~ Clear Given list
211  entityList.Clear();
212 
213  //~ Copy list
214  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
215  {
216  entityList.Insert(entityEntry);
217  }
218 
219  return entityList.Count();
220  }
221 
228  SCR_EntityCatalogEntry GetEntryWithPrefab(ResourceName prefabToFind)
229  {
230  if (SCR_StringHelper.IsEmptyOrWhiteSpace(prefabToFind))
231  return null;
232 
233  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
234  {
235  if (entityEntry.GetPrefab() == prefabToFind)
236  return entityEntry;
237  }
238 
239  return null;
240  }
241 
242 
243  //======================================== DIRECT ENTRY GETTERS WITH INDEX ========================================\\
244  //--------------------------------- Get Catalog Entry from Index ---------------------------------\\
245 
251  SCR_EntityCatalogEntry GetCatalogEntry(int index)
252  {
253  //~ Invalid index
254  if (!m_aEntityEntryList.IsIndexValid(index))
255  {
256  Print(string.Format("'SCR_EntityCatalog' Function: 'GetCatalogEntry()'. index: '%1' is invalid for catalog type '%2'.", index, typename.EnumToString(EEntityCatalogType, m_eEntityCatalogType)), LogLevel.ERROR);
257  return null;
258  }
259 
260  //~ Return Entry
261  return m_aEntityEntryList[index];
262  }
263 
264  //======================================== ENTITY ENTRY GETTER WITH LABELS ========================================\\
265  //--------------------------------- Get Entity List with Label ---------------------------------\\
266 
274  int GetEntityListWithLabel(EEditableEntityLabel label, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
275  {
276  //~ Clear Given list
277  filteredEntityList.Clear();
278 
279  //~ Copy list
280  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
281  {
282  //~ Does not have label
283  if (!entityEntry.HasEditableEntityLabel(label))
284  continue;
285 
286  //~ Add to list
287  filteredEntityList.Insert(entityEntry);
288  }
289 
290  return filteredEntityList.Count();
291  }
292 
293  //--------------------------------- Get Entity List WITHOUT Fata type ---------------------------------\\
294 
302  int GetEntityListExcludingLabel(EEditableEntityLabel excludinglabel, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
303  {
304  //~ Clear Given list
305  filteredEntityList.Clear();
306 
307  //~ Copy list
308  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
309  {
310  //~ HAS the label so do not add it to the list
311  if (entityEntry.HasEditableEntityLabel(excludinglabel))
312  continue;
313 
314  //~ Add to list
315  filteredEntityList.Insert(entityEntry);
316  }
317 
318  return filteredEntityList.Count();
319  }
320 
321  //--------------------------------- Get Full Filtered Entity List with Labels ---------------------------------\\
322 
332  int GetFullFilteredEntityListWithLabels(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<EEditableEntityLabel> includedLabels = null, array<EEditableEntityLabel> excludedLabels = null, bool needsAllIncluded = true)
333  {
334  //~ Clear Given list
335  filteredEntityList.Clear();
336 
337  //~ Copy list
338  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
339  {
340  //~ If entity has any of the given exclude continue to next
341  if (excludedLabels != null && !excludedLabels.IsEmpty() && entityEntry.HasAnyEditableEntityLabels(excludedLabels))
342  continue;
343 
344  //~ Check included labels
345  if (includedLabels != null && !includedLabels.IsEmpty())
346  {
347  //~ Needs all included
348  if (needsAllIncluded)
349  {
350  if (!entityEntry.HasAllEditableEntityLabels(includedLabels))
351  continue;
352  }
353  //~ Needs any included
354  else
355  {
356  if (!entityEntry.HasAnyEditableEntityLabels(includedLabels))
357  continue;
358  }
359  }
360 
361  //~ Add to list
362  filteredEntityList.Insert(entityEntry);
363  }
364 
365  return filteredEntityList.Count();
366  }
367 
368  //======================================== ENTITY ENTRY GETTER WITH DATA TYPES ========================================\\
369  //--------------------------------- Get Entity List with Data type ---------------------------------\\
370 
379  int GetEntityListWithData(typename dataClass, notnull out array<SCR_EntityCatalogEntry> filteredEntityList, out array<SCR_BaseEntityCatalogData> dataList = null)
380  {
381  //~ Clear Given list
382  filteredEntityList.Clear();
383 
384  //~ If returning datalist also clear
385  if (dataList)
386  dataList.Clear();
387 
389 
390  //~ Copy list
391  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
392  {
393  data = entityEntry.GetEntityDataOfType(dataClass);
394 
395  if (!data)
396  continue;
397 
398  if (dataList)
399  dataList.Insert(data);
400 
401  //~ Add to list
402  filteredEntityList.Insert(entityEntry);
403  }
404 
405  return filteredEntityList.Count();
406  }
407 
408  //--------------------------------- Get Entity List WITHOUT Data type ---------------------------------\\
409 
417  int GetEntityListExcludingData(typename excludingDataClass, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
418  {
419  //~ Clear Given list
420  filteredEntityList.Clear();
421 
422  //~ Copy list
423  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
424  {
425  //~ HAS the data type so do not add it to the list
426  if (entityEntry.HasEntityDataOfType(excludingDataClass))
427  continue;
428 
429  //~ Add to list
430  filteredEntityList.Insert(entityEntry);
431  }
432 
433  return filteredEntityList.Count();
434  }
435 
436  //--------------------------------- Get Full Filtered Entity List with Data Type ---------------------------------\\
437 
447  int GetFullFilteredEntityListWithData(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<typename> includedDataClasses = null, array<typename> excludedDataClasses = null, bool needsAllIncluded = true)
448  {
449  //~ Clear Given list
450  filteredEntityList.Clear();
451 
452  //~ Copy list
453  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
454  {
455  //~ If entity has any of the given exclude continue to next
456  if (excludedDataClasses != null && !excludedDataClasses.IsEmpty() && entityEntry.HasAnyEntityDataOfTypes(excludedDataClasses))
457  continue;
458 
459  //~ Check included labels
460  if (includedDataClasses != null && !includedDataClasses.IsEmpty())
461  {
462  //~ Needs all included
463  if (needsAllIncluded)
464  {
465  if (!entityEntry.HasAllEntityDataOfTypes(includedDataClasses))
466  continue;
467  }
468  //~ Needs any included
469  else
470  {
471  if (!entityEntry.HasAnyEntityDataOfTypes(includedDataClasses))
472  continue;
473  }
474  }
475 
476  //~ Add to list
477  filteredEntityList.Insert(entityEntry);
478  }
479 
480  return filteredEntityList.Count();
481  }
482 
483  //======================================== Get full filtered list ========================================\\
484  //--------------------------------- Get Full Filtered Entity List ---------------------------------\\
485 
498  int GetFullFilteredEntityList(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<EEditableEntityLabel> includedLabels = null, array<EEditableEntityLabel> excludedLabels = null, array<typename> includedDataClasses = null, array<typename> excludedDataClasses = null, bool needsAllIncludedLabels = true, bool needsAllIncludedClasses = true)
499  {
500  //~ Clear Given list
501  filteredEntityList.Clear();
502 
503  //~ Copy list
504  foreach (SCR_EntityCatalogEntry entityEntry: m_aEntityEntryList)
505  {
506  //~ If entity has any of the given exclude labels continue to next
507  if (excludedLabels != null && !excludedLabels.IsEmpty() && entityEntry.HasAnyEditableEntityLabels(excludedLabels))
508  continue;
509 
510  //~ If entity has any of the given exclude classes continue to next
511  if (excludedDataClasses != null && !excludedDataClasses.IsEmpty() && entityEntry.HasAnyEntityDataOfTypes(excludedDataClasses))
512  continue;
513 
514  //~ Check included labels
515  if (includedLabels != null && !includedLabels.IsEmpty())
516  {
517  //~ Needs all included
518  if (needsAllIncludedLabels)
519  {
520  if (!entityEntry.HasAllEditableEntityLabels(includedLabels))
521  continue;
522  }
523  //~ Needs any indluded
524  else
525  {
526  if (!entityEntry.HasAnyEditableEntityLabels(includedLabels))
527  continue;
528  }
529  }
530 
531  //~ If entity has none of the given include continue to next
532  if (includedDataClasses != null && !includedDataClasses.IsEmpty())
533  {
534  if (needsAllIncludedClasses)
535  {
536  if (!entityEntry.HasAllEntityDataOfTypes(includedDataClasses))
537  continue;
538  }
539  else
540  {
541  if (!entityEntry.HasAnyEntityDataOfTypes(includedDataClasses))
542  continue;
543  }
544  }
545 
546  //~ Add to list
547  filteredEntityList.Insert(entityEntry);
548  }
549 
550  return filteredEntityList.Count();
551  }
552 
553  //======================================== MERGE CATALOGS ========================================\\
554 
559  void MergeCatalogs(notnull SCR_EntityCatalog catalogToMerge)
560  {
561  array<SCR_EntityCatalogEntry> entityList = {};
562  catalogToMerge.GetEntityList(entityList);
563 
564  //~ Add the entry
565  foreach(SCR_EntityCatalogEntry entry : entityList)
566  {
567  m_aEntityEntryList.Insert(entry);
568  }
569  }
570 
571  //======================================== INIT ========================================\\
572  protected void InitCatalog()
573  {
574  //~ Init data for entries
575  for (int i = m_aEntityEntryList.Count() - 1; i >= 0; i--)
576  {
577  //~ Remove disabled entries on init
578  if (!m_aEntityEntryList[i].IsEnabled())
579  {
580  m_aEntityEntryList.RemoveOrdered(i);
581  continue;
582  }
583 
584  //~ Call init
585  m_aEntityEntryList[i].InitEntry(this, i);
586  }
587  }
588 
589  void SCR_EntityCatalog()
590  {
591  if (SCR_Global.IsEditMode())
592  return;
593 
594  InitCatalog();
595  }
596 };
597 
598 
599 class SCR_BaseContainerCustomEntityCatalogCatalog : BaseContainerCustomTitle
600 {
601  private typename m_EnumType;
602  private string m_PropertyName;
603  protected string m_sEntityListName;
604  protected string m_sEntityMultiListName;
605 
606  //------------------------------------------------------------------------------------------------
607  void SCR_BaseContainerCustomEntityCatalogCatalog(typename enumType, string propertyName, string entityListName, string multiListName)
608  {
609  m_EnumType = enumType;
610  m_PropertyName = propertyName;
611  m_sEntityListName = entityListName;
612  m_sEntityMultiListName = multiListName;
613  }
614 
615  //------------------------------------------------------------------------------------------------
616  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
617  {
618  bool hasError = false;
619 
620  int enumValue;
621  if (!source.Get(m_PropertyName, enumValue))
622  {
623  return false;
624  }
625 
626  int totalCount = 0;
627  int enabledCount = 0;
628 
629  //~ Get entry count
630  array<ref SCR_EntityCatalogEntry> entityList;
631  if (!source.Get(m_sEntityListName, entityList))
632  return false;
633 
634  foreach (SCR_EntityCatalogEntry entry: entityList)
635  {
636  if (entry.IsEnabled())
637  {
638  enabledCount++;
639 
640  //~ Is Empty show error warning in title
641  if (entry.GetPrefab().IsEmpty())
642  hasError = true;
643  }
644 
645  totalCount++;
646  }
647 
648  array<ref SCR_EntityCatalogMultiListEntry> multiLists;
649  if (source.Get(m_sEntityMultiListName, multiLists))
650  {
651  foreach (SCR_EntityCatalogMultiListEntry multiList: multiLists)
652  {
653  foreach (SCR_EntityCatalogEntry entry : multiList.m_aEntities)
654  {
655  if (entry.IsEnabled())
656  {
657  enabledCount++;
658 
659  //~ Is Empty show error warning in title
660  if (entry.GetPrefab().IsEmpty())
661  hasError = true;
662  }
663 
664  totalCount++;
665  }
666  }
667  }
668 
669  string format;
670  //~ Does not have disabled entries
671  if (enabledCount == totalCount)
672  format = "%1 (%2)";
673  //~ Has disabled entries
674  else
675  format = "%1 (%3 of %2)";
676 
677  //~ Has empty prefabs
678  if (hasError)
679  format += " !!";
680 
681  title = string.Format(format, typename.EnumToString(m_EnumType, enumValue), totalCount, enabledCount);
682  return true;
683  }
684 };
EEditableEntityLabel
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
InitCatalog
super InitCatalog()
SCR_BaseEntityCatalogData
Definition: SCR_BaseEntityCatalogData.c:5
EEntityCatalogType
EEntityCatalogType
Definition: EEntityCatalogType.c:4
SCR_StringHelper
Definition: SCR_StringHelper.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_BaseContainerCustomEntityCatalogCatalog
Definition: SCR_EntityCatalog.c:599
Attribute
typedef Attribute
Post-process effect of scripted camera.
IsEnabled
int IsEnabled()
Definition: SCR_BaseManualCameraComponent.c:99
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_Global
Definition: Functions.c:6
SCR_EntityCatalog
Definition: SCR_EntityCatalog.c:181
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
SCR_EntityCatalogEntry
Definition: SCR_EntityCatalogEntry.c:5
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