Medical - Disable AI twitching when unconscious (#9708)

Disable AI twitching when unconscious
This commit is contained in:
johnb432 2024-01-02 22:49:39 +01:00 committed by GitHub
parent b10c68405a
commit 38684890eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View File

@ -68,8 +68,12 @@ class CfgMovesMaleSdr: CfgMovesBasic {
// fix falling back to unconsciousness animation and disable rotating in that state // fix falling back to unconsciousness animation and disable rotating in that state
class Unconscious: Default { class Unconscious: Default {
ConnectTo[] = {}; // Prevents AI from moving torso and head when unconscious
aiming = "aimingNo";
aimingBody = "aimingUpNo";
head = "headNo"; head = "headNo";
ConnectTo[] = {};
forceAim = 1; forceAim = 1;
static = 1; static = 1;
}; };

View File

@ -1,4 +1,3 @@
class CfgMovesBasic; class CfgMovesBasic;
class CfgMovesMaleSdr: CfgMovesBasic { class CfgMovesMaleSdr: CfgMovesBasic {
class States { class States {
@ -10,6 +9,11 @@ class CfgMovesMaleSdr: CfgMovesBasic {
class DeadState; class DeadState;
class UNCON_ANIM(1): 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); file = QPATHTO_T(data\ace_unconscious_1.rtm);
}; };

View File

@ -50,26 +50,16 @@ if (_active) then {
_unit call EFUNC(common,throwWeapon); _unit call EFUNC(common,throwWeapon);
}; };
}; };
// Unlock controls for copilot if unit is pilot of aircraft // Unlock controls for copilot if unit is pilot of aircraft
if (vehicle _unit isKindOf "Air" && {_unit == driver vehicle _unit}) then { if (vehicle _unit isKindOf "Air" && {_unit == driver vehicle _unit}) then {
TRACE_1("pilot of air vehicle - unlocking controls",vehicle _unit); 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 // Do "Unlock controls" user action, co-pilot will then have to do the "Take Controls" actions
_unit action ["UnlockVehicleControl", vehicle _unit]; _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 { } else {
// Unit has woken up, no longer need to track this // Unit has woken up, no longer need to track this
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil]; _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 // This event doesn't correspond to unconscious in statemachine