2015-02-06 21:54:26 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-05-10 06:47:50 +00:00
|
|
|
* 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"
|
|
|
|
|
2015-08-04 23:15:20 +00:00
|
|
|
params ["_unit", "_newSurrenderState"];
|
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _returnValue = if (_newSurrenderState) then {
|
2015-08-04 23:15:20 +00:00
|
|
|
//no weapon equiped AND not currently surrendering and
|
2015-06-03 01:50:27 +00:00
|
|
|
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
|
2015-02-15 22:42:00 +00:00
|
|
|
} else {
|
2015-05-10 06:47:50 +00:00
|
|
|
//is Surrendering
|
|
|
|
(_unit getVariable [QGVAR(isSurrendering), false])
|
2015-02-15 22:42:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_returnValue
|