mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve medical statemachine settings (#7154)
* Improve medical statemachine settings * Multi-line condition and update fatal injury description * Check isPlayer in DeathAI transition Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
b4c1d0cb57
commit
5dbaef4e07
@ -3,7 +3,6 @@
|
|||||||
class ACE_Medical_StateMachine {
|
class ACE_Medical_StateMachine {
|
||||||
list = QUOTE(call EFUNC(common,getLocalUnits));
|
list = QUOTE(call EFUNC(common,getLocalUnits));
|
||||||
skipNull = 1;
|
skipNull = 1;
|
||||||
|
|
||||||
class Default {
|
class Default {
|
||||||
onState = QFUNC(handleStateDefault);
|
onState = QFUNC(handleStateDefault);
|
||||||
class Injury {
|
class Injury {
|
||||||
@ -44,7 +43,7 @@ class ACE_Medical_StateMachine {
|
|||||||
};
|
};
|
||||||
class Unconscious {
|
class Unconscious {
|
||||||
onState = QFUNC(handleStateUnconscious);
|
onState = QFUNC(handleStateUnconscious);
|
||||||
onStateEntered = QUOTE([ARR_2(_this,(true))] call EFUNC(medical_status,setUnconscious));
|
onStateEntered = QUOTE([ARR_2(_this,true)] call EFUNC(medical_status,setUnconscious));
|
||||||
class DeathAI {
|
class DeathAI {
|
||||||
targetState = "Dead";
|
targetState = "Dead";
|
||||||
condition = QUOTE(!GVAR(AIUnconsciousness) && {!isPlayer _this});
|
condition = QUOTE(!GVAR(AIUnconsciousness) && {!isPlayer _this});
|
||||||
@ -53,7 +52,7 @@ class ACE_Medical_StateMachine {
|
|||||||
targetState = "Injured";
|
targetState = "Injured";
|
||||||
condition = QEFUNC(medical_status,hasStableVitals);
|
condition = QEFUNC(medical_status,hasStableVitals);
|
||||||
events[] = {QEGVAR(medical,WakeUp)};
|
events[] = {QEGVAR(medical,WakeUp)};
|
||||||
onTransition = QUOTE([ARR_2(_this,(false))] call EFUNC(medical_status,setUnconscious));
|
onTransition = QUOTE([ARR_2(_this,false)] call EFUNC(medical_status,setUnconscious));
|
||||||
};
|
};
|
||||||
class FatalTransitions {
|
class FatalTransitions {
|
||||||
targetState = "CardiacArrest";
|
targetState = "CardiacArrest";
|
||||||
@ -65,24 +64,18 @@ class ACE_Medical_StateMachine {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class FatalInjury {
|
class FatalInjury {
|
||||||
// Transition state for handling instant death
|
// Transition state for handling instant death from fatal injuries
|
||||||
// This state raises the next transition in the same frame
|
// This state raises the next transition in the same frame
|
||||||
onStateEntered = QFUNC(enteredStateFatalInjury);
|
onStateEntered = QFUNC(enteredStateFatalInjury);
|
||||||
class DeathAI {
|
|
||||||
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
|
||||||
targetState = "Dead";
|
|
||||||
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
|
|
||||||
};
|
|
||||||
class SecondChance {
|
class SecondChance {
|
||||||
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
||||||
targetState = "CardiacArrest";
|
targetState = "CardiacArrest";
|
||||||
condition = QUOTE(GVAR(fatalInjuryCondition) > 0);
|
condition = QFUNC(conditionSecondChance);
|
||||||
onTransition = QFUNC(transitionSecondChance);
|
onTransition = QFUNC(transitionSecondChance);
|
||||||
};
|
};
|
||||||
class Death {
|
class Death {
|
||||||
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
||||||
targetState = "Dead";
|
targetState = "Dead";
|
||||||
condition = "true";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class CardiacArrest {
|
class CardiacArrest {
|
||||||
@ -90,8 +83,10 @@ class ACE_Medical_StateMachine {
|
|||||||
onStateEntered = QFUNC(enteredStateCardiacArrest);
|
onStateEntered = QFUNC(enteredStateCardiacArrest);
|
||||||
onStateLeaving = QFUNC(leftStateCardiacArrest);
|
onStateLeaving = QFUNC(leftStateCardiacArrest);
|
||||||
class DeathAI {
|
class DeathAI {
|
||||||
|
// If an AI unit reanimates, they will immediately die upon entering unconsciousness if AI Unconsciousness is disabled
|
||||||
|
// As a result, we immediately kill the AI unit since cardiac arrest is effectively useless for it
|
||||||
targetState = "Dead";
|
targetState = "Dead";
|
||||||
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
|
condition = QUOTE(!GVAR(AIUnconsciousness) && {!isPlayer _this});
|
||||||
};
|
};
|
||||||
class Timeout {
|
class Timeout {
|
||||||
targetState = "Dead";
|
targetState = "Dead";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
PREP(conditionCardiacArrestTimer);
|
PREP(conditionCardiacArrestTimer);
|
||||||
PREP(conditionExecutionDeath);
|
PREP(conditionExecutionDeath);
|
||||||
|
PREP(conditionSecondChance);
|
||||||
PREP(enteredStateCardiacArrest);
|
PREP(enteredStateCardiacArrest);
|
||||||
PREP(enteredStateDeath);
|
PREP(enteredStateDeath);
|
||||||
PREP(enteredStateFatalInjury);
|
PREP(enteredStateFatalInjury);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: BaerMitUmlaut
|
* Author: BaerMitUmlaut
|
||||||
* Condition for an execution caused death.
|
* Condition for an execution caused death (fatal injury received in cardiac arrest).
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,4 +17,6 @@
|
|||||||
|
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
(GVAR(fatalInjuryCondition) < 2) && {!(_unit getVariable [QEGVAR(medical,deathBlocked), false])}
|
(isPlayer _unit && {GVAR(fatalInjuriesPlayer) != FATAL_INJURIES_NEVER}
|
||||||
|
|| {!isPlayer _unit && {GVAR(fatalInjuriesAI) != FATAL_INJURIES_NEVER}})
|
||||||
|
&& {!(_unit getVariable [QEGVAR(medical,deathBlocked), false])}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: mharis001
|
||||||
|
* Condition for going into cardiac arrest upon receiving a fatal injury.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player] call ace_medical_statemachine_fnc_conditionSecondChance
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
isPlayer _unit && {GVAR(fatalInjuriesPlayer) != FATAL_INJURIES_ALWAYS} || {!isPlayer _unit && {GVAR(fatalInjuriesAI) != FATAL_INJURIES_ALWAYS}}
|
@ -1,18 +1,26 @@
|
|||||||
[
|
[
|
||||||
QGVAR(fatalInjuryCondition),
|
QGVAR(fatalInjuriesPlayer),
|
||||||
"LIST",
|
"LIST",
|
||||||
[LSTRING(FatalInjuryCondition_DisplayName), LSTRING(FatalInjuryCondition_Description)],
|
[LSTRING(FatalInjuriesPlayer_DisplayName), LSTRING(FatalInjuriesPlayer_Description)],
|
||||||
[ELSTRING(medical,Category), LSTRING(SubCategory)],
|
[ELSTRING(medical,Category), LSTRING(SubCategory)],
|
||||||
[[0, 1, 2], [ELSTRING(common,Always), LSTRING(InCardiacArrest), ELSTRING(common,Never)], 0],
|
[
|
||||||
|
[FATAL_INJURIES_ALWAYS, FATAL_INJURIES_CRDC_ARRST, FATAL_INJURIES_NEVER],
|
||||||
|
[ELSTRING(common,Always), LSTRING(InCardiacArrest), ELSTRING(common,Never)],
|
||||||
|
0
|
||||||
|
],
|
||||||
true
|
true
|
||||||
] call CBA_settings_fnc_init;
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
[
|
[
|
||||||
QGVAR(fatalInjuryConditionAI),
|
QGVAR(fatalInjuriesAI),
|
||||||
"CHECKBOX",
|
"LIST",
|
||||||
[LSTRING(FatalInjuryConditionAI_DisplayName), LSTRING(FatalInjuryConditionAI_Description)],
|
[LSTRING(FatalInjuriesAI_DisplayName), LSTRING(FatalInjuriesAI_Description)],
|
||||||
[ELSTRING(medical,Category), LSTRING(SubCategory)],
|
[ELSTRING(medical,Category), LSTRING(SubCategory)],
|
||||||
true,
|
[
|
||||||
|
[FATAL_INJURIES_ALWAYS, FATAL_INJURIES_CRDC_ARRST, FATAL_INJURIES_NEVER],
|
||||||
|
[ELSTRING(common,Always), LSTRING(InCardiacArrest), ELSTRING(common,Never)],
|
||||||
|
0
|
||||||
|
],
|
||||||
true
|
true
|
||||||
] call CBA_settings_fnc_init;
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
@ -16,3 +16,7 @@
|
|||||||
|
|
||||||
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
|
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
|
#define FATAL_INJURIES_ALWAYS 0
|
||||||
|
#define FATAL_INJURIES_CRDC_ARRST 1
|
||||||
|
#define FATAL_INJURIES_NEVER 2
|
||||||
|
@ -8,33 +8,17 @@
|
|||||||
<Russian>Состояния</Russian>
|
<Russian>Состояния</Russian>
|
||||||
<French>États</French>
|
<French>États</French>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuryCondition_DisplayName">
|
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuriesPlayer_DisplayName">
|
||||||
<English>Fatal Injury Player</English>
|
<English>Player Fatal Injuries</English>
|
||||||
<German>Tödliche Spielerverletzungen</German>
|
|
||||||
<Japanese>致命傷プレイヤー</Japanese>
|
|
||||||
<Russian>Смертельные ранения игрока</Russian>
|
|
||||||
<French>Blessure fatale des joueurs</French>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuryCondition_Description">
|
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuriesPlayer_Description">
|
||||||
<English>Controls when a player can receive a fatal injury.</English>
|
<English>Controls when players can receive fatal injuries. A fatal injury is caused by significant damage to the head or body.</English>
|
||||||
<German>Definiert wann ein Spieler tödliche Verletzungen bekommen kann</German>
|
|
||||||
<Japanese>プレイヤーが致命傷から蘇生できるかどうか決定します</Japanese>
|
|
||||||
<Russian>Определяет, когда игрок может получить смертельное ранение</Russian>
|
|
||||||
<French>Définit quand un joueur peut recevoir une blessure fatale.</French>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuryConditionAI_DisplayName">
|
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuriesAI_DisplayName">
|
||||||
<English>AI Instant Death</English>
|
<English>AI Fatal Injuries</English>
|
||||||
<German>Direkter Tod KI</German>
|
|
||||||
<Japanese>AI の即死</Japanese>
|
|
||||||
<Russian>Мгновенная смерть ИИ</Russian>
|
|
||||||
<French>Mort instantanée de l'IA</French>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuryConditionAI_Description">
|
<Key ID="STR_ACE_Medical_Statemachine_FatalInjuriesAI_Description">
|
||||||
<English>Controls if AI units are able to die instantly.</English>
|
<English>Controls when AI can receive fatal injuries. A fatal injury is caused by significant damage to the head or body.\nWhen set to "Always", this effectively produces "AI Instant Death" behaviour as AI will immediately die from any fatal injury.\nNOTE: Any mode other than "Always" requires AI Unconsciousness to be enabled.</English>
|
||||||
<German>Legt fest, ob eine KI direkt sterben kann</German>
|
|
||||||
<Japanese>AI が即死できるかどうか決定します</Japanese>
|
|
||||||
<Russian>Определяет, сможет ли ИИ мгновенно умереть</Russian>
|
|
||||||
<French>Définit si les unités IA peuvent mourir instantanément.</French>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_AIUnconsciousness_DisplayName">
|
<Key ID="STR_ACE_Medical_Statemachine_AIUnconsciousness_DisplayName">
|
||||||
<English>AI Unconsciousness</English>
|
<English>AI Unconsciousness</English>
|
||||||
@ -53,10 +37,7 @@
|
|||||||
<Chinese>AI無意識</Chinese>
|
<Chinese>AI無意識</Chinese>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_AIUnconsciousness_Description">
|
<Key ID="STR_ACE_Medical_Statemachine_AIUnconsciousness_Description">
|
||||||
<English>Allows AI to go unconscious instead of dying.</English>
|
<English>Controls whether AI can go unconscious instead of immediately dying.\nThis setting works together with the "AI Fatal Injuries" setting since, going into cardiac arrest requires that the unit is able to go unconscious.\nHowever, these settings are separated because units can go unconscious from critical vitals resulting from non-fatal injuries.\nIn essence, this means that in order to enable cardiac arrest for AI units, this setting must be enabled.</English>
|
||||||
<Japanese>AI が即死ではなく気絶へ移行できるかどうか決定します。</Japanese>
|
|
||||||
<French>Permet aux unités IA de perdre connaissance au lieu de mourir.</French>
|
|
||||||
<Russian>Позволяет ИИ оставаться без сознания вместо смерти.</Russian>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Medical_Statemachine_CardiacArrestTime_DisplayName">
|
<Key ID="STR_ACE_Medical_Statemachine_CardiacArrestTime_DisplayName">
|
||||||
<English>Cardiac Arrest Time</English>
|
<English>Cardiac Arrest Time</English>
|
||||||
|
Loading…
Reference in New Issue
Block a user