From 38684890ebf43dfe7c0bd056db5c7e24736cc690 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 2 Jan 2024 22:49:39 +0100 Subject: [PATCH] Medical - Disable AI twitching when unconscious (#9708) Disable AI twitching when unconscious --- addons/common/CfgMoves.hpp | 6 +++++- addons/medical_engine/CfgMoves.hpp | 6 +++++- .../functions/fnc_setUnconsciousState.sqf | 12 +----------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/common/CfgMoves.hpp b/addons/common/CfgMoves.hpp index 8ef1b0513d..14686526e9 100644 --- a/addons/common/CfgMoves.hpp +++ b/addons/common/CfgMoves.hpp @@ -68,8 +68,12 @@ class CfgMovesMaleSdr: CfgMovesBasic { // fix falling back to unconsciousness animation and disable rotating in that state class Unconscious: Default { - ConnectTo[] = {}; + // Prevents AI from moving torso and head when unconscious + aiming = "aimingNo"; + aimingBody = "aimingUpNo"; head = "headNo"; + + ConnectTo[] = {}; forceAim = 1; static = 1; }; diff --git a/addons/medical_engine/CfgMoves.hpp b/addons/medical_engine/CfgMoves.hpp index 7c99321887..34f0572479 100644 --- a/addons/medical_engine/CfgMoves.hpp +++ b/addons/medical_engine/CfgMoves.hpp @@ -1,4 +1,3 @@ - class CfgMovesBasic; class CfgMovesMaleSdr: CfgMovesBasic { class States { @@ -10,6 +9,11 @@ class CfgMovesMaleSdr: CfgMovesBasic { class DeadState; class UNCON_ANIM(1): DeadState { + // Prevents AI from moving torso and head when unconscious + aiming = "aimingNo"; + aimingBody = "aimingUpNo"; + head = "headNo"; + file = QPATHTO_T(data\ace_unconscious_1.rtm); }; diff --git a/addons/medical_status/functions/fnc_setUnconsciousState.sqf b/addons/medical_status/functions/fnc_setUnconsciousState.sqf index 3071ae0d14..e3d34f3b5a 100644 --- a/addons/medical_status/functions/fnc_setUnconsciousState.sqf +++ b/addons/medical_status/functions/fnc_setUnconsciousState.sqf @@ -50,26 +50,16 @@ if (_active) then { _unit call EFUNC(common,throwWeapon); }; }; + // Unlock controls for copilot if unit is pilot of aircraft if (vehicle _unit isKindOf "Air" && {_unit == driver vehicle _unit}) then { TRACE_1("pilot of air vehicle - unlocking controls",vehicle _unit); // Do "Unlock controls" user action, co-pilot will then have to do the "Take Controls" actions _unit action ["UnlockVehicleControl", vehicle _unit]; }; - - // Disable AI aiming - if (!isPlayer _unit && {_unit checkAIFeature "WEAPONAIM"}) then { - _unit disableAI "WEAPONAIM"; - _unit setVariable [QGVAR(reenableWeaponAim), true, true]; - }; } else { // Unit has woken up, no longer need to track this _unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil]; - - // Reenable AI aiming - if (_unit getVariable [QGVAR(reenableWeaponAim), false]) then { - _unit enableAI "WEAPONAIM"; - }; }; // This event doesn't correspond to unconscious in statemachine