mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
432a0102e8
Removed caller parameter.
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
/*
|
|
* Author: Glowbal
|
|
* Unload a person from a vehicle
|
|
*
|
|
* Arguments:
|
|
* 0: unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Returns true if succesfully unloaded person <BOOL>
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
|
|
|
private ["_unit","_vehicle", "_loaded", "_emptyPos"];
|
|
_unit = _this select 0;
|
|
_vehicle = vehicle _unit;
|
|
|
|
if (_vehicle == _unit) exitwith {false;};
|
|
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
|
|
|
_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]);
|
|
if (count _emptyPos == 0) exitwith {false};
|
|
|
|
_unit setPos _emptyPos;
|
|
unassignVehicle _unit;
|
|
if (!alive _unit) then {
|
|
_unit action ["Eject", vehicle _unit];
|
|
};
|
|
|
|
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
|
|
|
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
|
_loaded = _loaded - [_unit];
|
|
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
|
|
|
if (!([_unit] call FUNC(isAwake))) then {
|
|
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
|
};
|
|
|
|
true;
|