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_FactionCommanderEstablishCommandMenuHandler.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_FactionCommanderEstablishCommandMenuHandler
:
SCR_FactionCommanderConflictBaseMenuHandler
3
{
4
protected
SCR_AIGroup
m_Group
;
5
protected
ref
SCR_EstablishBaseMapCommandCursor
m_MapCommandCursor
;
6
7
protected
const
string
ESTABLISH_BASE_LIMIT_REACHED
=
"#AR-Notification_GROUP_TASK_ESTABLISH_BASE_TOO_MANY_BASES"
;
8
9
//------------------------------------------------------------------------------------------------
10
override
bool
CanQuickEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity)
11
{
12
if
(!super.CanQuickEntryBeShown(commanderFaction, playerId,
position
, hoveredEntity))
13
return
false
;
14
15
SCR_EstablishBaseTaskEntity
task
= SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
16
if
(!
task
)
17
return
false
;
18
19
return
true
;
20
}
21
22
//------------------------------------------------------------------------------------------------
23
override
bool
CanEntryBeSelected
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity, out
string
disabledText =
""
)
24
{
25
SCR_GameModeCampaign
gameModeCampaign =
SCR_GameModeCampaign
.Cast(
GetGame
().
GetGameMode
());
26
if
(gameModeCampaign && !gameModeCampaign.GetBaseManager().CanFactionBuildNewBase(commanderFaction))
27
{
28
disabledText =
ESTABLISH_BASE_LIMIT_REACHED
;
29
return
false
;
30
}
31
32
return
true
;
33
}
34
35
//------------------------------------------------------------------------------------------------
36
override
bool
CanGroupEntryBeSelected
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity,
SCR_AIGroup
group, out
string
disabledText =
""
)
37
{
38
SCR_Task
task
= SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
39
if
(!
task
)
40
{
41
SCR_GroupTaskManagerComponent
groupTaskManager =
SCR_GroupTaskManagerComponent
.GetInstance();
42
if
(groupTaskManager && groupTaskManager.CanCreateNewTaskWithTypename(
GetTaskPrefabClassTypename
(), commanderFaction))
43
return
true
;
44
45
return
false
;
46
}
47
48
SCR_TaskExecutorGroup
groupExecutor =
SCR_TaskExecutorGroup
.Cast(
SCR_TaskExecutorGroup
.FromGroup(group.
GetGroupID
()));
49
bool
canBeAssigned =
SCR_TaskSystem
.GetInstance().CanTaskBeAssignedTo(
task
, groupExecutor);
50
return
canBeAssigned && !
task
.IsTaskAssignedTo(groupExecutor);
51
}
52
53
//------------------------------------------------------------------------------------------------
54
override
void
OnCommandIssued
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity,
SCR_AIGroup
group)
55
{
56
SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent =
GetLocalCommanderComponent
();
57
if
(!factionCommanderPlayerComponent)
58
return
;
59
60
SCR_EstablishBaseTaskEntity
task
= SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
61
62
if
(!
task
)
63
{
64
m_MapCommandCursor
=
new
SCR_EstablishBaseMapCommandCursor
();
65
m_MapCommandCursor
.ShowCursor(
position
);
66
m_MapCommandCursor
.SetData(commanderFaction, playerId, hoveredEntity);
67
m_MapCommandCursor
.GetOnCommandExecuted().Insert(
OnCommandExecuted
);
68
m_Group
= group;
69
}
70
else
if
(group)
71
factionCommanderPlayerComponent.AssignGroupToTask(group.
GetGroupID
(),
task
.GetTaskID());
72
}
73
74
//------------------------------------------------------------------------------------------------
75
protected
void
OnCommandExecuted
(
vector
position
)
76
{
77
SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent =
GetLocalCommanderComponent
();
78
if
(!factionCommanderPlayerComponent || !
m_MapCommandCursor
)
79
return
;
80
81
factionCommanderPlayerComponent.CreateTask(
GetTaskPrefab
(),
position
,
m_Group
,
m_MapCommandCursor
.GetPlayerId());
82
}
83
84
//------------------------------------------------------------------------------------------------
85
override
bool
CanEntryBeShown
(notnull
Faction
commanderFaction,
int
playerId,
vector
position
,
IEntity
hoveredEntity)
86
{
87
SCR_GameModeCampaign
gameModeCampaign =
SCR_GameModeCampaign
.Cast(
GetGame
().
GetGameMode
());
88
if
(gameModeCampaign && !gameModeCampaign.GetEstablishingBasesEnabled())
89
return
false
;
90
91
return
super.CanEntryBeShown(commanderFaction, playerId,
position
, hoveredEntity);
92
}
93
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition
SCR_BaseGameModeComponent.c:15
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition
SCR_GameModeCampaign.c:1812
SCR_GroupTaskManagerComponent
void SCR_GroupTaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_GroupTaskManagerComponent.c:794
SCR_Task
void SCR_Task(IEntitySource src, IEntity parent)
Definition
SCR_Task.c:1938
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_EstablishBaseMapCommandCursor
Definition
SCR_EstablishBaseMapCommandCursor.c:2
SCR_FactionCommanderBaseMenuHandler::GetLocalCommanderComponent
SCR_FactionCommanderPlayerComponent GetLocalCommanderComponent()
Definition
SCR_FactionCommanderBaseMenuHandler.c:19
SCR_FactionCommanderBaseTaskMenuHandler::GetTaskPrefab
ResourceName GetTaskPrefab()
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:5
SCR_FactionCommanderBaseTaskMenuHandler::GetTaskPrefabClassTypename
GetTaskPrefabClassTypename()
Definition
SCR_FactionCommanderBaseTaskMenuHandler.c:36
SCR_FactionCommanderConflictBaseMenuHandler
Definition
SCR_FactionCommanderConflictBaseMenuHandler.c:3
SCR_FactionCommanderEstablishCommandMenuHandler
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:3
SCR_FactionCommanderEstablishCommandMenuHandler::CanEntryBeSelected
override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:23
SCR_FactionCommanderEstablishCommandMenuHandler::OnCommandExecuted
void OnCommandExecuted(vector position)
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:75
SCR_FactionCommanderEstablishCommandMenuHandler::OnCommandIssued
override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:54
SCR_FactionCommanderEstablishCommandMenuHandler::m_MapCommandCursor
ref SCR_EstablishBaseMapCommandCursor m_MapCommandCursor
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:5
SCR_FactionCommanderEstablishCommandMenuHandler::CanGroupEntryBeSelected
override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText="")
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:36
SCR_FactionCommanderEstablishCommandMenuHandler::m_Group
SCR_AIGroup m_Group
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:4
SCR_FactionCommanderEstablishCommandMenuHandler::CanQuickEntryBeShown
override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:10
SCR_FactionCommanderEstablishCommandMenuHandler::CanEntryBeShown
override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:85
SCR_FactionCommanderEstablishCommandMenuHandler::ESTABLISH_BASE_LIMIT_REACHED
const string ESTABLISH_BASE_LIMIT_REACHED
Definition
SCR_FactionCommanderEstablishCommandMenuHandler.c:7
SCR_TaskExecutorGroup
Definition
SCR_TaskExecutorGroup.c:2
SCR_TaskSystem
Definition
SCR_TaskSystem.c:6
vector
Definition
vector.c:13
scripts
Game
FactionCommander
MenuHandlers
SCR_FactionCommanderEstablishCommandMenuHandler.c
Generated by
1.17.0