From fb09514a005a6c6595d8f1009721ceb7ed307b64 Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Sun, 17 Jun 2018 14:57:07 +0100 Subject: [PATCH 1/4] Added force parameter to cargo load --- addons/cargo/functions/fnc_loadItem.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index f8b00478e6e..4fcbd4fdbd7 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -6,6 +6,7 @@ * Arguments: * 0: Item * 1: Vehicle + * 2: Force * * Return Value: * Object loaded @@ -17,12 +18,13 @@ */ #include "script_component.hpp" -params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]]; +params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]], ["_force", false]]; TRACE_2("params",_item,_vehicle); -if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; +if (!_force && {!([_item, _vehicle] call FUNC(canLoadItemIn))}) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; private _loaded = _vehicle getVariable [QGVAR(loaded), []]; +TRACE_1("before loaded array",_loaded); _loaded pushBack _item; _vehicle setVariable [QGVAR(loaded), _loaded, true]; From eeacf95dc23f062e81570361cfd594f52f0c7529 Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Sun, 17 Jun 2018 15:06:17 +0100 Subject: [PATCH 2/4] Specifically ignore interaction distance --- addons/cargo/functions/fnc_canLoadItemIn.sqf | 5 +++-- addons/cargo/functions/fnc_loadItem.sqf | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index 87806892413..7d5d98dc0cd 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -5,6 +5,7 @@ * Arguments: * 0: Item * 1: Holder Object (Vehicle) + * 2: Ignore interaction distance * * Return Value: * Can load in @@ -16,7 +17,7 @@ */ #include "script_component.hpp" -params [["_item", "", [objNull,""]], "_vehicle"]; +params [["_item", "", [objNull,""]], "_vehicle", ["_ignoreInteraction", false]]; if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {TRACE_1("vehicle not stable",_vehicle); false}; @@ -34,7 +35,7 @@ if (_item isEqualType "") then { } else { _validItem = (alive _item) && - {([_item, _vehicle] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}; + {_ignoreInteraction || {([_item, _vehicle] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}}; }; _validItem && diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 4fcbd4fdbd7..4d907c0c359 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Item * 1: Vehicle - * 2: Force + * 2: Ignore interaction distance * * Return Value: * Object loaded @@ -18,10 +18,10 @@ */ #include "script_component.hpp" -params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]], ["_force", false]]; +params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]], ["_ignoreInteraction", false]]; TRACE_2("params",_item,_vehicle); -if (!_force && {!([_item, _vehicle] call FUNC(canLoadItemIn))}) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; +if ({!([_item, _vehicle, _ignoreInteraction] call FUNC(canLoadItemIn))}) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; private _loaded = _vehicle getVariable [QGVAR(loaded), []]; TRACE_1("before loaded array",_loaded); From 53421ddbc84001c79a9f651f1fef71d10501b377 Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Sun, 17 Jun 2018 15:10:08 +0100 Subject: [PATCH 3/4] Fixed old brackets --- addons/cargo/functions/fnc_loadItem.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 4d907c0c359..a6f7c3c2391 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -21,7 +21,7 @@ params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]], ["_ignoreInteraction", false]]; TRACE_2("params",_item,_vehicle); -if ({!([_item, _vehicle, _ignoreInteraction] call FUNC(canLoadItemIn))}) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; +if !([_item, _vehicle, _ignoreInteraction] call FUNC(canLoadItemIn)) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; private _loaded = _vehicle getVariable [QGVAR(loaded), []]; TRACE_1("before loaded array",_loaded); From ad43353926cd0150fe45c8903007840e3a24354a Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Sun, 17 Jun 2018 15:11:19 +0100 Subject: [PATCH 4/4] Removed old trace --- addons/cargo/functions/fnc_loadItem.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index a6f7c3c2391..cb4772b7916 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -24,7 +24,6 @@ TRACE_2("params",_item,_vehicle); if !([_item, _vehicle, _ignoreInteraction] call FUNC(canLoadItemIn)) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; private _loaded = _vehicle getVariable [QGVAR(loaded), []]; -TRACE_1("before loaded array",_loaded); _loaded pushBack _item; _vehicle setVariable [QGVAR(loaded), _loaded, true];