Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ConsumableSalineBag.c
Go to the documentation of this file.
4
7class SCR_ConsumableSalineBag : SCR_ConsumableEffectHealthItems
8{
9
10 //------------------------------------------------------------------------------------------------
11 override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
12 {
14 if (itemComp)
15 itemComp.RequestUserLock(user, false);
16
17 ChimeraCharacter char = ChimeraCharacter.Cast(target);
18 if (!char)
19 return;
20
22 if (!damageMgr)
23 return;
24
25 SCR_CharacterBloodHitZone bloodHitZone = damageMgr.GetBloodHitZone();
26 if (!bloodHitZone)
27 return;
28
29 SCR_InventoryStorageManagerComponent inventoryStorageComp = SCR_InventoryStorageManagerComponent.Cast(user.FindComponent(SCR_InventoryStorageManagerComponent));
30 if (!inventoryStorageComp)
31 return;
32
33 SCR_SalineStorageComponent salineStorageComp = SCR_SalineStorageComponent.Cast(user.FindComponent(SCR_SalineStorageComponent));
34 if (!salineStorageComp)
35 return;
36
37 if (salineStorageComp.AddSalineBagToSlot(target, ECharacterHitZoneGroup.RIGHTARM, item, m_fItemRegenerationDuration))
39 }
40
41 //------------------------------------------------------------------------------------------------
42 override bool CanApplyEffect(notnull IEntity target, notnull IEntity user,out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE)
43 {
44 ChimeraCharacter char = ChimeraCharacter.Cast(target);
45 if (!char)
46 return false;
47
48 //Can only apply when SCR_CharacterBloodHitZone is damaged
49 SCR_CharacterDamageManagerComponent damageMgr = SCR_CharacterDamageManagerComponent.Cast(char.GetDamageManager());
50 if (!damageMgr || damageMgr.GetBloodHitZone().GetDamageState() == EDamageState.UNDAMAGED)
51 {
52 failReason = SCR_EConsumableFailReason.UNDAMAGED;
53 return false;
54 }
55
56 //Character must have slot for the salinebag to move to
57 SCR_SalineStorageComponent salineStorageMan = SCR_SalineStorageComponent.Cast(target.FindComponent(SCR_SalineStorageComponent));
58 if (!salineStorageMan)
59 return false;
60
61 array<IEntity> items = {};
62 salineStorageMan.GetAll(items);
63 if (!items.IsEmpty())
64 {
65 failReason = SCR_EConsumableFailReason.ALREADY_APPLIED;
66 return false;
67 }
68
69 return true;
70 }
71
72 //------------------------------------------------------------------------------------------------
73 override bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE)
74 {
75 return CanApplyEffect(target, user, failReason);
76 }
77
78 override ItemUseParameters GetAnimationParameters(IEntity item, notnull IEntity target, ECharacterHitZoneGroup group = ECharacterHitZoneGroup.VIRTUAL)
79 {
80 ItemUseParameters itemUseParams = super.GetAnimationParameters(item, target, group);
81 itemUseParams.SetAllowMovementDuringAction(true);
82 return itemUseParams;
83 }
84
85 //------------------------------------------------------------------------------------------------
86 EDamageType GetDefaultDamageType()
87 {
88 return EDamageType.HEALING;
89 }
90
91 //------------------------------------------------------------------------------------------------
92 // constructor
93 void SCR_ConsumableSalineBag()
94 {
95 m_eConsumableType = SCR_EConsumableType.SALINE;
96 }
97}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_EConsumableType
Type of consumable gadget.
float m_fItemRegenerationDuration
enum EVehicleType IEntity
SCR_VehicleDamageManagerComponent GetDamageManager()
proto external Managed FindComponent(typename typeName)
Blood - does not receive damage directly, only via scripted events.
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)
EDamageType
Definition EDamageType.c:13
EDamageState