Cargo load ignore interaction distance parameter (#6395)

* Added force parameter to cargo load

* Specifically ignore interaction distance

* Fixed old brackets

* Removed old trace
This commit is contained in:
Tim Beswick 2018-06-18 21:01:09 +01:00 committed by PabstMirror
parent 0a313ce41f
commit c0b9a31deb
2 changed files with 6 additions and 4 deletions

View File

@ -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>
@ -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 &&

View File

@ -6,6 +6,7 @@
* Arguments:
* 0: Item <OBJECT or STRING>
* 1: Vehicle <OBJECT>
* 2: Ignore interaction distance <BOOL>
*
* Return Value:
* Object loaded <BOOL>
@ -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;