ACE3/addons/common/functions/fnc_setCaptiveSwitch.sqf

33 lines
725 B
Plaintext
Raw Normal View History

2015-01-16 23:21:47 +00:00
/**
* fn_setCaptiveSwitch.sqf
* @Descr: Register a unit as captive for the unconscious state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, setCaptive BOOL]
* @Return: BOOL True if unit is put as set captive, otherwise false
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit", "_captiveSwitch", "_setCaptive"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_setCaptive = [_this, 1, false, [false]] call BIS_fnc_Param;
_captiveSwitch = true;
if (_setCaptive) then {
if (captive _unit) then {
_captiveSwitch = false;
} else {
_unit setCaptive true;
};
} else {
2015-01-17 12:54:44 +00:00
if (captive _unit) then {
2015-01-16 23:21:47 +00:00
_unit setCaptive false;
} else {
2015-01-17 12:54:44 +00:00
_captiveSwitch = false;
2015-01-16 23:21:47 +00:00
};
};
_captiveSwitch