ACE3/addons/captives/functions/fnc_surrender.sqf

64 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-02-03 02:04:50 +00:00
/*
* Author: commy2
* TODO
*
* Arguments:
* 0: Unit <OBJECT>
* 1: State <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_state);
if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
if (_state) then {
2015-02-04 19:16:19 +00:00
if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {};
2015-02-04 19:16:19 +00:00
_unit setVariable [QGVAR(isSurrender), true, true];
2015-02-04 05:56:51 +00:00
[_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus;
2015-02-04 05:56:51 +00:00
_unit spawn {
// fix for lowered rifle animation glitch
if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then {
_this playMove "amovpercmstpsraswrfldnon";
};
2015-02-04 19:16:19 +00:00
while {_this getVariable [QGVAR(isSurrender), false]} do {
2015-02-04 05:56:51 +00:00
sleep 0.001; //sleep in UI
2015-02-04 05:56:51 +00:00
if (isPlayer _this) then {showHUD false};
2015-02-04 05:56:51 +00:00
if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then {
2015-02-04 19:16:19 +00:00
_this setVariable [QGVAR(isSurrender), false, true];
2015-02-04 05:56:51 +00:00
} else {
_this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon";
};
};
if !(_this getVariable ["ACE_isUnconscious", false]) then {
_this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
} else {
_this playMoveNow "unconscious";
};
2015-02-04 05:56:51 +00:00
[_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus;
2015-02-04 05:56:51 +00:00
if (isPlayer _this) then {showHUD true};
};
} else {
2015-02-04 19:16:19 +00:00
_unit setVariable [QGVAR(isSurrender), false, true];
};
/*
player playMove "AmovPercMstpSsurWnonDnon"
player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"
2015-02-04 05:56:51 +00:00
*/