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_ContextGetInGroupCommand.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseGroupCommandTitleField
(
"m_sCommandName"
)]
2
class
SCR_ContextGetIngroupCommand
:
SCR_WaypointGroupCommand
3
{
4
[
Attribute
(
desc
:
"Prefab of the AI waypoint used in this command to get into specific vehicle"
,
params
:
"et class=AIWaypoint"
)]
5
protected
ResourceName
m_sSpecificEntityWP
;
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
{
12
//SpawnWPVisualization(targetPosition, playerID);
13
return
true
;
14
}
15
16
//SpawnWPVisualization(targetPosition, playerID);
17
if
(!
m_sWaypointPrefab
|| !
m_sSpecificEntityWP
|| !target || !targetPosition)
18
return
false
;
19
20
return
DecideAndSetWP
(cursorTarget, target, targetPosition, playerID);
21
}
22
23
//------------------------------------------------------------------------------------------------
24
bool
DecideAndSetWP
(
IEntity
cursorTarget,
IEntity
target,
vector
targetPosition,
int
playerID)
25
{
26
IEntity
playerEntity =
GetGame
().GetPlayerManager().GetPlayerControlledEntity(playerID);
27
if
(!playerEntity)
28
return
false
;
29
30
ChimeraCharacter
playerCharacter =
ChimeraCharacter
.Cast(playerEntity);
31
if
(!playerCharacter)
32
return
false
;
33
34
if
(playerCharacter.IsInVehicle())
35
{
36
CompartmentAccessComponent compartmentComp = playerCharacter.GetCompartmentAccessComponent();
37
if
(!compartmentComp)
38
return
false
;
39
40
IEntity
vehicleIn = compartmentComp.GetVehicleIn(playerCharacter);
41
if
(!vehicleIn)
42
return
false
;
43
44
return
CreateBoardingEntityWP
(target, vehicleIn, vehicleIn.
GetOrigin
());
45
}
46
47
if
(cursorTarget)
48
{
49
Vehicle
cursorVehicle =
Vehicle
.Cast(cursorTarget.
GetRootParent
());
50
if
(cursorVehicle)
51
return
CreateBoardingEntityWP
(target, cursorVehicle, cursorVehicle.
GetOrigin
());
52
}
53
54
//handle default logic
55
return
SetWaypointForAIGroup
(target, targetPosition, playerID);
56
}
57
58
//------------------------------------------------------------------------------------------------
59
bool
CreateBoardingEntityWP
(
IEntity
targetGroup,
IEntity
entity,
vector
position
)
60
{
61
Resource
waypointPrefab =
Resource
.Load(
m_sSpecificEntityWP
);
62
if
(!waypointPrefab.IsValid())
63
{
64
Print
(
"SCR_ContextGetInGroupCommand:: Invalid prefab path"
,
LogLevel
.ERROR);
65
return
false
;
66
}
67
68
SCR_AIGroup
slaveGroup =
SCR_AIGroup
.Cast(targetGroup);
69
if
(!slaveGroup)
70
return
false
;
71
72
EntitySpawnParams
params
=
EntitySpawnParams
();
73
params
.TransformMode = ETransformMode.WORLD;
74
params
.Transform[3] =
position
;
75
76
CheckPreviousWaypoints
(slaveGroup);
77
78
SCR_BoardingEntityWaypoint
wp =
SCR_BoardingEntityWaypoint
.Cast(
GetGame
().SpawnEntityPrefabLocal(waypointPrefab, null,
params
));
79
if
(!wp)
80
return
false
;
81
82
if
(
m_bForceCommand
)
83
wp.SetPriorityLevel(SCR_AIActionBase.PRIORITY_LEVEL_PLAYER);
84
85
wp.SetCompletionRadius(
m_fCompletionRadius
);
86
wp.SetEntity(entity);
87
slaveGroup.AddWaypoint(wp);
88
89
return
true
;
90
}
91
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetOrigin
proto external vector GetOrigin()
IEntity::GetRootParent
proto external IEntity GetRootParent()
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_BaseGroupCommandTitleField
Definition
SCR_PlayerCommandsConfig.c:155
SCR_BoardingEntityWaypoint
Definition
SCR_BoardingEntityWaypoint.c:7
SCR_ContextGetIngroupCommand
Definition
SCR_ContextGetInGroupCommand.c:3
SCR_ContextGetIngroupCommand::CreateBoardingEntityWP
bool CreateBoardingEntityWP(IEntity targetGroup, IEntity entity, vector position)
Definition
SCR_ContextGetInGroupCommand.c:59
SCR_ContextGetIngroupCommand::Execute
override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
Definition
SCR_ContextGetInGroupCommand.c:8
SCR_ContextGetIngroupCommand::DecideAndSetWP
bool DecideAndSetWP(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID)
Definition
SCR_ContextGetInGroupCommand.c:24
SCR_ContextGetIngroupCommand::m_sSpecificEntityWP
ResourceName m_sSpecificEntityWP
Definition
SCR_ContextGetInGroupCommand.c:5
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::m_bForceCommand
bool m_bForceCommand
Definition
SCR_WaypointGroupCommand.c:15
SCR_WaypointGroupCommand::m_sWaypointPrefab
ResourceName m_sWaypointPrefab
Definition
SCR_WaypointGroupCommand.c:6
SCR_WaypointGroupCommand::CheckPreviousWaypoints
void CheckPreviousWaypoints(SCR_AIGroup slaveGroup)
Definition
SCR_WaypointGroupCommand.c:160
SCR_WaypointGroupCommand::SetWaypointForAIGroup
bool SetWaypointForAIGroup(IEntity target, vector targetPosition, int playerID)
Definition
SCR_WaypointGroupCommand.c:59
vector
Definition
vector.c:13
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Commanding
Commands
SCR_ContextGetInGroupCommand.c
Generated by
1.17.0