Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditableEntityCore.c
Go to the documentation of this file.
1void ScriptInvoker_EntityCoreBudgetUpdated(EEditableEntityBudget type, int originalBudgetValue, int budgetChange, int updatedBudgetValue);
3typedef ScriptInvokerBase<ScriptInvoker_EntityCoreBudgetUpdated> ScriptInvoker_EntityCoreBudgetUpdatedEvent;
4
5void ScriptInvoker_EntityCoreBudgetUpdatedPerEntity(EEditableEntityBudget type, int originalBudgetValue, int budgetChange, int updatedBudgetValue, SCR_EditableEntityComponent entity);
7typedef ScriptInvokerBase<ScriptInvoker_EntityCoreBudgetUpdatedPerEntity> ScriptInvoker_EntityCoreBudgetUpdatedPerEntityEvent;
8
9void ScriptInvoker_AuthorRequestedFinished(set<SCR_EditableEntityAuthor> authors);
11typedef ScriptInvokerBase<ScriptInvoker_AuthorRequestedFinished> ScriptInvoker_AuthorRequestedFinishedEvent;
12
13
15
18[BaseContainerProps(configRoot: true)]
19class SCR_EditableEntityCore : SCR_GameCoreBase
20{
21 [Attribute(desc: "Settings for every entity type.")]
22 private ref array<ref SCR_EditableEntityCoreTypeSetting> m_TypeSettings;
23
24 [Attribute("1000", desc: "Draw distance override for player characters.")]
25 protected float m_fPlayerDrawDistance;
26
27 [Attribute(defvalue: "0.01", desc: "The distance modifier for players in vehicles which will be used to determine player filter's visibility.")]
29
30 [Attribute(desc: "Budget settings for every entity type.")]
31 private ref array<ref SCR_EditableEntityCoreBudgetSetting> m_BudgetSettings;
32
34
35 [Attribute(desc: "Label Groups which will have labels displayed in content browser. Groups are needed for certain functionality. If GROUPLESS group exist then all labels not defined in the EditableEntityCore config will be automatically added to the the groupless list but never displayed as a filter")]
36 private ref array<ref SCR_EditableEntityCoreLabelGroupSetting> m_LabelGroupSettings;
37
38 [Attribute(desc: "Label configs")]
39 private ref array<ref SCR_EditableEntityCoreLabelSetting> m_EntityLabels;
40
42
46
47 private ref set<SCR_EditableEntityComponent> m_Entities;
48
49 ref map<RplId, ref array<RplId>> m_OrphanEntityIds = new map<RplId, ref array<RplId>>();
50 private SCR_EditableEntityComponent m_CurrentLayer;
51
53 ref ScriptInvoker Event_OnEntityRegistered = new ScriptInvoker;
54
56 ref ScriptInvoker Event_OnEntityUnregistered = new ScriptInvoker;
57
59 ref ScriptInvoker Event_OnEntityRefreshed = new ScriptInvoker;
60
62 ref ScriptInvoker Event_OnParentEntityChanged = new ScriptInvoker;
63
65 ref ScriptInvoker Event_OnEntityAccessKeyChanged = new ScriptInvoker;
66
68 ref ScriptInvoker Event_OnEntityVisibilityChanged = new ScriptInvoker;
69
71 ref ScriptInvoker Event_OnEntityTransformChanged = new ScriptInvoker;
72
74 ref ScriptInvoker Event_OnEntityTransformChangedServer = new ScriptInvoker;
75
78
81
83 ref ScriptInvoker Event_OnEntityExtendedChange = new ScriptInvoker;
84
85 private ref map<EEditableEntityBudget, int> m_accumulatedBudgetChanges = new map<EEditableEntityBudget, int>;
86 bool budgetChangesAccumulated = false;
87
88 // UGC Authors
89 // Authors = people who currently own entity in a world
90 private ref map<string, ref SCR_EditableEntityAuthor> m_mAuthors = new map<string, ref SCR_EditableEntityAuthor>; // Held by server, needs to be requested by client.
91
92 protected bool m_bAuthorRequesting;
93
95
96 //------------------------------------------------------------------------------------------------
100 {
101 if (!m_Entities)
102 m_Entities = new set<SCR_EditableEntityComponent>();
103
104 if (m_Entities.Find(entity) < 0)
105 m_Entities.Insert(entity);
106 }
107
108 //------------------------------------------------------------------------------------------------
112 {
113 if (!m_Entities) return;
114
115 int index = m_Entities.Find(entity);
116 if (index != -1) m_Entities.Remove(index);
117 }
118
119 //------------------------------------------------------------------------------------------------
123 {
124 //--- Get settings for the entity based on its type
126 if (m_TypeSettingsMap.Find(entity.GetEntityType(), setting))
127 {
128 //--- Set default max draw distance
129 if (entity.GetMaxDrawDistanceSq() <= 0)
130 entity.SetMaxDrawDistance(setting.GetMaxDrawDistance());
131 }
132 else
133 {
134 Print(string.Format("Default type settings not found for '%1'!", Type().EnumToString(EEditableEntityType, entity.GetEntityType())), LogLevel.ERROR);
135 }
136
137 Event_OnEntityRegistered.Invoke(entity);
138
139 //:| Player ownership isn't ready if we don't wait for a frame before calling UpdateBudgets.
140 //:| This results in Player ownership related checks to have an undefined behavior.
141 GetGame().GetCallqueue().CallLater(UpdateBudgets, 0, false, entity, true, entity.GetOwnerScripted());
142 }
143
144 //------------------------------------------------------------------------------------------------
149 {
150 UpdateBudgets(entity, false, owner);
151 Event_OnEntityUnregistered.Invoke(entity);
152 }
153
154 //------------------------------------------------------------------------------------------------
160 void AddOrphan(RplId parentId, RplId orphanId)
161 {
162 array<RplId> orphanIds;
163 if (!m_OrphanEntityIds.Find(parentId, orphanIds))
164 orphanIds = {};
165
166 orphanIds.Insert(orphanId);
167 m_OrphanEntityIds.Insert(parentId, orphanIds);
168 }
169
170 //------------------------------------------------------------------------------------------------
175 int RemoveOrphans(RplId parentId, out notnull array<SCR_EditableEntityComponent> outOrphans)
176 {
177 if (!parentId.IsValid())
178 return 0;
179
180 //--- Check if there are some orphans for given parent. If not, terminate
181 array<RplId> orphanIds = {};
182 if (!m_OrphanEntityIds.Find(parentId, orphanIds))
183 return 0;
184
185 //--- Find all editable orphans
187 for (int i = orphanIds.Count() - 1; i >= 0; i--)
188 {
189 orphan = SCR_EditableEntityComponent.Cast(Replication.FindItem(orphanIds[i]));
190 if (orphan)
191 {
192 outOrphans.Insert(orphan);
193 orphanIds.Remove(i);
194 }
195 }
196
197 //--- No orphans left, unregister the parent
198 if (orphanIds.IsEmpty())
199 m_OrphanEntityIds.Remove(parentId);
200
201 return outOrphans.Count();
202 }
203
204 //------------------------------------------------------------------------------------------------
209 void GetAllEntities(out notnull set<SCR_EditableEntityComponent> entities, bool onlyDirect = false, bool skipIgnored = false)
210 {
211 entities.Clear();
212 if (!m_Entities) return;
213 foreach (SCR_EditableEntityComponent entity : m_Entities)
214 {
215 entities.Insert(entity);
216 if (!onlyDirect) entity.GetChildren(entities, onlyDirect, skipIgnored);
217 }
218 }
219
220 //------------------------------------------------------------------------------------------------
224 void GetAllEntities(out notnull set<SCR_EditableEntityComponent> entities, EEditableEntityAccessKey accessKey)
225 {
226 entities.Clear();
227 if (!m_Entities) return;
228 foreach (SCR_EditableEntityComponent entity : m_Entities)
229 {
230 if (!entity.HasAccessSelf(accessKey)) continue;
231
232 entities.Insert(entity);
233
234 if (entity.IsLayer())
235 {
236 set<SCR_EditableEntityComponent> subEntities = new set<SCR_EditableEntityComponent>;
237 entity.GetChildren(subEntities, false, accessKey);
238 foreach (SCR_EditableEntityComponent child : subEntities)
239 {
240 entities.Insert(child);
241 }
242 //entities.InsertAll(subEntities)
243 }
244 }
245 }
246
247 //------------------------------------------------------------------------------------------------
251 int GetAllEntitiesByAuthorUID(out notnull set<SCR_EditableEntityComponent> entities, string playerUID)
252 {
253 entities.Clear();
254 if (!m_Entities)
255 return 0;
256
257 foreach (SCR_EditableEntityComponent entity : m_Entities)
258 {
259 string authorUID = entity.GetAuthorUID();
260 if (authorUID.IsEmpty() || authorUID != playerUID)
261 continue;
262
263 entities.Insert(entity);
264
265 if (entity.IsLayer())
266 {
267 set<SCR_EditableEntityComponent> subEntities = new set<SCR_EditableEntityComponent>;
268 entity.GetChildren(subEntities);
269 foreach (SCR_EditableEntityComponent child : subEntities)
270 {
271 if (authorUID.IsEmpty() || authorUID != playerUID)
272 continue;
273
274 entities.Insert(child);
275 }
276 }
277 }
278
279 return entities.Count();
280 }
281
282 //------------------------------------------------------------------------------------------------
286 static int GetAllEntitiesByAuthorUIDExt(out notnull set<SCR_EditableEntityComponent> entities, string playerUID)
287 {
289 if (!core)
290 return 0;
291
292 return core.GetAllEntitiesByAuthorUID(entities, playerUID);
293 }
294
295 //------------------------------------------------------------------------------------------------
299 int GetAllEntitiesByAuthorID(out notnull set<SCR_EditableEntityComponent> entities, int playerID)
300 {
301 entities.Clear();
302 if (!m_Entities)
303 return 0;
304
305 foreach (SCR_EditableEntityComponent entity : m_Entities)
306 {
307 int authorID = entity.GetAuthorPlayerID();
308 if (playerID != authorID)
309 continue;
310
311 entities.Insert(entity);
312
313 if (entity.IsLayer())
314 {
315 set<SCR_EditableEntityComponent> subEntities = new set<SCR_EditableEntityComponent>;
316 entity.GetChildren(subEntities);
317 foreach (SCR_EditableEntityComponent child : subEntities)
318 {
319 if (playerID != authorID)
320 continue;
321
322 entities.Insert(child);
323 }
324 }
325 }
326
327 return entities.Count();
328 }
329
330 //------------------------------------------------------------------------------------------------
334 static int GetAllEntitiesByAuthorIDExt(out notnull set<SCR_EditableEntityComponent> entities, int playerID)
335 {
337 if (!core)
338 return 0;
339
340 return core.GetAllEntitiesByAuthorID(entities, playerID);
341 }
342
343 //------------------------------------------------------------------------------------------------
351 {
352 float nearestDis = float.MAX;
353 SCR_EditableEntityComponent nearestEntity;
354
355 set<SCR_EditableEntityComponent> entities = new set<SCR_EditableEntityComponent>();
356 if (onlyDirect)
357 entities = m_Entities;
358 else
359 GetAllEntities(entities);
360
361 foreach (SCR_EditableEntityComponent entity : m_Entities)
362 {
363 if (entity.GetEntityType() != type || !entity.HasEntityFlag(flags))
364 continue;
365
366 vector entityPos;
367 if (!entity.GetPos(entityPos))
368 continue;
369
370 float dis = vector.DistanceSq(entityPos, pos);
371 if (dis > nearestDis)
372 continue;
373
374 nearestDis = dis;
375 nearestEntity = entity;
376 }
377 return nearestEntity;
378 }
379
380 //------------------------------------------------------------------------------------------------
385 {
387 if (m_TypeSettingsMap.Find(type, setting))
388 return setting.GetInteraction();
389 else
390 return null;
391 }
392
393 //------------------------------------------------------------------------------------------------
398 {
400 return m_TypeSettingsMap.Find(type, setting) && setting.GetCanBePlayer();
401 }
402
403 //------------------------------------------------------------------------------------------------
408 {
410 switch (entityType)
411 {
412 case EEditableEntityType.GENERIC:
413 case EEditableEntityType.ITEM:
414 budget = EEditableEntityBudget.PROPS;
415 break;
416 case EEditableEntityType.CHARACTER:
417 case EEditableEntityType.GROUP:
418 budget = EEditableEntityBudget.AI;
419 break;
420 case EEditableEntityType.VEHICLE:
421 budget = EEditableEntityBudget.VEHICLES;
422 break;
423 case EEditableEntityType.WAYPOINT:
424 budget = EEditableEntityBudget.WAYPOINTS;
425 break;
426 case EEditableEntityType.COMMENT:
427 case EEditableEntityType.SYSTEM:
428 case EEditableEntityType.TASK:
429 budget = EEditableEntityBudget.SYSTEMS;
430 break;
431 default:
432 budget = EEditableEntityBudget.PROPS;
433 break;
434 }
435 return budget;
436 }
437
438 //------------------------------------------------------------------------------------------------
441 void GetBudgets(out notnull array<ref SCR_EditableEntityCoreBudgetSetting> budgets)
442 {
443 foreach (SCR_EditableEntityCoreBudgetSetting budget : m_BudgetSettings)
444 {
445 budgets.Insert(budget);
446 }
447 }
448
449 //------------------------------------------------------------------------------------------------
452 bool GetBudget(EEditableEntityBudget budgetType, out SCR_EditableEntityCoreBudgetSetting budgetSettings)
453 {
454 budgetSettings = m_BudgetSettingsInternal.Get(budgetType);
455
456 bool result = budgetSettings;
457
458 #ifdef BUDGET_OPTIMIZATION_CHECKS
459 if (result && !budgetSettings)
460 {
461 Print("GetBudget: Budget type wasn't defined!", LogLevel.ERROR);
462 return GetBudget_Old(budgetType, budgetSettings);
463 }
464 #endif
465
466 return result;
467 }
468
469 //------------------------------------------------------------------------------------------------
472 private bool GetBudget_Old(EEditableEntityBudget budgetType, out SCR_EditableEntityCoreBudgetSetting budgetSettings)
473 {
474 //there was a problem, do previous logic
475 foreach (SCR_EditableEntityCoreBudgetSetting budget : m_BudgetSettings)
476 {
477 if (budget.GetBudgetType() == budgetType)
478 {
479 budgetSettings = budget;
480 return true;
481 }
482 }
483 return false;
484 }
485
486 //------------------------------------------------------------------------------------------------
489 void GetLabelGroups(out notnull array<ref SCR_EditableEntityCoreLabelGroupSetting> labelGroups)
490 {
491 foreach (SCR_EditableEntityCoreLabelGroupSetting labelGroup : m_LabelGroupSettings)
492 {
493 int index = labelGroups.Count();
494
495 for (int i = 0; i < index; i++)
496 {
497 if (labelGroups[i].GetOrder() >= labelGroup.GetOrder())
498 {
499 index = i;
500 break;
501 }
502 }
503
504 labelGroups.InsertAt(labelGroup, index);
505 }
506 }
507
508 //------------------------------------------------------------------------------------------------
512 int GetLabelGroupOrder(EEditableEntityLabelGroup groupLabel)
513 {
514 foreach (SCR_EditableEntityCoreLabelGroupSetting labelGroup : m_LabelGroupSettings)
515 {
516 if (labelGroup.GetLabelGroupType() == groupLabel)
517 return labelGroup.GetOrder();
518 }
519
520 return -1;
521 }
522
523 //------------------------------------------------------------------------------------------------
528 bool GetLabelGroupType(EEditableEntityLabel label, out EEditableEntityLabelGroup labelGroup)
529 {
530 SCR_EditableEntityCoreLabelSetting labelSettings;
531 if (!m_LabelSettingsMap.Find(label, labelSettings))
532 return false;
533
534 labelGroup = labelSettings.GetLabelGroupType();
535 return labelGroup != EEditableEntityLabelGroup.NONE;
536 }
537
538 //------------------------------------------------------------------------------------------------
543 bool GetLabelsOfGroup(EEditableEntityLabelGroup groupType, out notnull array<SCR_EditableEntityCoreLabelSetting> labels)
544 {
545 return m_LabelListMap.Find(groupType, labels);
546 }
547
548 //------------------------------------------------------------------------------------------------
553 bool GetLabelUIInfo(EEditableEntityLabel entityLabel, out SCR_UIInfo uiInfo)
554 {
555 SCR_EditableEntityCoreLabelSetting labelSetting = m_LabelSettingsMap.Get(entityLabel);
556 if (labelSetting)
557 uiInfo = labelSetting.GetInfo();
558
559 return uiInfo != null;
560 }
561
562 //------------------------------------------------------------------------------------------------
568 bool GetLabelUIInfoIfValid(EEditableEntityLabel entityLabel, EEditorMode currentMode, out SCR_UIInfo uiInfo)
569 {
570 SCR_EditableEntityCoreLabelSetting labelSetting = m_LabelSettingsMap.Get(entityLabel);
571 if (labelSetting)
572 {
573 if (labelSetting.IsValid(currentMode))
574 uiInfo = labelSetting.GetInfo();
575 else
576 uiInfo = null;
577 }
578
579 return uiInfo != null;
580 }
581
582 //------------------------------------------------------------------------------------------------
588 {
589 SCR_EditableEntityCampaignBuildingLabelSetting buildModeLabelSetting = SCR_EditableEntityCampaignBuildingLabelSetting.Cast(m_LabelSettingsMap.Get(entityLabel));
590 if (!buildModeLabelSetting)
591 return null;
592
593 SCR_UIInfo uiInfo = buildModeLabelSetting.GetInfo();
594 SCR_EServicePointType linkedConflictServicePoint = buildModeLabelSetting.GetLinkedConflictServicePoint();
595 if (!uiInfo && linkedConflictServicePoint < 0)
596 return null;
597
598 return new SCR_EditableEntityCampaignBuildingModeLabelData(entityLabel, uiInfo, linkedConflictServicePoint);
599 }
600
601 //------------------------------------------------------------------------------------------------
607 int GetCampaignBuildingModeLabelsData(notnull array<EEditableEntityLabel> entityLabels, notnull out array<ref SCR_EditableEntityCampaignBuildingModeLabelData> validBuildmodeLabelData)
608 {
609 validBuildmodeLabelData.Clear();
610
611 SCR_EditableEntityCampaignBuildingLabelSetting buildModeLabelSetting;
612 SCR_UIInfo uiInfo;
613 SCR_EServicePointType linkedConflictServicePoint;
614
615 foreach (EEditableEntityLabel entityLabel : entityLabels)
616 {
617 if (entityLabel == EEditableEntityLabel.TRAIT_SERVICE)
618 continue;
619
620 buildModeLabelSetting = SCR_EditableEntityCampaignBuildingLabelSetting.Cast(m_LabelSettingsMap.Get(entityLabel));
621 if (!buildModeLabelSetting)
622 continue;
623
624 uiInfo = buildModeLabelSetting.GetInfo();
625 linkedConflictServicePoint = buildModeLabelSetting.GetLinkedConflictServicePoint();
626
627 if (!uiInfo && linkedConflictServicePoint < 0)
628 continue;
629
630 validBuildmodeLabelData.Insert(new SCR_EditableEntityCampaignBuildingModeLabelData(entityLabel, uiInfo, linkedConflictServicePoint));
631 }
632
633 return validBuildmodeLabelData.Count();
634 }
635
636 //------------------------------------------------------------------------------------------------
640 SCR_UIInfo GetBuildModeLabelUIInfo(EEditableEntityLabel entityLabel)
641 {
642 SCR_EditableEntityCampaignBuildingLabelSetting buildModeLabelSetting = SCR_EditableEntityCampaignBuildingLabelSetting.Cast(m_LabelSettingsMap.Get(entityLabel));
643 if (!buildModeLabelSetting)
644 return null;
645
646 return buildModeLabelSetting.GetInfo();
647 }
648
649 //------------------------------------------------------------------------------------------------
653 SCR_EServicePointType GetBuildModeLabelLinkedConflictService(EEditableEntityLabel entityLabel)
654 {
655 SCR_EditableEntityCampaignBuildingLabelSetting buildModeLabelSetting = SCR_EditableEntityCampaignBuildingLabelSetting.Cast(m_LabelSettingsMap.Get(entityLabel));
656 if (!buildModeLabelSetting)
657 return -1;
658
659 return buildModeLabelSetting.GetLinkedConflictServicePoint();
660 }
661
662 //------------------------------------------------------------------------------------------------
665 int GetLabelOrder(EEditableEntityLabel entityLabel)
666 {
667 //~ Labels do not use order so get array index
668 array<SCR_EditableEntityCoreLabelSetting> labels = {};
669 EEditableEntityLabelGroup groupLabel;
670 GetLabelGroupType(entityLabel, groupLabel);
671
672 if (!GetLabelsOfGroup(groupLabel, labels))
673 return -1;
674
675 int count = labels.Count();
676
677 for (int i = 0; i < count; i++)
678 {
679 if (labels[i].GetLabelType() == entityLabel)
680 return i;
681 }
682
683 return -1;
684 }
685
686 //------------------------------------------------------------------------------------------------
689 void OrderLabels(inout notnull array<EEditableEntityLabel> labels)
690 {
691 if (labels.IsEmpty())
692 return;
693
694 array<EEditableEntityLabelGroup> orderedGroups = {};
695 map<EEditableEntityLabelGroup, ref array<EEditableEntityLabel>> groupsWithLabels = new map<EEditableEntityLabelGroup, ref array<EEditableEntityLabel>>();
696
697 int groupLabelCount = 0;
698 bool groupAdded = false;
699 EEditableEntityLabelGroup groupLabel;
700
701 //~ Get label groups of the given label and get order of the group
702 foreach (EEditableEntityLabel label : labels)
703 {
704 GetLabelGroupType(label, groupLabel);
705
706 if (!groupsWithLabels.Contains(groupLabel))
707 groupsWithLabels.Insert(groupLabel, new array<EEditableEntityLabel>());
708
709 groupsWithLabels[groupLabel].Insert(label);
710
711 //~ New list so add it and continue
712 if (orderedGroups.IsEmpty())
713 {
714 orderedGroups.Insert(groupLabel);
715 groupLabelCount++;
716 continue;
717 }
718
719 //~ Already in list so continue
720 if (orderedGroups.Contains(groupLabel))
721 continue;
722
723 groupAdded = false;
724 //~ Check existing and place it in the correct order
725 for (int i = 0; i < groupLabelCount; i++)
726 {
727 //~ Group Label is higher order so add it to the list and break loop
728 if (GetLabelGroupOrder(groupLabel) <= GetLabelGroupOrder(orderedGroups[i]))
729 {
730 orderedGroups.InsertAt(groupLabel, i);
731 groupLabelCount++;
732 groupAdded = true;
733 break;
734 }
735 }
736
737 if (groupAdded)
738 continue;
739
740 orderedGroups.Insert(groupLabel);
741 groupLabelCount++;
742 }
743
744 array<EEditableEntityLabel> orderedLabels = {};
745 int orderedLabelCount;
746 bool labelAdded = false;
747 array<EEditableEntityLabel> allOrderedLabels = {};
748
749 array<EEditableEntityLabel> labelsTest = {};
750
751 //~ For each ordered group get the labels and order those as well
752 foreach (EEditableEntityLabelGroup group : orderedGroups)
753 {
754 orderedLabelCount = 0;
755 orderedLabels.Clear();
756
757 //~ Go over each label in the group and order them from highest to lowest
758 foreach (EEditableEntityLabel label : groupsWithLabels[group])
759 {
760 //~ New list so add it and continue
761 if (orderedLabels.IsEmpty())
762 {
763 orderedLabels.Insert(label);
764 orderedLabelCount++;
765 continue;
766 }
767
768 labelAdded = false;
769 //~ Check existing and place it in the correct order
770 for (int i = 0; i < orderedLabelCount; i++)
771 {
772 //~ Label is higher order so add it to the list and break loop
773 if (GetLabelOrder(label) <= GetLabelOrder(orderedLabels[i]))
774 {
775 orderedLabels.InsertAt(label, i);
776 orderedLabelCount++;
777 labelAdded = true;
778 break;
779 }
780 }
781
782 if (labelAdded)
783 continue;
784
785 //~ Lowest order so add it there
786 orderedLabels.Insert(label);
787 orderedLabelCount++;
788 }
789
790 //~ Add the ordered labels to the overal ordered list
791 allOrderedLabels.InsertAll(orderedLabels);
792 }
793
794 //~ Set out labels to ordered labels
795 labels.Copy(allOrderedLabels);
796 }
797
798 //------------------------------------------------------------------------------------------------
801 void LoadSettings(SCR_EditableEntityComponent entity)
802 {
803 if (!entity) return;
804
805 //--- Get settings for the entity based on its type
806 SCR_EditableEntityCoreTypeSetting setting = null;
807 if (!m_TypeSettingsMap.Find(entity.GetEntityType(), setting))
808 {
809 Print(string.Format("Default type settings not found for '%1'!", Type().EnumToString(EEditableEntityType, entity.GetEntityType())), LogLevel.ERROR);
810 return;
811 }
812
813 //--- Set default max draw distance
814 if (entity.GetMaxDrawDistanceSq() <= 0)
815 entity.SetMaxDrawDistance(setting.GetMaxDrawDistance());
816 }
817
818 //------------------------------------------------------------------------------------------------
821 SCR_EditableEntityCoreTypeSetting GetSettings(SCR_EditableEntityComponent entity)
822 {
823 SCR_EditableEntityCoreTypeSetting setting = null;
824 if (entity && !m_TypeSettingsMap.Find(entity.GetEntityType(), setting))
825 return setting;
826
827 return null;
828 }
829
830 //------------------------------------------------------------------------------------------------
834 float GetPlayerDrawDistanceSq(bool isInVehicle)
835 {
836 float modifiedDrawDistance = m_fPlayerDrawDistance;
837 if (isInVehicle)
838 modifiedDrawDistance *= m_fPlayerVehicleDistanceModifier;
839
840 return modifiedDrawDistance;
841 }
842
843 //------------------------------------------------------------------------------------------------
845 void Log()
846 {
847 if (!m_Entities) return;
848 Print("--------------------------------------------------", LogLevel.DEBUG);
849 Print(string.Format("--- ALL (%1)", m_Entities.Count()), LogLevel.DEBUG);
850 foreach (SCR_EditableEntityComponent entity : m_Entities)
851 {
852 entity.Log();
853 }
854 Print("--------------------------------------------------", LogLevel.DEBUG);
855 }
856
857 //------------------------------------------------------------------------------------------------
862 void UpdateBudgets(SCR_EditableEntityComponent entity, bool added, IEntity owner = null)
863 {
864 if (!entity)
865 return;
866
867 EEditableEntityType entityType = entity.GetEntityType();
868 if (entity.HasEntityFlag(EEditableEntityFlag.LOCAL) || entity.HasEntityFlag(EEditableEntityFlag.NON_INTERACTIVE))
869 return;
870
871 if (!owner)
872 owner = entity.GetOwner();
873
874 if (added)
875 {
876 // Budget update is delayed by one frame since AI-control can not be determined directly on spawn
877 // Update is delayed for these and potentionally other entities
878 GetGame().GetCallqueue().CallLater(UpdateBudgetForEntity, 0, false, entity, added, owner);
879 }
880 else
881 {
882 UpdateBudgetForEntity(entity, added, owner);
883 }
884 }
885
886 //------------------------------------------------------------------------------------------------
891 protected void UpdateBudgetForEntity(SCR_EditableEntityComponent entity, bool added, IEntity owner)
892 {
893 // Entity was deleted before delayed update could run, ignore entity.
894 // Will be ignored for both delayed Register and Unregister so shouldn't affect total budget
895 if (!entity)
896 return;
897
898 array<ref SCR_EntityBudgetValue> entityBudgetCosts = {};
899 if (entity.GetEntityBudgetCost(entityBudgetCosts, owner))
900 {
901 if (entityBudgetCosts.IsEmpty())
902 {
903 SCR_EditableGroupComponent editableGroupComponent = SCR_EditableGroupComponent.Cast(entity);
904 if (editableGroupComponent)
905 editableGroupComponent.GetPrefabBudgetCost(entityBudgetCosts);
906 }
907
908 foreach (SCR_EntityBudgetValue budgetCost : entityBudgetCosts)
909 {
910 QueueBudgetChange(budgetCost.GetBudgetType(), added, entity, budgetCost);
911 }
912 }
913 else
914 {
915 QueueBudgetChange(GetBudgetForEntityType(entity.GetEntityType(owner)), added, entity);
916 }
917 }
918
919 void QueueBudgetChange(EEditableEntityBudget budgetType, bool added, SCR_EditableEntityComponent entity, SCR_EntityBudgetValue budgetCost = null)
920 {
921 SCR_EditableEntityCoreBudgetSetting budgetSettings;
922 if (!GetBudget(budgetType, budgetSettings))
923 return;
924
925 const int originalBudgetValue = budgetSettings.GetCurrentBudget();
926 int budgetChange = budgetSettings.GetMinBudgetCost();
927
928 //budget change cant be less than minimum budget cost
929 if (budgetCost)
930 budgetChange = Math.Max(budgetChange, budgetCost.GetBudgetValue());
931
932 //if we are deleting the entity we reduce the budget
933 if (!added)
934 budgetChange *= -1;
935
936 //budget we should have if we had been applying all budget changes at the same time
937 const int adjustedCurrentBudget = budgetSettings.GetCurrentBudget() + m_accumulatedBudgetChanges[budgetType];
938 const int updatedBudgetValue = adjustedCurrentBudget + budgetChange;
939
940 //update current budget changes
941 m_accumulatedBudgetChanges[budgetType] = m_accumulatedBudgetChanges[budgetType] + budgetChange;
942
943 Event_OnEntityBudgetUpdatedPerEntity.Invoke(budgetType, adjustedCurrentBudget, budgetChange, updatedBudgetValue, entity);
944
945 if (!budgetChangesAccumulated)
946 {
947 GetGame().GetCallqueue().CallLater(ApplyQueuedBudgetChanges);
948 budgetChangesAccumulated = true;
949 }
950 }
951
953 {
954 SCR_EditableEntityCoreBudgetSetting budgetSettings = null;
955 int budgetChange = 0;
956 int originalBudgetValue = 0;
957
958 EEditableEntityBudget budgetType = 0;
959
960 MapIterator it = m_accumulatedBudgetChanges.Begin();
961 const MapIterator end = m_accumulatedBudgetChanges.End();
962
963 while (it != end)
964 {
965 //Print("Budget: " + m_accumulatedBudgetChanges.GetIteratorKey(it));
966 //Print("Value: " + m_accumulatedBudgetChanges.GetIteratorElement(it));
967
968 budgetChange = m_accumulatedBudgetChanges.GetIteratorElement(it);
969 if (budgetChange == 0)
970 {
971 //advance to next budget
972 it = m_accumulatedBudgetChanges.Next(it);
973 continue;
974 }
975
976 budgetType = m_accumulatedBudgetChanges.GetIteratorKey(it);
977 budgetSettings = m_BudgetSettingsInternal[budgetType];
978
979 originalBudgetValue = budgetSettings.GetCurrentBudget();
980
981 //substraced budget change has to be a positive number
982 if (budgetChange > 0)
983 budgetChange = budgetSettings.AddToBudget(budgetChange);
984 else
985 budgetChange = budgetSettings.SubtractFromBudget(-budgetChange);
986
987 const int updatedBudgetValue = budgetSettings.GetCurrentBudget();
988
989 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_BUDGET_CHANGES))
990 Print(string.Format("New budget for type %1: %2", budgetType, updatedBudgetValue), LogLevel.NORMAL);
991
992 Event_OnEntityBudgetUpdated.Invoke(budgetType, originalBudgetValue, budgetChange, updatedBudgetValue);
993
994 //reset it for next budget update
995 m_accumulatedBudgetChanges[budgetType] = 0;
996
997 //advance to next budget
998 it = m_accumulatedBudgetChanges.Next(it);
999 }
1000
1001 budgetChangesAccumulated = false;
1002 }
1003 //------------------------------------------------------------------------------------------------
1009 protected void UpdateBudget(EEditableEntityBudget budgetType, bool added, SCR_EditableEntityComponent entity, SCR_EntityBudgetValue budgetCost = null)
1010 {
1011 SCR_EditableEntityCoreBudgetSetting budgetSettings;
1012 if (!GetBudget(budgetType, budgetSettings))
1013 return;
1014
1015 int originalBudgetValue = budgetSettings.GetCurrentBudget();
1016 int budgetChange = 0;
1017 if (added)
1018 {
1019 budgetChange = budgetSettings.AddToBudget(budgetCost);
1020 }
1021 else
1022 {
1023 budgetChange = budgetSettings.SubtractFromBudget(budgetCost);
1024 }
1025
1026 int updatedBudgetValue = originalBudgetValue + budgetChange;
1027
1028 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_BUDGET_CHANGES))
1029 Print(string.Format("New budget for type %1: %2", budgetType, updatedBudgetValue), LogLevel.NORMAL);
1030
1031 Event_OnEntityBudgetUpdated.Invoke(budgetType, originalBudgetValue, budgetChange, updatedBudgetValue, entity);
1032 }
1033
1034 //------------------------------------------------------------------------------------------------
1036 {
1037 set<SCR_EditableEntityComponent> entitiesToCheck = new set<SCR_EditableEntityComponent>;
1038 array<SCR_EditableEntityComponent> entitiesToDelete = {};
1039
1040 foreach (SCR_EditableEntityComponent component : m_Entities)
1041 {
1042 //entity or its children doesnt have this budget type
1043 if (!component.EntityHasBudgetOfType(budgetToFree))
1044 continue;
1045
1046 entitiesToCheck.Clear();
1047
1048 //we want to check this entity and all its children
1049 entitiesToCheck.Insert(component);
1050 component.GetChildren(entitiesToCheck);
1051
1052 foreach (SCR_EditableEntityComponent entityToCheck : entitiesToCheck)
1053 {
1054 array<ref SCR_EntityBudgetValue> entityBudgetCosts = {};
1055
1056 //entity doesn't have the budget we want
1057 if (!entityToCheck.EntityHasBudgetOfType(budgetToFree))
1058 continue;
1059
1060 entitiesToDelete.Insert(entityToCheck);
1061 }
1062 }
1063
1064 foreach (SCR_EditableEntityComponent component : entitiesToDelete)
1065 {
1066 component.Delete(true);
1067 }
1068 }
1069
1071 //--- Authors logic (UGC)
1072 //------------------------------------------------------------------------------------------------
1073 void RegisterAuthorServer(SCR_EditableEntityAuthor newAuthor)
1074 {
1075 if (RplSession.Mode() == RplMode.Client)
1076 return;
1077
1078 if (!m_mAuthors.Contains(newAuthor.m_sAuthorUID))
1079 {
1080 newAuthor.m_iEntityCount++;
1081 m_mAuthors.Insert(newAuthor.m_sAuthorUID, newAuthor);
1082 Print("SCR_EditableEntityCore::RegisterAuthorServer - Author Added", LogLevel.VERBOSE);
1083 }
1084 else
1085 {
1086 m_mAuthors[newAuthor.m_sAuthorUID].m_iEntityCount++;
1087 Print("SCR_EditableEntityCore::RegisterAuthorServer - Author Updated", LogLevel.VERBOSE);
1088 }
1089 }
1090
1091 //------------------------------------------------------------------------------------------------
1092 void AuthorEntityRemovedServer(SCR_EditableEntityAuthor newAuthor)
1093 {
1094 if (RplSession.Mode() == RplMode.Client)
1095 return;
1096
1097 if (!m_mAuthors.Contains(newAuthor.m_sAuthorUID))
1098 {
1099 Print("SCR_EditableEntityCore::AuthorEntityRemovedServer - This should not happen, author has to be registered if entity is being removed", LogLevel.ERROR);
1100 }
1101 else
1102 {
1103 m_mAuthors[newAuthor.m_sAuthorUID].m_iEntityCount--;
1104
1105 if (m_mAuthors[newAuthor.m_sAuthorUID].m_iEntityCount <= 0)
1106 m_mAuthors.Remove(newAuthor.m_sAuthorUID);
1107 }
1108 }
1109
1110 //------------------------------------------------------------------------------------------------
1111 set<SCR_EditableEntityAuthor> GetAllAuthorsServer()
1112 {
1113 if (RplSession.Mode() == RplMode.Client)
1114 return new set<SCR_EditableEntityAuthor>();
1115
1116 set<SCR_EditableEntityAuthor> authors = new set<SCR_EditableEntityAuthor>();
1117
1118 foreach (SCR_EditableEntityAuthor author : m_mAuthors)
1119 {
1120 authors.Insert(author);
1121 }
1122
1123 return authors;
1124 }
1125
1126 //------------------------------------------------------------------------------------------------
1128 {
1130 if (!managerCore)
1131 return;
1132
1133 SCR_EditorManagerEntity manager = managerCore.GetEditorManager();
1134 if (!manager)
1135 return;
1136
1138 {
1139 m_bAuthorRequesting = true;
1140 manager.RequestAllAuthors();
1141 }
1142 }
1143
1144 //------------------------------------------------------------------------------------------------
1146 void AddAuthorOnRequest(notnull SCR_EditableEntityAuthor newAuthor)
1147 {
1148 if (m_mAuthors.IsEmpty())
1149 m_mAuthors.Insert(newAuthor.m_sAuthorUID, newAuthor);
1150
1151 foreach (SCR_EditableEntityAuthor author : m_mAuthors)
1152 {
1153 if (author.m_sAuthorUID == newAuthor.m_sAuthorUID)
1154 {
1155 author = newAuthor;
1156 PrintFormat("SCR_EditableEntityCore::AddAuthorOnRequest - %1 Updated", newAuthor.m_sAuthorUID, level: LogLevel.VERBOSE);
1157 return;
1158 }
1159 }
1160
1161 m_mAuthors.Insert(newAuthor.m_sAuthorUID, newAuthor);
1162
1163 PrintFormat("SCR_EditableEntityCore::AddAuthorOnRequest - %1", newAuthor.m_sAuthorUID, level: LogLevel.VERBOSE);
1164 }
1165
1166 //------------------------------------------------------------------------------------------------
1168 {
1169 m_bAuthorRequesting = false;
1170
1171 set<SCR_EditableEntityAuthor> authors = new set<SCR_EditableEntityAuthor>();
1172 foreach (SCR_EditableEntityAuthor author : m_mAuthors)
1173 {
1174 authors.Insert(author);
1175 }
1176
1177 Event_OnAuthorsRegisteredFinished.Invoke(authors);
1178 }
1179
1180 //------------------------------------------------------------------------------------------------
1181 SCR_EditableEntityAuthor FindAuthorByIdentity(UUID authorIdentity)
1182 {
1183 return m_mAuthors[authorIdentity];
1184 }
1185
1186 //------------------------------------------------------------------------------------------------
1187 protected void OnPlayerIdentityAvailable(int playerId)
1188 {
1189 const UUID identity = SCR_PlayerIdentityUtils.GetPlayerIdentityId(playerId);
1190 SCR_EditableEntityAuthor author = FindAuthorByIdentity(identity);
1191 if (author)
1192 author.m_iAuthorID = playerId;
1193 }
1194
1195 //------------------------------------------------------------------------------------------------
1196 override void OnUpdate(float timeSlice)
1197 {
1198 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_ALL))
1199 {
1200 int type = DiagMenu.GetValue(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_TYPE) - 1;
1201 if (type == -1)
1202 {
1203 Log();
1204 }
1205 else
1206 {
1208 if (filter)
1209 filter.Log();
1210 }
1211 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_ALL, false);
1212 }
1213 }
1214
1215 //------------------------------------------------------------------------------------------------
1216 override void OnGameStart()
1217 {
1218 const typename state = EEditableEntityState;
1219 DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES, "Editable Entities", "Editor");
1220 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_ALL, "", "Log All", "Editable Entities");
1221 DiagMenu.RegisterRange(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_TYPE, "", "Log Type", "Editable Entities", string.Format("-1 %1 -1 1", state.GetVariableCount() - 1));
1222 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_DISABLE, "", "Disable entities", "Editable Entities");
1223
1224 auto gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
1225 if (gameMode)
1227 }
1228
1229 //------------------------------------------------------------------------------------------------
1230 override void OnBeforeWorldCleanup()
1231 {
1232 auto gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
1233 if (gameMode)
1235
1236 m_Entities = null;
1237 m_CurrentLayer = null;
1238
1239 Event_OnEntityRegistered = new ScriptInvoker;
1240 Event_OnEntityUnregistered = new ScriptInvoker;
1241 Event_OnParentEntityChanged = new ScriptInvoker;
1242 Event_OnEntityAccessKeyChanged = new ScriptInvoker;
1243 Event_OnEntityVisibilityChanged = new ScriptInvoker;
1244 Event_OnEntityExtendedChange = new ScriptInvoker;
1245 Event_OnEntityBudgetUpdated = new ScriptInvoker_EntityCoreBudgetUpdatedEvent();
1246
1247 DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES);
1248 DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_LOG_ALL);
1249
1250 Restart();
1251 }
1252
1253 //------------------------------------------------------------------------------------------------
1254 //This class doesnt reset between server restarts, so we do a soft-reset of its contents here.
1255 void Restart()
1256 {
1262
1263 m_Entities = null;
1264 m_CurrentLayer = null;
1265
1266 m_OrphanEntityIds = new map<RplId, ref array<RplId>>();
1267 m_CurrentLayer = null;
1268
1269 m_accumulatedBudgetChanges = new map<EEditableEntityBudget, int>;
1270 budgetChangesAccumulated = false;
1271
1272 // UGC Authors
1273 // Authors = people who currently own entity in a world
1274 m_mAuthors = new map<string, ref SCR_EditableEntityAuthor>; // Held by server, needs to be requested by client.
1275 m_bAuthorRequesting = false;
1276
1277 Init();
1278
1279 //clear budget costs between restarts
1280 foreach (SCR_EditableEntityCoreBudgetSetting setting : m_BudgetSettings)
1281 {
1282 setting.SetCurrentBudget(0);
1283 setting.UnreserveBudget(setting.GetReservedBudget());
1284 }
1285 }
1286
1287 //------------------------------------------------------------------------------------------------
1288 void Init()
1289 {
1290 foreach (SCR_EditableEntityCoreTypeSetting setting : m_TypeSettings)
1291 {
1292 m_TypeSettingsMap.Insert(setting.GetType(), setting)
1293 }
1294
1295 foreach (SCR_EditableEntityCoreLabelSetting labelSetting : m_EntityLabels)
1296 {
1297 if (!labelSetting)
1298 continue;
1299
1300 m_LabelSettingsMap.Insert(labelSetting.GetLabelType(), labelSetting);
1301 }
1302
1303
1304 //~ Check if groupless label group exist and create a labelSetting for any label not defined in EntityCore with LabelGroup GROUPLESS
1305 foreach (SCR_EditableEntityCoreLabelGroupSetting labelGroup : m_LabelGroupSettings)
1306 {
1307 //~ Make sure the groupless label group exists
1308 if (labelGroup && labelGroup.GetLabelGroupType() == EEditableEntityLabelGroup.GROUPLESS)
1309 {
1310 //~ Get all labels that exist in the enum but are not defined in entity core. Add them to the label list under group: Groupless
1311 array<int> allLabels = {};
1312 int count = SCR_Enum.GetEnumValues(EEditableEntityLabel, allLabels);
1314
1315 //~ Create new groupless labels
1316 for (int i = 0; i < count; i++)
1317 {
1318 //~ Already in m_EntityLabels
1319 if (m_LabelSettingsMap.Contains(allLabels[i]))
1320 continue;
1321
1322 labelSetting = SCR_EditableEntityCoreLabelSetting.CreateGrouplessLabel(allLabels[i]);
1323 m_EntityLabels.Insert(labelSetting);
1324 m_LabelSettingsMap.Insert(allLabels[i], labelSetting);
1325 }
1326
1327 break;
1328 }
1329 }
1330
1331 foreach (SCR_EditableEntityCoreLabelGroupSetting labelGroup : m_LabelGroupSettings)
1332 {
1333 array<SCR_EditableEntityCoreLabelSetting> groupLabels = {};
1334 EEditableEntityLabelGroup labelGroupType = labelGroup.GetLabelGroupType();
1335 m_LabelGroupSettingsMap.Insert(labelGroupType, labelGroup);
1336
1337 foreach (SCR_EditableEntityCoreLabelSetting entityLabel : m_EntityLabels)
1338 {
1339 if (!entityLabel)
1340 continue;
1341
1342 if (entityLabel.GetLabelGroupType() == labelGroupType)
1343 {
1344 groupLabels.Insert(entityLabel);
1345 }
1346 }
1347
1348 m_LabelListMap.Insert(labelGroupType, groupLabels);
1349 }
1350
1351 //overwrite the nulls with the actual values where valid
1352 foreach (SCR_EditableEntityCoreBudgetSetting budgetSetting : m_BudgetSettings)
1353 {
1354 m_BudgetSettingsInternal.Insert(budgetSetting.GetBudgetType(), budgetSetting);
1355 }
1356 }
1357
1358 // constructor
1360 {
1361 Restart();
1362 //--- Square the value
1364 }
1365}
SCR_EAIThreatSectorFlags flags
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
EEditableEntityBudget
EEditableEntityLabel
EEditableEntityLabelGroup
ArmaReforgerScripted GetGame()
Definition game.c:1398
RplMode
Mode of replication.
Definition RplMode.c:9
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_BaseGameMode GetGameMode()
EDamageType type
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_EditableEntityCampaignBuildingModeLabelData(EEditableEntityLabel label, SCR_UIInfo uiInfo, SCR_EServicePointType linkedServicePoint)
func ScriptInvoker_EntityCoreBudgetUpdated
ScriptInvokerBase< ScriptInvoker_AuthorRequestedFinished > ScriptInvoker_AuthorRequestedFinishedEvent
ScriptInvokerBase< ScriptInvoker_EntityCoreBudgetUpdated > ScriptInvoker_EntityCoreBudgetUpdatedEvent
ScriptInvokerBase< ScriptInvoker_EntityCoreBudgetUpdatedPerEntity > ScriptInvoker_EntityCoreBudgetUpdatedPerEntityEvent
func ScriptInvoker_EntityCoreBudgetUpdatedPerEntity
func ScriptInvoker_AuthorRequestedFinished
void SCR_EditableGroupComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
int GetOrder()
void LoadSettings()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
override void Log()
int Type
enum EVehicleType IEntity
Diagnostic and developer menu system.
Definition DiagMenu.c:18
Definition Math.c:13
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14
static SCR_BaseEditableEntityFilter GetInstance(EEditableEntityState state, bool showError=false)
ScriptInvokerBase< SCR_BaseGameMode_PlayerId > GetOnPlayerAuditSuccess()
bool HasEntityFlag(EEditableEntityFlag flag)
void Log(string prefix="", bool onlyDirect=false, LogLevel logLevel=LogLevel.DEBUG)
void SetMaxDrawDistance(float maxDrawDistance)
EEditableEntityType GetEntityType(IEntity owner=null)
bool GetEntityBudgetCost(out notnull array< ref SCR_EntityBudgetValue > outBudgets, IEntity owner=null)
void GetAllEntities(out notnull set< SCR_EditableEntityComponent > entities, bool onlyDirect=false, bool skipIgnored=false)
EEditableEntityBudget GetBudgetForEntityType(EEditableEntityType entityType)
void RemoveFromRoot(SCR_EditableEntityComponent entity)
SCR_EditableEntityAuthor FindAuthorByIdentity(UUID authorIdentity)
override void OnUpdate(float timeSlice)
int RemoveOrphans(RplId parentId, out notnull array< SCR_EditableEntityComponent > outOrphans)
SCR_EditableEntityComponent FindNearestEntity(vector pos, EEditableEntityType type, EEditableEntityFlag flags=0, bool onlyDirect=true)
void RegisterEntity(SCR_EditableEntityComponent entity)
static int GetAllEntitiesByAuthorUIDExt(out notnull set< SCR_EditableEntityComponent > entities, string playerUID)
void GetBudgets(out notnull array< ref SCR_EditableEntityCoreBudgetSetting > budgets)
void AddAuthorOnRequest(notnull SCR_EditableEntityAuthor newAuthor)
Do not call this function yourself, this has to be requested by server.
void UnRegisterEntity(SCR_EditableEntityComponent entity, IEntity owner=null)
void AddOrphan(RplId parentId, RplId orphanId)
bool GetBudget(EEditableEntityBudget budgetType, out SCR_EditableEntityCoreBudgetSetting budgetSettings)
int GetAllEntitiesByAuthorUID(out notnull set< SCR_EditableEntityComponent > entities, string playerUID)
void DeleteAllEntitiesThatHaveBudgetOfType(EEditableEntityBudget budgetToFree)
ref ScriptInvoker_AuthorRequestedFinishedEvent Event_OnAuthorsRegisteredFinished
void UpdateBudget(EEditableEntityBudget budgetType, bool added, SCR_EditableEntityComponent entity, SCR_EntityBudgetValue budgetCost=null)
void RegisterAuthorServer(SCR_EditableEntityAuthor newAuthor)
void QueueBudgetChange(EEditableEntityBudget budgetType, bool added, SCR_EditableEntityComponent entity, SCR_EntityBudgetValue budgetCost=null)
void AuthorEntityRemovedServer(SCR_EditableEntityAuthor newAuthor)
void AddToRoot(SCR_EditableEntityComponent entity)
int GetAllEntitiesByAuthorID(out notnull set< SCR_EditableEntityComponent > entities, int playerID)
void UpdateBudgetForEntity(SCR_EditableEntityComponent entity, bool added, IEntity owner)
SCR_EditableEntityInteraction GetEntityInteraction(EEditableEntityType type)
void GetAllEntities(out notnull set< SCR_EditableEntityComponent > entities, EEditableEntityAccessKey accessKey)
bool GetEntityCanBeControlled(EEditableEntityType type)
set< SCR_EditableEntityAuthor > GetAllAuthorsServer()
void OnPlayerIdentityAvailable(int playerId)
static int GetAllEntitiesByAuthorIDExt(out notnull set< SCR_EditableEntityComponent > entities, int playerID)
Core component to manage SCR_EditorManagerEntity.
SCR_EditorManagerEntity GetEditorManager()
Definition UUID.c:28
Definition Types.c:486
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
EEditableEntityAccessKey
EEditableEntityFlag
Unique flags of the entity.
EEditableEntityState
SCR_FieldOfViewSettings Attribute
EEditorMode
Editor mode that defines overall functionality.
Definition EEditorMode.c:6
int MapIterator
Definition Types.c:469
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134