3 [
Attribute(
"{59A6F1EBC6C64F79}Prefabs/Logic/SeizingTrigger.et",
UIWidgets.ResourceNamePicker,
"",
"et")]
23 [
Attribute(
"7",
desc:
"Units in a vehicle (most probably aircraft) above this altitude will be ignored.")]
32 [
Attribute(
"5",
"How many characters need to be seizing at once to achieve the minimum seizing time.")]
35 [
Attribute(
"0",
desc:
"How long after respawn is player able to start seizing or defending.")]
38 [
Attribute(
"0",
desc:
"When checked, the seizing timer will decrease gradually when the seizing is interrupted.")]
41 [
Attribute(
"0",
desc:
"Allow seizing for playable factions only.")]
44 [
Attribute(
"0",
desc:
"Allow defending for playable factions only.")]
47 [
Attribute(
"0",
desc:
"If enabled, at least one player has to be present in the capture area to progress.")]
59 [
RplProp(onRplName:
"OnSeizingTimestampChanged")]
62 [
RplProp(onRplName:
"OnSeizingTimestampChanged")]
190 array<IEntity> presentEntities = {};
191 int presentEntitiesCount =
m_Trigger.GetEntitiesInside(presentEntities);
214 for (
int i = 0; i < presentEntitiesCount; i++)
216 IEntity entity = presentEntities[i];
220 RplComponent.DeleteRplEntity(entity,
false);
226 if (!evaluatedEntityFaction)
229 factionCount = factionsPresence.Get(evaluatedEntityFaction);
232 if (factionCount == 0)
233 factionsPresence.Insert(evaluatedEntityFaction, 1);
235 factionsPresence.Set(evaluatedEntityFaction, factionCount + 1);
239 factionsPlayerPresence.Set(evaluatedEntityFaction,
true);
244 int highestAttackingPresence;
245 int highestDefendingPresence;
246 int curSeizingCharacters;
249 foreach (
SCR_Faction faction,
int presence : factionsPresence)
259 if (presence > highestAttackingPresence)
261 highestAttackingPresence = presence;
262 prevailingFaction = faction;
264 else if (presence == highestAttackingPresence)
266 prevailingFaction = null;
271 if (prevailingFaction)
273 foreach (
SCR_Faction faction,
int presence : factionsPresence)
280 if (faction == prevailingFaction)
283 highestDefendingPresence =
Math.Max(presence, highestDefendingPresence);
287 if (prevailingFaction && highestAttackingPresence > highestDefendingPresence)
293 prevailingFaction = null;
294 curSeizingCharacters = 0;
315 SCR_ChimeraCharacter
char = SCR_ChimeraCharacter.Cast(ent);
322 CharacterControllerComponent charControl =
char.GetCharacterController();
327 int playerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(ent);
328 if (!playerId && charControl)
330 AIControlComponent ctrComp = charControl.GetAIControlComponent();
333 AIAgent ai = ctrComp.GetAIAgent();
334 if (ai && ai.GetLOD() == AIAgent.GetMaxLOD())
348 if (
m_mSpawnTimers.Get(playerId).Greater(world.GetServerTimestamp()))
357 return entityFaction;
464 FactionManager factionManager =
GetGame().GetFactionManager();
482 FactionManager factionManager =
GetGame().GetFactionManager();
501 FactionManager factionManager =
GetGame().GetFactionManager();
529 if (!controlledEntity)
543 array<IEntity> queue = {
GetOwner()};
544 SCR_FlagComponent flag;
548 while (!queue.IsEmpty())
550 processedEntity = queue[0];
553 flag = SCR_FlagComponent.Cast(processedEntity.
FindComponent(SCR_FlagComponent));
555 flag.ChangeMaterial(faction.GetFactionFlagMaterial());
559 while (nextInHierarchy)
561 queue.Insert(nextInHierarchy);
562 nextInHierarchy = nextInHierarchy.
GetSibling();
587 if (playerFaction == faction)
606 super.OnBaseFactionChanged(faction);
613 SCR_ChimeraCharacter
char = SCR_ChimeraCharacter.Cast(ent);
617 CharacterControllerComponent charControl =
char.GetCharacterController();
624 int playerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(ent);
628 AIControlComponent ctrComp = charControl.GetAIControlComponent();
632 if (ctrComp.IsAIActivated())
653 base.UnregisterLogicComponent(
this);
667 super.OnPostInit(owner);
707 Print(
"SCR_SeizingComponent: Owner is missing SCR_FactionAffiliationComponent! Terminating...",
LogLevel.ERROR);
712 if (!triggerResource)
714 Print(
"SCR_SeizingComponent: Trigger resource failed to load! Terminating...",
LogLevel.ERROR);
719 m_Trigger = BaseGameTriggerEntity.Cast(
GetGame().SpawnEntityPrefabLocal(triggerResource,
GetGame().GetWorld()));
722 Print(
"SCR_SeizingComponent: Trigger failed to spawn! Terminating...",
LogLevel.ERROR);
ArmaReforgerScripted GetGame()
SCR_BaseGameMode GetGameMode()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
SCR_CharacterSoundComponentClass GetComponentData()
void SCR_FactionManager(IEntitySource src, IEntity parent)
SCR_MilitaryBaseLogicComponentClass m_aBases
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ScriptInvokerBase< OnTimerChangeFn > OnTimerChangeInvoker
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external int AddChild(notnull IEntity child, TNodeId pivot, EAddChildFlags flags=EAddChildFlags.AUTO_TRANSFORM)
Add Entity to hierarchy. Pivot is pivot index, or -1 for center of parent.
proto external IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external IEntity GetSibling()
Object holding reference to resource. In destructor release the resource.
ScriptInvokerBase< SCR_BaseGameMode_PlayerIdAndEntity > GetOnPlayerSpawned()
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
ResourceName GetTriggerPrefab()
ResourceName m_sTriggerPrefab
ENotification m_eCapturedByEnemiesNotification
bool NotificationsAllowed()
ref map< int, WorldTimestamp > m_mSpawnTimers
static const float TRIGGER_CHECK_PERIOD_ACTIVE
override void EOnFrame(IEntity owner, float timeSlice)
WorldTimestamp m_fInterruptedCaptureTimestamp
void HandleGradualReset()
When capture started after getting interrupted, take into account the time spent on it.
void NotifyPlayerInRadius(notnull SCR_Faction faction)
OnTimerChangeInvoker GetOnTimerChange()
WorldTimestamp GetSeizingEndTimestamp()
bool m_bIgnoreNonPlayableDefenders
WorldTimestamp m_fSeizingStartTimestamp
void EvaluatePrevailingFaction()
BaseGameTriggerEntity m_Trigger
SCR_Faction m_PrevailingFactionPrevious
void OnPrevailingFactionChanged()
void OnPlayerSpawned(int playerId, IEntity controlledEntity)
SCR_FactionAffiliationComponent m_FactionControl
WorldTimestamp m_fSeizingEndTimestamp
static const float TRIGGER_CHECK_PERIOD_IDLE
float m_fMinimumSeizingTime
bool m_bIgnoreNonPlayableAttackers
bool m_bShowNotifications
void AllowNotifications(bool allow)
void RpcDo_OnCaptureInterrupt(int factionIndex)
RplComponent m_RplComponent
float m_fCurrentSeizingTime
bool m_bGradualTimerReset
void ~SCR_SeizingComponent()
float m_fMaximumSeizingTime
void OnSeizingTimestampChanged()
int m_iMaximumSeizingCharacters
float m_fInterruptedCaptureDuration
bool IsDisabledAI(IEntity ent)
void UpdateFlagsInHierarchy(notnull SCR_Faction faction)
override void OnPostInit(IEntity owner)
bool GetIsLocalPlayerPresent()
void OnQueryFinished(BaseGameTriggerEntity trigger)
WorldTimestamp GetSeizingStartTimestamp()
SCR_Faction m_PrevailingFaction
ScriptInvoker GetOnCaptureStart()
bool m_bCapturingRequiresPlayer
ref ScriptInvoker m_OnCaptureInterrupt
void RpcDo_OnCaptureStart(int factionIndex)
ref OnTimerChangeInvoker m_OnTimerChange
ENotification m_eCapturedByFriendliesNotification
ref ScriptInvoker m_OnCaptureStart
void RpcDo_OnCaptureFinish(int factionIndex)
ref ScriptInvoker m_OnCaptureFinish
SCR_Faction EvaluateEntityFaction(IEntity ent)
override void OnBaseFactionChanged(Faction faction)
ScriptInvoker GetOnCaptureFinish()
ScriptInvoker GetOnCaptureInterrupt()
bool m_bDeleteDisabledAIs
void RefreshSeizingTimer()
float m_fRespawnCooldownPeriod
static float GetHeightAboveTerrain(vector pos, BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.