Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PossessSpawnRequestComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Respawn/PlayerController")]
5
6class SCR_PossessSpawnRequestComponent : SCR_SpawnRequestComponent
7{
8 //------------------------------------------------------------------------------------------------
9 override typename GetHandlerType()
10 {
11 return SCR_PossessSpawnHandlerComponent;
12 }
13
14 //------------------------------------------------------------------------------------------------
15 override typename GetDataType()
16 {
18 }
19
20 //------------------------------------------------------------------------------------------------
21 protected override bool DoCanRequestRespawn(SCR_SpawnData data)
22 {
23 #ifdef _ENABLE_RESPAWN_LOGS
24 Print(string.Format("%1::DoCanRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
26 #endif
27
29 if (!possessData)
30 return false;
31
32 Rpc(Rpc_CanRequestRespawn_S, possessData.GetRplId());
33 return true;
34 }
35
36 //------------------------------------------------------------------------------------------------
37 [RplRpc(RplChannel.Reliable, RplRcver.Server)]
38 private void Rpc_CanRequestRespawn_S(RplId entityRplId)
39 {
40 #ifdef _ENABLE_RESPAWN_LOGS
41 Print(string.Format("%1::Rpc_CanRequestRespawn_S(playerId: %2, entityRplId: %3)", Type().ToString(),
43 entityRplId), LogLevel.NORMAL);
44 #endif
45
46 SCR_PossessSpawnData data = SCR_PossessSpawnData.FromRplId(entityRplId);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 protected override bool DoRequestRespawn(SCR_SpawnData data)
52 {
53 #ifdef _ENABLE_RESPAWN_LOGS
54 Print(string.Format("%1::DoRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
56 #endif
57
59 if (!possessData)
60 return false;
61
62 Rpc(Rpc_RequestRespawn_S, possessData.GetRplId(), possessData.GetSkipPreload());
63 return true;
64 }
65
66 //------------------------------------------------------------------------------------------------
67 [RplRpc(RplChannel.Reliable, RplRcver.Server)]
68 private void Rpc_RequestRespawn_S(RplId entityRplId, bool skipPreload)
69 {
70 #ifdef _ENABLE_RESPAWN_LOGS
71 Print(string.Format("%1::Rpc_RequestRespawn_S(playerId: %2, entityRplId: %3)", Type().ToString(),
73 entityRplId), LogLevel.NORMAL);
74 #endif
75
76 SCR_PossessSpawnData possessData = SCR_PossessSpawnData.FromRplId(entityRplId);
77 possessData.SetSkipPreload(skipPreload);
78 ProcessRequest_S(possessData);
79 }
80
81 #ifdef ENABLE_DIAG
82 //------------------------------------------------------------------------------------------------
83 override SCR_BaseRespawnDiag CreateDiag()
84 {
85 return new SCR_PossessRespawnDiag();
86 }
87 #endif
88}
89
90#ifdef ENABLE_DIAG
91class SCR_PossessRespawnDiag : SCR_RespawnDiag<SCR_PossessSpawnRequestComponent>
92{
93 protected int m_RplId;
94
95 //------------------------------------------------------------------------------------------------
96 override void DrawContent()
97 {
98 super.DrawContent();
99 DbgUI.InputInt("Entity RplId: ", m_RplId);
100 }
101
102 //------------------------------------------------------------------------------------------------
103 protected override SCR_SpawnData CreateData()
104 {
105 return SCR_PossessSpawnData.FromRplId(m_RplId);
106 }
107}
108#endif
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Get all prefabs that have the spawner data
SCR_FreeSpawnRequestComponentClass SCR_SpawnRequestComponentClass GetHandlerType()
override GetDataType()
bool DoRequestRespawn(SCR_SpawnData data)
void ProcessRequest_S(SCR_SpawnData data)
void ProcessCanRequest_S(SCR_SpawnData data)
bool DoCanRequestRespawn(SCR_SpawnData data)
int Type
override bool GetSkipPreload()
override void SetSkipPreload(bool skip)
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
proto external PlayerController GetPlayerController()
proto external int GetPlayerId()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition EnNetwork.c:95
RplRcver
Definition RplRcver.c:59
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition RplChannel.c:14
int RplId
Definition EnNetwork.c:33
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.