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_ExplosiveChargeAction.c
Go to the documentation of this file.
1
class
SCR_ExplosiveChargeAction
:
SCR_ScriptedUserAction
2
{
3
[
Attribute
(
"CMD_Item_Action"
,
desc
:
"Name of the command that will be used to bind usage animation"
)]
4
protected
string
m_sUseItemCommandName
;
5
6
[
Attribute
(
"#AR-UserAction_ExplosiveCharge_ArmedWithDifferentFuze"
,
desc
:
"Localized string of the text that will be shown when charge is armed with different fuze"
)]
7
protected
LocalizedString
m_sDifferentFuzeInUseText
;
8
9
protected
SCR_ExplosiveChargeComponent
m_ChargeComp
;
10
protected
ChimeraCharacter
m_ActionUser
;
11
12
protected
const
float
MAX_ALLOWED_ANIMATION_DISTANCE
= 0.3;
13
14
//------------------------------------------------------------------------------------------------
15
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
16
{
17
m_ChargeComp
=
SCR_ExplosiveChargeComponent
.Cast(pOwnerEntity.
FindComponent
(
SCR_ExplosiveChargeComponent
));
18
}
19
20
//------------------------------------------------------------------------------------------------
21
override
bool
CanBeShownScript
(
IEntity
user)
22
{
23
if
(!
m_ChargeComp
)
24
return
false
;
25
26
if
(!
m_ChargeComp
.GetTrigger())
27
return
false
;
28
29
return
true
;
30
}
31
32
//------------------------------------------------------------------------------------------------
33
override
bool
CanBePerformedScript
(
IEntity
user)
34
{
35
if
(!
m_ChargeComp
.GetRplId().IsValid())
36
return
false
;
37
38
return
true
;
39
}
40
41
//------------------------------------------------------------------------------------------------
42
override
bool
GetActionNameScript
(out
string
outName)
43
{
44
UIInfo
actionInfo =
GetUIInfo
();
45
if
(!actionInfo)
46
return
false
;
47
48
outName = actionInfo.GetName();
49
50
return
true
;
51
}
52
53
//------------------------------------------------------------------------------------------------
54
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
55
{
56
m_ActionUser
=
ChimeraCharacter
.Cast(pUserEntity);
57
if
(!
m_ActionUser
)
58
return
;
59
60
if
(
m_sUseItemCommandName
!=
string
.Empty)
61
AnimateUsage
(pUserEntity);
62
else
63
ProcesFinished
(
GetOwner
(),
true
, null);
64
}
65
66
//------------------------------------------------------------------------------------------------
67
protected
void
AnimateUsage
(
IEntity
pUserEntity)
68
{
69
SCR_CharacterControllerComponent
charController =
SCR_CharacterControllerComponent
.Cast(
m_ActionUser
.GetCharacterController());
70
if
(!charController)
71
return
;
72
73
CharacterAnimationComponent
pAnimationComponent = charController.GetAnimationComponent();
74
int
itemActionId = pAnimationComponent.BindCommand(
m_sUseItemCommandName
);
75
vector
charWorldMat[4];
76
pUserEntity.
GetWorldTransform
(charWorldMat);
77
float
lerpFactor =
vector
.DistanceXZ(charWorldMat[3],
GetOwner
().
GetOrigin
());
78
lerpFactor =
Math
.Clamp((lerpFactor -
MAX_ALLOWED_ANIMATION_DISTANCE
) / lerpFactor, 0.01, 1);
79
charWorldMat[3][0] =
Math
.Lerp(charWorldMat[3][0],
GetOwner
().
GetOrigin
()[0], lerpFactor);
80
charWorldMat[3][2] =
Math
.Lerp(charWorldMat[3][2],
GetOwner
().
GetOrigin
()[2], lerpFactor);
81
PointInfo
ptWS =
new
PointInfo
();
82
ptWS.Set(null,
""
, charWorldMat);
83
84
ItemUseParameters
params
=
new
ItemUseParameters
();
85
params
.SetEntity(
GetOwner
());
86
params
.SetAllowMovementDuringAction(
false
);
87
params
.SetKeepInHandAfterSuccess(
true
);
88
params
.SetCommandID(itemActionId);
89
params
.SetCommandIntArg(3);
90
params
.SetCommandFloatArg(0.0);
91
params
.SetAlignmentPoint(ptWS);
92
93
charController.TryUseItemOverrideParams(
params
);
94
charController.
m_OnItemUseEndedInvoker
.Insert(
ProcesFinished
);
95
}
96
97
//------------------------------------------------------------------------------------------------
99
void
ProcesFinished
(
IEntity
item,
bool
successful,
ItemUseParameters
animParams)
100
{
101
if
(!
m_ActionUser
)
102
return
;
103
104
SCR_CharacterControllerComponent
characterController =
SCR_CharacterControllerComponent
.Cast(
m_ActionUser
.GetCharacterController());
105
if
(!characterController)
106
return
;
107
108
characterController.
m_OnItemUseEndedInvoker
.Remove(
ProcesFinished
);
109
}
110
}
GetOrigin
vector GetOrigin()
Definition
SCR_AIUtilityComponent.c:471
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
BaseUserAction::GetOwner
proto external IEntity GetOwner()
Returns the parent entity of this action.
BaseUserAction::GetUIInfo
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
CharacterAnimationComponent
Definition
CharacterAnimationComponent.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetWorldTransform
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
ItemUseParameters
Definition
ItemUseParameters.c:16
LocalizedString
Definition
LocalizedString.c:22
Math
Definition
Math.c:13
PointInfo
PointInfo - allows to define position.
Definition
PointInfo.c:9
SCR_CharacterControllerComponent
Definition
SCR_CharacterControllerComponent.c:36
SCR_CharacterControllerComponent::m_OnItemUseEndedInvoker
ref OnItemUseEndedInvoker m_OnItemUseEndedInvoker
Definition
SCR_CharacterControllerComponent.c:78
SCR_ExplosiveChargeAction
Definition
SCR_ExplosiveChargeAction.c:2
SCR_ExplosiveChargeAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_ExplosiveChargeAction.c:15
SCR_ExplosiveChargeAction::m_ActionUser
ChimeraCharacter m_ActionUser
Definition
SCR_ExplosiveChargeAction.c:10
SCR_ExplosiveChargeAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_ExplosiveChargeAction.c:21
SCR_ExplosiveChargeAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_ExplosiveChargeAction.c:42
SCR_ExplosiveChargeAction::m_sUseItemCommandName
string m_sUseItemCommandName
Definition
SCR_ExplosiveChargeAction.c:4
SCR_ExplosiveChargeAction::MAX_ALLOWED_ANIMATION_DISTANCE
const float MAX_ALLOWED_ANIMATION_DISTANCE
Definition
SCR_ExplosiveChargeAction.c:12
SCR_ExplosiveChargeAction::AnimateUsage
void AnimateUsage(IEntity pUserEntity)
Definition
SCR_ExplosiveChargeAction.c:67
SCR_ExplosiveChargeAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_ExplosiveChargeAction.c:54
SCR_ExplosiveChargeAction::m_sDifferentFuzeInUseText
LocalizedString m_sDifferentFuzeInUseText
Definition
SCR_ExplosiveChargeAction.c:7
SCR_ExplosiveChargeAction::ProcesFinished
void ProcesFinished(IEntity item, bool successful, ItemUseParameters animParams)
Called by everyone when process was finished.
Definition
SCR_ExplosiveChargeAction.c:99
SCR_ExplosiveChargeAction::m_ChargeComp
SCR_ExplosiveChargeComponent m_ChargeComp
Definition
SCR_ExplosiveChargeAction.c:9
SCR_ExplosiveChargeAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_ExplosiveChargeAction.c:33
SCR_ExplosiveChargeComponent
Definition
SCR_ExplosiveChargeComponent.c:11
SCR_ScriptedUserAction
A scripted action class having optional logic to check if vehicle is valid.
Definition
SCR_ScriptedUserAction.c:6
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UserActions
SCR_ExplosiveChargeAction.c
Generated by
1.17.0