Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LimbDamagePassRule.c
Go to the documentation of this file.
1[BaseContainerProps(), SCR_DamagePassRuleContainerTitle()]
3{
4 [Attribute(defvalue: "0", desc: "Hit zone group which is going to absorb the rest of the damage, in case that all hit zones from the group of this hit zone are already destroyed", uiwidget: UIWidgets.ComboBox, enumType: ECharacterHitZoneGroup)]
6
7 //------------------------------------------------------------------------------------------------
12 override void HandlePassedDamage(inout notnull BaseDamageContext damageContext, notnull SCR_HitZone srcHitZone, notnull SCR_DamageManagerComponent dmgManager)
13 {
14 // If damage states are defined, only allow passing while damage state is allowed
15 if (!m_aDamageStates.IsEmpty() && !m_aDamageStates.Contains(srcHitZone.GetDamageState()))
16 return;
17
18 // If damage types are defined, only allow passing specified damage types
19 if (!m_aSourceDamageTypes.IsEmpty() && !m_aSourceDamageTypes.Contains(damageContext.damageType))
20 return;
21
23 BaseDamageContext contextCopy = BaseDamageContext.Cast(damageContext.Clone());
24 contextCopy.damageValue *= m_fMultiplier;
25
26 // Change passed damage type unless it is set to true
28 contextCopy.damageType = m_eOutputDamageType;
29
30 array<HitZone> groupHitZones = {};
31 if (dmgManager.GetHitZonesOfGroupsFromOwner({srcHitZone.GetHitZoneGroup(), m_eSpilloverHitZoneGroup}, groupHitZones) < 1)
32 return; // probably this is never going to happen but if it somehow does then its going to be sus as... very sus!
33
34 SCR_HitZone targetHitZone;
35 foreach (HitZone hZ : groupHitZones)
36 {
37 if (contextCopy.damageValue <= 0)
38 return; // we quit when we managed to distribute all of the damage, or when we run out of the hit zones
39
40 if (hZ == srcHitZone) // no infinity loop allowed!
41 continue;
42
43 if (hZ.GetDamageState() == EDamageState.DESTROYED) // same goes for this, as otherwise other parts would try to pass this damage to other parts... you get the point
44 continue;
45
46 targetHitZone = SCR_HitZone.Cast(hZ); // there should be no need to null check this, as GetHitZonesOfGroups will only return hit zones of SCR_HitZone type
47 TryDealDamage(contextCopy, targetHitZone, dmgManager);
48 }
49 }
50
51 //------------------------------------------------------------------------------------------------
56 protected void TryDealDamage(inout notnull BaseDamageContext damageContext, notnull SCR_HitZone targetHitZone, notnull SCR_DamageManagerComponent dmgManager)
57 {
59 float absorbedDamage;
60 damageContext.struckHitZone = targetHitZone;
61 if (damageContext.damageType == EDamageType.TRUE)
62 {
63 absorbedDamage = targetHitZone.GetHealth();
64 dmgManager.HandleDamage(damageContext);
65 damageContext.damageValue -= absorbedDamage;
66 return;
67 }
68
69 const float dmgBaseMultiplier = targetHitZone.GetBaseDamageMultiplier();
70 if (dmgBaseMultiplier == 0)
71 return;
72
73 const float dmgTypeMultiplier = targetHitZone.GetDamageMultiplier(damageContext.damageType);
74 if (dmgTypeMultiplier == 0)
75 return;
76
77 const float dmgReduction = targetHitZone.GetDamageReduction();
78 const float dmgThreshold = targetHitZone.GetDamageThreshold();
79
81 const float effectiveDamageValue = damageContext.damageValue * dmgBaseMultiplier * dmgTypeMultiplier - dmgReduction;
82 if (effectiveDamageValue < dmgThreshold)
83 return;
84
85 absorbedDamage = targetHitZone.GetHealth() + dmgReduction;
86 if (absorbedDamage < dmgThreshold)
87 absorbedDamage = dmgThreshold;
88
89 absorbedDamage = absorbedDamage / dmgBaseMultiplier / dmgTypeMultiplier;
90
91 dmgManager.HandleDamage(damageContext);
92 damageContext.damageValue -= absorbedDamage;
93 }
94}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ref array< EDamageState > m_aDamageStates
ref array< EDamageType > m_aSourceDamageTypes
void TryDealDamage(inout notnull BaseDamageContext damageContext, notnull SCR_HitZone targetHitZone, notnull SCR_DamageManagerComponent dmgManager)
override void HandlePassedDamage(inout notnull BaseDamageContext damageContext, notnull SCR_HitZone srcHitZone, notnull SCR_DamageManagerComponent dmgManager)
ECharacterHitZoneGroup m_eSpilloverHitZoneGroup
SCR_FieldOfViewSettings Attribute
EDamageType
Definition EDamageType.c:13
EDamageState