ACE3/addons/zeus/functions/fnc_moduleSurrender.sqf

50 lines
1.4 KiB
Plaintext
Raw Normal View History

/*
* Author: SilentSpike
* Flips the surrender state of the unit the module is attached to.
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* ReturnValue:
* nil
*
* Public: no
*/
#include "script_component.hpp"
PARAMS_3(_logic,_units,_activated);
2015-05-18 11:59:37 +00:00
private ["_unit","_surrendering"];
if (!_activated) exitWith {};
if (isNil QEFUNC(captives,setSurrendered)) then {
2015-06-04 18:33:19 +00:00
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
} else {
2015-05-18 21:49:47 +00:00
_unit = attachedTo _logic;
2015-05-18 21:49:47 +00:00
if (isNull _unit) then {
2015-06-04 18:33:19 +00:00
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
2015-05-18 21:49:47 +00:00
} else {
if !(_unit isKindOf "CAManBase") then {
2015-06-04 18:33:19 +00:00
[LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured);
2015-05-18 21:49:47 +00:00
} else {
if !(alive _unit) then {
2015-06-04 18:33:19 +00:00
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
2015-05-18 21:49:47 +00:00
} else {
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
2015-06-04 18:33:19 +00:00
[LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured);
2015-05-18 21:49:47 +00:00
} else {
_surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
// Event initalized by ACE_Captives
["SetSurrendered", _unit, [_unit, !_surrendering]] call EFUNC(common,targetEvent);
};
};
};
};
};
deleteVehicle _logic;