ACE3/addons/captives/functions/fnc_canSurrender.sqf

32 lines
736 B
Plaintext
Raw Normal View History

2015-02-06 21:54:26 +00:00
/*
* Author: PabstMirror
* Checks the conditions for being able switch surrender states
2015-02-06 21:54:26 +00:00
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: New Surrender State to test <BOOL>
*
* Return Value:
* The return value <BOOL>
*
* Example:
2015-02-06 23:03:56 +00:00
* [Jean, true] call ACE_captives_fnc_canSurrender;
2015-02-06 21:54:26 +00:00
*
* Public: No
*/
#include "script_component.hpp"
private "_returnValue";
params ["_unit", "_newSurrenderState"];
_returnValue = if (_newSurrenderState) then {
//no weapon equiped AND not currently surrendering and
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
} else {
//is Surrendering
(_unit getVariable [QGVAR(isSurrendering), false])
};
_returnValue