mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Reset captive status on respawn for reliability
Previously we were resetting on death, but this caused problems when the respawnDelay was 0 as the dead unit wasn't actually the player. To account for "group" and "side" respawn types where you change unit on respawn and could potentially become a captive unit, I am explicity checking the mission respawn type before resetting variables.
This commit is contained in:
parent
e59a4163f7
commit
7c846502b5
@ -25,14 +25,6 @@ class Extended_GetOut_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
//reset captivity and escorting status when getting killed
|
|
||||||
class Extended_Killed_EventHandlers {
|
|
||||||
class CAManBase {
|
|
||||||
class GVAR(AutoDetachCaptive) {
|
|
||||||
killed = QUOTE(_this call FUNC(handleKilled));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//mission start
|
//mission start
|
||||||
class Extended_InitPost_EventHandlers {
|
class Extended_InitPost_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: PabstMirror
|
|
||||||
* Handles when a unit is kill. Reset captivity and escorting status
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: _oldUnit <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [bob1] call ACE_captives_fnc_handleKilled
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
params ["_oldUnit"];
|
|
||||||
|
|
||||||
if (!local _oldUnit) exitWith {};
|
|
||||||
|
|
||||||
if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then {
|
|
||||||
[_oldUnit, false] call FUNC(setHandcuffed);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
|
|
||||||
_oldUnit setVariable [QGVAR(isEscorting), false, true];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then {
|
|
||||||
[_oldUnit, false] call FUNC(setSurrendered);
|
|
||||||
};
|
|
@ -20,20 +20,34 @@ params ["_unit","_dead"];
|
|||||||
|
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
//With respawn="group", we could be respawning into a unit that is handcuffed/captive
|
// Group and side respawn can potentially respawn you as a captive unit
|
||||||
//If they are, reset and rerun the SET function
|
// Base and instant respawn cannot, so captive should be entirely reset
|
||||||
//if not, make sure to explicity disable the setCaptivityStatus, because captiveNum does not work correctly on respawn
|
// So we explicity account for the respawn type
|
||||||
|
private ["_respawn"];
|
||||||
|
_respawn = [0] call BIS_fnc_missionRespawnType;
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
if (_respawn > 3) then {
|
||||||
_unit setVariable [QGVAR(isHandcuffed), false];
|
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||||
[_unit, true] call FUNC(setHandcuffed);
|
_unit setVariable [QGVAR(isHandcuffed), false];
|
||||||
|
[_unit, true] call FUNC(setHandcuffed);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||||
|
_unit setVariable [QGVAR(isSurrendering), false];
|
||||||
|
[_unit, true] call FUNC(setSurrendered);
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
|
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||||
|
[_unit, false] call FUNC(setHandcuffed);
|
||||||
|
};
|
||||||
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
|
||||||
};
|
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||||
_unit setVariable [QGVAR(isSurrendering), false];
|
[_unit, false] call FUNC(setSurrendered);
|
||||||
[_unit, true] call FUNC(setSurrendered);
|
};
|
||||||
} else {
|
|
||||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||||
|
|
||||||
|
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
|
||||||
|
_oldUnit setVariable [QGVAR(isEscorting), false, true];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user