Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_HealSupportStationAction.c
Go to the documentation of this file.
2 {
3  [Attribute("#AR-SupportStation_Heal_ActionInvalid_FullHealth", desc: "Text shown on action if undamaged", uiwidget: UIWidgets.LocaleEditBox)]
4  protected LocalizedString m_sInvalidDamaged;
5 
6  [Attribute("#AR-Inventory_Bleeding", desc: "Text shown on action if character is bleeding and action cannot be performed", uiwidget: UIWidgets.LocaleEditBox)]
7  protected LocalizedString m_sInvalidCharacterIsBleeding;
8 
9  //[Attribute("loc Can not heal more (Disabled)", desc: "Character cannot heal more as max healing is reached", uiwidget: UIWidgets.LocaleEditBox)]
10  //protected LocalizedString m_sInvalidMaxHealingReached;
11 
12  //[Attribute("loc Seek medical base (Disabled)", desc: "Character cannot heal more as max healing is reached for healing with field service (Ambulance).", uiwidget: UIWidgets.LocaleEditBox)]
13  //protected LocalizedString m_sInvalidMaxHealingReachedField;
14 
15  [Attribute("#AR-SupportStation_Heal_ActionInvalid_Needs_SupportStation_Emergency", desc: "Character cannot heal more as max healing is reached for healing with emergency heal (No medical services in the area)", uiwidget: UIWidgets.LocaleEditBox)]
16  protected LocalizedString m_sInvalidMaxHealingReachedEmergency;
17 
18  [Attribute(ECharacterHitZoneGroup.VIRTUAL.ToString(), UIWidgets.ComboBox, "Which hitzone group will be healed, VIRTUAL means all hitzones are healed", enums:ParamEnumArray.FromEnum(ECharacterHitZoneGroup) )]
19  protected ECharacterHitZoneGroup m_eHitZoneGroup;
20 
21  [Attribute("0", desc: "If this heal action will also heal the blood hitzone")]
22  protected bool m_bHealBloodHitzone;
23 
24  protected HitZone m_BloodHitZone;
25 
26  //------------------------------------------------------------------------------------------------
27  protected override ESupportStationType GetSupportStationType()
28  {
29  return ESupportStationType.HEAL;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  ECharacterHitZoneGroup GetHitZoneGroup()
34  {
35  return m_eHitZoneGroup;
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  protected override bool RequiresGadget()
40  {
41  return true;
42  }
43 
44  //------------------------------------------------------------------------------------------------
45  protected override int GetActionDecimalCount()
46  {
47  return 0;
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  protected override LocalizedString GetInvalidPerformReasonString(ESupportStationReasonInvalid reasonInvalid)
52  {
53  //~ Entity is undamaged
54  if (reasonInvalid == ESupportStationReasonInvalid.HEAL_ENTITY_UNDAMAGED)
55  return m_sInvalidDamaged;
56  else if (reasonInvalid == ESupportStationReasonInvalid.HEAL_CHARACTER_IS_BLEEDING)
57  return m_sInvalidCharacterIsBleeding;
58  //else if (reasonInvalid == ESupportStationReasonInvalid.HEAL_MAX_HEALABLE_HEALTH_REACHED)
59  // return m_sInvalidMaxHealingReached;
60  //else if (reasonInvalid == ESupportStationReasonInvalid.HEAL_MAX_HEALABLE_HEALTH_REACHED_FIELD)
61  // return m_sInvalidMaxHealingReachedField;
62  else if (reasonInvalid == ESupportStationReasonInvalid.HEAL_MAX_HEALABLE_HEALTH_REACHED_EMERGENCY)
63  return m_sInvalidMaxHealingReachedEmergency;
64 
65  return super.GetInvalidPerformReasonString(reasonInvalid);
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  override bool CanBeShownScript(IEntity user)
70  {
71  if (!m_DamageManagerComponent || m_aHitZonesToHeal.IsEmpty())
72  return false;
73 
74  foreach(HitZone hitzone : m_aHitZonesToHeal)
75  {
76  //~ Has a hitzone that is damaged so show
77  if (hitzone.GetHealthScaled() != 1)
78  return super.CanBeShownScript(user);
79  }
80 
81  //~ Not damaged
82  return false;
83  }
84 
85  //------------------------------------------------------------------------------------------------
86  override bool CanBePerformedScript(IEntity user)
87  {
88  //~ Can heal blood hitzone but somewhere the character is bleeding
89  if (m_BloodHitZone && m_DamageManagerComponent.IsDamagedOverTime(EDamageType.BLEEDING))
90  {
91  SetCanPerform(false, ESupportStationReasonInvalid.HEAL_CHARACTER_IS_BLEEDING);
92  return false;
93  }
94 
95  //~ Check if the character is bleeding at the hitzones this action heals
96  foreach(HitZone hitzone : m_aHitZonesToHeal)
97  {
98  if (hitzone.GetDamageOverTime(EDamageType.BLEEDING) > 0)
99  {
100  SetCanPerform(false, ESupportStationReasonInvalid.HEAL_CHARACTER_IS_BLEEDING);
101  return false;
102  }
103  }
104 
105  return super.CanBePerformedScript(user);
106  }
107 
108  //------------------------------------------------------------------------------------------------
110  HitZone GetBloodHitZoneToHeal()
111  {
112  return m_BloodHitZone;
113  }
114 
115  //------------------------------------------------------------------------------------------------
116  protected override void SetHitZonesToHeal()
117  {
118  m_aHitZonesToHeal.Clear();
119 
120  //~ If it should heal the blood hitzone then set reference to it
121  if (m_bHealBloodHitzone)
122  {
124  if (charDamageManager)
125  m_BloodHitZone = charDamageManager.GetBloodHitZone();
126  }
127 
128  //~ Virtual gets all hitzones
130  {
131  super.SetHitZonesToHeal();
132  return;
133  }
134 
135  //~ Get specific hitzone group
136  m_DamageManagerComponent.GetHitZonesOfGroup(m_eHitZoneGroup, m_aHitZonesToHeal);
137  }
138 }
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition: SCR_CharacterDamageManagerComponent.c:1
m_eHitZoneGroup
protected ECharacterHitZoneGroup m_eHitZoneGroup
Definition: SCR_InventoryHitZonePointUI.c:403
HitZone
Definition: HitZone.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_HealSupportStationAction
Definition: SCR_HealSupportStationAction.c:1
ESupportStationReasonInvalid
ESupportStationReasonInvalid
Definition: ESupportStationReasonInvalid.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_DamageManagerComponent
private DamageManagerComponent m_DamageManagerComponent
Definition: SpectateTargetComponent.c:11
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
ESupportStationType
ESupportStationType
Definition: ESupportStationType.c:2
SCR_BaseDamageHealSupportStationAction
Allows healing of action owner (not user)
Definition: SCR_BaseDamageHealSupportStationAction.c:2
EDamageType
EDamageType
Definition: EDamageType.c:12
LocalizedString
Definition: LocalizedString.c:21