2015-04-30 18:44:43 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Unload a person from a vehicle
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-04-30 18:44:43 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Returns true if succesfully unloaded person <BOOL>
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-14 19:29:07 +00:00
|
|
|
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-09-18 17:12:38 +00:00
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
private "_vehicle";
|
2015-01-16 23:21:47 +00:00
|
|
|
_vehicle = vehicle _unit;
|
|
|
|
|
2015-09-18 17:12:38 +00:00
|
|
|
if (_vehicle == _unit) exitWith {false};
|
|
|
|
|
|
|
|
if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false};
|
|
|
|
|
|
|
|
private "_emptyPos";
|
2015-09-18 17:40:48 +00:00
|
|
|
_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]; // @todo to small?
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-09-18 17:12:38 +00:00
|
|
|
if (count _emptyPos == 0) exitWith {false};
|
2015-05-25 17:32:52 +00:00
|
|
|
|
2015-05-25 16:43:29 +00:00
|
|
|
if (!isNull _vehicle) then {
|
2015-09-18 17:12:38 +00:00
|
|
|
[[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call FUNC(execRemoteFnc);
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-09-18 17:12:38 +00:00
|
|
|
true
|