Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ConsumableEffectHealthItems.c
Go to the documentation of this file.
2class SCR_ConsumableEffectHealthItems : SCR_ConsumableEffectBase
3{
4 [Attribute("0", UIWidgets.EditBox, "Regeneration speed of related hitZone when consuming this item", category: "Regeneration")]
5 protected float m_fItemRegenerationSpeed;
6
7 [Attribute("0", UIWidgets.EditBox, "Regeneration duration of related hitZone when consuming this item in seconds", category: "Regeneration")]
9
10 [Attribute("0", UIWidgets.EditBox, "Total amount of regeneration that will be applied to the related hitZone. Will be ignored if m_fItemRegenerationDuration > 0", category: "Regeneration")]
12
13 [Attribute(desc: "DamageEffects to add when the effect is applied")]
14 protected ref array<ref SCR_DamageEffect> m_aDamageEffectsToLoad;
15
16 //Cached to remember which bodypart to remove effect from
18
19 //------------------------------------------------------------------------------------------------
20 override bool ActivateEffect(IEntity target, IEntity user, IEntity item, ItemUseParameters animParams = null)
21 {
22 ItemUseParameters localAnimParams = animParams;
23 if (!localAnimParams)
24 {
25 //user-held healthitem needs to get data from target to perform anim
26 localAnimParams = GetAnimationParameters(item, target);
27 }
28
29 if (!localAnimParams)
30 return false;
31
32 if (!super.ActivateEffect(target, user, item, localAnimParams))
33 return false;
34
35 ChimeraCharacter character = ChimeraCharacter.Cast(target);
36 if (!character)
37 return false;
38
39 CharacterControllerComponent controller = character.GetCharacterController();
40 if (!controller)
41 return false;
42
43 if (localAnimParams.GetIntParam() == EBandagingAnimationBodyParts.LeftLeg || localAnimParams.GetIntParam() == EBandagingAnimationBodyParts.RightLeg)
44 {
45 if (controller.GetStance() == ECharacterStance.STAND)
46 controller.SetStanceChange(ECharacterStanceChange.STANCECHANGE_TOCROUCH);
47 }
48
49 return true;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
54 {
56 if (itemComp)
57 itemComp.RequestUserLock(user, false);
58
59 ChimeraCharacter char = ChimeraCharacter.Cast(target);
60 if (!char)
61 return;
62
64 }
65
66 //------------------------------------------------------------------------------------------------
68 {
70 SCR_DotDamageEffect dotClone;
71
72 array<HitZone> hitZones = {};
73 damageMgr.GetHitZonesOfGroup(GetTargetHitZoneGroup(), hitZones);
74 if (hitZones.IsEmpty())
75 hitZones.Insert(damageMgr.GetDefaultHitZone());
76
78 {
79 effect.SetInstigator(Instigator.CreateInstigator(instigator));
80 effect.SetDamageType(effect.GetDefaultDamageType());
81 effect.SetAffectedHitZone(hitZones[0]);
82
83 dotClone = SCR_DotDamageEffect.Cast(effect);
84 if (dotClone)
85 {
86 dotClone.SetDPS(-GetItemRegenSpeed());
87 dotClone.SetMaxDuration(m_fItemRegenerationDuration);
88 }
89
90 damageMgr.AddDamageEffect(effect);
91 }
92 };
93
94 //------------------------------------------------------------------------------------------------
96 {
97 float itemRegenSpeed = 0;
98 if (m_fItemRegenerationSpeed != 0) // If a regeneration time is set, regen will occur for given amount of time at the itemRegenerationSpeed
99 itemRegenSpeed = m_fItemRegenerationSpeed;
100 else if (m_fItemAbsoluteRegenerationAmount != 0) // If an absolute regen amount is set instead of a duration, the regen will last until the amount of points has been distributed at the itemRegenerationSpeed
102
103 return itemRegenSpeed;
104 }
105
106 //------------------------------------------------------------------------------------------------
108 {
109 ChimeraCharacter char = ChimeraCharacter.Cast(user);
110 if (!char)
111 return false;
112
113 CharacterAnimationComponent animationComponent = char.GetAnimationComponent();
114 if (!animationComponent)
115 return false;
116
117 m_iPlayerApplyToSelfCmdId = animationComponent.BindCommand("CMD_HealSelf");
118 m_iPlayerApplyToOtherCmdId = animationComponent.BindCommand("CMD_HealOther");
119 m_iPlayerReviveCmdId = animationComponent.BindCommand("CMD_Revive");
120 if (m_iPlayerApplyToSelfCmdId < 0 || m_iPlayerApplyToOtherCmdId < 0)
121 {
122 Print("One or both healing animationCommands have incorrect ID's!!", LogLevel.ERROR);
123 return false;
124 }
125
126 return true;
127 }
128
129 //------------------------------------------------------------------------------------------------
135 bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE);
136
137 //------------------------------------------------------------------------------------------------
141 {
143 return m_iPlayerReviveCmdId;
144 }
145
146 //------------------------------------------------------------------------------------------------
151}
int TAnimGraphCommand
Definition ECommandIDs.c:1
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
EBandagingAnimationBodyParts
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_VehicleDamageManagerComponent GetDamageManager()
proto external Managed FindComponent(typename typeName)
bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason=SCR_EConsumableFailReason.NONE)
override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
void AddConsumableDamageEffects(notnull ChimeraCharacter char, IEntity instigator)
override bool UpdateAnimationCommands(IEntity user)
override bool ActivateEffect(IEntity target, IEntity user, IEntity item, ItemUseParameters animParams=null)
ref array< ref SCR_DamageEffect > m_aDamageEffectsToLoad
TAnimGraphCommand GetReviveAnimCmnd(IEntity user)
ECharacterStanceChange
ECharacterStance
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute