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_PatrolGroupCommand.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
[
BaseContainerProps
()]
3
class
SCR_PatrolGroupCommand
:
SCR_WaypointGroupCommand
4
{
5
static
const
ResourceName
cycleWPResource =
"{35BD6541CBB8AC08}Prefabs/AI/Waypoints/AIWaypoint_Cycle.et"
;
6
7
//------------------------------------------------------------------------------------------------
8
override
bool
Execute(
IEntity
cursorTarget,
IEntity
target,
vector
targetPosition,
int
playerID,
bool
isClient)
9
{
10
if
(isClient && playerID ==
SCR_PlayerController
.
GetLocalPlayerId
())
11
return
true
;
12
13
if
(!target || !targetPosition)
14
return
false
;
15
16
return
Patrol(target, targetPosition, playerID);
17
}
18
19
//------------------------------------------------------------------------------------------------
20
bool
Patrol(
IEntity
target,
vector
targetPosition,
int
playerID)
21
{
22
SCR_AIGroup
slaveGroup =
SCR_AIGroup
.Cast(target);
23
if
(!slaveGroup)
24
return
false
;
25
26
Resource
waypointPrefab =
Resource
.Load(
GetWaypointPrefab
());
27
if
(!waypointPrefab.IsValid())
28
return
false
;
29
30
Resource
cycleWPPrefab =
Resource
.Load(cycleWPResource);
31
if
(!cycleWPPrefab.IsValid())
32
return
false
;
33
34
SCR_PlayerController
orderingPlayerController =
SCR_PlayerController
.Cast(
GetGame
().GetPlayerManager().
GetPlayerController
(playerID));
35
if
(!orderingPlayerController)
36
return
false
;
37
38
IEntity
playerEntity = orderingPlayerController.GetControlledEntity();
39
if
(!playerEntity)
40
return
false
;
41
42
CheckPreviousWaypoints
(slaveGroup);
43
44
EntitySpawnParams
params
=
EntitySpawnParams
();
45
params
.TransformMode = ETransformMode.WORLD;
46
params
.Transform[3] = playerEntity.
GetOrigin
();
47
48
array<AIWaypoint> waypoints = {};
49
50
PlayerController controller =
GetGame
().GetPlayerManager().GetPlayerController(playerID);
51
if
(!controller)
52
return
false
;
53
54
SCR_PlayerControllerCommandingComponent commandingComp = SCR_PlayerControllerCommandingComponent.Cast(controller.FindComponent(SCR_PlayerControllerCommandingComponent));
55
if
(!commandingComp)
56
return
false
;
57
58
waypoints.Insert(
SCR_AIWaypoint
.Cast(
GetGame
().SpawnEntityPrefabLocal(waypointPrefab, null,
params
)));
59
waypoints[0].SetCompletionRadius(
m_fCompletionRadius
);
60
commandingComp.DrawWaypointVisualization(playerEntity.
GetOrigin
(),
m_fCompletionRadius
);
61
62
params
.Transform[3] = targetPosition;
63
waypoints.Insert(
SCR_AIWaypoint
.Cast(
GetGame
().SpawnEntityPrefabLocal(waypointPrefab, null,
params
)));
64
waypoints[1].SetCompletionRadius(
m_fCompletionRadius
);
65
commandingComp.DrawWaypointVisualization(targetPosition,
m_fCompletionRadius
,
false
);
66
67
AIWaypointCycle waypointCycle = AIWaypointCycle.Cast(
GetGame
().SpawnEntityPrefabLocal(cycleWPPrefab, null,
params
));
68
69
if
(!waypointCycle)
70
return
false
;
71
72
waypointCycle.SetWaypoints(waypoints);
73
74
slaveGroup.AddWaypoint(waypointCycle);
75
76
return
true
;
77
}
78
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
IEntity
Definition
IEntity.c:13
IEntity::GetOrigin
proto external vector GetOrigin()
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIWaypoint
Definition
SCR_AIWaypoint.c:6
SCR_PatrolGroupCommand
Definition
SCR_PatrolGroupCommand.c:4
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalPlayerId
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Definition
SCR_PlayerController.c:481
SCR_WaypointGroupCommand
Definition
SCR_WaypointGroupCommand.c:4
SCR_WaypointGroupCommand::m_fCompletionRadius
float m_fCompletionRadius
Definition
SCR_WaypointGroupCommand.c:18
SCR_WaypointGroupCommand::GetWaypointPrefab
ResourceName GetWaypointPrefab()
Definition
SCR_WaypointGroupCommand.c:121
SCR_WaypointGroupCommand::CheckPreviousWaypoints
void CheckPreviousWaypoints(SCR_AIGroup slaveGroup)
Definition
SCR_WaypointGroupCommand.c:160
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
scripts
Game
Commanding
Commands
SCR_PatrolGroupCommand.c
Generated by
1.17.0