From fc8a70872fd79afe46efc24293bc27d3097845c1 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Wed, 29 Nov 2017 23:07:30 +0300 Subject: [PATCH] Lock object while loading to cargo + disable disassembling (#5624) --- addons/cargo/functions/fnc_startLoadIn.sqf | 10 +++++++--- addons/common/functions/fnc_claim.sqf | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index a3bc0f01af..092440e5d4 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -35,13 +35,17 @@ if (isNull _vehicle) exitWith { private _return = false; // Start progress bar if ([_object, _vehicle] call FUNC(canLoadItemIn)) then { + [_player, _object, true] call EFUNC(common,claim); private _size = [_object] call FUNC(getSizeItem); [ 5 * _size, - [_object,_vehicle], - {["ace_loadCargo", _this select 0] call CBA_fnc_localEvent}, - {}, + [_object, _vehicle], + { + [objNull, _this select 0 select 0, true] call EFUNC(common,claim); + ["ace_loadCargo", _this select 0] call CBA_fnc_localEvent; + }, + {[objNull, _this select 0 select 0, true] call EFUNC(common,claim)}, localize LSTRING(LoadingItem), {true}, ["isNotSwimming"] diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index 79237d725b..8df41cb241 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -30,10 +30,17 @@ _target setVariable [QGVAR(owner), _unit, true]; // lock target object if (_lockTarget) then { + private _canBeDisassembled = !([] isEqualTo getArray (_target call CBA_fnc_getObjectConfig >> "assembleInfo" >> "dissasembleTo")); if (!isNull _unit) then { [QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent; + if (_canBeDisassembled) then { + _target enableWeaponDisassembly false; + }; } else { [QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent; + if (_canBeDisassembled) then { + _target enableWeaponDisassembly true; + }; }; };