ACE3/addons/common/functions/fnc_loadPerson.sqf
Vdauphin 5ca113d0ba FIX: ace_common_fnc_loadPerson don't detect taru with place for crew (#5464)
When you load somebody inside a vehicle the ace_common_fnc_loadPerson is
used. This fonction acutually search nearestObjects of type ["Car",
"Air", "Tank", "Ship_F"] to put player inside. Infortunatly, the taru
family with crew place (exemple
:"Land_Pod_Heli_Transport_04_medevac_black_F") are not detected because
the corresponding parent class of
"Land_Pod_Heli_Transport_04_medevac_black_F" is :
["Land_Pod_Heli_Transport_04_medevac_F","Pod_Heli_Transport_04_crewed_base_F","StaticWeapon","LandVehicle","Land","AllVehicles","All"].
To avoid this, the "Pod_Heli_Transport_04_crewed_base_F" parent class
should also be search by nearestobjects.
2017-08-28 22:51:03 -05:00

42 lines
1.1 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>
*
* Example:
* [bob, kevin] call ace_common_fnc_loadPerson
*
* 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","Pod_Heli_Transport_04_crewed_base_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);
["ace_loadPersonEvent", [_unit, _vehicle, _caller], _unit] call CBA_fnc_targetEvent;
};
_vehicle