Captives - Disallow ACRE/TFAR radio usage on surrender/handcuff (#8388)

* Block radio on captive/surrendered/unconscious via status effect

* missing semicolon

* Don't broadcast setVar if radio addon doesn't exist

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Salluci 2021-09-25 13:16:15 -03:00 committed by GitHub
parent f9d064e5f4
commit 48912be73c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 4 deletions

View File

@ -42,6 +42,7 @@ if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith
if (_state) then {
_unit setVariable [QGVAR(isHandcuffed), true, true];
[_unit, "setCaptive", QGVAR(Handcuffed), true] call EFUNC(common,statusEffect_set);
[_unit, "blockRadio", QGVAR(Handcuffed), true] call EFUNC(common,statusEffect_set);
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
[_unit, false] call FUNC(setSurrendered);
@ -82,6 +83,7 @@ if (_state) then {
} else {
_unit setVariable [QGVAR(isHandcuffed), false, true];
[_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set);
[_unit, "blockRadio", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set);
//remove AnimChanged EH
private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];

View File

@ -45,6 +45,7 @@ if (_state) then {
_unit setVariable [QGVAR(isSurrendering), true, true];
[_unit, "setCaptive", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set);
[_unit, "blockRadio", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set);
if (_unit == ACE_player) then {
["captive", [false, false, false, false, false, false, false, false, false, true]] call EFUNC(common,showHud);
@ -71,6 +72,7 @@ if (_state) then {
} else {
_unit setVariable [QGVAR(isSurrendering), false, true];
[_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set);
[_unit, "blockRadio", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set);
//remove AnimChanged EH
private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];

View File

@ -26,6 +26,7 @@
["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType);
["blockThrow", false, ["ACE_Attach", "ACE_concertina_wire", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_rearm", "ACE_refuel", "ACE_Sandbag", "ACE_Trenches", "ACE_tripod"]] call FUNC(statusEffect_addType);
["setHidden", true, ["ace_unconscious"]] call FUNC(statusEffect_addType);
["blockRadio", false, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType);
[QGVAR(forceWalk), {
params ["_object", "_set"];
@ -71,6 +72,20 @@
};
}] call CBA_fnc_addEventHandler;
[QGVAR(blockRadio), {
params ["_object", "_set"];
TRACE_2("blockRadio EH",_object,_set);
if (_object isEqualTo ACE_Player && {_set > 0}) then {
call FUNC(endRadioTransmission);
};
if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {
_object setVariable ["tf_unable_to_use_radio", _set > 0, true];
};
if (isClass (configFile >> "CfgPatches" >> "acre_main")) then {
_object setVariable ["acre_sys_core_isDisabled", _set > 0, true];
};
}] call CBA_fnc_addEventHandler;
[QGVAR(blockDamage), { //Name reversed from `allowDamage` because we want NOR logic
params ["_object", "_set"];
if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then {

View File

@ -33,11 +33,9 @@ if (_setVolume) then {
// TFAR
_unit setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
_unit setVariable ["tf_globalVolume", NORMAL_LEVEL];
_unit setVariable ["tf_unable_to_use_radio", false];
// ACRE2
if (!isNil "acre_api_fnc_setGlobalVolume") then { [NORMAL_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
_unit setVariable ["acre_sys_core_isDisabled", false, true];
} else {
// Vanilla Game
@ -46,9 +44,7 @@ if (_setVolume) then {
// TFAR
_unit setVariable ["tf_voiceVolume", NO_SOUND, true];
_unit setVariable ["tf_globalVolume", MUTED_LEVEL];
_unit setVariable ["tf_unable_to_use_radio", true];
// ACRE2
if (!isNil "acre_api_fnc_setGlobalVolume") then { [MUTED_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
_unit setVariable ["acre_sys_core_isDisabled", true, true];
};

View File

@ -31,6 +31,9 @@ _unit setVariable [VAR_UNCON, _active, true];
// Stop AI firing at unconscious units in most situations (global effect)
[_unit, "setHidden", "ace_unconscious", _active] call EFUNC(common,statusEffect_set);
// Block radio on unconsciousness for compatibility with captive module
[_unit, "blockRadio", "ace_unconscious", _active] call EFUNC(common,statusEffect_set);
if (_active) then {
// Don't bother setting this if not used
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {