mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
5d70db3d9b
Fix #2965 The FRIES is a "Helicopter" so we were trying to load into it, because it was closest. Also disable Cargo system on it so we don't load other things into it And remove all interactions on it as well.
39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
/*
|
|
* Author: Glowbal
|
|
* Loads a specified unit into any nearby vehicle
|
|
*
|
|
* Arguments:
|
|
* 0: Unit that will load <OBJECT>
|
|
* 1: Unit to be loaded <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed <OBJECT>
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
#define GROUP_SWITCH_ID QFUNC(loadPerson)
|
|
|
|
params ["_caller", "_unit"];
|
|
|
|
private _vehicle = objNull;
|
|
|
|
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
|
|
|
|
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F"], 10];
|
|
|
|
{
|
|
TRACE_1("",_x);
|
|
if ((_x emptyPositions "cargo" > 0) || {_x emptyPositions "gunner" > 0}) exitWith {
|
|
_vehicle = _x;
|
|
};
|
|
} forEach _nearVehicles;
|
|
|
|
if (!isNull _vehicle) then {
|
|
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);
|
|
["loadPersonEvent", _unit, [_unit, _vehicle, _caller]] call FUNC(objectEvent);
|
|
};
|
|
|
|
_vehicle
|