ACE3/addons/zeus/functions/fnc_moduleSurrender.sqf

53 lines
1.5 KiB
Plaintext
Raw Normal View History

/*
* Author: SilentSpike
2015-07-20 20:07:53 +00:00
* Flips the surrender state of the unit the module is placed on.
*
* Arguments:
2015-08-15 20:11:49 +00:00
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
2015-08-15 20:11:49 +00:00
* Return Value:
* None
*
* Example:
* [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleSurrender
*
2015-08-15 20:11:49 +00:00
* Public: No
*/
#include "script_component.hpp"
params ["_logic"];
if !(local _logic) exitWith {};
if (isNil QEFUNC(captives,setSurrendered)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
} else {
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
2015-07-20 20:07:53 +00:00
if ((_mouseOver select 0) != "OBJECT") then {
[LSTRING(NothingSelected)] call FUNC(showMessage);
2015-05-18 21:49:47 +00:00
} else {
private _unit = effectivecommander (_mouseOver select 1);
2015-07-20 20:07:53 +00:00
2015-05-18 21:49:47 +00:00
if !(_unit isKindOf "CAManBase") then {
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
2015-05-18 21:49:47 +00:00
} else {
if !(alive _unit) then {
[LSTRING(OnlyAlive)] call FUNC(showMessage);
2015-05-18 21:49:47 +00:00
} else {
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
[LSTRING(OnlyNonCaptive)] call FUNC(showMessage);
2015-05-18 21:49:47 +00:00
} else {
private _surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
2015-05-18 21:49:47 +00:00
// Event initalized by ACE_Captives
2016-05-25 18:23:53 +00:00
[QEGVAR(captives,setSurrendered), [_unit, !_surrendering], _unit] call CBA_fnc_targetEvent;
2015-05-18 21:49:47 +00:00
};
};
};
};
};
deleteVehicle _logic;