Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MenuSpawnLogic.c
Go to the documentation of this file.
2class SCR_MenuSpawnLogic : SCR_SpawnLogic
3{
4 [Attribute("", uiwidget: UIWidgets.EditBox, category: "Respawn", desc: "Default faction for players to spawn with or empty if none.")]
6
7 [Attribute("4", desc: "Delay (in seconds) for opening deploy menu after death.")]
8 protected float m_fDeployMenuOpenDelay;
9
10 [Attribute("0", desc: "Delay opening deploy menu until player has a spawn point available")]
11 protected bool m_bWaitForSpawnPoints;
12
13 [Attribute("0", desc: "If true, use a fade effect when deploy map is open")]
14 protected bool m_bUseFadeEffect;
15
16 //------------------------------------------------------------------------------------------------
17 override void OnPlayerAuditSuccess_S(int playerId)
18 {
19 super.OnPlayerAuditSuccess_S(playerId);
20 ExcuteInitialLoadOrSpawn_S(playerId);
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override protected void DoSpawn_S(int playerId)
25 {
26 Faction forcedFaction;
27 if (GetForcedFaction(forcedFaction))
28 {
29 PlayerController pc = GetGame().GetPlayerManager().GetPlayerController(playerId);
31 if (playerFactionComp)
32 playerFactionComp.RequestFaction(forcedFaction);
33 }
34
35 // Send a notification to registered client:
36 // Always ensure to hook OnLocalPlayer callbacks prior to sending such notification,
37 // otherwise the notification will be disregarded
38 GetPlayerRespawnComponent_S(playerId).NotifyReadyForSpawn_S();
39 }
40
41 //------------------------------------------------------------------------------------------------
42 override void OnPlayerEntityLost_S(int playerId)
43 {
44 super.OnPlayerEntityLost_S(playerId);
45 GetPlayerRespawnComponent_S(playerId).NotifyReadyForSpawn_S();
46 }
47
48 //------------------------------------------------------------------------------------------------
49 protected bool GetForcedFaction(out Faction faction)
50 {
51 if (m_sForcedFaction.IsEmpty())
52 return false;
53
54 // Resolve Alias
55 SCR_FactionAliasComponent factionAliasComponent = SCR_FactionAliasComponent.Cast(GetGame().GetFactionManager().FindComponent(SCR_FactionAliasComponent));
56 if (factionAliasComponent)
57 m_sForcedFaction = factionAliasComponent.ResolveFactionAlias(m_sForcedFaction);
58
59 faction = GetGame().GetFactionManager().GetFactionByKey(m_sForcedFaction);
60 if (!faction)
61 {
62 Print(string.Format("Auto spawn logic did not find faction by name: %1", m_sForcedFaction), LogLevel.WARNING);
63 return false;
64 }
65
66 return true;
67 }
68
69 //------------------------------------------------------------------------------------------------
72 {
74 }
75
76 //------------------------------------------------------------------------------------------------
78 {
80 }
81
82 //------------------------------------------------------------------------------------------------
84 {
85 return m_bUseFadeEffect;
86 }
87}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
float GetDeployMenuOpenDelay()
Delay in seconds.
override void OnPlayerAuditSuccess_S(int playerId)
void DoSpawn_S(int playerId)
override void OnPlayerEntityLost_S(int playerId)
bool GetForcedFaction(out Faction faction)
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
SCR_FieldOfViewSettings Attribute