Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ConsumableBandage.c
Go to the documentation of this file.
4 {
5  //------------------------------------------------------------------------------------------------
6  override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
7  {
8  super.ApplyEffect(target, user, item, animParams);
9 
10  ChimeraCharacter char = ChimeraCharacter.Cast(target);
11  if (!char)
12  return;
13 
15  if (!damageMgr)
16  return;
17 
18  array<HitZone> hitZones = {};
19  ECharacterHitZoneGroup hzGroup;
20  damageMgr.GetBandageAnimHitzones(animParams.GetIntParam(), hitZones);
21  if (hitZones.IsEmpty())
22  {
23  hzGroup = damageMgr.GetCharMostDOTHitzoneGroup(EDamageType.BLEEDING);
24  }
25  else
26  {
27  HitZone targetHitZone = hitZones.Get(0);
28  if (!targetHitZone)
29  return;
30 
31  SCR_CharacterHitZone charHitZone = SCR_CharacterHitZone.Cast(targetHitZone);
32  if (!charHitZone)
33  return;
34 
35  hzGroup = charHitZone.GetHitZoneGroup();
36  }
37 
38  if (hzGroup == ECharacterHitZoneGroup.VIRTUAL)
39  return;
40 
41  damageMgr.RemoveGroupBleeding(hzGroup);
42  }
43 
44  //------------------------------------------------------------------------------------------------
45  override bool CanApplyEffect(notnull IEntity target, notnull IEntity user, out SCR_EConsumableFailReason failReason)
46  {
47  ChimeraCharacter char = ChimeraCharacter.Cast(target);
48  if (!char)
49  return false;
50 
52  if (!damageMgr)
53  return false;
54 
55  return damageMgr.IsDamagedOverTime(EDamageType.BLEEDING);
56  }
57 
58  //------------------------------------------------------------------------------------------------
59  override bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE)
60  {
61  ChimeraCharacter char = ChimeraCharacter.Cast(target);
62  if (!char)
63  return false;
64 
66  return damageMgr && damageMgr.GetGroupDamageOverTime(group, EDamageType.BLEEDING) > 0;
67  }
68 
69  //------------------------------------------------------------------------------------------------
71  override ItemUseParameters GetAnimationParameters(IEntity item, notnull IEntity target, ECharacterHitZoneGroup group = ECharacterHitZoneGroup.VIRTUAL)
72  {
73  ChimeraCharacter char = ChimeraCharacter.Cast(target);
74  if (!char)
75  return null;
76 
78  if (!damageMgr)
79  return null;
80 
82 
83  if (group != ECharacterHitZoneGroup.VIRTUAL)
84  {
85  if (!damageMgr.GetGroupIsBeingHealed(group))
86  bodyPartToBandage = damageMgr.FindAssociatedBandagingBodyPart(group);
87  }
88  else
89  {
90  group = damageMgr.GetCharMostDOTHitzoneGroup(EDamageType.BLEEDING, ignoreIfBeingTreated: true);
91  array<HitZone> hitzones = {};
92  damageMgr.GetHitZonesOfGroup(group, hitzones);
93  if (!hitzones || hitzones.IsEmpty())
94  return null;
95 
96  SCR_CharacterHitZone hitzone = SCR_CharacterHitZone.Cast(hitzones[0]);
97  if (!hitzone)
98  return null;
99 
100  bodyPartToBandage = hitzone.GetBodyPartToHeal();
101  }
102 
103  if (bodyPartToBandage == EBandagingAnimationBodyParts.Invalid)
104  return null;
105 
107  params.SetEntity(item);
108  params.SetAllowMovementDuringAction(false);
109  params.SetKeepInHandAfterSuccess(false);
110  params.SetCommandID(GetApplyToSelfAnimCmnd(target));
111  params.SetCommandIntArg(1);
112  params.SetCommandFloatArg(0.0);
113  params.SetMaxAnimLength(m_fApplyToSelfDuration);
114  params.SetIntParam(bodyPartToBandage);
115 
116  return params;
117  }
118 
119  //------------------------------------------------------------------------------------------------
120  // constructor
121  void SCR_ConsumableBandage()
122  {
123  m_eConsumableType = SCR_EConsumableType.BANDAGE;
124  }
125 }
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
SCR_CharacterHitZone
Definition: SCR_CharacterHitZone.c:55
HitZone
Definition: HitZone.c:12
ItemUseParameters
Definition: ItemUseParameters.c:15
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
GetDamageManager
proto external SCR_DamageManagerComponent GetDamageManager()
Returns component which handles damage.
SCR_ConsumableBandage
Bandage effect.
Definition: SCR_ConsumableBandage.c:3
EDamageType
EDamageType
Definition: EDamageType.c:12
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
EBandagingAnimationBodyParts
EBandagingAnimationBodyParts
Definition: SCR_CharacterHitZone.c:27
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