Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_GameModeEditor.c
Go to the documentation of this file.
1
class
SCR_GameModeEditorClass
:
SCR_BaseGameModeClass
2
{
3
};
4
7
class
SCR_GameModeEditor
:
SCR_BaseGameMode
8
{
9
[
Attribute
(defvalue:
"1"
,
category
:
"Game Mode: Editor"
)]
10
protected
bool
m_bAutoInitEditor
;
11
12
[
Attribute
(defvalue:
SCR_Enum
.GetDefault(
EGameModeEditorTarget
.VOTE),
category
:
"Game Mode: Editor"
,
desc
:
"Who will become the Game Master?"
, uiwidget:
UIWidgets
.ComboBox, enums: ParamEnumArray.FromEnum(
EGameModeEditorTarget
))]
13
protected
EGameModeEditorTarget
m_GameMasterTarget
;
14
16
//--- Variables
17
protected
int
m_iPersistentGameMasterPlayerID
;
18
protected
SCR_EditorManagerCore
m_Core
;
19
21
//--- Public getters, anywhere
27
EGameModeEditorTarget
GetGameMasterTarget
()
28
{
29
return
m_GameMasterTarget
;
30
}
31
32
protected
void
OnEditorManagerCreatedServer
(
SCR_EditorManagerEntity
editorManager)
33
{
34
if
(editorManager.GetPlayerID() ==
SCR_PlayerController
.
GetLocalPlayerId
() ||
m_GameMasterTarget
==
EGameModeEditorTarget
.EVERYBODY)
35
{
36
SCR_VotingManagerComponent
votingManager =
SCR_VotingManagerComponent
.GetInstance();
37
if
(votingManager)
38
{
39
votingManager.StartVoting(
EVotingType
.EDITOR_IN, 0, editorManager.GetPlayerID());
40
votingManager.EndVoting(
EVotingType
.EDITOR_IN, editorManager.GetPlayerID(),
EVotingOutcome
.FORCE_WIN);
41
}
42
return
;
43
}
44
}
45
protected
void
OnEditorManagerDeletedServer
(
SCR_EditorManagerEntity
editorManager)
46
{
47
}
48
protected
void
OnEditorManagerInitOwner
(
SCR_EditorManagerEntity
editorManager)
49
{
50
if
(editorManager.IsLimited())
51
{
52
//--- ToDo: Show after spawn?
53
SCR_HintSequenceComponent hintSequence = SCR_HintSequenceComponent.Cast(FindComponent(SCR_HintSequenceComponent));
54
if
(hintSequence)
55
GetGame
().GetCallqueue().CallLater(hintSequence.StartSequence, 1000);
//--- ToDo: Don't hardcode the delay?
56
}
57
//Open editor if the game has not ended
58
else
if
(
GetState
() !=
SCR_EGameModeState
.POSTGAME)
59
{
60
editorManager.SetAutoInit(
m_bAutoInitEditor
);
61
}
62
}
63
64
//Limited changed, so call notification and show hint
65
protected
void
OnLimitedChanged
(
bool
isLimited)
66
{
67
SCR_EditorManagerEntity
editorManager =
SCR_EditorManagerEntity
.GetInstance();
68
if
(!editorManager)
return
;
69
70
int
playerID = editorManager.GetPlayerID();
71
72
//Became Player
73
if
(isLimited)
74
{
75
SCR_NotificationsComponent.SendToEveryone(
ENotification
.EDITOR_PLAYER_NO_LONGER_GM, playerID);
76
}
77
//Became GM
78
else
79
{
80
SCR_NotificationsComponent.SendToEveryone(
ENotification
.EDITOR_PLAYER_BECAME_GM, playerID);
81
}
82
}
83
protected
void
OnPlayerTerminated
(
int
playerId)
84
{
85
//--- When solo, open the editor after death
86
if
(
m_Core
.GetEditorManager(playerId) ==
SCR_EditorManagerEntity
.GetInstance() &&
GetGame
().GetPlayerManager().
GetPlayerCount
() == 1)
87
{
88
SCR_PlayerController
playerController =
SCR_PlayerController
.Cast(
GetGame
().
GetPlayerController
());
89
if
(!playerController || !playerController.
IsPossessing
())
90
SCR_EditorManagerEntity
.OpenInstance();
91
}
92
}
93
95
//--- Override functions
96
override
void
OnPlayerKilled
(
int
playerId,
IEntity
playerEntity,
IEntity
killerEntity, notnull
Instigator
killer)
97
{
98
OnPlayerTerminated
(playerId);
99
super.OnPlayerKilled(playerId, playerEntity, killerEntity, killer);
100
}
101
override
void
OnPlayerDeleted
(
int
playerId,
IEntity
player)
102
{
103
OnPlayerTerminated
(playerId);
104
super.OnPlayerDeleted(playerId, player);
105
}
106
override
void
OnGameStart
()
107
{
108
super.OnGameStart();
109
110
if
(
RplSession
.Mode() ==
RplMode
.Client || !
m_Core
)
111
return
;
112
113
m_Core
.Event_OnEditorManagerCreatedServer.Insert(
OnEditorManagerCreatedServer
);
114
m_Core
.Event_OnEditorManagerDeletedServer.Insert(
OnEditorManagerDeletedServer
);
115
116
SCR_EditorManagerEntity
localEditorManager =
SCR_EditorManagerEntity
.GetInstance();
117
if
(localEditorManager)
118
OnEditorManagerCreatedServer
(localEditorManager);
119
120
GameStatsApi
statsApi =
GetGame
().GetStatsApi();
121
if
(statsApi)
122
statsApi.EditorStart();
123
}
124
override
void
OnGameEnd
()
125
{
126
if
(
RplSession
.Mode() !=
RplMode
.Client)
127
{
128
GameStatsApi
statsApi =
GetGame
().GetStatsApi();
129
if
(statsApi)
130
statsApi.EditorClosed();
131
}
132
133
super.OnGameEnd();
134
}
135
void
SCR_GameModeEditor
(
IEntitySource
src,
IEntity
parent)
136
{
137
m_Core
=
SCR_EditorManagerCore
.Cast(
SCR_EditorManagerCore
.GetInstance(
SCR_EditorManagerCore
));
138
if
(!
m_Core
)
return
;
139
140
m_Core
.Event_OnEditorManagerInitOwner.Insert(
OnEditorManagerInitOwner
);
141
}
142
void
~SCR_GameModeEditor
()
143
{
144
SCR_EditorManagerEntity
editorManager =
SCR_EditorManagerEntity
.GetInstance();
145
if
(editorManager)
146
editorManager.GetOnLimitedChange().Remove(
OnLimitedChanged
);
147
}
148
};
149
150
enum
EGameModeEditorTarget
151
{
152
VOTE
,
153
EVERYBODY
,
154
NOBODY
155
};
ENotification
ENotification
Definition
ENotification.c:5
EVotingOutcome
EVotingOutcome
Definition
EVotingOutcome.c:2
EVotingType
EVotingType
Definition
EVotingType.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
RplMode
RplMode
Mode of replication.
Definition
RplMode.c:9
SCR_EGameModeState
SCR_EGameModeState
Definition
SCR_EGameModeState.c:5
SCR_EditorManagerEntity
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Definition
SCR_EditorManagerEntity.c:2211
GetPlayerCount
int GetPlayerCount()
Definition
SCR_Faction.c:554
EGameModeEditorTarget
EGameModeEditorTarget
Definition
SCR_GameModeEditor.c:151
EVERYBODY
@ EVERYBODY
Everyone is the Game Master.
Definition
SCR_GameModeEditor.c:153
VOTE
@ VOTE
Players will vote their own Game Master.
Definition
SCR_GameModeEditor.c:152
NOBODY
@ NOBODY
Nobody is the Game Master.
Definition
SCR_GameModeEditor.c:154
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
SCR_VotingManagerComponent
void SCR_VotingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_VotingManagerComponent.c:1083
GameStatsApi
Statistical Api - Analytics.
Definition
GameStatsApi.c:14
IEntity
Definition
IEntity.c:13
IEntitySource
Definition
IEntitySource.c:13
Instigator
Definition
Instigator.c:13
RplSession
Definition
RplSession.c:8
SCR_BaseGameModeClass
Definition
SCR_BaseGameMode.c:13
SCR_BaseGameMode::GetState
SCR_EGameModeState GetState()
Definition
SCR_BaseGameMode.c:358
SCR_BaseGameMode::SCR_BaseGameMode
void SCR_BaseGameMode(IEntitySource src, IEntity parent)
Definition
SCR_BaseGameMode.c:2292
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition
SCR_EditorManagerCore.c:6
SCR_Enum
Definition
SCR_Enum.c:2
SCR_GameModeEditorClass
Definition
SCR_GameModeEditor.c:2
SCR_GameModeEditor::GetGameMasterTarget
EGameModeEditorTarget GetGameMasterTarget()
Definition
SCR_GameModeEditor.c:27
SCR_GameModeEditor::~SCR_GameModeEditor
void ~SCR_GameModeEditor()
Definition
SCR_GameModeEditor.c:142
SCR_GameModeEditor::m_GameMasterTarget
EGameModeEditorTarget m_GameMasterTarget
Definition
SCR_GameModeEditor.c:13
SCR_GameModeEditor::SCR_GameModeEditor
void SCR_GameModeEditor(IEntitySource src, IEntity parent)
Definition
SCR_GameModeEditor.c:135
SCR_GameModeEditor::OnEditorManagerInitOwner
void OnEditorManagerInitOwner(SCR_EditorManagerEntity editorManager)
Definition
SCR_GameModeEditor.c:48
SCR_GameModeEditor::OnGameEnd
override void OnGameEnd()
Definition
SCR_GameModeEditor.c:124
SCR_GameModeEditor::OnPlayerKilled
override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
Definition
SCR_GameModeEditor.c:96
SCR_GameModeEditor::OnLimitedChanged
void OnLimitedChanged(bool isLimited)
Definition
SCR_GameModeEditor.c:65
SCR_GameModeEditor::m_Core
SCR_EditorManagerCore m_Core
Definition
SCR_GameModeEditor.c:18
SCR_GameModeEditor::OnEditorManagerCreatedServer
void OnEditorManagerCreatedServer(SCR_EditorManagerEntity editorManager)
Definition
SCR_GameModeEditor.c:32
SCR_GameModeEditor::OnGameStart
override void OnGameStart()
Definition
SCR_GameModeEditor.c:106
SCR_GameModeEditor::OnEditorManagerDeletedServer
void OnEditorManagerDeletedServer(SCR_EditorManagerEntity editorManager)
Definition
SCR_GameModeEditor.c:45
SCR_GameModeEditor::m_iPersistentGameMasterPlayerID
int m_iPersistentGameMasterPlayerID
Definition
SCR_GameModeEditor.c:17
SCR_GameModeEditor::m_bAutoInitEditor
bool m_bAutoInitEditor
Definition
SCR_GameModeEditor.c:10
SCR_GameModeEditor::OnPlayerDeleted
override void OnPlayerDeleted(int playerId, IEntity player)
Definition
SCR_GameModeEditor.c:101
SCR_GameModeEditor::OnPlayerTerminated
void OnPlayerTerminated(int playerId)
Definition
SCR_GameModeEditor.c:83
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::IsPossessing
bool IsPossessing()
Definition
SCR_PlayerController.c:434
SCR_PlayerController::GetLocalPlayerId
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Definition
SCR_PlayerController.c:481
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
scripts
Game
GameMode
SCR_GameModeEditor.c
Generated by
1.17.0