Medical Engine - Fix unconscious animation state checks (#8623)

This commit is contained in:
Whigital 2021-11-08 00:15:52 +01:00 committed by GitHub
parent 9be0b8b6c6
commit 2441ef493e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 39 deletions

View File

@ -1,9 +1,9 @@
class CfgExtendedAnimation {
class Revive {
left = QGVAR(faceLeft_unconscious);
right = QGVAR(faceRight_unconscious);
front = QGVAR(faceDown_unconscious);
back = QGVAR(faceUp_unconscious);
left = QUNCON_ANIM(faceLeft);
right = QUNCON_ANIM(faceRight);
front = QUNCON_ANIM(faceDown);
back = QUNCON_ANIM(faceUp);
};
};

View File

@ -8,75 +8,86 @@ class CfgMovesMaleSdr: CfgMovesBasic {
weaponIK = 0;
};
class Unconscious;
class DeadState;
class ace_unconscious_1: DeadState {
class UNCON_ANIM(1): DeadState {
file = QPATHTO_T(data\ace_unconscious_1.rtm);
};
class ace_unconscious_2: ace_unconscious_1 {
class UNCON_ANIM(2): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_2.rtm);
};
class ace_unconscious_3: ace_unconscious_1 {
class UNCON_ANIM(3): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_3.rtm);
};
class ace_unconscious_4: ace_unconscious_1 {
class UNCON_ANIM(4): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_4.rtm);
};
class ace_unconscious_5: ace_unconscious_1 {
class UNCON_ANIM(5): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_5.rtm);
};
class ace_unconscious_6: ace_unconscious_1 {
class UNCON_ANIM(6): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_6.rtm);
};
class ace_unconscious_7: ace_unconscious_1 {
class UNCON_ANIM(7): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_7.rtm);
};
class ace_unconscious_8: ace_unconscious_1 {
class UNCON_ANIM(8): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_8.rtm);
};
class ace_unconscious_1_1: ace_unconscious_1 {
class UNCON_ANIM(1_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_1_1.rtm);
};
class ace_unconscious_2_1: ace_unconscious_1 {
class UNCON_ANIM(2_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_2_1.rtm);
};
class ace_unconscious_3_1: ace_unconscious_1 {
class UNCON_ANIM(3_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_3_1.rtm);
};
class ace_unconscious_4_1: ace_unconscious_1 {
class UNCON_ANIM(4_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_4_1.rtm);
};
class ace_unconscious_5_1: ace_unconscious_1 {
class UNCON_ANIM(5_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_5_1.rtm);
};
class ace_unconscious_6_1: ace_unconscious_1 {
class UNCON_ANIM(6_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_6_1.rtm);
};
class ace_unconscious_7_1: ace_unconscious_1 {
class UNCON_ANIM(7_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_7_1.rtm);
};
class ace_unconscious_8_1: ace_unconscious_1 {
class UNCON_ANIM(8_1): UNCON_ANIM(1) {
file = QPATHTO_T(data\ace_unconscious_8_1.rtm);
};
/* added for the "ace_unc" part */
class KIA_passenger_boat_holdleft;
class ace_unconscious_9: KIA_passenger_boat_holdleft {
};
class UNCON_ANIM(9): KIA_passenger_boat_holdleft {};
class KIA_driver_boat01;
class ace_unconscious_10: KIA_driver_boat01 {
};
class UNCON_ANIM(10): KIA_driver_boat01 {};
class GVAR(faceDown_unconscious): Unconscious {
};
class Unconscious;
class UNCON_ANIM(faceDown): Unconscious {};
class GVAR(faceLeft_unconscious): Unconscious {
};
class UNCON_ANIM(faceLeft): Unconscious {};
class GVAR(faceRight_unconscious): Unconscious {
};
class UNCON_ANIM(faceRight): Unconscious {};
class GVAR(faceUp_unconscious): Unconscious {
};
class UNCON_ANIM(faceUp): Unconscious {};
class AmovPpneMstpSnonWnonDnon;
class ACE_UnconsciousOutProne: AmovPpneMstpSnonWnonDnon {

View File

@ -39,10 +39,10 @@ GVAR(armorCache) = false call CBA_fnc_createNamespace;
GVAR(fixedStatics) = [];
GVAR(animations) = [] call CBA_fnc_createNamespace;
GVAR(animations) setVariable [QGVAR(faceUp_unconscious), ["ace_unconscious_2","ace_unconscious_2_1","ace_unconscious_7_1","ace_unconscious_8_1","ace_unconscious_5_1","ace_unconscious_6_1"]];
GVAR(animations) setVariable [QGVAR(faceDown_unconscious), ["ace_unconscious_1", "ace_unconscious_3", "ace_unconscious_4","unconscious","ace_unconscious_9","ace_unconscious_3_1","ace_unconscious_4_1"]];
GVAR(animations) setVariable [QGVAR(faceLeft_unconscious), ["ace_unconscious_7","ace_unconscious_8","ace_unconscious_1_1","ace_unconscious_7_1","ace_unconscious_8_1"]];
GVAR(animations) setVariable [QGVAR(faceRight_unconscious), ["ace_unconscious_5","ace_unconscious_6","ace_unconscious_10","ace_unconscious_5_1","ace_unconscious_6_1"]];
GVAR(animations) setVariable [QUNCON_ANIM(faceUp), [QUNCON_ANIM(2),QUNCON_ANIM(2_1),QUNCON_ANIM(7_1),QUNCON_ANIM(8_1),QUNCON_ANIM(5_1),QUNCON_ANIM(6_1)]];
GVAR(animations) setVariable [QUNCON_ANIM(faceDown), [QUNCON_ANIM(1),QUNCON_ANIM(3),QUNCON_ANIM(4),"unconscious",QUNCON_ANIM(9),QUNCON_ANIM(3_1),QUNCON_ANIM(4_1)]];
GVAR(animations) setVariable [QUNCON_ANIM(faceLeft), [QUNCON_ANIM(7),QUNCON_ANIM(8),QUNCON_ANIM(1_1),QUNCON_ANIM(7_1),QUNCON_ANIM(8_1)]];
GVAR(animations) setVariable [QUNCON_ANIM(faceRight), [QUNCON_ANIM(5),QUNCON_ANIM(6),QUNCON_ANIM(10),QUNCON_ANIM(5_1),QUNCON_ANIM(6_1)]];
private _fnc_fixStatic = {
params ["_vehicle"];
@ -69,7 +69,7 @@ addMissionEventHandler ["Loaded", {
// Use object reference to indicate the waitUnit is already running (this prevents issues with respawning units keeping SetVars)
if ((_unit getVariable [QGVAR(waitForAnim), objNull]) == _unit) exitWith {};
_unit setVariable [QGVAR(waitForAnim), _unit];
[{(animationState _this) find QGVAR(face) != -1}, {
[{(animationState _this) find QUNCON_ANIM(face) != -1}, {
[_this, animationState _this] call FUNC(applyAnimAfterRagdoll);
}, _unit, 20] call CBA_fnc_waitUntilAndExecute;
} else {

View File

@ -59,7 +59,7 @@ if (_isUnconscious) then {
if (!alive _unit) exitWith {};
// Fix unit being in locked animation with switchMove (If unit was unloaded from a vehicle, they may be in deadstate instead of unconscious)
private _animation = animationState _unit;
if ((_animation == "unconscious" || {_animation == "deadstate" || {_animation find "ace_unconscious_" != -1}}) && {lifeState _unit != "INCAPACITATED"}) then {
if ((_animation == "unconscious" || {_animation == "deadstate" || {_animation find QGVAR(uncon_anim) != -1}}) && {lifeState _unit != "INCAPACITATED"}) then {
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
TRACE_1("forcing SwitchMove",animationState _unit);
};

View File

@ -36,3 +36,6 @@
// don't change, these reflect hard coded engine behaviour
#define DAMAGED_MIN_THRESHOLD 0.45
#define LIMPING_MIN_DAMAGE 0.5
#define UNCON_ANIM(var1) DOUBLES(GVAR(uncon_anim),var1)
#define QUNCON_ANIM(var1) QUOTE(UNCON_ANIM(var1))