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_ArmExplosiveChargeWithRemoteFuzeAction.c
Go to the documentation of this file.
1
class
SCR_ArmExplosiveChargeWithRemoteFuzeAction
:
SCR_ExplosiveChargeAction
2
{
3
protected
SCR_DetonatorGadgetComponent
m_HeldDetonatorComp
;
4
protected
bool
m_bInProgress
;
5
6
//------------------------------------------------------------------------------------------------
7
override
bool
CanBeShownScript
(
IEntity
user)
8
{
9
if
(!super.CanBeShownScript(user))
10
return
false
;
11
12
if
(
m_bInProgress
)
13
return
false
;
14
15
ChimeraCharacter
character
=
ChimeraCharacter
.Cast(user);
16
if
(!
character
)
17
return
false
;
18
19
CharacterControllerComponent charController =
character
.GetCharacterController();
20
if
(!charController || charController.IsChangingItem())
21
return
false
;
22
23
IEntity
item = charController.GetAttachedGadgetAtLeftHandSlot();
24
if
(!item)
25
return
false
;
26
27
m_HeldDetonatorComp
= SCR_DetonatorGadgetComponent.Cast(item.
FindComponent
(SCR_DetonatorGadgetComponent));
28
if
(!
m_HeldDetonatorComp
)
29
return
false
;
30
31
return
true
;
32
}
33
34
//------------------------------------------------------------------------------------------------
35
override
bool
CanBePerformedScript
(
IEntity
user)
36
{
37
if
(!super.CanBePerformedScript(user))
38
return
false
;
39
40
if
(!
m_HeldDetonatorComp
)
41
return
false
;
42
43
if
(
m_HeldDetonatorComp
.IsAttachedToTheDetonator(
m_ChargeComp
.GetRplId()))
44
{
45
UIInfo
actionInfo =
GetUIInfo
();
46
if
(!actionInfo)
47
return
false
;
48
49
SetCannotPerformReason
(actionInfo.GetDescription());
50
return
false
;
51
}
52
53
if
(
m_ChargeComp
.GetUsedFuzeType() !=
SCR_EFuzeType
.NONE)
54
{
55
SetCannotPerformReason
(
m_sDifferentFuzeInUseText
);
56
return
false
;
57
}
58
59
return
true
;
60
}
61
62
//------------------------------------------------------------------------------------------------
63
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
64
{
65
if
(!pUserEntity || !
m_ChargeComp
)
66
return
;
67
68
if
(!
m_ChargeComp
.GetRplId().IsValid())
69
return
;
70
71
ChimeraCharacter
character
=
ChimeraCharacter
.Cast(pUserEntity);
72
if
(!
character
)
73
return
;
74
75
CharacterControllerComponent charController =
character
.GetCharacterController();
76
if
(!charController || charController.IsChangingItem())
77
return
;
78
79
IEntity
item = charController.GetAttachedGadgetAtLeftHandSlot();
80
if
(!item)
81
return
;
82
83
m_HeldDetonatorComp
= SCR_DetonatorGadgetComponent.Cast(item.
FindComponent
(SCR_DetonatorGadgetComponent));
84
if
(!
m_HeldDetonatorComp
)
//we need to do this as other clients will also execute this code and they need to have newest detonator
85
return
;
86
87
super.PerformAction(pOwnerEntity, pUserEntity);
88
}
89
90
//------------------------------------------------------------------------------------------------
91
override
void
AnimateUsage
(
IEntity
pUserEntity)
92
{
93
m_bInProgress
=
true
;
94
super.AnimateUsage(pUserEntity);
95
}
96
97
//------------------------------------------------------------------------------------------------
98
override
void
ProcesFinished
(
IEntity
item,
bool
successful,
ItemUseParameters
animParams)
99
{
100
super.ProcesFinished(item, successful, animParams);
101
m_bInProgress
=
false
;
102
if
(!successful)
103
return
;
104
105
if
(!
m_HeldDetonatorComp
|| !
m_ChargeComp
)
106
return
;
107
108
m_HeldDetonatorComp
.ConnectNewCharge(
m_ChargeComp
.GetRplId());
109
110
if
(
m_ChargeComp
.GetTrigger())
111
m_ChargeComp
.GetTrigger().SetUser(
m_ActionUser
);
112
113
RplId
detonatorId =
Replication
.FindItemId(
m_HeldDetonatorComp
);
114
if
(detonatorId.IsValid())
115
m_ChargeComp
.ConnectDetonator(
SCR_EFuzeType
.REMOTE, detonatorId);
116
}
117
118
//------------------------------------------------------------------------------------------------
119
override
bool
GetActionNameScript
(out
string
outName)
120
{
121
UIInfo
actionInfo =
GetUIInfo
();
122
if
(!actionInfo)
123
return
false
;
124
125
if
(!
m_HeldDetonatorComp
)
126
return
false
;
127
128
InventoryItemComponent
detonatorIIC =
InventoryItemComponent
.Cast(
m_HeldDetonatorComp
.GetOwner().FindComponent(
InventoryItemComponent
));
129
if
(!detonatorIIC)
130
return
false
;
131
132
UIInfo
detonatorUiInfo = detonatorIIC.GetUIInfo();
133
if
(!detonatorUiInfo)
134
return
false
;
135
136
outName =
WidgetManager
.Translate(actionInfo.GetName(), detonatorUiInfo.GetName());
137
138
return
true
;
139
}
140
}
SCR_EFuzeType
SCR_EFuzeType
Enum with all types of fuzes.
Definition
SCR_EFuzeType.c:3
GetUIInfo
SCR_UIInfo GetUIInfo()
Definition
SCR_EditableEntityCampaignBuildingModeLabelSetting.c:27
BaseUserAction::SetCannotPerformReason
void SetCannotPerformReason(string reason)
Definition
BaseUserAction.c:21
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
InventoryItemComponent
Definition
InventoryItemComponent.c:13
ItemUseParameters
Definition
ItemUseParameters.c:16
Replication
Main replication API.
Definition
Replication.c:14
RplId
Replication item identifier.
Definition
RplId.c:14
SCR_ArmExplosiveChargeWithRemoteFuzeAction
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:2
SCR_ArmExplosiveChargeWithRemoteFuzeAction::AnimateUsage
override void AnimateUsage(IEntity pUserEntity)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:91
SCR_ArmExplosiveChargeWithRemoteFuzeAction::m_HeldDetonatorComp
SCR_DetonatorGadgetComponent m_HeldDetonatorComp
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:3
SCR_ArmExplosiveChargeWithRemoteFuzeAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:63
SCR_ArmExplosiveChargeWithRemoteFuzeAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:119
SCR_ArmExplosiveChargeWithRemoteFuzeAction::m_bInProgress
bool m_bInProgress
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:4
SCR_ArmExplosiveChargeWithRemoteFuzeAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:35
SCR_ArmExplosiveChargeWithRemoteFuzeAction::ProcesFinished
override void ProcesFinished(IEntity item, bool successful, ItemUseParameters animParams)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:98
SCR_ArmExplosiveChargeWithRemoteFuzeAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c:7
SCR_ExplosiveChargeAction
Definition
SCR_ExplosiveChargeAction.c:2
SCR_ExplosiveChargeAction::m_ActionUser
ChimeraCharacter m_ActionUser
Definition
SCR_ExplosiveChargeAction.c:10
SCR_ExplosiveChargeAction::m_sDifferentFuzeInUseText
LocalizedString m_sDifferentFuzeInUseText
Definition
SCR_ExplosiveChargeAction.c:7
SCR_ExplosiveChargeAction::m_ChargeComp
SCR_ExplosiveChargeComponent m_ChargeComp
Definition
SCR_ExplosiveChargeAction.c:9
SCR_ScriptedUserAction::character
ChimeraCharacter character
Definition
SCR_ScriptedUserAction.c:35
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
WidgetManager
Definition
WidgetManager.c:16
scripts
Game
UserActions
SCR_ArmExplosiveChargeWithRemoteFuzeAction.c
Generated by
1.17.0