mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Towing - Fix swimming issues (#9401)
* Fix swimming issues * Fix fire with rope in hand
This commit is contained in:
parent
4dd2568fe0
commit
74be4f1503
@ -3,6 +3,7 @@
|
||||
["MouseButtonUp", LINKFUNC(onMouseButtonUp)] call CBA_fnc_addDisplayHandler;
|
||||
GVAR(mouseLeft) = false;
|
||||
GVAR(mouseRight) = false;
|
||||
GVAR(blockFireEHID) = -1;
|
||||
|
||||
GVAR(cancel) = false;
|
||||
GVAR(canAttach) = false;
|
||||
@ -11,4 +12,3 @@ GVAR(canAttach) = false;
|
||||
params ["_parent", "_child"];
|
||||
_child setTowParent _parent;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
@ -28,8 +28,9 @@ if (_ropeLength == 0) then {
|
||||
|
||||
_unit removeItem _ropeClass;
|
||||
|
||||
GVAR(isSwimming) = _unit call EFUNC(common,isSwimming);
|
||||
GVAR(putWeaponAwayNextFrame) = false;
|
||||
GVAR(cancel) = false;
|
||||
GVAR(canAttach) = false;
|
||||
[LINKFUNC(towStateMachinePFH), 0, [TOW_STATE_ATTACH_PARENT, _unit, _target, objNull, _ropeLength, _ropeClass]] call CBA_fnc_addPerFrameHandler;
|
||||
[QGVAR(ropeDeployed), [_unit, _target, _ropeClass]] call CBA_fnc_localEvent;
|
||||
|
||||
|
@ -18,11 +18,38 @@
|
||||
params ["_args", "_handle"];
|
||||
_args params ["_state", "_unit", "_parent", "_rope", "_length", "_ropeClass"];
|
||||
|
||||
private _wasSwimming = GVAR(isSwimming);
|
||||
GVAR(isSwimming) = _unit call EFUNC(common,isSwimming);
|
||||
|
||||
// skip this frame to wait for weapon in hands
|
||||
if (_wasSwimming && {!GVAR(isSwimming)}) exitWith {GVAR(putWeaponAwayNextFrame) = true;};
|
||||
// move weapon to back in next frame
|
||||
if (GVAR(putWeaponAwayNextFrame)) then {
|
||||
if (currentWeapon _unit isNotEqualTo "") then {[_unit] call EFUNC(weaponselect,putWeaponAway)};
|
||||
GVAR(putWeaponAwayNextFrame) = false;
|
||||
};
|
||||
|
||||
// block fire when swimming in wetsuit with weapon
|
||||
if (GVAR(isSwimming) && {currentWeapon _unit isNotEqualTo ""}) then {
|
||||
if (GVAR(blockFireEHID) == -1) then {
|
||||
GVAR(blockFireEHID) = [_unit, "DefaultAction", {true}, {}] call EFUNC(common,addActionEventHandler);
|
||||
};
|
||||
} else {
|
||||
if (GVAR(blockFireEHID) != -1) then {
|
||||
[_unit, "DefaultAction", GVAR(blockFireEHID)] call EFUNC(common,removeActionEventHandler);
|
||||
GVAR(blockFireEHID) = -1;
|
||||
};
|
||||
};
|
||||
|
||||
private _exitCondition = !(
|
||||
(alive GVAR(attachHelper)) &&
|
||||
{ alive _parent } &&
|
||||
{ alive _unit } &&
|
||||
{ "" isEqualTo currentWeapon _unit || { _unit call EFUNC(common,isSwimming) }} &&
|
||||
{
|
||||
currentWeapon _unit isEqualTo ""
|
||||
|| {_unit call EFUNC(common,isSwimming)} // swimming in wetsuit forces weapon in hands
|
||||
|| {getPosASLW _unit select 2 < -1.5} // walking-to-swimming animation in wetsuit lasts for 3 seconds
|
||||
} &&
|
||||
{ [_unit, objNull, [INTERACTION_EXCEPTIONS]] call EFUNC(common,canInteractWith) } &&
|
||||
{ "unconscious" isNotEqualTo toLower animationState _unit } &&
|
||||
{ !(_unit getVariable ["ACE_isUnconscious", false]) } &&
|
||||
@ -149,6 +176,9 @@ switch (_state) do {
|
||||
[_handle] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setVariable [QGVAR(hint), []];
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
if (GVAR(blockFireEHID) != -1) then {
|
||||
[_unit, "DefaultAction", GVAR(blockFireEHID)] call EFUNC(common,removeActionEventHandler);
|
||||
GVAR(blockFireEHID) = -1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user