ACE3/addons/captives/functions/fnc_canSurrender.sqf

30 lines
719 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
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
*/
params ["_unit", "_newSurrenderState"];
private _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