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_HealingUserAction.c
Go to the documentation of this file.
1
class
SCR_HealingUserAction
:
ScriptedUserAction
2
{
3
[
Attribute
(
"0"
,
UIWidgets
.ComboBox,
"Which hitzone group will be checked for conditions"
, enums:ParamEnumArray.FromEnum(
ECharacterHitZoneGroup
) )]
4
protected
ECharacterHitZoneGroup
m_eHitZoneGroup
;
5
6
[
Attribute
(
"0"
,
UIWidgets
.ComboBox,
"Which consumabletype will be checked for conditions"
, enums:ParamEnumArray.FromEnum(
SCR_EConsumableType
) )]
7
protected
SCR_EConsumableType
m_eConsumableType
;
8
9
[
Attribute
(
"#AR-FailReason_AlreadyApplied"
,
UIWidgets
.EditBox,
"String for already applied healing gadgets"
)]
10
protected
LocalizedString
m_sAlreadyApplied
;
11
12
[
Attribute
(
"#AR-FailReason_NotBleeding"
,
UIWidgets
.EditBox,
"String for when target hitzone isn't bleeding"
)]
13
protected
LocalizedString
m_sNotBleeding
;
14
15
[
Attribute
(
"#AR-FailReason_NoBloodLoss"
,
UIWidgets
.EditBox,
"String for when blood hitzone isn't damaged"
)]
16
protected
LocalizedString
m_sNoBloodLoss
;
17
18
[
Attribute
(
"#AR-FailReason_NotDamaged"
,
UIWidgets
.EditBox,
"String for when target hitzone isn't damaged"
)]
19
protected
LocalizedString
m_sNotDamaged
;
20
21
//------------------------------------------------------------------------------------------------
22
protected
SCR_ConsumableItemComponent
GetConsumableComponent
(notnull
ChimeraCharacter
userChar)
23
{
24
CharacterControllerComponent controller = userChar.GetCharacterController();
25
if
(!controller)
26
return
null;
27
28
IEntity
item = controller.GetAttachedGadgetAtLeftHandSlot();
29
if
(!item)
30
return
null;
31
32
return
SCR_ConsumableItemComponent.Cast(item.
FindComponent
(SCR_ConsumableItemComponent));
33
}
34
35
//------------------------------------------------------------------------------------------------
36
override
bool
CanBeShownScript
(
IEntity
user)
37
{
38
// It is not allowed to perform healing useraction on self
39
if
(!user || user ==
GetOwner
())
40
return
false
;
41
42
// Target character
43
ChimeraCharacter
targetCharacter =
ChimeraCharacter
.Cast(
GetOwner
());
44
if
(!targetCharacter)
45
return
false
;
46
47
// Medic character
48
ChimeraCharacter
userCharacter =
ChimeraCharacter
.Cast(user);
49
if
(!userCharacter)
50
return
false
;
51
52
// Medics' item use ability check
53
CharacterControllerComponent userController = userCharacter.GetCharacterController();
54
if
(!userController || userController.IsUsingItem())
55
return
false
;
56
57
// Check if character is in a vehicle and if healing is allowed from seat, if so
58
if
(userCharacter.IsInVehicle() && !
HealingAllowedFromSeat
(userCharacter))
59
return
false
;
60
61
// Can only see healing useractions when holding respective consumable
62
SCR_ConsumableItemComponent consumableComponent =
GetConsumableComponent
(userCharacter);
63
if
(!consumableComponent || consumableComponent.GetConsumableType() !=
m_eConsumableType
)
64
return
false
;
65
66
// Cannot see healing useractions on dead people
67
SCR_CharacterDamageManagerComponent
damageMan =
SCR_CharacterDamageManagerComponent
.Cast(targetCharacter.GetDamageManager());
68
if
(!damageMan || damageMan.GetState() ==
EDamageState
.DESTROYED)
69
return
false
;
70
71
if
(damageMan.
GetGroupIsBeingHealed
(
m_eHitZoneGroup
))
72
return
false
;
73
74
return
true
;
75
}
76
77
//------------------------------------------------------------------------------------------------
78
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
79
{
80
// Target character
81
ChimeraCharacter
targetCharacter =
ChimeraCharacter
.Cast(
GetOwner
());
82
if
(!targetCharacter)
83
return
;
84
85
// Medic character
86
ChimeraCharacter
userCharacter =
ChimeraCharacter
.Cast(pUserEntity);
87
if
(!userCharacter)
88
return
;
89
90
SCR_CharacterControllerComponent
userController =
SCR_CharacterControllerComponent
.Cast(userCharacter.GetCharacterController());
91
if
(!userController)
92
return
;
93
94
IEntity
item = userController.GetAttachedGadgetAtLeftHandSlot();
95
if
(!item)
96
return
;
97
98
SCR_ConsumableItemComponent consumableComponent =
GetConsumableComponent
(userCharacter);
99
if
(!consumableComponent)
100
return
;
101
102
consumableComponent.SetTargetCharacter(targetCharacter);
103
SCR_ConsumableEffectHealthItems
consumableEffect =
SCR_ConsumableEffectHealthItems
.Cast(consumableComponent.GetConsumableEffect());
104
if
(!consumableEffect)
105
return
;
106
107
TAnimGraphCommand
desiredCmd;
108
if
(pOwnerEntity == pUserEntity)
109
desiredCmd = consumableEffect.GetApplyToSelfAnimCmnd(pOwnerEntity);
110
else
111
desiredCmd = consumableEffect.GetApplyToOtherAnimCmnd(pOwnerEntity);
112
113
SCR_CharacterControllerComponent
targetController =
SCR_CharacterControllerComponent
.Cast(targetCharacter.GetCharacterController());
114
if
(targetController && targetController.IsUnconscious())
115
desiredCmd = consumableEffect.
GetReviveAnimCmnd
(pOwnerEntity);
116
117
SCR_CharacterDamageManagerComponent
targetDamageMan =
SCR_CharacterDamageManagerComponent
.Cast(targetCharacter.GetDamageManager());
118
if
(!targetDamageMan)
119
return
;
120
121
ItemUseParameters
params
=
ItemUseParameters
();
122
params
.SetEntity(item);
123
params
.SetAllowMovementDuringAction(
false
);
124
params
.SetKeepInHandAfterSuccess(
true
);
125
params
.SetCommandID(desiredCmd);
126
params
.SetCommandIntArg(1);
127
params
.SetCommandFloatArg(0.0);
128
params
.SetMaxAnimLength(consumableEffect.GetApplyToOtherDuraction());
129
params
.SetIntParam(targetDamageMan.
FindAssociatedBandagingBodyPart
(
m_eHitZoneGroup
));
130
131
consumableEffect.
ActivateEffect
(pOwnerEntity, pUserEntity, item,
params
);
132
}
133
134
//------------------------------------------------------------------------------------------------
135
bool
HealingAllowedFromSeat
(
ChimeraCharacter
char
)
136
{
137
if
(!
char
)
138
return
false
;
139
140
CompartmentAccessComponent compartmentAccess =
char
.GetCompartmentAccessComponent();
141
if
(!compartmentAccess)
142
return
false
;
143
144
SCR_DoctorCompartmentSlot
doctorSlot =
SCR_DoctorCompartmentSlot
.Cast(compartmentAccess.GetCompartment());
145
if
(!doctorSlot)
146
return
false
;
147
148
return
doctorSlot.
AllowHealingFromCompartment
();
149
}
150
151
//------------------------------------------------------------------------------------------------
152
ECharacterHitZoneGroup
GetUserActionGroup
()
153
{
154
return
m_eHitZoneGroup
;
155
}
156
};
TAnimGraphCommand
int TAnimGraphCommand
Definition
ECommandIDs.c:1
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition
SCR_CharacterDamageManagerComponent.c:2
SCR_EConsumableType
SCR_EConsumableType
Type of consumable gadget.
Definition
SCR_ConsumableEffectBase.c:3
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
BaseUserAction::GetOwner
proto external IEntity GetOwner()
Returns the parent entity of this action.
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
ItemUseParameters
Definition
ItemUseParameters.c:16
LocalizedString
Definition
LocalizedString.c:22
SCR_CharacterControllerComponent
Definition
SCR_CharacterControllerComponent.c:36
SCR_CharacterDamageManagerComponent
Definition
SCR_CharacterDamageManagerComponent.c:19
SCR_CharacterDamageManagerComponent::GetGroupIsBeingHealed
bool GetGroupIsBeingHealed(ECharacterHitZoneGroup hitZoneGroup)
Definition
SCR_CharacterDamageManagerComponent.c:1273
SCR_CharacterDamageManagerComponent::FindAssociatedBandagingBodyPart
EBandagingAnimationBodyParts FindAssociatedBandagingBodyPart(ECharacterHitZoneGroup hitZoneGroup)
Definition
SCR_CharacterDamageManagerComponent.c:1163
SCR_ConsumableEffectHealthItems
Definition
SCR_ConsumableEffectHealthItems.c:3
SCR_ConsumableEffectHealthItems::ActivateEffect
override bool ActivateEffect(IEntity target, IEntity user, IEntity item, ItemUseParameters animParams=null)
Definition
SCR_ConsumableEffectHealthItems.c:20
SCR_ConsumableEffectHealthItems::GetReviveAnimCmnd
TAnimGraphCommand GetReviveAnimCmnd(IEntity user)
Definition
SCR_ConsumableEffectHealthItems.c:140
SCR_DoctorCompartmentSlot
Definition
SCR_DoctorCompartmentSlot.c:2
SCR_DoctorCompartmentSlot::AllowHealingFromCompartment
bool AllowHealingFromCompartment()
Definition
SCR_DoctorCompartmentSlot.c:7
SCR_HealingUserAction
Definition
SCR_HealingUserAction.c:2
SCR_HealingUserAction::GetUserActionGroup
ECharacterHitZoneGroup GetUserActionGroup()
Definition
SCR_HealingUserAction.c:152
SCR_HealingUserAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_HealingUserAction.c:36
SCR_HealingUserAction::m_sNoBloodLoss
LocalizedString m_sNoBloodLoss
Definition
SCR_HealingUserAction.c:16
SCR_HealingUserAction::m_eHitZoneGroup
ECharacterHitZoneGroup m_eHitZoneGroup
Definition
SCR_HealingUserAction.c:4
SCR_HealingUserAction::m_sNotDamaged
LocalizedString m_sNotDamaged
Definition
SCR_HealingUserAction.c:19
SCR_HealingUserAction::m_sAlreadyApplied
LocalizedString m_sAlreadyApplied
Definition
SCR_HealingUserAction.c:10
SCR_HealingUserAction::m_eConsumableType
SCR_EConsumableType m_eConsumableType
Definition
SCR_HealingUserAction.c:7
SCR_HealingUserAction::m_sNotBleeding
LocalizedString m_sNotBleeding
Definition
SCR_HealingUserAction.c:13
SCR_HealingUserAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_HealingUserAction.c:78
SCR_HealingUserAction::GetConsumableComponent
SCR_ConsumableItemComponent GetConsumableComponent(notnull ChimeraCharacter userChar)
Definition
SCR_HealingUserAction.c:22
SCR_HealingUserAction::HealingAllowedFromSeat
bool HealingAllowedFromSeat(ChimeraCharacter char)
Definition
SCR_HealingUserAction.c:135
ScriptedUserAction
Definition
ScriptedUserAction.c:13
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
UserActions
SCR_HealingUserAction.c
Generated by
1.17.0