mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical Engine - Prevent issues with respawning and ragdoll animations (#7796)
This commit is contained in:
parent
d751aca8ba
commit
46f3c55758
@ -64,12 +64,12 @@ addMissionEventHandler ["Loaded", {
|
|||||||
["ace_unconscious", {
|
["ace_unconscious", {
|
||||||
params ["_unit", "_active"];
|
params ["_unit", "_active"];
|
||||||
if (_active) then {
|
if (_active) then {
|
||||||
if (_unit getVariable [QGVAR(waitForAnim), true]) then {
|
// Use object reference to indicate the waitUnit is already running (this prevents issues with respawning units keeping SetVars)
|
||||||
[{(animationState _this) find QGVAR(face) != -1}, {
|
if ((_unit getVariable [QGVAR(waitForAnim), objNull]) == _unit) exitWith {};
|
||||||
[_this, animationState _this] call FUNC(applyAnimAfterRagdoll);
|
_unit setVariable [QGVAR(waitForAnim), _unit];
|
||||||
}, _unit, 20] call CBA_fnc_waitUntilAndExecute;
|
[{(animationState _this) find QGVAR(face) != -1}, {
|
||||||
_unit setVariable [QGVAR(waitForAnim), false];
|
[_this, animationState _this] call FUNC(applyAnimAfterRagdoll);
|
||||||
};
|
}, _unit, 20] call CBA_fnc_waitUntilAndExecute;
|
||||||
} else {
|
} else {
|
||||||
_unit setVariable [QGVAR(waitForAnim), nil];
|
_unit setVariable [QGVAR(waitForAnim), nil];
|
||||||
if (local _unit) then {
|
if (local _unit) then {
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit", "_anim"];
|
params ["_unit", "_anim"];
|
||||||
|
TRACE_2("applyAnimAfterRagdoll",_unit,_unconsciousAnimation);
|
||||||
|
|
||||||
if !(IS_UNCONSCIOUS(_unit) && // do not run if unit is conscious
|
if !(IS_UNCONSCIOUS(_unit) && // do not run if unit is conscious
|
||||||
{alive _unit && // do not run if unit is dead
|
{alive _unit && // do not run if unit is dead
|
||||||
{isNull objectParent _unit}}) exitWith {}; // do not run if unit in any vehicle
|
{isNull objectParent _unit}}) exitWith {}; // do not run if unit in any vehicle
|
||||||
@ -25,7 +27,7 @@ private _unconsciousAnimation = selectRandom (GVAR(animations) getVariable [_ani
|
|||||||
|
|
||||||
if (_unconsciousAnimation isEqualTo "") exitWith {
|
if (_unconsciousAnimation isEqualTo "") exitWith {
|
||||||
// not a valid animation found
|
// not a valid animation found
|
||||||
ERROR("No valid animation found!");
|
ERROR_1("No valid animation found! [from anim: %1]",_anim);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Apply the animation only locally on the machine and do not broadcast it to others
|
// Apply the animation only locally on the machine and do not broadcast it to others
|
||||||
|
Loading…
Reference in New Issue
Block a user