Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ConsumableMorphine.c
Go to the documentation of this file.
4 {
5  [Attribute("10", UIWidgets.EditBox, "Regeneration speed of related hitzone when consuming this item", category: "Regeneration")]
6  protected float m_fItemRegenerationSpeed;
7 
8  [Attribute("10", UIWidgets.EditBox, "Regeneration duration of related hitzone when consuming this item in seconds", category: "Regeneration")]
9  protected float m_fItemRegenerationDuration;
10 
11  [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  protected float m_fItemAbsoluteRegenerationAmount;
13 
14  //------------------------------------------------------------------------------------------------
15  override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
16  {
17  super.ApplyEffect(target, user, item, animParams);
18 
19  ChimeraCharacter char = ChimeraCharacter.Cast(target);
20  if (!char)
21  return;
22 
24  if (!damageMgr)
25  return;
26 
27  array<HitZone> physicalHitZones = {};
28  damageMgr.GetPhysicalHitZones(physicalHitZones);
29  foreach (HitZone physicalHitZone: physicalHitZones)
30  {
31  SCR_HitZone hitzone = SCR_HitZone.Cast(physicalHitZone);
32  if (!hitzone)
33  continue;
34 
35  hitzone.CustomRegeneration(target, m_fItemRegenerationDuration, m_fItemRegenerationSpeed, m_fItemAbsoluteRegenerationAmount);
36  }
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  override bool CanApplyEffect(notnull IEntity target, notnull IEntity user, out SCR_EConsumableFailReason failReason)
41  {
42  ChimeraCharacter char = ChimeraCharacter.Cast(target);
43  if (!char)
44  return false;
45 
47  if (!damageMgr)
48  return false;
49 
50  array<HitZone> hitzones = {};
51  damageMgr.GetPhysicalHitZones(hitzones);
52 
53  foreach (HitZone hitzone : hitzones)
54  {
55  if (hitzone.GetDamageOverTime(EDamageType.HEALING) < 0)
56  {
57  failReason = SCR_EConsumableFailReason.ALREADY_APPLIED;
58  return false;
59  }
60 
61  if (hitzone.GetDamageState() != EDamageState.UNDAMAGED)
62  return true;
63  }
64 
65  failReason = SCR_EConsumableFailReason.UNDAMAGED;
66 
67  return false;
68  }
69 
70  //------------------------------------------------------------------------------------------------
71  override bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE)
72  {
73  return CanApplyEffect(target, user, failReason);
74  }
75 
76  //------------------------------------------------------------------------------------------------
77  // constructor
79  {
80  m_eConsumableType = SCR_EConsumableType.MORPHINE;
81  }
82 }
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition: SCR_CharacterDamageManagerComponent.c:1
SCR_EConsumableType
SCR_EConsumableType
Type of consumable gadget.
Definition: SCR_ConsumableEffectBase.c:2
SCR_ConsumableEffectHealthItems
Definition: SCR_ConsumableEffectHealthItems.c:2
HitZone
Definition: HitZone.c:12
ItemUseParameters
Definition: ItemUseParameters.c:15
EDamageState
EDamageState
Definition: EDamageState.c:12
SCR_ConsumableMorphine
Morphine effect.
Definition: SCR_ConsumableMorphine.c:3
m_fItemRegenerationDuration
float m_fItemRegenerationDuration
Definition: SCR_SalineStorageComponent.c:9
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
GetDamageManager
proto external SCR_DamageManagerComponent GetDamageManager()
Returns component which handles damage.
SCR_HitZone
Definition: SCR_HitZone.c:1
EDamageType
EDamageType
Definition: EDamageType.c:12
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180