Merge pull request #5191 from Arcanum417/medical-rewrite-kill-ai

[Medical Rewrite] Options to enable insta-death for AI
This commit is contained in:
commy2 2018-01-02 15:09:47 +01:00 committed by GitHub
commit 5c9d1ada84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 5 deletions

View File

@ -40,6 +40,7 @@ Aleksey EpMAK Yermakov <epmak777@gmail.com>
Alganthe <alganthe@live.fr>
Andrea "AtixNeon" Verano <veranoandrea88@gmail.com>
Anthariel <Contact@storm-simulation.com>
Arcanum417 <lubos.len@gmail.com>
Anton
Arcanum417 <lubos.len@gmail.com>
Arkhir <wonsz666@gmail.com >

View File

@ -45,6 +45,10 @@ class ACE_Medical_StateMachine {
class Unconscious {
onState = QUOTE(DFUNC(handleStateUnconscious));
onStateEntered = QUOTE([ARR_2(_this,(true))] call FUNC(setUnconsciousStatemachine));
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(unconsciousConditionAI)});
};
class WakeUp {
targetState = "Injured";
condition = QUOTE(_this call FUNC(hasStableVitals));
@ -64,6 +68,11 @@ class ACE_Medical_StateMachine {
// Transition state for handling instant death
// This state raises the next transition in the same frame
onStateEntered = QUOTE(DFUNC(enteredStateFatalInjury));
class DeathAI {
events[] = {QGVAR(FatalInjuryInstantTransition)};
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
};
class SecondChance {
events[] = {QGVAR(FatalInjuryInstantTransition)};
targetState = "CardiacArrest";
@ -79,6 +88,10 @@ class ACE_Medical_StateMachine {
class CardiacArrest {
onStateEntered = QUOTE(DFUNC(enteredStateCardiacArrest));
onStateLeaving = QUOTE(DFUNC(leftStateCardiacArrest));
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
};
class Timeout {
targetState = "Dead";
condition = QUOTE(DFUNC(conditionCardiacArrestTimer));

View File

@ -117,6 +117,20 @@ class ACE_Settings {
typeName = "SCALAR";
values[] = {"Always", "In Cardiac Arrest", "Never"};
};
class GVAR(fatalInjuryConditionAI) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_fatalInjuryConditionAI_DisplayName);
description = CSTRING(MedicalSettings_fatalInjuryConditionAI_Description);
value = 1;
typeName = "BOOL";
};
class GVAR(unconsciousConditionAI) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_unconsciousConditionAI_DisplayName);
description = CSTRING(MedicalSettings_unconsciousConditionAI_Description);
value = 1;
typeName = "BOOL";
};
class GVAR(cardiacArrestTime) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_cardiacArrestTime_DisplayName);

View File

@ -125,10 +125,22 @@ class CfgVehicles {
};
class never {
name = ECSTRING(common,Never);
value = 1;
value = 2;
};
};
};
class fatalInjuryConditionAI {
displayName = CSTRING(MedicalSettings_fatalInjuryConditionAI_DisplayName);
description = CSTRING(MedicalSettings_fatalInjuryConditionAI_Description);
typeName = "BOOL";
defaultValue = 1;
};
class unconsciousConditionAI {
displayName = CSTRING(MedicalSettings_unconsciousConditionAI_DisplayName);
description = CSTRING(MedicalSettings_unconsciousConditionAI_Description);
typeName = "BOOL";
defaultValue = 1;
};
class cardiacArrestTime {
displayName = CSTRING(MedicalSettings_cardiacArrestTime_DisplayName);
description = CSTRING(MedicalSettings_cardiacArrestTime_Description);

View File

@ -8,7 +8,7 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam);
authors[] = {"Glowbal", "KoffeinFlummi"};
authors[] = {"Glowbal", "KoffeinFlummi","Arcanum417"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};

View File

@ -35,6 +35,8 @@ if !(_activated) exitWith {};
[_logic, QGVAR(playerDamageThreshold), "playerDamageThreshold"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(fatalInjuryCondition), "fatalInjuryCondition"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(fatalInjuryConditionAI), "fatalInjuryConditionAI"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(unconsciousConditionAI), "unconsciousConditionAI"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(cardiacArrestTime), "cardiacArrestTime"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(medicSetting_PainVisualization), "painVisualization"] call EFUNC(common,readSettingFromModule);

View File

@ -3493,12 +3493,24 @@
<Chinese>AI 死亡前所能承受的傷害程度</Chinese>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryCondition_DisplayName">
<English>Fatal Injury</English>
<English>Fatal Injury Player</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryCondition_Description">
<English>Defines when you can receive a fatal injury</English>
<English>Defines when Player can receive a fatal injury</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryCondition_InCardiacArrest">
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryConditionAI_DisplayName">
<English>Instant death AI</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryConditionAI_Description">
<English>Defines if AI will be able to die instantly</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_unconsciousConditionAI_DisplayName">
<English>Forbid unconscious AI</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_unconsciousConditionAI_Description">
<English>Defines if AI will be denied to go unconscious and will die instead</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fatalInjuryCondition_InCardiacArrest">
<English>In Cardiac Arrest</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_cardiacArrestTime_DisplayName">