35 return { RplComponent };
75 [
Attribute(
desc:
"Any ResourceType that is set here cannot be enabled or disabled in runtime for this entity by editor", uiwidget:
UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(
EResourceType))]
115 [
RplProp(onRplName:
"OnVisibilityChanged")]
153 return disabledResourceTypes.Count();
171 if (!factionAffiliation)
174 Faction suppliesFaction = factionAffiliation.GetAffiliatedFaction();
175 if (!suppliesFaction)
178 Faction playerFaction = character.GetFaction();
179 if (playerFaction != suppliesFaction)
180 return factionAffiliation.GetOwner().FindComponent(SCR_CampaignSourceBaseComponent) != null;
197 if ((
index < 0) == enable)
246 static SCR_ResourceComponent FindResourceComponent(
IEntity entity,
bool ignoreChildIfHasStorage =
false)
253 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.Cast(entity.
FindComponent(SCR_ResourceComponent));
254 if (resourceComponent)
255 return resourceComponent;
260 SlotManagerComponent slotManager = SlotManagerComponent.Cast(entity.
FindComponent(SlotManagerComponent));
264 array<EntitySlotInfo> outSlotInfos = {};
265 slotManager.GetSlotInfos(outSlotInfos);
268 foreach (EntitySlotInfo slotInfo : outSlotInfos)
270 slot = slotInfo.GetAttachedEntity();
275 resourceComponent = SCR_ResourceComponent.Cast(slot.
FindComponent(SCR_ResourceComponent));
276 if (resourceComponent)
279 if (!ignoreChildIfHasStorage)
280 return resourceComponent;
283 if (!slot.
FindComponent(ScriptedBaseInventoryStorageComponent))
284 return resourceComponent;
291 InventoryItemComponent inventoryItem = InventoryItemComponent.Cast(entity.
FindComponent(InventoryItemComponent));
295 if (inventoryItem.GetParentSlot())
299 return SCR_ResourceComponent.FindResourceComponent(entity.
GetParent(), ignoreChildIfHasStorage);
371 if (higherLimitPosition == 0)
377 while (
position < higherLimitPosition)
385 || resourceType != encapsulator.GetResourceType())
404 if (higherLimitPosition == 0)
409 while (
position < higherLimitPosition)
417 || resourceType != encapsulator.GetResourceType())
432 EResourceType compareResourceType = encapsulator.GetResourceType();
434 if (resourceType > compareResourceType)
436 else if (resourceType < compareResourceType)
437 higherLimitPosition = comparePosition;
459 if (encapsulatorCount == 0)
462 array<SCR_ResourceEncapsulator> encapsulators = {};
464 encapsulators.Reserve(encapsulatorCount);
468 encapsulators.Insert(encapsulator);
471 return encapsulators;
485 if (higherLimitPosition == 0)
491 while (
position < higherLimitPosition)
518 if (higherLimitPosition == 0)
523 while (
position < higherLimitPosition)
531 || resourceType != container.GetResourceType())
546 EResourceType compareResourceType = container.GetResourceType();
548 if (resourceType > compareResourceType)
552 else if (resourceType < compareResourceType)
554 higherLimitPosition = comparePosition;
574 if (containerCount == 0)
577 array<SCR_ResourceContainer> containers = {};
579 containers.Reserve(containerCount);
583 containers.Insert(container);
599 if (higherLimitPosition == 0)
603 SCR_ResourceConsumer consumer;
605 while (
position < higherLimitPosition)
613 || identifier != consumer.GetGeneratorIdentifier()
614 || resourceType != consumer.GetResourceType())
634 if (higherLimitPosition == 0)
639 while (
position < higherLimitPosition)
647 || identifier != consumer.GetGeneratorIdentifier()
648 || resourceType != consumer.GetResourceType())
663 EResourceType compareResourceType = consumer.GetResourceType();
666 if (identifier > comapareIdentifier)
670 else if (identifier < comapareIdentifier)
672 higherLimitPosition = comparePosition;
674 else if (resourceType > compareResourceType)
678 else if (resourceType < compareResourceType)
680 higherLimitPosition = comparePosition;
699 if (consumerCount == 0)
702 array<SCR_ResourceConsumer> consumers = {};
703 consumers.Reserve(consumerCount);
707 consumers.Insert(container);
723 if (higherLimitPosition == 0)
729 while (
position < higherLimitPosition)
738 || resourceType != generator.GetResourceType())
757 if (higherLimitPosition == 0)
762 while (
position < higherLimitPosition)
770 || identifier != generator.GetIdentifier()
771 || resourceType != generator.GetResourceType())
786 EResourceType compareResourceType = generator.GetResourceType();
789 if (identifier > comapareIdentifier)
793 else if (identifier < comapareIdentifier)
795 higherLimitPosition = comparePosition;
797 else if (resourceType > compareResourceType)
801 else if (resourceType < compareResourceType)
803 higherLimitPosition = comparePosition;
825 if (generatorCount == 0)
828 array<SCR_ResourceGenerator> generators = {};
830 generators.Reserve(generatorCount);
834 generators.Insert(generator);
967 GetGame().GetResourceGrid().FlagResourceItem(
this);
979 GetGame().GetResourceGrid().UnflagResourceItem(
this);
1018 super.OnPostInit(owner);
1027 set<EResourceType> duplicateRemoveSet =
new set<EResourceType>();
1031 duplicateRemoveSet.Insert(resourceType);
1052 FactionAffiliationComponent factionAffiliationComponentTemp;
1055 while (parentEntity)
1057 factionAffiliationComponentTemp = FactionAffiliationComponent.Cast(parentEntity.
FindComponent(FactionAffiliationComponent));
1059 if (factionAffiliationComponentTemp)
1062 parentEntity = parentEntity.
GetParent();
1069 Physics physics = owner.GetPhysics();
1070 vector tempBoundsMaxs, tempBoundsMins;
1080 array<ref SCR_ResourceContainer> containers = prefabData.
GetContainers();
1085 typename containerInstanceTypename;
1091 containerInstanceTypename = container.Type();
1096 containerInstance.
Initialize(owner, container);
1102 int comparePosition;
1109 compareResourceType = compareContainer.GetResourceType();
1111 if (resourceType > compareResourceType)
1114 else if (resourceType < compareResourceType)
1115 maxPosition = comparePosition;
1124 if (container.IsIsolated())
1138 array<ref SCR_ResourceEncapsulator> encapsulators = {};
1143 encapsulator.Initialize(owner);
1146 int maxPosition = encapsulators.Count();
1147 EResourceType resourceType = encapsulator.GetResourceType();
1149 int comparePosition;
1155 compareEncapsulator = encapsulators[comparePosition];
1156 compareResourceType = compareEncapsulator.GetResourceType();
1158 if (resourceType > compareResourceType)
1161 else if (resourceType < compareResourceType)
1162 maxPosition = comparePosition;
1168 encapsulators.InsertAt(encapsulator,
position);
1177 array<ref SCR_ResourceConsumer> consumers = {};
1187 consumer.Initialize(owner);
1190 int maxPosition = consumers.Count();
1195 int comparePosition;
1196 SCR_ResourceConsumer compareConsumer;
1201 compareConsumer = consumers[comparePosition];
1202 compareGeneratorIdentifier = compareConsumer.GetGeneratorIdentifier();
1203 compareResourceType = compareConsumer.GetResourceType();
1205 if (generatorIdentifier > compareGeneratorIdentifier)
1207 else if (generatorIdentifier < compareGeneratorIdentifier)
1208 maxPosition = comparePosition;
1209 else if (resourceType > compareResourceType)
1211 else if (resourceType < compareResourceType)
1212 maxPosition = comparePosition;
1217 consumers.InsertAt(consumer,
position);
1226 array<ref SCR_ResourceGenerator> generators = {};
1236 generator.Initialize(owner);
1239 int maxPosition = generators.Count();
1244 int comparePosition;
1250 compareGenerator = generators[comparePosition];
1251 comapareIdentifier = compareGenerator.GetIdentifier();
1252 compareResourceType = compareGenerator.GetResourceType();
1254 if (identifier > comapareIdentifier)
1256 else if (identifier < comapareIdentifier)
1257 maxPosition = comparePosition;
1258 else if (resourceType > compareResourceType)
1260 else if (resourceType < compareResourceType)
1261 maxPosition = comparePosition;
1266 generators.InsertAt(generator,
position);
1291 SCR_ResourceComponent childResourceComponent = SCR_ResourceComponent.Cast(child.
FindComponent(SCR_ResourceComponent));
1292 if (!childResourceComponent)
1308 queue = encapsulator.GetContainerQueue();
1315 container.GetComponent().SetIsVisible(
false);
1319 bool isCompletelyIsolated =
true;
1324 isCompletelyIsolated &= container.
IsIsolated();
1327 if (isCompletelyIsolated)
1363 consumer.DebugDraw();
1366 height =
Math.Max(height, consumer.GetResourceRange());
1376 encapsulator.DebugDraw();
1386 generator.DebugDraw();
1389 height =
Math.Max(height, generator.GetStorageRange());
1399 container.DebugDraw();
1440 override int _WB_GetAfterWorldUpdateSpecs(
IEntity owner, IEntitySource src)
1442 return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
1450 override event void _WB_AfterWorldUpdate(
IEntity owner,
float timeSlice)
1455 super._WB_AfterWorldUpdate(timeSlice);
1462 SCR_ResourceGrid grid =
GetGame().GetResourceGrid();
1468 consumer.GetContainerQueue().Clear();
1476 generator.GetContainerQueue().Clear();
1483 return super._WB_OnKeyChanged(owner, src, key, ownerContainers, parent);
1524 container.EnableDecay(
false);
1529 bool isCompletelyIsolated =
true;
1533 isCompletelyIsolated &= container.IsEncapsulated();
1536 if (isCompletelyIsolated)
1560 container.EnableDecay(
true);
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
void TEMP_OnInteractorReplicated()
FactionAffiliationComponent m_FactionAffiliationComponent
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
override void OnChildAdded(IEntity parent, IEntity child)
const float UPDATE_PERIOD
SCR_CharacterSoundComponentClass GetComponentData()
override bool _WB_OnKeyChanged(IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
Any property value has been changed. You can use editor API here and do some additional edit actions ...
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_EditableEntityVehicleCompartmentVisibilityChildComponentClass SCR_EditableEntityVisibilityChildComponentClass OnAddedToParent(IEntity child, IEntity parent)
void SetGridContainersBoundsMins(int mins)
bool m_bEnableDebugVisualization
Setting for enabling the debugging visualization of the container and/or consumer.
RplComponent m_ReplicationComponent
Replication component attached to the owner entity.
bool IsDebugVisualizationEnabled()
void OnRemovedFromParent(IEntity child, IEntity parent)
ref array< EResourceType > m_aDisallowChangingEnableResource
void SetGridUpdateId(int gridUpdateId)
EResourceDebugVisualizationFlags
ref array< ref SCR_ResourceConsumer > m_aConsumers
Refer to SCR_ResourceConsumer for documentation.
ref array< ref SCR_ResourceGenerator > m_aGenerators
Refer to SCR_ResourceGenerator for documentation.
ScriptInvoker TEMP_GetOnInteractorReplicated()
HOTFIX: Until replication issues are resolved.
SCR_ResourceConsumer GetConsumer(EResourceGeneratorID identifier, EResourceType resourceType)
int m_iGridContainersBoundsMins
bool GetNextConsumerCandidate(inout int position, inout int higherLimitPosition, inout SCR_ResourceConsumer consumer, EResourceGeneratorID identifier, EResourceType resourceType)
void OnAddedToParentEx(IEntity child, IEntity parent)
void SetGridContainersBoundsMaxs(int maxs)
FactionAffiliationComponent GetFactionAffiliationComponent()
const float UPDATE_DISTANCE_TRESHOLD_SQUARE
bool IsGridUpdateIdGreaterThan(int gridUpdateId)
bool m_bIsFlaggedForProcessing
void OnVisibilityChanged()
vector m_vGridContainersBoundingVolumeMaxs
int GetDisabledResourceTypes(inout notnull array< EResourceType > disabledResourceTypes)
vector m_vGridContainersBoundingVolumeMins
ref array< ref SCR_ResourceEncapsulator > m_aEncapsulators
Refer to SCR_ResourceEncapsulator for documentation.
void DeleteQueryInteractors()
void GetGridContainersWorldBoundingBox(out vector mins, out vector maxs)
ref array< ref SCR_ResourceContainer > m_aContainerInstances
void SetResourceTypeEnabled(bool enable, EResourceType resourceType=EResourceType.SUPPLIES)
ref ScriptInvoker m_TEMP_OnInteractorReplicated
HOTFIX: Until replication issues are resolved.
ref Color m_DebugColor
Setting for the base color for the debugging visualization of the container and/or consumer.
bool GetNextGeneratorCandidate(inout int position, inout int higherLimitPosition, inout SCR_ResourceGenerator generator, EResourceGeneratorID identifier, EResourceType resourceType)
int GetGridContainersBoundsMins()
void OnVehiclePhysicsActive(IEntity owner, bool activeState)
bool IsResourceTypeEnabled(EResourceType resourceType=EResourceType.SUPPLIES)
func SCR_Resources_OnResourceEnabledChanged
bool GetNextContainerCandidate(inout int position, inout int higherLimitPosition, inout SCR_ResourceContainer container, EResourceType resourceType)
SCR_ResourceGenerator GetGenerator(EResourceGeneratorID identifier, EResourceType resourceType)
ref ScriptInvokerBase< SCR_Resources_OnResourceEnabledChanged > m_OnResourceTypeEnabledChanged
void SetIsVisible(bool state)
array< SCR_ResourceContainer > GetContainers()
bool CanBeUsedByCharacter(notnull SCR_ChimeraCharacter character)
RplComponent GetReplicationComponent()
void UnflagForProcessing()
bool ShouldGeneratorsBeReplicated()
SCR_ResourceContainer GetContainer(EResourceType resourceType)
ScriptInvokerBase< SCR_Resources_OnResourceEnabledChanged > GetOnResourceTypeEnabledChanged()
int m_iGridContainersBoundsMaxs
SCR_ResourceEncapsulator GetEncapsulator(EResourceType resourceType)
ref array< EResourceType > m_aDisabledResourceTypes
void SetGridContainersBounds(int mins, int maxs)
int GetGridContainersBoundsMaxs()
void GetGridContainersBoundingBox(out vector mins, out vector maxs)
bool GetNextEncapsulatorCandidate(inout int position, inout int higherLimitPosition, inout SCR_ResourceEncapsulator encapsulator, EResourceType resourceType)
array< SCR_ResourceEncapsulator > GetEncapsulators()
bool m_bIsAddedToParentBuffered
bool CanResourceTypeEnabledBeChanged(EResourceType resourceType=EResourceType.SUPPLIES)
array< SCR_ResourceGenerator > GetGenerators()
bool ShouldConsumersBeReplicated()
SCR_ResourceComponentClass UPDATE_DISTANCE_TRESHOLD
array< SCR_ResourceConsumer > GetConsumers()
void OnResourceTypeEnabledChanged()
void GetGridContainersBounds(out int mins, out int maxs)
void UpdateLastPosition()
Updates the serial number for the current processing call of the resource grid onto this component.
EResourceDebugVisualizationFlags m_eDebugVisualizationFlags
Flags for enabling the debugging visualization.
EResourceContainerStorageType
EResourceContainerOnEmptyBehavior
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void GetChildren(out array< SCR_ScenarioFrameworkLayerBase > children)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external IEntity GetParent()
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
array< ref SCR_ResourceContainer > GetContainers()
ref array< ref SCR_ResourceContainer > m_aContainers
static override array< typename > Requires(IEntityComponentSource src)
EResourceType GetResourceType()
override bool IsIsolated()
void Initialize(notnull IEntity owner, notnull SCR_ResourceContainer container)
EResourceContainerOnEmptyBehavior GetOnEmptyBehavior()
void GetAxisAlignedBoundingVolume(inout vector mins, inout vector maxs)
SCR_ResourceContainer GetContainerAt(int index)
override EResourceGeneratorID GetIdentifier()
int IncreaseGridUpdateId()
void UnregisterResourceItem(notnull SCR_ResourceComponent item)
Instance of created debug visualizer.
enum EPhysicsLayerPresets Vehicle
IEntity GetOwner()
Owner entity of the fuel tank.
override void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.