8 [
Attribute(
"1",
desc:
"How often will the spawn's position be updated to match assigned player's position (in seconds).",
category:
"Player Spawn Point")]
9 protected float m_fUpdateInterval;
11 [
Attribute(
desc:
"Spawn point visualization. Original 'Info' attribute will be ignored.",
category:
"Player Spawn Point")]
14 [
RplProp(onRplName:
"OnSetPlayerID")]
20 protected Faction m_CachedFaction;
21 protected IEntity m_TargetPlayer;
25 IEntity GetTargetPlayer()
27 return m_TargetPlayer;
36 if (playerID ==
m_iPlayerID || !Replication.IsServer())
44 IEntity player = SCR_PossessingManagerComponent.GetPlayerMainEntity(
m_iPlayerID);
67 LinkInfo(m_PlayerInfo);
84 Print(
string.Format(
"Couldn't enable point, mismatching playerId(s), expected: %1, got: %2",
m_iPlayerID, playerId), LogLevel.WARNING);
89 m_TargetPlayer = playerEntity;
100 Print(
string.Format(
"Couldn't disable point, mismatching playerId(s), expected: %1, got: %2",
m_iPlayerID, playerId), LogLevel.WARNING);
106 m_CachedFaction =
null;
107 m_TargetPlayer =
null;
117 ClearFlags(EntityFlags.STATIC,
false);
121 Replication.BumpMe();
136 SetFlags(EntityFlags.STATIC,
false);
140 Replication.BumpMe();
149 vector pos = m_TargetPlayer.GetOrigin();
155 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
164 super.GetPositionAndRotation(pos, rot);
169 IEntity vehicle = compartmentAccessTarget.GetVehicle();
171 rot = vehicle.GetAngles();
173 rot = m_TargetPlayer.GetAngles();
184 if (!compartmentAccessTarget)
187 return Vehicle.Cast(compartmentAccessTarget.GetVehicle());
194 if (!super.CanReserveFor_S(playerId))
201 BaseCompartmentManagerComponent compartmentManager = BaseCompartmentManagerComponent.Cast(targetVehicle.FindComponent(BaseCompartmentManagerComponent));
202 array<BaseCompartmentSlot> compartments = {};
203 int count = compartmentManager.GetCompartments(compartments);
204 for (
int i = 0; i < count; i++)
206 BaseCompartmentSlot slot = compartments[i];
207 if (!slot.IsOccupied() && !slot.IsReserved())
223 #ifdef _ENABLE_RESPAWN_LOGS
224 Print(
string.Format(
"%1::PrepareSpawnedEntity_S(playerId: %2, data: %3, entity: %4)", Type().ToString(),
225 requestComponent.GetPlayerId(),
data, entity), LogLevel.NORMAL);
229 if (!super.PrepareSpawnedEntity_S(requestComponent,
data, entity))
234 if (!compartmentAccessPlayer)
249 #ifdef _ENABLE_RESPAWN_LOGS
250 Print(
string.Format(
"%1::PrepareSpawnedEntityForVehicle_S(playerId: %2, data: %3, entity: %4, vehicle: %5)", Type().ToString(),
251 requestComponent.GetPlayerId(),
data, entity, vehicle), LogLevel.NORMAL);
255 BaseCompartmentManagerComponent compartmentManager = BaseCompartmentManagerComponent.Cast(vehicle.FindComponent(BaseCompartmentManagerComponent));
257 array<BaseCompartmentSlot> compartments = {};
258 int count = compartmentManager.GetCompartments(compartments);
259 for (
int i = 0; i < count; i++)
261 BaseCompartmentSlot slot = compartments[i];
262 if (!slot.IsOccupied() && (!slot.IsReserved() || slot.IsReservedBy(entity)))
263 return accessComponent.MoveInVehicle(vehicle, slot);
272 if (!super.CanFinalizeSpawn_S(requestComponent,
data, entity))
277 if (accessComponent && accessComponent.IsGettingIn())