From 9bcabd081b2aead1d3e03f305fb1f3a66111344b Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Tue, 19 Jan 2016 17:24:01 -0300 Subject: [PATCH] Reorder the fireEH function to allow particle effects for nearby remote players. Add a setting for that (default off). --- addons/overheating/ACE_Settings.hpp | 7 ++++ addons/overheating/functions/fnc_firedEH.sqf | 41 ++++++++++++-------- addons/overheating/stringtable.xml | 6 +++ 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/addons/overheating/ACE_Settings.hpp b/addons/overheating/ACE_Settings.hpp index 18936bb37f..37c999a2bd 100644 --- a/addons/overheating/ACE_Settings.hpp +++ b/addons/overheating/ACE_Settings.hpp @@ -13,6 +13,13 @@ class ACE_Settings { displayName = CSTRING(showParticleEffects_displayName); description = CSTRING(showParticleEffects_description); }; + class GVAR(showParticleEffectsForEveryone) { + typeName = "BOOL"; + isClientSettable = 1; + value = 0; + displayName = CSTRING(showParticleEffectsForEveryone_displayName); + description = CSTRING(showParticleEffectsForEveryone_description); + }; class GVAR(overheatingDispersion) { typeName = "BOOL"; value = 1; diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index 1641553ac8..d6e604ecdd 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -88,24 +88,11 @@ if (GVAR(overheatingDispersion)) then { TRACE_PROJECTILE_INFO(_projectile); }; -// ------ LOCAL PLAYER ONLY ------------ -// Only compute jamming and show Visual Effects for the local player -if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);}; -_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)); - -// increase jam chance on dusty grounds if prone (and at ground level) -if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then { - private _surface = configFile >> "CfgSurfaces" >> ((surfaceType getPosASL _unit) select [1]); - if (isClass _surface) then { - TRACE_1("dust",getNumber (_surface >> "dust")); - _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; - }; -}; - -TRACE_3("check for random jam",_unit,_weapon,_jamChance); -if ((random 1) < _jamChance) then { - [_unit, _weapon] call FUNC(jamWeapon); +// ------ LOCAL AND NEARBY PLAYERS DEPENDING ON SETTINGS ------------ +// Particle effects only apply to the local player and, depending on settings, to other nearby players +if (_unit != ACE_player && (!GVAR(showParticleEffectsForEveryone) || {_unit distance ACE_player > 20})) exitWith { + END_COUNTER(firedEH); }; //Particle Effects: @@ -134,4 +121,24 @@ if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDro }; }; +// ------ LOCAL PLAYER ONLY ------------ +// Only compute jamming for the local player +if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);}; + +_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)); + +// increase jam chance on dusty grounds if prone (and at ground level) +if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then { + private _surface = configFile >> "CfgSurfaces" >> ((surfaceType getPosASL _unit) select [1]); + if (isClass _surface) then { + TRACE_1("dust",getNumber (_surface >> "dust")); + _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; + }; +}; + +TRACE_3("check for random jam",_unit,_weapon,_jamChance); +if ((random 1) < _jamChance) then { + [_unit, _weapon] call FUNC(jamWeapon); +}; + END_COUNTER(firedEH); diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 75ac666aae..4cbca42554 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -31,6 +31,12 @@ Show particle effects when weapon overheats + + Overheating Particle Effects for everyone + + + Show particle effects when other players weapon overheats + Overheating Dispersion