Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/captives/functions/fnc_setHandcuffed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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);
Expand Down Expand Up @@ -81,6 +82,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];
Expand Down
2 changes: 2 additions & 0 deletions addons/captives/functions/fnc_setSurrendered.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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];
Expand Down
11 changes: 11 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -71,6 +72,16 @@
};
}] 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);
};
_object setVariable ["tf_unable_to_use_radio", _set > 0, true];
_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 {
Expand Down
4 changes: 0 additions & 4 deletions addons/common/functions/fnc_setVolume.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
};
3 changes: 3 additions & 0 deletions addons/medical_status/functions/fnc_setUnconsciousState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

if (_active) then {
// Don't bother setting this if not used
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
Expand Down