2015-09-18 16:28:19 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Check if unit is underwater
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-18 16:28:19 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* if unit is in the water (BOOLEAN)
|
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
params ["_unit"];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
private "_return";
|
2015-01-16 23:21:47 +00:00
|
|
|
_return = false;
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
if (surfaceIsWater getPosASL _unit) then {
|
|
|
|
private "_pos";
|
|
|
|
_pos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
|
|
|
|
|
|
|
if (_pos select 2 < 0) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_return = true;
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
_return
|