Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FreeSpawnRequestComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Respawn/PlayerController")]
5
6class SCR_FreeSpawnRequestComponent : SCR_SpawnRequestComponent
7{
8 //------------------------------------------------------------------------------------------------
9 override typename GetHandlerType()
10 {
11 return SCR_FreeSpawnHandlerComponent;
12 }
13
14 //------------------------------------------------------------------------------------------------
15 override typename GetDataType()
16 {
17 return SCR_FreeSpawnData;
18 }
19
20 //------------------------------------------------------------------------------------------------
22 {
23 #ifdef _ENABLE_RESPAWN_LOGS
24 Print(string.Format("%1::DoCanRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
26 #endif
27
28 // We can construct whatever we want here on client
29 Rpc(Rpc_CanRequestRespawn_S, data.GetPosition(), data.GetAngles(), data.GetPrefab());
30 return true;
31 }
32
33 //------------------------------------------------------------------------------------------------
34 [RplRpc(RplChannel.Reliable, RplRcver.Server)]
35 private void Rpc_CanRequestRespawn_S(vector position, vector angles, ResourceName prefab)
36 {
37 #ifdef _ENABLE_RESPAWN_LOGS
38 Print(string.Format("%1::Rpc_CanRequestRespawn_S(playerId: %2, pos: %3, ang: %4, pref: %5)", Type().ToString(),
41 angles,
42 prefab), LogLevel.NORMAL);
43 #endif
44
45 SCR_FreeSpawnData data = new SCR_FreeSpawnData(prefab, position, angles);
47 }
48
49 //------------------------------------------------------------------------------------------------
53 protected override bool DoRequestRespawn(SCR_SpawnData data)
54 {
55 #ifdef _ENABLE_RESPAWN_LOGS
56 Print(string.Format("%1::DoRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
58 #endif
59
60 // We can construct whatever we want here on client
61 Rpc(Rpc_RequestRespawn_S, data.GetPosition(), data.GetAngles(), data.GetPrefab());
62 return true;
63 }
64
65 //------------------------------------------------------------------------------------------------
66 [RplRpc(RplChannel.Reliable, RplRcver.Server)]
67 private void Rpc_RequestRespawn_S(vector position, vector angles, ResourceName prefab)
68 {
69 #ifdef _ENABLE_RESPAWN_LOGS
70 Print(string.Format("%1::Rpc_RequestRespawn_S(playerId: %2, pos: %3, ang: %4, pref: %5)", Type().ToString(),
73 angles,
74 prefab), LogLevel.NORMAL);
75 #endif
76
77 SCR_FreeSpawnData data = new SCR_FreeSpawnData(prefab, position, angles);
79 }
80
81 #ifdef ENABLE_DIAG
82 //------------------------------------------------------------------------------------------------
83 override SCR_BaseRespawnDiag CreateDiag()
84 {
85 return new SCR_FreeRespawnDiag();
86 }
87 #endif
88}
89
90#ifdef ENABLE_DIAG
91class SCR_FreeRespawnDiag : SCR_RespawnDiag<SCR_FreeSpawnRequestComponent>
92{
93 protected string m_Prefab = "{7A9EE19AB67B298B}Prefabs/Characters/Factions/INDFOR/FIA/Character_FIA_base.et";
94 protected string m_Position = "0 0.1 2";
95 protected string m_Angles = "0 180 0";
96
97 //------------------------------------------------------------------------------------------------
98 override void DrawContent()
99 {
100 super.DrawContent();
101 DbgUI.InputText("Prefab: ", m_Prefab);
102 DbgUI.InputText("Position: ", m_Position);
103 }
104
105 //------------------------------------------------------------------------------------------------
106 protected override SCR_SpawnData CreateData()
107 {
108 vector position = m_Position.ToVector();
109 vector angles = m_Angles.ToVector();
110 return new SCR_FreeSpawnData(m_Prefab, position, angles);
111 }
112}
113#endif
ResourceName m_Prefab
ref array< string > angles
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
vector position
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
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
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
vector m_Position
Only in XY, Z is ignored.
Definition EnWidgets.c:81