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 13 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
1 change: 1 addition & 0 deletions addons/medical/Configs/ACE/Settings.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ACE_SettingsConfig {
m_aInitialModSettings {
ACE_Medical_Settings "{60FD72EFA3DB8236}" {
m_bSecondChanceOnHeadEnabled 1
}
}
}
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
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -12,13 +13,14 @@ StringTableRuntime {
}
Texts {
"Aplikovat epinefrin"
"Bez bolestí"
"Při vědomí"
"Příliš zraněný"
"Requires healing at hospital or ambulance"
"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
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -15,6 +16,7 @@ StringTableRuntime {
"Kein Schmerz"
"Nicht bewusstlos"
"Zu verletzt"
"Requires healing at hospital or ambulance"
"Erhöht die Wahrscheinlichkeit des Aufwachens"
"Lindert starke Schmerzen"
"Verabreicht an bewusstlose Patienten."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.en_us.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.es_es.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
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
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -15,6 +16,7 @@ StringTableRuntime {
"Ne ressent pas de douleur"
"Pas inconscient"
"Trop grièvement blessé"
"Requires healing at hospital or ambulance"
"Augmente les chances de reprise de connaissance"
"Allège une douleur violente"
"Administrée à des patients inconscients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.it_it.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.ja_jp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.ko_kr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.pl_pl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.pt_br.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.ru_ru.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
14 changes: 10 additions & 4 deletions addons/medical/Language/ACE_Medical_localization.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@ StringTable {
}
CustomStringTableItem "{60F61507D00761D0}" {
Id "ACE_Medical-FailReason_TooInjured"
Target_en_us "Too injured"
Target_en_us "Requires healing"
Target_fr_fr "Trop grièvement blessé"
Target_de_de "Zu verletzt"
Target_cs_cz "Příliš zraněný"
Modified 1626752371
Modified 1645048824
Author "kexanone"
LastChanged "apollo-jk"
LastChanged "AleX"
}
CustomStringTableItem "{61D51487241F1A28}" {
Id "ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
Target_en_us "Requires healing at hospital or ambulance"
Modified 1645048841
Author "AleX"
LastChanged "AleX"
}
CustomStringTableItem "{60CF45A17B6601E3}" {
Id "ACE_Medical-InfoWidget_Epinephrine"
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
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.uk_ua.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
Expand Down
4 changes: 3 additions & 1 deletion addons/medical/Language/ACE_Medical_localization.zh_cn.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ StringTableRuntime {
"ACE_Medical-FailReason_NoPain"
"ACE_Medical-FailReason_NotUnconscious"
"ACE_Medical-FailReason_TooInjured"
"ACE_Medical-FailReason_TooInjured_MedicalFacilityRequired"
"ACE_Medical-InfoWidget_Epinephrine"
"ACE_Medical-InfoWidget_Morphine"
"ACE_Medical-Item_Epinephrine_Description"
Expand All @@ -14,7 +15,8 @@ StringTableRuntime {
"Inject epinephrine"
"Not in pain"
"Not unconscious"
"Too injured"
"Requires healing"
"Requires healing at hospital or ambulance"
"Increases wake-up chance"
"Alleviates severe pain"
"Administered to unconscious patients."
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,21 @@ 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 max scaled health.
//! When atMedicalFacility is true, it will check for any damage (scaled health of 0.999), otherwise it will compare against the max scaled heal with a medical kit.
bool ACE_Medical_CanBeHealed(bool atMedicalFacility = false)
{
// Calculating the maxHeal to check against
float maxHeal = 0;
if (atMedicalFacility)
maxHeal = 0.999;
else
m_fACE_Medical_MedicalKitMaxHeal;
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved

// Iterating hitzones and checking max health
foreach (HitZone hitZone : m_aACE_Medical_PhysicalHitZones)
{
if (hitZone.GetHealthScaled() < 0.999)
if (hitZone.GetHealthScaled() < maxHeal)
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(atMedicalFacility:true))
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
{
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(atMedicalFacility:false))
alexgibbs606 marked this conversation as resolved.
Show resolved Hide resolved
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_TOO_DAMAGED_MEDICAL_FACILITY_REQUIRED;

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_TOO_DAMAGED_MEDICAL_FACILITY_REQUIRED
}
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_TOO_DAMAGED_MEDICAL_FACILITY_REQUIRED)
SetCannotPerformReason(m_sTooInjured_MedicalFacilityRequired);

return false;
}
Expand Down