From 52007fab6a687a5bf992de3faf18f844c5c475dd Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 6 Mar 2016 12:06:17 +0100 Subject: [PATCH] Add sanity checks, fix explosives checks --- addons/explosives/functions/fnc_cancelPlacement.sqf | 7 +------ addons/explosives/functions/fnc_setupExplosive.sqf | 7 +++++++ addons/sandbag/functions/fnc_deployCancel.sqf | 2 +- addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf | 2 +- addons/trenches/functions/fnc_placeCancel.sqf | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/explosives/functions/fnc_cancelPlacement.sqf b/addons/explosives/functions/fnc_cancelPlacement.sqf index 4a7f385a01..e6bd60f637 100644 --- a/addons/explosives/functions/fnc_cancelPlacement.sqf +++ b/addons/explosives/functions/fnc_cancelPlacement.sqf @@ -18,11 +18,6 @@ params ["_unit", "_key"]; -if (_key != 1) exitWith {}; - -if (_unit == ACE_player && - {([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} && - {(_magClassname in (magazines _unit))} -) exitWith {}; +if (_key != 1 || {!GVAR(pfeh_running)}) exitWith {}; GVAR(placeAction) = PLACE_CANCEL; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 567bb95db8..709ea688d5 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -141,6 +141,13 @@ GVAR(TweakedAngle) = 0; //Don't allow placing in a bad position: if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; + if (_unit != ACE_player || + {!([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} || + {!(_magClassname in (magazines _unit))} + ) then { + GVAR(placeAction) = PLACE_CANCEL; + }; + if (GVAR(placeAction) != PLACE_WAITING) then { [_pfID] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_running) = false; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index e0315d7849..6cb38e4f73 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -18,7 +18,7 @@ params ["_unit", "_key"]; -if (_key != 1) exitWith {}; +if (_key != 1 || {GVAR(deployPFH) == -1}) exitWith {}; // enable running again [_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set); diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index 6f9eb5cff9..b009028c93 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -20,7 +20,7 @@ params ["_unit", "_key"]; -if (_key != 1) exitWith {}; +if (_key != 1 || {isNull GVAR(ladder)}) exitWith {}; // enable running again [_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set); diff --git a/addons/trenches/functions/fnc_placeCancel.sqf b/addons/trenches/functions/fnc_placeCancel.sqf index 90c9d6ecc7..b3d6bf78da 100644 --- a/addons/trenches/functions/fnc_placeCancel.sqf +++ b/addons/trenches/functions/fnc_placeCancel.sqf @@ -18,7 +18,7 @@ params ["_unit", "_key"]; -if (_key != 1) exitWith {}; +if (_key != 1 || {GVAR(digPFH) == -1}) exitWith {}; // enable running again [_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set);