ACE3/addons/zeus/functions/fnc_moduleSurrender.sqf

52 lines
1.6 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 <NIL>
*
2015-08-15 20:11:49 +00:00
* Public: No
*/
#include "script_component.hpp"
2015-08-04 22:16:23 +00:00
params ["_logic", "_units", "_activated"];
2015-08-15 20:11:49 +00:00
private ["_mouseOver", "_unit", "_surrendering"];
if !(_activated && local _logic) exitWith {};
if (isNil QEFUNC(captives,setSurrendered)) then {
2015-06-04 18:33:19 +00:00
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
} else {
2015-07-20 20:07:53 +00:00
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
2015-07-20 20:07:53 +00:00
if ((_mouseOver select 0) != "OBJECT") then {
2015-06-04 18:33:19 +00:00
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
2015-05-18 21:49:47 +00:00
} else {
2015-07-20 20:07:53 +00:00
_unit = effectivecommander (_mouseOver select 1);
2015-05-18 21:49:47 +00:00
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, !_surrendering], _unit] call CBA_fnc_targetEvent;
2015-05-18 21:49:47 +00:00
};
};
};
};
};
deleteVehicle _logic;