2015-01-16 23:21:47 +00:00
|
|
|
/**
|
|
|
|
* fn_inWater_f.sqf
|
|
|
|
* @Descr: Check if unit is underwater
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: [unit OBJECT]
|
|
|
|
* @Return: BOOL True if unit is in the water
|
|
|
|
* @PublicAPI: true
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_return","_aslPos"];
|
|
|
|
|
|
|
|
PARAMS_1(_unit);
|
2015-01-16 23:21:47 +00:00
|
|
|
_return = false;
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-01-16 23:21:47 +00:00
|
|
|
if ((surfaceIsWater getPos _unit)) then {
|
2015-04-03 22:26:27 +00:00
|
|
|
_aslPos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
2015-01-18 19:09:19 +00:00
|
|
|
if ((_aslPos select 2) <= 0) then {
|
|
|
|
_return = true;
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
2015-05-14 18:06:06 +00:00
|
|
|
|
|
|
|
_return;
|