Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkPluginSpawnPoint.c
Go to the documentation of this file.
3{
4 [Attribute("0", desc: "Find empty position for spawning within given radius. When none is found, entity position will be used.")]
5 float m_fSpawnRadius;
6
7 [Attribute("US", UIWidgets.EditBox, "Determines which faction can spawn on this spawn point."), RplProp(onRplName: "OnSetFactionKey")]
8 string m_sFaction;
9
10 [Attribute("0")]
11 bool m_bShowInDeployMapOnly;
12
13 [Attribute("0", desc: "Use custom timer when deploying on this spawn point. Takes the remaining respawn time from SCR_TimedSpawnPointComponent")]
14 bool m_bTimedSpawnPoint;
15
16 [Attribute()]
17 ref SCR_UIInfo m_Info;
18
19 [Attribute("0", desc: "Allow usage of Spawn Positions in range")]
20 bool m_bUseNearbySpawnPositions;
21
22 [Attribute("100", desc: "Spawn position detection radius, in metres")]
23 float m_fSpawnPositionUsageRange;
24
25 [Attribute("0", desc: "Additional respawn time (in seconds) when spawning on this spawn point"), RplProp()]
26 float m_fRespawnTime;
27
28 [Attribute(defvalue: "1", desc: "Pass Spawned Entity for Actions On Spawn Point Used. Otherwise it will pass the slot (layer) this plugin is attached to.")]
29 bool m_bPassSpawnedEntity;
30
31 [Attribute(UIWidgets.Auto, desc: "What to do once Spawn Point is used",)]
32 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnSpawnPointUsed;
33
34 IEntity m_Asset;
35
36 //------------------------------------------------------------------------------------------------
39 override void Init(SCR_ScenarioFrameworkLayerBase object)
40 {
41 if (!object)
42 return;
43
44 super.Init(object);
45 m_Asset = object.GetSpawnedEntity();
46 if (!m_Asset)
47 return;
48
49 SCR_SpawnPoint spawnPoint = SCR_SpawnPoint.Cast(m_Asset);
50 if (!spawnPoint)
51 return;
52
53 // Resolve Alias
54 SCR_FactionAliasComponent factionAliasComponent = SCR_FactionAliasComponent.Cast(GetGame().GetFactionManager().FindComponent(SCR_FactionAliasComponent));
55 if (factionAliasComponent)
56 m_sFaction = factionAliasComponent.ResolveFactionAlias(m_sFaction);
57
58 spawnPoint.SetSpawnRadius(m_fSpawnRadius);
59 spawnPoint.SetFactionKey(m_sFaction);
60 spawnPoint.SetVisibleInDeployMapOnly(m_bShowInDeployMapOnly);
61 spawnPoint.SetIsTimed(m_bTimedSpawnPoint);
62
63 if (m_Info)
64 {
65 spawnPoint.LinkInfo(m_Info);
66 spawnPoint.SetSpawnPointName(m_Info.GetName());
67 }
68
69 spawnPoint.SetUseNearbySpawnPositions(m_bUseNearbySpawnPositions);
70 spawnPoint.SetSpawnPositionRange(m_fSpawnPositionUsageRange);
71 spawnPoint.SetRespawnTime(m_fRespawnTime);
72
73 spawnPoint.GetOnSpawnPointFinalizeSpawn().Insert(OnFinalizeSpawnDone_S);
74 }
75
76 //------------------------------------------------------------------------------------------------
81 void OnFinalizeSpawnDone_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, IEntity entity)
82 {
83 // Here you can debug specific Plugin instance.
84 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Plugin Inspector
85 if (m_bDebug)
86 Print("[SCR_ScenarioFrameworkPluginSpawnPoint.OnFinalizeSpawnDone_S] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
87
88 if (!data || !m_Asset)
89 return;
90
92 if (!spawnPointData)
93 return;
94
95 SCR_SpawnPoint spawnPoint = spawnPointData.GetSpawnPoint();
96 if (!spawnPoint)
97 return;
98
99 if (spawnPoint != m_Asset)
100 return;
101
102 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnSpawnPointUsed)
103 {
104 if (m_bPassSpawnedEntity)
105 action.OnActivate(entity);
106 else
107 action.OnActivate(m_Object.GetOwner());
108 }
109 }
110
111 //------------------------------------------------------------------------------------------------
112 override array<ref SCR_ScenarioFrameworkActionBase> GetActions()
113 {
114 return m_aActionsOnSpawnPointUsed;
115 }
116}
override void Init()
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
Get all prefabs that have the spawner data
array< ref SCR_MenuActionPreset > GetActions()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Spawn point entity defines positions on which players can possibly spawn.
void SetFactionKey(string factionKey)
static SCR_SpawnPointFinalizeSpawn_Invoker GetOnSpawnPointFinalizeSpawn()
void SetUseNearbySpawnPositions(bool use)
void SetSpawnPositionRange(float range)
void SetRespawnTime(float time)
void SetSpawnRadius(float radius)
void SetVisibleInDeployMapOnly(bool visible)
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
SCR_FieldOfViewSettings Attribute