37 [
Attribute(
"0",
UIWidgets.EditBox,
"If bigger than 0, defines radius in which spawn will be randomized")]
40 [
Attribute(
"",
UIWidgets.EditBox,
"Determines which faction can spawn on this spawn point."),
RplProp(onRplName:
"OnSetFactionKey")]
46 [
Attribute(
"0",
desc:
"Use custom timer when deploying on this spawn point. Takes the remaining respawn time from SCR_TimedSpawnPointComponent")]
58 [
Attribute(
"0",
desc:
"Allow usage of Spawn Positions in range")]
61 [
Attribute(
"100",
desc:
"Spawn position detection radius, in metres")]
64 [
Attribute(
"0",
desc:
"Additional respawn time (in seconds) when spawning on this spawn point"),
RplProp()]
67 [
Attribute(
"0",
desc:
"Spawn directly in the location of the spawnpoint, ignoring any checks")]
77 private static ref array<SCR_SpawnPoint> m_aSpawnPoints =
new array<SCR_SpawnPoint>();
146 if (!s_OnSpawnPointFinalizeSpawn)
149 return s_OnSpawnPointFinalizeSpawn;
225 #ifdef _ENABLE_RESPAWN_LOGS
231 Debug.Error(
string.Format(
"SCR_SpawnPoint reservation for playerId: %1 failed!", playerId));
246 #ifdef _ENABLE_RESPAWN_LOGS
279 string factionKey =
string.Empty;
281 factionKey = faction.GetFactionKey();
288 auto mapDescriptor = SCR_MapDescriptorComponent.Cast(spawnPoint.FindComponent(SCR_MapDescriptorComponent));
292 bool visible = show && !factionKey.IsEmpty() && spawnPoint.GetFactionKey() == factionKey;
293 if (mapDescriptor.Item())
294 mapDescriptor.Item().SetVisible(visible);
305 return RplId.Invalid();
320 RplComponent rplComponent = RplComponent.Cast(instance);
330 SCR_SpawnPositionComponentManager spawnPosManagerComponent = SCR_SpawnPositionComponentManager.GetInstance();
331 if (!spawnPosManagerComponent)
334 array<SCR_SpawnPositionComponent> positions = {};
339 SCR_SpawnPositionComponent
position;
341 while (!positions.IsEmpty())
343 position = positions.GetRandomElement();
347 pos =
position.GetOwner().GetOrigin();
348 rot =
position.GetOwner().GetAngles();
413 if (spawnPointIndex >= 0 && spawnPointIndex < m_aSpawnPoints.Count())
414 return m_aSpawnPoints[spawnPointIndex];
423 return m_aSpawnPoints.Find(spawnPoint);
438 return m_aSpawnPoints.Count();
480 Event_SpawnPointFactionAssigned.Invoke(
this);
514 return character &&
vector.DistanceSq(character.GetOrigin(),
GetOrigin()) < range*range;
519 static array<SCR_SpawnPoint> GetSpawnPoints()
521 return m_aSpawnPoints;
528 if (!m_aSpawnPoints || m_aSpawnPoints.IsEmpty())
531 return m_aSpawnPoints.GetRandomElement();
536 static SCR_SpawnPoint GetRandomSpawnPoint(SCR_ChimeraCharacter character)
541 return GetRandomSpawnPointForFaction(character.GetFactionKey());
546 static array<SCR_SpawnPoint> GetSpawnPointsForPlayer(SCR_ChimeraCharacter character)
548 string factionKey =
string.Empty;
550 factionKey = character.GetFactionKey();
552 return GetSpawnPointsForFaction(factionKey);
558 static array<SCR_SpawnPoint> GetSpawnPointsForFaction(
string factionKey)
560 array<SCR_SpawnPoint> factionSpawnPoints =
new array<SCR_SpawnPoint>();
561 if (factionKey.IsEmpty())
562 return factionSpawnPoints;
564 array<SCR_SpawnPoint> spawnPoints = GetSpawnPoints();
567 if (spawnPoint && spawnPoint.GetFactionKey() == factionKey)
568 factionSpawnPoints.Insert(spawnPoint);
570 return factionSpawnPoints;
576 static int GetSpawnPointCountForFaction(
string factionKey)
578 if (factionKey.IsEmpty())
584 if (!spawnPoint)
continue;
585 if (spawnPoint.GetFactionKey() == factionKey)
593 static SCR_SpawnPoint GetRandomSpawnPointForFaction(
string factionKey)
595 array<SCR_SpawnPoint> spawnPoints = GetSpawnPointsForFaction(factionKey);
596 if (!spawnPoints.IsEmpty())
597 return spawnPoints.GetRandomElement();
634 void SetInfo(SCR_UIInfo info)
651 void SetSpawnPointName(
string name)
654 Replication.BumpMe();
665 void SetIsTimed(
bool isTimed)
671 void LinkInfo(SCR_UIInfo info)
678 override void SetColorAndText()
683 FactionManager factionManager =
GetGame().GetFactionManager();
689 m_iColor = faction.GetFactionColor().PackToInt();
713 bool PrepareSpawnedEntity_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnData
data,
IEntity entity)
744 bool CanFinalizeSpawn_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnData
data,
IEntity entity)
755 void OnFinalizeSpawnDone_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnData
data,
IEntity entity)
757 if (s_OnSpawnPointFinalizeSpawn)
758 s_OnSpawnPointFinalizeSpawn.Invoke(requestComponent,
data, entity);
762 override void EOnInit(
IEntity owner)
764 super.EOnInit(owner);
765 if (!
GetGame().GetWorldEntity())
781 m_aSpawnPoints.Insert(
this);
782 Event_OnSpawnPointCountChanged.Invoke(
m_sFaction);
783 Event_SpawnPointAdded.Invoke(
this);
813 Event_SpawnPointAdded.Invoke(
this);
817 Event_OnSpawnPointCountChanged.Invoke(
m_sFaction);
837 m_aSpawnPoints.RemoveItem(
this);
841 Event_OnSpawnPointCountChanged.Invoke(
m_sFaction);
842 Event_SpawnPointRemoved.Invoke(
this);
854 SCR_RandomSpawnManagerComponent randomSpawnManager = SCR_RandomSpawnManagerComponent.Cast(
GetGame().
GetGameMode().FindComponent(SCR_RandomSpawnManagerComponent));
856 if (!randomSpawnManager)
868 if (!randomSpawnManager.RequestSpawnPosition(
m_sFaction, m_aSpawnPoints, safePosition))
873 vOutPosition = safePosition;
874 vOutRotation = {
Math.RandomFloat(0, 360), 0, 0};
ArmaReforgerScripted GetGame()
SCR_BaseGameMode GetGameMode()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
override SCR_UIInfo GetInfo()
Get all prefabs that have the spawner data
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
override string GetSpawnPointName()
SCR_PositionClass GenericEntityClass SCR_Position(IEntitySource src, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void GetChildren(out array< SCR_ScenarioFrameworkLayerBase > children)
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
func SpawnPointDelegateMethod
ScriptInvokerBase< SpawnPointNameChangedInvoker > SCR_SpawnPointNameChanged_Invoker
func SpawnPointNameChangedInvoker
func SpawnPointFinalizeSpawnInvoker
ScriptInvokerBase< SpawnPointDelegateMethod > SpawnPointInvoker
ScriptInvokerBase< SpawnPointFinalizeSpawnInvoker > SCR_SpawnPointFinalizeSpawn_Invoker
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external void SetAngles(vector angles)
Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis.
proto external void SetOrigin(vector orig)
proto external IEntity GetSibling()
Replication item identifier.
Spawn point entity defines positions on which players can possibly spawn.
bool ReserveFor_S(int playerId)
static SCR_SpawnPoint GetSpawnPointByIndex(int spawnPointIndex)
Return spawn point or null if out of bounds.
override bool RplSave(ScriptBitWriter writer)
static int GetSpawnPointIndex(SCR_SpawnPoint spawnPoint)
Return spawn point index or -1 if not existent.
bool IsSpawnPointVisibleForPlayer(int pid)
bool GetVisibleInDeployMapOnly()
void SetFactionKey(string factionKey)
void InitFactionAffiliation(IEntity owner)
bool m_bSpawnPointEnabled
int m_iRandomSpawnMaxAttempts
ref ScriptInvokerBool m_OnSetSpawnPointEnabled
static SCR_SpawnPointFinalizeSpawn_Invoker GetOnSpawnPointFinalizeSpawn()
static ref SCR_SpawnPointNameChanged_Invoker OnSpawnPointNameChanged
bool m_bUseNearbySpawnPositions
vector m_vCylinderVectorOffset
void ApplyFactionChange(FactionAffiliationComponent owner, Faction previousFaction, Faction newFaction)
array< SCR_Position > GetChildSpawnPoints()
static SCR_SpawnPoint GetSpawnPointByRplId(RplId id)
static void ShowSpawnPointDescriptors(bool show, Faction faction)
bool CanReserveFor_S(int playerId, out SCR_ESpawnResult result=SCR_ESpawnResult.SPAWN_NOT_ALLOWED)
void SCR_SpawnPoint(IEntitySource src, IEntity parent)
void SetPriority(int priority)
float m_fPlayerCylinderHeight
void SetUseNearbySpawnPositions(bool use)
SCR_FactionAffiliationComponent m_FactionAffiliationComponent
void SetFaction(Faction faction)
void SetSpawnPositionRange(float range)
bool GetRandomPositionAndRotation(out vector vOutPosition, out vector vOutRotation)
ScriptInvokerBool GetOnSpawnPointEnabled()
bool IsSpawnPointEnabled()
bool RplLoad(ScriptBitReader reader)
bool GetEmptyPositionAndRotationInRange(out vector pos, out vector rot)
bool m_bShowInDeployMapOnly
void SetRespawnTime(float time)
float m_fRandomSpawnRadius
ref set< int > m_ReservationLocks
void SetSpawnRadius(float radius)
void SetSpawnPointEnabled_S(bool enabled)
static int CountSpawnPoints()
bool IsSpawnPointActive()
float m_fPlayerCylinderRadius
RplComponent m_RplComponent
void ClearReservationFor_S(int playerId)
bool IsReservedFor_S(int playerId)
void SetVisibleInDeployMapOnly(bool visible)
void GetPositionAndRotation(out vector pos, out vector rot)
float GetSpawnPositionRange()
float m_fSpawnPositionUsageRange
ref array< SCR_Position > m_aChildren
bool IsSpawnPointRandom()
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)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
RespawnSystemComponentClass GameComponentClass vector vector rotation
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
proto native vector Vector(float x, float y, float z)