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_FactionCommanderBaseRequestMenuHandler.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_FactionCommanderBaseRequestMenuHandler
:
SCR_FactionCommanderBaseTaskMenuHandler
3
{
4
[
Attribute
(
desc
:
"If true, player voted as commander can assign group to request"
)]
5
protected
bool
m_bCanBeGroupAssignedByCommander
;
6
7
protected
const
string
LIMIT_REQUEST_REACHED_TEXT
=
"#AR-FactionCommander_LimitRequestReached"
;
8
9
//------------------------------------------------------------------------------------------------
10
override
bool
CanEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity)
11
{
12
return
true
;
13
}
14
15
//------------------------------------------------------------------------------------------------
16
bool
CanRequestEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity)
17
{
18
SCR_BaseRequestedTaskEntity
task
= SCR_BaseRequestedTaskEntity.Cast(hoveredEntity);
19
if
(
task
)
20
return
false
;
21
22
return
true
;
23
}
24
25
//------------------------------------------------------------------------------------------------
26
override
bool
CanQuickEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity)
27
{
28
if
(!super.CanQuickEntryBeShown(commanderFaction, playerId,
position
, hoveredEntity))
29
return
false
;
30
31
return
IsTaskValid
(hoveredEntity);
32
}
33
34
//------------------------------------------------------------------------------------------------
35
bool
CanRequestEntryBeSelected
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity, out
string
disabledText =
""
)
36
{
37
if
(
GetActiveGroupRequestCount
(commanderFaction, playerId) >= SCR_BaseRequestedTaskEntity.REQUEST_MAX_COUNT)
38
{
39
disabledText =
LIMIT_REQUEST_REACHED_TEXT
;
40
return
false
;
41
}
42
43
SCR_GroupTaskManagerComponent
groupTaskManager =
SCR_GroupTaskManagerComponent
.GetInstance();
44
if
(!groupTaskManager)
45
return
false
;
46
47
return
groupTaskManager.CanCreateNewTaskWithTypename(
GetTaskPrefabClassTypename
(), commanderFaction);
48
}
49
50
//------------------------------------------------------------------------------------------------
51
override
bool
CanGroupEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity,
SCR_AIGroup
group)
52
{
53
if
(!super.CanGroupEntryBeShown(commanderFaction, playerId,
position
, hoveredEntity, group))
54
return
false
;
55
56
// commander can assign group into request if it is allowed by config
57
if
(
m_bCanBeGroupAssignedByCommander
&& SCR_FactionCommanderPlayerComponent.IsLocalPlayerCommander())
58
return
true
;
59
60
return
false
;
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
bool
CanGroupEntryBeSelected
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity,
SCR_AIGroup
group, out
string
disabledText =
""
)
65
{
66
if
(!group)
67
return
false
;
68
69
if
(
GetActiveGroupRequestCount
(commanderFaction, playerId) >= SCR_BaseRequestedTaskEntity.REQUEST_MAX_COUNT)
70
{
71
disabledText =
LIMIT_REQUEST_REACHED_TEXT
;
72
return
false
;
73
}
74
75
SCR_BaseRequestedTaskEntity
task
= SCR_BaseRequestedTaskEntity.Cast(hoveredEntity);
76
if
(!
task
)
77
{
78
SCR_GroupTaskManagerComponent
groupTaskManager =
SCR_GroupTaskManagerComponent
.GetInstance();
79
return
groupTaskManager && groupTaskManager.CanCreateNewTaskWithTypename(
GetTaskPrefabClassTypename
(), commanderFaction);
80
}
81
82
SCR_TaskExecutorGroup
groupExecutor =
SCR_TaskExecutorGroup
.Cast(
SCR_TaskExecutorGroup
.FromGroup(group.
GetGroupID
()));
83
bool
canBeAssigned =
SCR_TaskSystem
.GetInstance().CanTaskBeAssignedTo(
task
, groupExecutor);
84
return
canBeAssigned && !
task
.IsTaskAssignedTo(groupExecutor);
85
}
86
87
//------------------------------------------------------------------------------------------------
89
protected
int
GetActiveGroupRequestCount
(
Faction
commanderFaction,
int
playerId)
90
{
91
SCR_GroupsManagerComponent
groupsManager =
SCR_GroupsManagerComponent
.GetInstance();
92
if
(!groupsManager)
93
return
false
;
94
95
SCR_AIGroup
playerGroup = groupsManager.GetPlayerGroup(playerId);
96
if
(!playerGroup)
97
return
false
;
98
99
array<SCR_Task> tasks = {};
100
SCR_TaskSystem
.GetInstance().GetTasksByStateFiltered(
101
tasks,
102
SCR_ETaskState
.CREATED |
SCR_ETaskState
.ASSIGNED,
103
commanderFaction.GetFactionKey(),
104
-1,
105
SCR_BaseRequestedTaskEntity,
106
true
107
);
108
109
int
counter;
110
SCR_BaseRequestedTaskEntity requestedGroupTask;
111
112
foreach
(
SCR_Task
task
: tasks)
113
{
114
requestedGroupTask = SCR_BaseRequestedTaskEntity.Cast(
task
);
115
if
(requestedGroupTask && requestedGroupTask.GetRequesterId() == playerGroup.
GetGroupID
())
116
counter++;
117
}
118
119
return
counter;
120
}
121
122
//------------------------------------------------------------------------------------------------
123
override
void
OnCommandIssued
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity,
SCR_AIGroup
group)
124
{
125
SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent =
GetLocalCommanderComponent
();
126
if
(!factionCommanderPlayerComponent)
127
return
;
128
129
SCR_GroupsManagerComponent
groupComp =
SCR_GroupsManagerComponent
.GetInstance();
130
if
(!groupComp)
131
return
;
132
133
SCR_AIGroup
requesterGroup = groupComp.GetPlayerGroup(playerId);
134
if
(!requesterGroup)
135
return
;
136
137
if
(!
IsTaskValid
(hoveredEntity))
138
{
139
factionCommanderPlayerComponent.CreateRequestedTask(
GetTaskPrefab
(),
position
, requesterGroup.
GetGroupID
(), group, playerId,
this
);
140
return
;
141
}
142
143
if
(!SCR_FactionCommanderPlayerComponent.IsLocalPlayerCommander())
144
return
;
145
146
SCR_Task
task
=
SCR_Task
.Cast(hoveredEntity);
147
if
(group)
148
factionCommanderPlayerComponent.AssignGroupToTask(group.
GetGroupID
(),
task
.GetTaskID());
149
}
150
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
SCR_GroupTaskManagerComponent
void SCR_GroupTaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_GroupTaskManagerComponent.c:794
SCR_GroupsManagerComponent
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_GroupsManagerComponent.c:1747
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
SCR_Task
void SCR_Task(IEntitySource src, IEntity parent)
Definition
SCR_Task.c:1938
SCR_ETaskState
SCR_ETaskState
Definition
SCR_Task.c:3
task
from task
Definition
SCR_TaskNotificationConfigs.c:12
Faction
Definition
Faction.c:13
IEntity
Definition
IEntity.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIGroup::GetGroupID
int GetGroupID()
Definition
SCR_AIGroup.c:935
SCR_FactionCommanderBaseMenuHandler::GetLocalCommanderComponent
SCR_FactionCommanderPlayerComponent GetLocalCommanderComponent()
Definition
SCR_FactionCommanderBaseMenuHandler.c:19
SCR_FactionCommanderBaseRequestMenuHandler
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:3
SCR_FactionCommanderBaseRequestMenuHandler::OnCommandIssued
override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:123
SCR_FactionCommanderBaseRequestMenuHandler::CanQuickEntryBeShown
override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:26
SCR_FactionCommanderBaseRequestMenuHandler::LIMIT_REQUEST_REACHED_TEXT
const string LIMIT_REQUEST_REACHED_TEXT
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:7
SCR_FactionCommanderBaseRequestMenuHandler::CanGroupEntryBeSelected
override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText="")
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:64
SCR_FactionCommanderBaseRequestMenuHandler::m_bCanBeGroupAssignedByCommander
bool m_bCanBeGroupAssignedByCommander
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:5
SCR_FactionCommanderBaseRequestMenuHandler::CanRequestEntryBeSelected
bool CanRequestEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:35
SCR_FactionCommanderBaseRequestMenuHandler::CanGroupEntryBeShown
override bool CanGroupEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:51
SCR_FactionCommanderBaseRequestMenuHandler::CanEntryBeShown
override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:10
SCR_FactionCommanderBaseRequestMenuHandler::GetActiveGroupRequestCount
int GetActiveGroupRequestCount(Faction commanderFaction, int playerId)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:89
SCR_FactionCommanderBaseRequestMenuHandler::CanRequestEntryBeShown
bool CanRequestEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
Definition
SCR_FactionCommanderBaseRequestMenuHandler.c:16
SCR_FactionCommanderBaseTaskMenuHandler
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:3
SCR_FactionCommanderBaseTaskMenuHandler::GetTaskPrefab
ResourceName GetTaskPrefab()
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:5
SCR_FactionCommanderBaseTaskMenuHandler::IsTaskValid
bool IsTaskValid(IEntity hoveredEntity)
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:18
SCR_FactionCommanderBaseTaskMenuHandler::GetTaskPrefabClassTypename
GetTaskPrefabClassTypename()
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:36
SCR_TaskExecutorGroup
Definition
SCR_TaskExecutorGroup.c:2
SCR_TaskSystem
Definition
SCR_TaskSystem.c:6
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
FactionCommander
MenuHandlers
SCR_FactionCommanderBaseRequestMenuHandler.c
Generated by
1.17.0