Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseDeployableSpawnPointComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/DeployableItems", description: "")]
5
7class SCR_BaseDeployableSpawnPointComponent : SCR_BaseDeployableInventoryItemComponent
8{
9 protected static ref array<SCR_BaseDeployableSpawnPointComponent> s_aActiveDeployedSpawnPoints = {};
10
11 protected static ref ScriptInvokerInt s_OnSpawnPointDismantled;
12
13 // Setup
14 [Attribute("{35347E7AA6BDF8CE}Prefabs/MP/Spawning/ItemSpecifics/RestrictedDeployableSpawnPoint_Radio.et", uiwidget: UIWidgets.ResourcePickerThumbnail, params: "et", category: "Setup")]
16
17 // General
18 [Attribute(category: "General")]
20
22
24
25 //------------------------------------------------------------------------------------------------
26 static ScriptInvokerInt GetOnSpawnPointDismantled()
27 {
28 if (!s_OnSpawnPointDismantled)
29 s_OnSpawnPointDismantled = new ScriptInvokerInt();
30
31 return s_OnSpawnPointDismantled;
32 }
33
34 //------------------------------------------------------------------------------------------------
41
42 //------------------------------------------------------------------------------------------------
43 protected void ToggleRadioChatter(bool enable)
44 {
45 SignalsManagerComponent signalsManagerComp = SignalsManagerComponent.Cast(GetOwner().FindComponent(SignalsManagerComponent));
46 if (!signalsManagerComp)
47 return;
48
49 int radioChatter = signalsManagerComp.FindSignal("DeployableRadioChatter");
50
51 if (enable)
52 signalsManagerComp.SetSignalValue(radioChatter, 1);
53 else
54 signalsManagerComp.SetSignalValue(radioChatter, 0);
55 }
56
57 //------------------------------------------------------------------------------------------------
59 {
60 Resource resource = Resource.Load(m_sSpawnPointPrefab);
61 if (!resource.IsValid())
62 return null;
63
65 params.Transform = m_aOriginalTransform;
66 params.TransformMode = ETransformMode.WORLD;
67 return SCR_DeployableSpawnPoint.Cast(GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), params));
68 }
69
70 //------------------------------------------------------------------------------------------------
73 override void Deploy(IEntity userEntity = null, bool reload = false)
74 {
75 if (!m_RplComponent || m_RplComponent.IsProxy())
76 return;
77
78 if (m_bIsDeployed)
79 return;
80
81 super.Deploy(userEntity, reload);
82
84 if (!m_SpawnPoint)
85 return;
86
87 m_SpawnPoint.SetDeployableSpawnPointComponent(this);
88 m_SpawnPoint.SetFactionKey(m_FactionKey);
89
91
93 if (data && data.IsSoundEnabled())
95 }
96
97 //------------------------------------------------------------------------------------------------
100 override void Dismantle(IEntity userEntity = null, bool reload = false)
101 {
102 if (!m_RplComponent || m_RplComponent.IsProxy())
103 return;
104
105 if (!m_bIsDeployed)
106 return;
107
108 super.Dismantle(userEntity, reload);
109
110 if (m_SpawnPoint)
111 {
112 RplComponent rplComp = RplComponent.Cast(m_SpawnPoint.FindComponent(RplComponent));
113 if (!rplComp)
114 return;
115
116 rplComp.DeleteRplEntity(m_SpawnPoint, false);
117 }
118
119 s_aActiveDeployedSpawnPoints.RemoveItem(this);
120
121 int userID = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(userEntity);
122 if (s_OnSpawnPointDismantled)
123 s_OnSpawnPointDismantled.Invoke(userID);
124
126 if (data && data.IsSoundEnabled())
128 }
129
130 //------------------------------------------------------------------------------------------------
131 protected void OnSpawnPointDeployingEnabledChanged(bool enabled)
132 {
134
135 if (!m_RplComponent || m_RplComponent.IsProxy())
136 return;
137
138 if (enabled)
139 {
140 if (!m_bIsDeployed && m_bWasDeployed)
141 {
142 m_bWasDeployed = false;
143 Deploy(m_PreviousOwner);
144 }
145
146 return;
147 }
148
149 if (m_bIsDeployed)
150 {
151 m_PreviousOwner = GetGame().GetPlayerManager().GetPlayerControlledEntity(m_iItemOwnerID);
152 m_bWasDeployed = true;
153 Dismantle();
154 }
155 }
156
157 //------------------------------------------------------------------------------------------------
159 static array<SCR_BaseDeployableSpawnPointComponent> GetActiveDeployedSpawnPoints()
160 {
162 }
163
164 //------------------------------------------------------------------------------------------------
167 {
168 return m_SpawnPoint;
169 }
170
171 //------------------------------------------------------------------------------------------------
174 void Update(float timeSlice);
175
176 //------------------------------------------------------------------------------------------------
178 {
179 World world = GetOwner().GetWorld();
181 if (!updateSystem)
182 return;
183
184 updateSystem.Register(this);
185 }
186
187 //------------------------------------------------------------------------------------------------
189 {
190 World world = GetOwner().GetWorld();
192 if (!updateSystem)
193 return;
194
195 updateSystem.Unregister(this);
196 }
197
198 //------------------------------------------------------------------------------------------------
199 override void EOnInit(IEntity owner)
200 {
201 super.EOnInit(owner);
202
203 BaseGameMode gameMode = GetGame().GetGameMode();
204 if (!gameMode)
205 return;
206
208 if (!playerSpawnPointManager)
209 {
211 return;
212 }
213
216 }
217
218 //------------------------------------------------------------------------------------------------
219 override void OnDelete(IEntity owner)
220 {
221 super.OnDelete(owner);
222
224
225 s_aActiveDeployedSpawnPoints.RemoveItem(this);
226
227 if (s_OnSpawnPointDismantled)
228 s_OnSpawnPointDismantled.Invoke(-1);
229
230 if (!m_bIsDeployed || !m_RplComponent || m_RplComponent.IsProxy())
231 return;
232
233 if (!m_SpawnPoint || m_SpawnPoint.IsDeleted())
234 return;
235
236 RplComponent rplComp = RplComponent.Cast(m_SpawnPoint.FindComponent(RplComponent));
237 if (!rplComp)
238 return;
239
240 rplComp.DeleteRplEntity(m_SpawnPoint, false);
241 }
242
243 //------------------------------------------------------------------------------------------------
244 // destructor
246 {
247 BaseGameMode gameMode = GetGame().GetGameMode();
248 if (gameMode)
249 {
251 if (playerSpawnPointManager)
253 }
254
255 if (m_bIsDeployed && Replication.IsServer())
256 s_aActiveDeployedSpawnPoints.RemoveItem(this);
257 }
258}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_DeployableSpawnPoint CreateSpawnPoint()
void ToggleRadioChatter(bool enable)
void ~SCR_BaseDeployableSpawnPointComponent()
override void OnRplDeployed()
SCR_BaseDeployableSpawnPointComponentClass s_aActiveDeployedSpawnPoints
Base class which all deployable spawn points / radios inherit from.
void ConnectToDeployableSpawnPointSystem()
void OnSpawnPointDeployingEnabledChanged(bool enabled)
override void Dismantle(IEntity userEntity=null, bool reload=false)
void DisconnectFromDeployableSpawnPointSystem()
ResourceName m_sSpawnPointPrefab
RplComponent m_RplComponent
SCR_SpawnPoint m_SpawnPoint
SCR_SpawnPoint GetSpawnPoint()
bool Deploy(SCR_EMobileAssemblyStatus status, int playerId=0, bool silent=false)
SCR_CharacterSoundComponentClass GetComponentData()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Get all prefabs that have the spawner data
ScriptInvokerBase< ScriptInvokerIntMethod > ScriptInvokerInt
proto external BaseWorld GetWorld()
Main replication API.
Definition Replication.c:14
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
Base class which all deployable inventory items inherit from.
void Register(SCR_BaseDeployableSpawnPointComponent component)
void Unregister(SCR_BaseDeployableSpawnPointComponent component)
Spawn point entity defines positions on which players can possibly spawn.
Definition World.c:16
void EntitySpawnParams()
Definition gameLib.c:130
IEntity GetOwner()
Owner entity of the fuel tank.
override void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute