mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
More Surrender Fixes
Increase "drop hands" animation speed (now just 1/2 of normal) Use "AnimChanged" EH to watch for animation breaks while surrendering Only "crack" the hands up animation if we are in the right animation state
This commit is contained in:
parent
dec34b4b30
commit
3c65c422b1
@ -72,7 +72,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
InterpolateTo[] = {"Unconscious",0.01};
|
||||
};
|
||||
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
|
||||
speed = 0.333; //for gameplay reasons, slow this down
|
||||
speed = 0.5; //for gameplay reasons, slow this down
|
||||
actions = "CivilStandActions";
|
||||
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
|
||||
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
|
||||
|
@ -18,5 +18,12 @@
|
||||
|
||||
PARAMS_2(_unit,_newSurrenderState);
|
||||
|
||||
//TODO: any other conditions??
|
||||
(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState))
|
||||
private "_returnValue";
|
||||
|
||||
_returnValue = if (_newSurrenderState) then {
|
||||
!(_unit getVariable [QGVAR(isSurrendering), false]); //Not currently surrendering
|
||||
} else {
|
||||
(_unit getVariable [QGVAR(isSurrendering), false]); //isSurrendering and on the hands up animation - // && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"};
|
||||
};
|
||||
|
||||
_returnValue
|
||||
|
@ -30,7 +30,12 @@ if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then {
|
||||
|
||||
if (_state) then {
|
||||
_unit setVariable [QGVAR(isSurrendering), true, true];
|
||||
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
};
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
[{
|
||||
PARAMS_1(_unit);
|
||||
@ -38,37 +43,42 @@ if (_state) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
||||
|
||||
//Start up a pfeh to make sure the unit actualy goes into the animation
|
||||
//Only change variables and captivity when they reach that state
|
||||
//fixes vaulting to break animation
|
||||
[{
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_2_PVT(_args,_unit,_maxTime);
|
||||
|
||||
if (time > _maxTime) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||
ERROR("Surrender animation failed");
|
||||
};
|
||||
if ((animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon") exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
//Adds an animation changed eh
|
||||
//Should handle changes in animation
|
||||
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||
PARAMS_2(_unit,_newAnimation);
|
||||
if (_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") then {
|
||||
ERROR("Surrender animation failed");
|
||||
systemChat "You Stop Surrendering";
|
||||
[_unit, false] call FUNC(surrender);
|
||||
};
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
};
|
||||
}, 0, [_unit, (time + 20)]] call CBA_fnc_addPerFrameHandler;
|
||||
}];
|
||||
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
|
||||
|
||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if ((vehicle _unit) == _unit) then {
|
||||
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
_animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
|
||||
//spin up a PFEH, to watching animationState for the next 10 seconds to make sure we don't enter
|
||||
[{
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_2_PVT(_args,_unit,_maxTime);
|
||||
//If maxtime or they re-surrendered, exit loop
|
||||
if ((time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]}) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
//Only break animation if they are actualy the "hands up" animation (because we are using switchmove)
|
||||
if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
}, 0.05, [_unit, (time + 15)]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
//only re-enable HUD if not handcuffed
|
||||
|
Loading…
Reference in New Issue
Block a user