Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_RadioVehicleSpawnPointComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/GameMode", description: "Spawn point entity", visible: false)]
5
6class SCR_RadioVehicleSpawnPoint : SCR_SpawnPoint
7{
10
11 //------------------------------------------------------------------------------------------------
12 override void EOnInit(IEntity owner)
13 {
14 super.EOnInit(owner);
15
16 BaseGameMode gameMode = GetGame().GetGameMode();
17 if (gameMode)
19
20 IEntity parent = owner.GetParent();
21 while (parent)
22 {
23 if (Vehicle.Cast(parent))
24 {
25 m_PhysicsVehicle = Vehicle.Cast(parent);
26 break;
27 }
28
29 parent = parent.GetParent();
30 }
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override bool IsSpawnPointEnabled()
35 {
36 return m_bSpawnPointEnabled && (!m_PlayerSpawnPointManager || m_PlayerSpawnPointManager.IsRadioVehicleSpawningEnabled());
37 }
38
39 //------------------------------------------------------------------------------------------------
40 override bool CanReserveFor_S(int playerId, out SCR_ESpawnResult result = SCR_ESpawnResult.SPAWN_NOT_ALLOWED)
41 {
42 if (!super.CanReserveFor_S(playerId, result))
43 {
44 if (m_PlayerSpawnPointManager && !m_PlayerSpawnPointManager.IsRadioVehicleSpawningEnabled())
45 result = SCR_ESpawnResult.NOT_ALLOWED_RADIO_VEHICLE_SPAWNING_DISABLED;
46
47 return false;
48 }
49
50 //~ Vehicle is moving
52 {
53 Physics physics = m_PhysicsVehicle.GetPhysics();
54 if (physics && (physics.GetVelocity() != vector.Zero || physics.GetAngularVelocity() != vector.Zero))
55 {
56 result = SCR_ESpawnResult.NOT_ALLOWED_VEHICLE_MOVING;
57 return false;
58 }
59 }
60
61
62 //~ Check if occupied
64 {
65 Faction defaultFaction = m_FactionAffiliationComponent.GetDefaultAffiliatedFaction();
66 Faction currentFaction = m_FactionAffiliationComponent.GetAffiliatedFaction();
67
68 if (!currentFaction)
69 return true;
70
71 if (defaultFaction != currentFaction)
72 {
73 SCR_Faction scrDefaultFaction = SCR_Faction.Cast(defaultFaction);
74
75 if (!scrDefaultFaction || !scrDefaultFaction.IsFactionFriendly(currentFaction))
76 {
77 result = SCR_ESpawnResult.NOT_ALLOWED_SPAWNPOINT_OCCUPIED_BY_HOSTILE;
78 return false;
79 }
80 }
81 }
82
83 return true;
84 }
85
86 //------------------------------------------------------------------------------------------------
87 protected override void InitFactionAffiliation(IEntity owner)
88 {
89 IEntity parent = owner.GetParent();
90 while (parent && !m_FactionAffiliationComponent)
91 {
94 parent = parent.GetParent();
95 }
96
99
101 {
102 Faction faction = m_FactionAffiliationComponent.GetDefaultAffiliatedFaction();
103 if (faction)
104 m_sFaction = faction.GetFactionKey();
105 }
106 }
107}
ArmaReforgerScripted GetGame()
Definition game.c:1398
FactionAffiliationComponent m_FactionAffiliationComponent
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_ESpawnResult
SCR_RadioVehicleSpawnPointClass m_PlayerSpawnPointManager
proto external Managed FindComponent(typename typeName)
proto external IEntity GetParent()
Spawn point entity defines positions on which players can possibly spawn.
void InitFactionAffiliation(IEntity owner)
bool CanReserveFor_S(int playerId, out SCR_ESpawnResult result=SCR_ESpawnResult.SPAWN_NOT_ALLOWED)
bool IsSpawnPointEnabled()
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24
override void EOnInit(IEntity owner)