Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Improve Epi status message in the event of critical injury #83

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addons/medical/Language/ACE_Medical_localization.cs_cz.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,13 +13,14 @@ StringTableRuntime {
}
Texts {
"Aplikovat epinefrin"
"Too injured (Requires a field hospital or ambulance)"
"Bez bolestí"
"Při vědomí"
"Příliš zraněný"
"Zvyšuje pravděpodobnost probuzení se z bezvědomí"
"Zmírňuje silné bolesti"
"Aplikováno pacientům v bezvědomí."
"Epinefrin"
"Bez bolestí"
"Zmírňuje silné bolesti"
"Aplikováno pacientům v silných bolestech."
}
}
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.de_de.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Epinephrin injizieren"
"Too injured (Requires a field hospital or ambulance)"
"Kein Schmerz"
"Nicht bewusstlos"
"Zu verletzt"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.en_us.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.es_es.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.fr_fr.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Injecter de l'adrénaline"
"Too injured (Requires a field hospital or ambulance)"
"Ne ressent pas de douleur"
"Pas inconscient"
"Trop grièvement blessé"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.it_it.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.ja_jp.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.ko_kr.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.pl_pl.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.pt_br.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.ru_ru.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
8 changes: 7 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ StringTable {
Author "kexanone"
LastChanged "apollo-jk"
}
CustomStringTableItem "{61D51487241F1A28}" {
Id "ACE_Medical-FailReason_CriticallyInjured"
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
Target_en_us "Too injured (Requires a field hospital or ambulance)"
Modified 1641677954
Author "AleX"
LastChanged "AleX"
}
CustomStringTableItem "{60C8CE8D36767C39}" {
Id "ACE_Medical-FailReason_NoPain"
Target_en_us "Not in pain"
Expand Down Expand Up @@ -81,7 +88,6 @@ StringTable {
Author "kexanone"
LastChanged "apollo-jk"
}
}
CustomStringTableItem "{5E101C5589E004EE}" {
Id "ACE_Medical-Item_Morphine_Description"
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
Target_en_us "Administered to patients in severe pain."
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.uk_ua.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/Language/ACE_Medical_localization.zh_cn.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
StringTableRuntime {
Ids {
"ACE_Medical-EpinephrineInjectionAction"
"ACE_Medical-FailReason_CriticallyInjured"
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
Expand All @@ -12,6 +13,7 @@ StringTableRuntime {
}
Texts {
"Inject epinephrine"
"Too injured (Requires a field hospital or ambulance)"
"Not in pain"
"Not unconscious"
"Too injured"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ modded class SCR_CharacterDamageManagerComponent : SCR_DamageManagerComponent
protected ACE_Medical_PainHitZone m_pACE_Medical_PainHitZone;
protected float m_fACE_Medical_ModeratePainThreshold;
protected float m_fACE_Medical_SeriousPainThreshold;
protected float m_fACE_Medical_MedicalKitMaxHeal;

// We only notify the replication system about changes of these members on initialization
// After init, each proxy is itself responsible for updating these members
Expand Down Expand Up @@ -53,6 +54,7 @@ modded class SCR_CharacterDamageManagerComponent : SCR_DamageManagerComponent
{
m_bACE_Medical_SecondChanceOnHeadEnabled = settings.m_bSecondChanceOnHeadEnabled;
m_fACE_Medical_SecondChanceRegenScale = settings.m_fSecondChanceRegenScale;
m_fACE_Medical_MedicalKitMaxHeal = settings.m_fMedicalKitMaxHealScaled;
}

ACE_Medical_EnableSecondChance(true);
Expand Down Expand Up @@ -84,12 +86,17 @@ modded class SCR_CharacterDamageManagerComponent : SCR_DamageManagerComponent
}

//------------------------------------------------------------------------------------------------
//! Returns true if at least one physical hit zone is injured
bool ACE_Medical_CanBeHealed()
//! Returns true if at least one physical hit zone is below the provided scaled health. Defaults to 99% health (Any damage to any limb).
bool ACE_Medical_CanBeHealed(float maxHealth = -1)
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
{
// Checking default argument
if (maxHealth < 0)
maxHealth = m_fACE_Medical_MedicalKitMaxHeal;

// Iterating hitzones and checking max health
foreach (HitZone hitZone : m_aACE_Medical_PhysicalHitZones)
{
if (hitZone.GetHealthScaled() < 0.999)
if (hitZone.GetHealthScaled() < maxHealth)
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ class ACE_Medical_ConsumableEpinephrine : SCR_ConsumableEffectHealthItems
failReason = SCR_EConsumableFailReason.IS_BLEEDING;
return false;
}

// Cannot be applied if critically injured
// We also have to check if the character is still healable
if (damageManager.ACE_Medical_HasCriticalHealth() && damageManager.ACE_Medical_CanBeHealed())

// In the event the patient is critically injured, we don't allow epi
if (damageManager.ACE_Medical_HasCriticalHealth() && damageManager.ACE_Medical_CanBeHealed(0.999))
{
failReason = SCR_EConsumableFailReason.ACE_MEDICAL_TOO_DAMAGED;
// If the patient can still be healed with the medicalkit, we'll just say that the patient is too injured
if (damageManager.ACE_Medical_CanBeHealed())
failReason = SCR_EConsumableFailReason.ACE_MEDICAL_TOO_DAMAGED;
// Otherwise, we'll display a seperate message showing the patient as critically injured
else
failReason = SCR_EConsumableFailReason.ACE_MEDICAL_CRITICALLY_INJURED;
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ modded enum SCR_EConsumableType
modded enum SCR_EConsumableFailReason
{
ACE_MEDICAL_NOT_INCAPACITATED,
ACE_MEDICAL_TOO_DAMAGED
ACE_MEDICAL_TOO_DAMAGED,
ACE_MEDICAL_CRITICALLY_INJURED
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class ACE_Medical_EpinephrineUserAction : SCR_MorphineUserAction
[Attribute(defvalue: "#ACE_Medical-FailReason_TooInjured", desc: "String for when target is too damaged")]
protected LocalizedString m_sTooDamaged;

[Attribute(defvalue: "#ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired", desc: "String for when target is critically injured")]
protected LocalizedString m_sTooInjured_MedicalFacilityRequired;

//------------------------------------------------------------------------------------------------
//! Same as in SCR_MorphineUserAction, but handle case where target is bleeding
override bool CanBePerformedScript(IEntity user)
Expand All @@ -34,6 +37,8 @@ class ACE_Medical_EpinephrineUserAction : SCR_MorphineUserAction
SetCannotPerformReason(m_sIsBleeding);
else if (reason == SCR_EConsumableFailReason.ACE_MEDICAL_TOO_DAMAGED)
SetCannotPerformReason(m_sTooDamaged);
else if (reason == SCR_EConsumableFailReason.ACE_MEDICAL_CRITICALLY_INJURED)
SetCannotPerformReason(m_sTooInjured_MedicalFacilityRequired);

return false;
}
Expand Down