18 [
Attribute(
"{5A258632A5C32E48}Prefabs/MP/Spawning/ItemSpecifics/RestrictedDeployableSpawnPoint_Radio_Supplies.et", uiwidget:
UIWidgets.ResourcePickerThumbnail,
params:
"et",
category:
"Setup")]
25 [
Attribute(defvalue:
"1",
desc:
"Play audio cue once spawn point can/cannot be deployed",
category:
"General")]
28 [
Attribute(defvalue:
"1",
desc:
"Show notification once spawn point can/cannot be deployed",
category:
"General")]
50 [
Attribute(defvalue:
"600",
params:
"0 inf",
desc:
"Time in seconds after deployment for the spawn to regenerate",
category:
"Respawning")]
57 [
Attribute(defvalue:
"1.0",
desc:
"Rate at which spawn point will check if it can be deployed or not",
category:
"Queries")]
60 [
Attribute(defvalue:
"0",
desc:
"Can be deployed only when in faction radio range",
category:
"Queries")]
66 [
Attribute(defvalue:
"0",
desc:
"Check if spawn points are nearby before deploying",
category:
"Queries")]
69 [
Attribute(defvalue:
"0",
desc:
"Check if characters are nearby before deploying",
category:
"Queries")]
75 [
Attribute(defvalue:
"250.0",
desc:
"Query radius for other existing spawn points",
category:
"Queries")]
81 [
Attribute(defvalue:
"0",
desc:
"Query all military bases, not just Main Operating Bases",
category:
"Queries")]
100 [
Attribute(defvalue:
"#AR-DeployableSpawnPoints_UserAction_OutsideDeployArea",
category:
"User Actions")]
103 [
Attribute(defvalue:
"#AR-DeployableSpawnPoints_UserAction_DeployLimitReached",
category:
"User Actions")]
106 [
Attribute(defvalue:
"#AR-DeployableSpawnPoints_UserAction_NoGroupJoined",
category:
"User Actions")]
109 [
Attribute(defvalue:
"1",
desc:
"Should notify if friendly dismantles the spawnpoint",
category:
"Notifications")]
132 protected static ref array<ref Shape> s_aDebugShapes = {};
158 soundComp.SoundEvent(
SCR_SoundEvent.SOUND_DEPLOYED_RADIO_ENTER_ZONE);
160 soundComp.SoundEvent(
SCR_SoundEvent.SOUND_DEPLOYED_RADIO_EXIT_ZONE);
167 if (entities.IsEmpty())
170 float queryRadius = 100;
171 bool isBase, isSpawnPoint, isCharacter;
173 if (SCR_MilitaryBaseComponent.Cast(entities[0].FindComponent(SCR_MilitaryBaseComponent)))
183 else if (SCR_ChimeraCharacter.Cast(entities[0]))
189 float radiusSq = queryRadius * queryRadius;
193 vector origin = e.GetOrigin();
197 s_aDebugShapes.Insert(
Shape.CreateSphere(
Color.RED,
ShapeFlags.WIREFRAME, origin, queryRadius));
200 float distanceToItemSq =
vector.DistanceSq(spawnPointOrigin, origin);
201 bool isWithinRadius = distanceToItemSq < radiusSq;
217 else if (isSpawnPoint)
222 else if (isCharacter)
238 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(userEntity.FindComponent(FactionAffiliationComponent));
239 if (!factionAffiliation)
242 Faction affiliatedFaction = factionAffiliation.GetAffiliatedFaction();
243 if (!affiliatedFaction)
246 FactionKey userFactionKey = affiliatedFaction.GetFactionKey();
253 SCR_PossessingManagerComponent possessingManagerComp = SCR_PossessingManagerComponent.GetInstance();
254 if (!possessingManagerComp)
257 int userID = possessingManagerComp.GetIdFromControlledEntity(userEntity);
259 SCR_PlayerControllerGroupComponent playerControllerGroupComp = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(userID);
260 if (!playerControllerGroupComp)
263 int userGroupID = playerControllerGroupComp.GetGroupID();
274 array<IEntity> entities = {};
276 FactionManager factionManager =
GetGame().GetFactionManager();
289 if (campaignBaseManager)
293 notification =
ENotification.DEPLOYABLE_SPAWNPOINTS_ZONE_EXITED;
307 array<SCR_MilitaryBaseComponent> baseComponents = {};
309 baseManager.
GetBases(baseComponents);
311 foreach (SCR_MilitaryBaseComponent baseComponent : baseComponents)
316 if (baseComponent.GetFaction() != faction)
320 entities.Insert(baseComponent.GetOwner());
325 if (!campaignBaseComponent || !campaignBaseComponent.
IsHQ())
328 entities.Insert(baseComponent.GetOwner());
334 notification =
ENotification.DEPLOYABLE_SPAWNPOINTS_ZONE_EXITED;
344 array<SCR_SpawnPoint> spawnPoints =
SCR_SpawnPoint.GetSpawnPoints();
351 if (!SCR_PlayerRadioSpawnPoint.Cast(spawnPoint) && spawnPoint.GetFactionKey() != faction.GetFactionKey())
352 entities.Insert(spawnPoint);
357 notification =
ENotification.DEPLOYABLE_SPAWNPOINTS_ZONE_EXITED;
371 foreach (SCR_ChimeraCharacter character : characters)
376 if (character == userEntity || character.GetCharacterController().IsDead())
379 entities.Insert(character);
384 notification =
ENotification.DEPLOYABLE_SPAWNPOINTS_ZONE_EXITED;
389 notification =
ENotification.DEPLOYABLE_SPAWNPOINTS_ZONE_ENTERED;
411 if (!resource.IsValid())
415 params.Transform = m_aOriginalTransform;
416 params.TransformMode = ETransformMode.WORLD;
431 int userID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(userEntity);
433 SCR_PlayerControllerGroupComponent playerControllerGroupComp = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(userID);
434 if (!playerControllerGroupComp)
443 const int groupId = playerControllerGroupComp.GetGroupID();
444 SCR_AIGroup playerGroup = groupsManager.FindGroup(groupId);
455 group.IncreaseDeployedRadioCount();
457 super.Deploy(userEntity, reload);
463 if (!restrictedSpawnPoint)
494 if (!restrictedSpawnPoint)
513 SCR_ChimeraCharacter dismantlingCharacter = SCR_ChimeraCharacter.Cast(userEntity);
514 if (dismantlingCharacter)
516 int dismantlingPlayerID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(dismantlingCharacter);
518 Faction dismantlingFaction = dismantlingCharacter.GetFaction();
521 if (dismantlingFaction && dismantlingFaction == groupFaction)
522 SCR_NotificationsComponent.SendToGroup(
m_iGroupID,
ENotification.GROUP_RADIO_DISMANTLED_BY_FRIENDLY, dismantlingPlayerID);
531 super.Dismantle(userEntity, reload);
538 SCR_PossessingManagerComponent possessingManagerComp = SCR_PossessingManagerComponent.GetInstance();
539 if (!possessingManagerComp)
542 const int userID = possessingManagerComp.GetIdFromControlledEntity(userEntity);
547 SCR_NotificationsComponent.SendToPlayer(userID,
ENotification.DEPLOYABLE_SPAWNPOINTS_DISPLAY_RESPAWN_COUNT, respawnsLeft,
m_iMaxRespawns);
551 SCR_PlayerControllerGroupComponent playerControllerGroupComp = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(userID);
552 if (!playerControllerGroupComp)
555 const int userGroupID = playerControllerGroupComp.GetGroupID();
558 SCR_NotificationsComponent.SendToPlayer(userID,
ENotification.DEPLOYABLE_SPAWNPOINTS_DISPLAY_GROUP,
m_iGroupID);
562 SCR_NotificationsComponent.SendToPlayer(userID,
ENotification.DEPLOYABLE_SPAWNPOINTS_DISPLAY_RESPAWN_COUNT, respawnsLeft,
m_iMaxRespawns);
578 if (!restrictedSpawnPoint)
586 SCR_PossessingManagerComponent possessingManagerComp = SCR_PossessingManagerComponent.GetInstance();
587 if (!possessingManagerComp)
590 const int userID = possessingManagerComp.GetIdFromControlledEntity(userEntity);
595 SCR_NotificationsComponent.SendToPlayer(userID,
ENotification.DEPLOYABLE_SPAWNPOINTS_LOADOUTS_ALLOWED);
597 SCR_NotificationsComponent.SendToPlayer(userID,
ENotification.DEPLOYABLE_SPAWNPOINTS_LOADOUTS_BANNED);
665 IEntity ownerEntity =
GetGame().GetPlayerManager().GetPlayerControlledEntity(m_iItemOwnerID);
666 if (!ownerEntity || ownerEntity != userEntity)
759 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.Cast(
m_SpawnPoint.FindComponent(SCR_ResourceComponent));
760 if (!resourceComponent)
773 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.Cast(
m_SpawnPoint.FindComponent(SCR_ResourceComponent));
774 if (resourceComponent)
827 if (!restrictedSpawnPoint)
837 super.Update(owner, timeSlice);
858 s_aDebugShapes.Clear();
883 parentEntity = parentSlot.GetStorage().GetOwner();
884 parentSlot = parentSlot.GetStorage().GetParentSlot();
887 if (!parentEntity || !SCR_ChimeraCharacter.Cast(parentEntity))
893 int userID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(parentEntity);
900 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(parentEntity.
FindComponent(FactionAffiliationComponent));
901 if (!factionAffiliation)
904 Faction affiliatedFaction = factionAffiliation.GetAffiliatedFaction();
905 if (!affiliatedFaction)
908 FactionKey userFactionKey = affiliatedFaction.GetFactionKey();
930 SCR_NotificationsComponent.SendToPlayer(userID, notification);
943 super.EOnInit(owner);
947 BaseGameMode gameMode =
GetGame().GetGameMode();
952 if (playerSpawnPointManager)
960 PlayerController playerController =
GetGame().GetPlayerController();
961 if (!playerController)
964 SCR_PlayerControllerGroupComponent groupComponent = SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
983 super.OnDelete(owner);
989 BaseGameMode gameMode =
GetGame().GetGameMode();
994 if (playerSpawnPointManager)
1002 s_aDebugShapes.Clear();
1005 SCR_PlayerControllerGroupComponent groupComponent = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
ArmaReforgerScripted GetGame()
void ConnectToDeployableSpawnPointSystem()
bool m_bDeployableSpawnPointsEnabled
ResourceName m_sSpawnPointPrefab
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
RplComponent m_RplComponent
SCR_SpawnPoint m_SpawnPoint
void SCR_CharacterRegistrationComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_CharacterSoundComponentClass GetComponentData()
Get all prefabs that have the spawner data
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ESpawnPointBudgetType
enum SCR_ESpawnPointBudgetType EntityEditorProps(category:"GameScripted/DeployableItems", description:"")
proto external Managed FindComponent(typename typeName)
Object holding reference to resource. In destructor release the resource.
void DecreaseDeployedRadioCount()
Created in SCR_GameModeCampaign.
bool IsEntityInFactionRadioSignal(notnull IEntity entity, notnull Faction faction)
override bool DoCheckIfFactionFriendly(Faction faction)
static Faction GetEntityFaction(notnull IEntity entity)
int GetBases(notnull out array< SCR_MilitaryBaseComponent > bases)
static SCR_MilitaryBaseSystem GetInstance()
ScriptInvokerInt GetOnSpawnPointTicketAmountChanged()
SCR_ESpawnPointBudgetType GetDeployableSpawnPointBudgetType()
SCR_SpawnPointBudgetInvoker GetOnSpawnPointBudgetTypeChanged()
int GetDeployableSpawnPointTicketAmount()
bool SetResourceValue(float value, bool notifyChange=true)
Deployable spawn point with configurable conditions.
SCR_DeployableSpawnPoint CreateSpawnPoint()
bool m_bUnlockActionsForAllGroups
bool IsDeployLimitReachedLocal()
void OnGroupRemoved(SCR_AIGroup group)
int m_iMaxSpawnPointsPerGroup
bool CanDeployBePerformed(out string reason)
bool m_bAllowAllGroupsToSpawn
bool m_bSpawnLimitReached
void OnSpawnPointBudgetTypeChanged(SCR_ESpawnPointBudgetType budgetType)
bool IsCustomLoadoutsAllowed()
override void Update(float timeSlice)
bool CanBeDeployedAtPosition(vector position, notnull IEntity userEntity, out int notification=-1)
override bool CanDismantleBeShown(notnull IEntity userEntity)
bool m_bQueryFactionRadioRange
void OnSpawnPointTicketAmountChanged(int tickets)
bool CanInfoBeShown(notnull IEntity userEntity)
void ShowInfo(notnull IEntity userEntity)
Display amount of respawns left - called from SCR_ShowDeployableSpawnPointInfo.PerformAction.
static ref array< int > s_aActiveDeployedSpawnPointGroupIDs
int m_iRespawnGenerationTime
ResourceName m_sSpawnPointPrefabSupplies
string m_sNoGroupJoinedMessage
void SetSuppliesValue(float value, bool refreshDeployedContainer=true)
override void Deploy(IEntity userEntity, bool reload=false)
Check if deploy is possible, then call super.Deploy().
string m_sOutsideDeployAreaMessage
bool m_bAllowCustomLoadouts
float m_fQueryRadiusBases
float m_fRespawnGenerationTimer
SCR_AIGroup m_LocalPlayerGroup
bool m_bPlaySoundOnZoneEntered
bool CanToggleLoadoutSpawningBeShown(notnull IEntity userEntity)
SCR_ESpawnPointBudgetType GetBudgetType()
float m_fQueryRadiusCharacters
float GetQueryRadiusCharacters()
bool CanOpenStorageBeShown(notnull IEntity userEntity)
int m_iRespawnGenerationAmount
bool m_bUnlockActionsForEnemyFactions
bool EntityQuery(notnull array< IEntity > entities, notnull Faction spawnPointFaction, vector spawnPointOrigin)
Returns true when there are no entities in the specified area that could prevent deploying.
float m_fQueryRadiusSpawnPoints
bool m_bIgnoreEnemySpawnPoints
bool m_bIsGroupLimitReached
void GenerateRespawns(int amount)
void SetRespawnCount(int respawnCount)
float GetSuppliesValue(bool refreshFromDeployedContainer=true)
void OnGroupChanged(int groupID)
bool GetAllowAllGroupsToSpawn()
string m_sDeployLimitReachedMessage
bool CanActionBeShown(notnull IEntity userEntity, bool checkFaction, bool checkGroupID)
void DeployByGroup(notnull SCR_AIGroup group, IEntity userEntity=null, bool reload=false)
bool m_bShowNotificationOnZoneEntered
SCR_ESpawnPointBudgetType m_eRespawnBudgetType
override void OnDelete(IEntity owner)
void ToggleSpawningWithLoadout(IEntity userEntity=null)
Toggles spawning with custom loadout.
bool m_bIsOutsideExclusionZone
void SetSpawningWithLoadout(bool allow, IEntity userEntity=null)
void SetBudgetType(SCR_ESpawnPointBudgetType budgetType)
bool GetIgnoreEnemyCharacters()
void RPC_AddSpawnPointGroupBroadcast(int groupID)
override bool CanDeployBeShown(notnull IEntity userEntity)
bool m_bIgnoreEnemyCharacters
override void EOnInit(IEntity owner)
override void Dismantle(IEntity userEntity=null, bool reload=false)
Cache respawn count; then call super.Dismantle().
void SetMaxRespawns(int maxRespawns)
void RPC_RemoveSpawnPointGroupBroadcast(int groupID)
void RPC_PlaySoundOnZoneEnteredBroadcast(bool entered)
Basically SCR_SpawnPoint with the ability to limit respawn amount.
void SetGroupID(int groupID)
void SetAllowAllGroupsToSpawn(bool allowAllGroupsToSpawn)
void SetRespawnCount(int respawnCount)
void SetMaxRespawns(int maxRespawns)
void SetLoadoutAllowed(bool allow)
void SetBudgetType(SCR_ESpawnPointBudgetType budgetType)
Spawn point entity defines positions on which players can possibly spawn.
Instance of created debug visualizer.
IEntity GetOwner()
Owner entity of the fuel tank.
@ NONE
When Shape is created and not initialized yet.
SCR_FieldOfViewSettings Attribute
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.