Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo load ignore interaction distance parameter #6395

Merged
merged 4 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions addons/cargo/functions/fnc_canLoadItemIn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Arguments:
* 0: Item <OBJECT or STRING>
* 1: Holder Object (Vehicle) <OBJECT>
* 2: Ignore interaction distance <BOOL>
*
* Return Value:
* Can load in <BOOL>
Expand All @@ -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};

Expand All @@ -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 &&
Expand Down
5 changes: 3 additions & 2 deletions addons/cargo/functions/fnc_loadItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Arguments:
* 0: Item <OBJECT or STRING>
* 1: Vehicle <OBJECT>
* 2: Ignore interaction distance <BOOL>
*
* Return Value:
* Object loaded <BOOL>
Expand All @@ -17,10 +18,10 @@
*/
#include "script_component.hpp"

params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]];
params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]], ["_ignoreInteraction", false]];
TRACE_2("params",_item,_vehicle);

if !([_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), []];
_loaded pushBack _item;
Expand Down