From 358a95381b8bb27b6759f47e51ffcfbf8e9bdea6 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 8 Mar 2015 16:56:47 +0100 Subject: [PATCH 1/4] Clientside display text option for weapon grenades --- addons/weaponselect/config.cpp | 10 ++++++++++ .../functions/fnc_displayGrenadeTypeAndNumber.sqf | 2 ++ addons/weaponselect/functions/fnc_selectGrenadeAll.sqf | 7 ++++--- .../weaponselect/functions/fnc_selectGrenadeFrag.sqf | 8 ++++---- .../weaponselect/functions/fnc_selectGrenadeOther.sqf | 8 ++++---- addons/weaponselect/stringtable.xml | 6 ++++++ 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/addons/weaponselect/config.cpp b/addons/weaponselect/config.cpp index adebcd322c..9bf9c7c39c 100644 --- a/addons/weaponselect/config.cpp +++ b/addons/weaponselect/config.cpp @@ -13,3 +13,13 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" + +class ACE_Settings { + class GVAR(DisplayText) { + typeName = "BOOL"; + isClientSetable = 1; + value = 1; + displayName = "$STR_ACE_Weaponselect_SettingDisplayTextName"; + description = "$STR_ACE_Weaponselect_SettingDisplayTextDesc"; + }; +}; diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 2f8a4c3f87..4605bd3861 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -14,6 +14,8 @@ private ["_magazine", "_numberofMagazines"]; +if !(GVAR(DisplayText)) exitwith {}; + _magazine = _this select 0; _numberofMagazines = _this select 1; diff --git a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf b/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf index 685ef4b76e..72977e6ad6 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf @@ -36,9 +36,10 @@ if (_nextMuzzle != "") then { // There is a no muzzle with magazines --> select nothing GVAR(CurrentGrenadeMuzzleFrag) = ""; GVAR(CurrentGrenadeMuzzleOther) = ""; - _text = [localize "STR_ACE_WeaponSelect_NoGrenadesLeft", [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - + if (GVAR(DisplayText)) then { + _text = [localize "STR_ACE_WeaponSelect_NoGrenadesLeft", [1,0,0]] call EFUNC(common,stringToColoredText); + [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); + }; }; if (_nextMuzzle in GVAR(FragMuzzles)) then { diff --git a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf b/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf index 4b6c4dabb2..6eb1714b51 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf @@ -35,10 +35,10 @@ if (_nextMuzzle != "") then { } else { // There is a no muzzle with magazines --> select nothing GVAR(CurrentGrenadeMuzzleFrag) = ""; - - _text = [localize "STR_ACE_WeaponSelect_NoFragsLeft", [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - + if (GVAR(DisplayText)) then { + _text = [localize "STR_ACE_WeaponSelect_NoFragsLeft", [1,0,0]] call EFUNC(common,stringToColoredText); + [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); + }; }; GVAR(CurrentGrenadeMuzzleIsFrag) = true; diff --git a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf b/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf index 62b5325011..32c0e43666 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf @@ -35,10 +35,10 @@ if (_nextMuzzle != "") then { } else { // There is a no muzzle with magazines --> select nothing GVAR(CurrentGrenadeMuzzleOther) = ""; - - _text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - + if (GVAR(DisplayText)) then { + _text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText); + [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); + }; }; GVAR(CurrentGrenadeMuzzleIsFrag) = false; diff --git a/addons/weaponselect/stringtable.xml b/addons/weaponselect/stringtable.xml index a8c736b4fb..fc678e8820 100644 --- a/addons/weaponselect/stringtable.xml +++ b/addons/weaponselect/stringtable.xml @@ -2,6 +2,12 @@ + + Display text on weapon select + + + Display a hint or text on weapon select or grenade throw. + Select Pistol Pistole auswählen From d919c2436d1a23443177dffe34022ab0085f6a9c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 8 Mar 2015 16:56:57 +0100 Subject: [PATCH 2/4] Clientside display text option for weapon reload --- addons/reload/CfgEventHandlers.hpp | 2 +- addons/reload/config.cpp | 11 +++++++++++ addons/reload/functions/fnc_checkAmmo.sqf | 4 ++-- addons/reload/stringtable.xml | 6 ++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/addons/reload/CfgEventHandlers.hpp b/addons/reload/CfgEventHandlers.hpp index 8de6a01f06..05860b3f9f 100644 --- a/addons/reload/CfgEventHandlers.hpp +++ b/addons/reload/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_Take_EventHandlers { class CAManBase { class ACE_AmmoIndicatorReload { - clientTake = QUOTE(if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_3(_this select 0, vehicle (_this select 0), true)] call FUNC(checkAmmo)};); + clientTake = QUOTE(if !(GVAR(DisplayText)) exitwith {}; if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_3(_this select 0, vehicle (_this select 0), true)] call FUNC(checkAmmo)};); }; }; }; diff --git a/addons/reload/config.cpp b/addons/reload/config.cpp index 6e0c14049d..84d17090a8 100644 --- a/addons/reload/config.cpp +++ b/addons/reload/config.cpp @@ -17,3 +17,14 @@ class CfgPatches { #include "CfgActions.hpp" #include "RscInGameUI.hpp" + +class ACE_Settings { + class GVAR(DisplayText) { + typeName = "BOOL"; + isClientSetable = 1; + value = 1; + displayName = "$STR_ACE_reload_SettingDisplayTextName"; + description = "$STR_ACE_reload_SettingDisplayTextDesc"; + }; +}; + diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index fab1ebf333..99aa6b10bf 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -2,12 +2,12 @@ * Author: commy2 * * Count the ammo of the currently loaded magazine or count rifle grenades. Play animation and display message. - * + * * Argument: * 0: The player (Object) * 1: The vehicle (Object) * 2: Skip the animation? Used after reloading (Bool) - * + * * Return value: * Nothing */ diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index 1f39b0e743..859b186ef7 100644 --- a/addons/reload/stringtable.xml +++ b/addons/reload/stringtable.xml @@ -2,6 +2,12 @@ + + Check ammo on weapon reload + + + Check the ammo in your new magazine on magazine reload. + Check Ammo Munition prüfen From 2250255d65efed07ecff446e0f1f855798a95a6e Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 8 Mar 2015 16:57:06 +0100 Subject: [PATCH 3/4] Clientside display text option for weapon jamming --- addons/overheating/config.cpp | 11 +++++++++++ addons/overheating/functions/fnc_clearJam.sqf | 17 ++++++++++------- addons/overheating/functions/fnc_jamWeapon.sqf | 2 +- addons/overheating/stringtable.xml | 6 ++++++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index c3778862e6..b72660ce72 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -19,3 +19,14 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + +class ACE_Settings { + class GVAR(DisplayTextOnJam) { + typeName = "BOOL"; + isClientSetable = 1; + value = 1; + displayName = "$STR_ACE_overheating_SettingDisplayTextName"; + description = "$STR_ACE_overheating_SettingDisplayTextDesc"; + }; +}; + diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 76941d75ac..4bba92eb3f 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -42,13 +42,16 @@ if (_weapon in _jammedWeapons) then { }; _unit playActionNow _clearJamAction; - }; - if (_weapon == primaryWeapon _unit) then { - playSound QGVAR(fixing_rifle); - } else { - if (_weapon == secondaryWeapon _unit) then { - playSound QGVAR(fixing_pistol); + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; }; }; - [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured); + + if (GVAR(DisplayTextOnJam)) then { + [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index f11b72688c..7810fb0ce2 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -61,7 +61,7 @@ if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { _statement = { playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0}) then { + if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { [localize "STR_ACE_Overheating_WeaponJammed"] call EFUNC(common,displayTextStructured); GVAR(knowAboutJam) = true; }; diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index f8cea2ddb9..bea2c61ca2 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -2,6 +2,12 @@ + + Display text on jam + + + Display a notification whenever your weapon gets jammed + Spare barrel Ersatzlauf From c7ede12b9974dac51b48c770b5aef560a5a6d9ea Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 9 Mar 2015 19:03:55 +0100 Subject: [PATCH 4/4] Removed weapon select, is now just grenade throw --- addons/weaponselect/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/weaponselect/stringtable.xml b/addons/weaponselect/stringtable.xml index fc678e8820..3a39d59396 100644 --- a/addons/weaponselect/stringtable.xml +++ b/addons/weaponselect/stringtable.xml @@ -3,10 +3,10 @@ - Display text on weapon select + Display text on grenade throw - Display a hint or text on weapon select or grenade throw. + Display a hint or text on grenade throw. Select Pistol