2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Closes the current dialog if the target moves, changes vehicle etc.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target unit
|
|
|
|
* 1: Ignore the unit being dead? (Optional, default: No)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_this spawn {
|
|
|
|
_target = _this select 0;
|
|
|
|
_ignoreDead = _this select 1;
|
|
|
|
if (isNil "_ignoreDead") then {_ignoreDead = false};
|
|
|
|
|
|
|
|
_vehicleTarget = vehicle _target;
|
2015-01-12 04:02:33 +00:00
|
|
|
_vehiclePlayer = vehicle ACE_player;
|
2015-01-11 16:42:31 +00:00
|
|
|
_inVehicle = _target != _vehicleTarget;
|
|
|
|
|
|
|
|
_position = getPosASL _target;
|
|
|
|
|
|
|
|
_fnc_check = {
|
|
|
|
// either unit changed vehicles
|
2015-01-12 04:02:33 +00:00
|
|
|
if (_vehiclePlayer != vehicle ACE_player) exitWith {True};
|
2015-01-11 16:42:31 +00:00
|
|
|
if (_vehicleTarget != vehicle _target) exitWith {True};
|
|
|
|
|
|
|
|
// target died
|
|
|
|
if (!alive _target && {!_ignoreDead}) exitWith {True};
|
|
|
|
|
|
|
|
// player fell unconscious
|
2015-01-12 04:02:33 +00:00
|
|
|
if (ACE_player getVariable ["ACE_isUnconscious", False]) exitWith {True};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
// target moved (outside of vehicle)
|
|
|
|
(!_inVehicle && {getPosASL _target distanceSqr _position > 1})
|
|
|
|
};
|
|
|
|
|
|
|
|
waitUntil {
|
|
|
|
if (call _fnc_check) then {
|
|
|
|
closeDialog 0;
|
2015-01-15 17:41:22 +00:00
|
|
|
call EFUNC(interaction,hideMenu);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-01-15 17:41:22 +00:00
|
|
|
(isNil QEGVAR(interaction,MainButton) && !dialog) || {!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])} //Exit loop if DisableMouse dialog open
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
};
|