From 5348a5d2ae18c3dae0bcbbc0d07989f36d09274b Mon Sep 17 00:00:00 2001 From: DartRuffian Date: Tue, 29 Oct 2024 23:53:10 -0500 Subject: [PATCH 1/8] Add setting to disable hunger/thirst updates in Zeus --- addons/field_rations/functions/fnc_update.sqf | 4 ++-- addons/field_rations/initSettings.inc.sqf | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/field_rations/functions/fnc_update.sqf b/addons/field_rations/functions/fnc_update.sqf index 762af12d883..8f66cb193b2 100644 --- a/addons/field_rations/functions/fnc_update.sqf +++ b/addons/field_rations/functions/fnc_update.sqf @@ -23,8 +23,8 @@ params ["_nextMpSync"]; // Access global variable once private _player = ACE_player; -// Exit if player is not alive or a virtual unit -if (!alive _player || {_player isKindOf "VirtualMan_F"}) exitWith { +// Exit if player is not alive, a virtual unit, or is in Zeus interface (if setting is enabled) +if (!alive _player || {_player isKindOf "VirtualMan_F"} || {!GVAR(zeusUpdates) && {!isNull findDisplay 312}}) exitWith { [LINKFUNC(update), _nextMpSync, 1] call CBA_fnc_waitAndExecute; QGVAR(hud) cutFadeOut 0.5; }; diff --git a/addons/field_rations/initSettings.inc.sqf b/addons/field_rations/initSettings.inc.sqf index 16e2d4eb2d6..422cdc74c1e 100644 --- a/addons/field_rations/initSettings.inc.sqf +++ b/addons/field_rations/initSettings.inc.sqf @@ -101,3 +101,12 @@ [[-1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], [LSTRING(Dynamic), "0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", 0], 0], false ] call CBA_fnc_addSetting; + +[ + QGVAR(zeusUpdates), + "CHECKBOX", + [LSTRING(ZeusUpdates_DisplayName), LSTRING(ZeusUpdates_Description)], + LSTRING(DisplayName), + false, + true +] call CBA_fnc_addSetting; From 5879d21db251c740d0b632732805496d01c174ef Mon Sep 17 00:00:00 2001 From: DartRuffian Date: Wed, 30 Oct 2024 00:17:30 -0500 Subject: [PATCH 2/8] Add status effect --- addons/field_rations/XEH_postInit.sqf | 9 +++++++++ addons/field_rations/functions/fnc_update.sqf | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/field_rations/XEH_postInit.sqf b/addons/field_rations/XEH_postInit.sqf index ee921c5139a..382065063e4 100644 --- a/addons/field_rations/XEH_postInit.sqf +++ b/addons/field_rations/XEH_postInit.sqf @@ -138,6 +138,15 @@ if !(hasInterface) exitWith {}; // Add respawn eventhandler to reset necessary variables, done through script so only added if field rations is enabled ["CAManBase", "respawn", LINKFUNC(handleRespawn)] call CBA_fnc_addClassEventHandler; + // Add status effect to block hunger/thirst updates + ["field_rations_blockUpdates", false, []] call EFUNC(common,statusEffect_addType); + + [QEGVAR(common,field_rations_blockUpdates), { + params ["_object", "_set"]; + TRACE_2("blockUpdates EH",_object,_set); + _object setVariable [QGVAR(blockUpdates), _set > 0]; + }] call CBA_fnc_addEventHandler; + // Start update loop [LINKFUNC(update), CBA_missionTime + MP_SYNC_INTERVAL, 1] call CBA_fnc_waitAndExecute; diff --git a/addons/field_rations/functions/fnc_update.sqf b/addons/field_rations/functions/fnc_update.sqf index 8f66cb193b2..cd757237494 100644 --- a/addons/field_rations/functions/fnc_update.sqf +++ b/addons/field_rations/functions/fnc_update.sqf @@ -24,7 +24,12 @@ params ["_nextMpSync"]; private _player = ACE_player; // Exit if player is not alive, a virtual unit, or is in Zeus interface (if setting is enabled) -if (!alive _player || {_player isKindOf "VirtualMan_F"} || {!GVAR(zeusUpdates) && {!isNull findDisplay 312}}) exitWith { +if ( + !alive _player || + {_player isKindOf "VirtualMan_F"} || + {!GVAR(zeusUpdates) && {!isNull findDisplay 312}} || + {_player getVariable [QGVAR(blockUpdates), false]} +) exitWith { [LINKFUNC(update), _nextMpSync, 1] call CBA_fnc_waitAndExecute; QGVAR(hud) cutFadeOut 0.5; }; From 3a4ff93df038268395beda7f8cc3c70423d28d54 Mon Sep 17 00:00:00 2001 From: DartRuffian Date: Wed, 30 Oct 2024 00:17:47 -0500 Subject: [PATCH 3/8] Fix typos in status effect functions --- addons/common/functions/fnc_statusEffect_addType.sqf | 2 +- addons/common/functions/fnc_statusEffect_get.sqf | 2 +- addons/common/functions/fnc_statusEffect_localEH.sqf | 2 +- addons/common/functions/fnc_statusEffect_resetVariables.sqf | 2 +- addons/common/functions/fnc_statusEffect_respawnEH.sqf | 2 +- addons/common/functions/fnc_statusEffect_set.sqf | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_statusEffect_addType.sqf b/addons/common/functions/fnc_statusEffect_addType.sqf index 5535b0d9145..548c309e393 100644 --- a/addons/common/functions/fnc_statusEffect_addType.sqf +++ b/addons/common/functions/fnc_statusEffect_addType.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Status Effect Name, this should match a corresponding event name * 1: Send event globally - * 2: Common Effect Reaons to pre-seed durring init + * 2: Common Effect Reasons to pre-seed during init * 3: Send event to JIP (requires sending event globally) * * Return Value: diff --git a/addons/common/functions/fnc_statusEffect_get.sqf b/addons/common/functions/fnc_statusEffect_get.sqf index e7b2a19b289..a1bbbdebaca 100644 --- a/addons/common/functions/fnc_statusEffect_get.sqf +++ b/addons/common/functions/fnc_statusEffect_get.sqf @@ -4,7 +4,7 @@ * Retrives list of current status effects * * Arguments: - * 0: vehicle that it will be attached to (player or vehicle) + * 0: Vehicle that it will be attached to (player or vehicle) * 1: Effect Name * * Return Value: diff --git a/addons/common/functions/fnc_statusEffect_localEH.sqf b/addons/common/functions/fnc_statusEffect_localEH.sqf index e60679350d0..8d7f3679c04 100644 --- a/addons/common/functions/fnc_statusEffect_localEH.sqf +++ b/addons/common/functions/fnc_statusEffect_localEH.sqf @@ -4,7 +4,7 @@ * Handles locality switch, runs a respawn check and then reapplies all effect events. * * Arguments: - * 0: vehicle that it will be attached to (player or vehicle) + * 0: Vehicle that it will be attached to (player or vehicle) * 1: isLocal * * Return Value: diff --git a/addons/common/functions/fnc_statusEffect_resetVariables.sqf b/addons/common/functions/fnc_statusEffect_resetVariables.sqf index a9b6853b9f8..9825bc2e6c9 100644 --- a/addons/common/functions/fnc_statusEffect_resetVariables.sqf +++ b/addons/common/functions/fnc_statusEffect_resetVariables.sqf @@ -4,7 +4,7 @@ * Resets all effect numbers to 0 when an object respawns (but does not apply the effect event). * * Arguments: - * 0: vehicle that it will be attached to (player or vehicle) + * 0: Vehicle that it will be attached to (player or vehicle) * * Return Value: * None diff --git a/addons/common/functions/fnc_statusEffect_respawnEH.sqf b/addons/common/functions/fnc_statusEffect_respawnEH.sqf index edad032a9aa..71be834af6b 100644 --- a/addons/common/functions/fnc_statusEffect_respawnEH.sqf +++ b/addons/common/functions/fnc_statusEffect_respawnEH.sqf @@ -4,7 +4,7 @@ * Handles the Respawn Event Handler to reset effects. * * Arguments: - * 0: vehicle that it will be attached to (player or vehicle) + * 0: Vehicle that it will be attached to (player or vehicle) * * Return Value: * None diff --git a/addons/common/functions/fnc_statusEffect_set.sqf b/addons/common/functions/fnc_statusEffect_set.sqf index a4bf352a565..adc5ff87495 100644 --- a/addons/common/functions/fnc_statusEffect_set.sqf +++ b/addons/common/functions/fnc_statusEffect_set.sqf @@ -4,7 +4,7 @@ * Adds or removes an id to a status effect and will send an event to apply. * * Arguments: - * 0: vehicle that it will be attached to (player or vehicle) + * 0: Vehicle that it will be attached to (player or vehicle) * 1: Effect Name * 2: Unique Reason ID * 3: Is Set (true adds/false removes) From f4365a1110f4a47ca7780f1948a47851e97571d0 Mon Sep 17 00:00:00 2001 From: DartRuffian Date: Fri, 15 Nov 2024 08:16:13 -0600 Subject: [PATCH 4/8] Re-add stringtable entries --- addons/field_rations/stringtable.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/field_rations/stringtable.xml b/addons/field_rations/stringtable.xml index 166e3d5ed38..628e0086f57 100644 --- a/addons/field_rations/stringtable.xml +++ b/addons/field_rations/stringtable.xml @@ -1282,5 +1282,11 @@ 飲用水補給 饮用水补给 + + If enabled, players will need to eat and drink while in Zeus. + + + Update Hunger And Thirst In Zeus + From 689b91e2efafcc8570cbd6711fbb0da7d3472d08 Mon Sep 17 00:00:00 2001 From: Dart <59131299+DartRuffian@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:16:09 -0600 Subject: [PATCH 5/8] Update event name --- addons/field_rations/XEH_postInit.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/field_rations/XEH_postInit.sqf b/addons/field_rations/XEH_postInit.sqf index 382065063e4..04fcdf0e75f 100644 --- a/addons/field_rations/XEH_postInit.sqf +++ b/addons/field_rations/XEH_postInit.sqf @@ -139,9 +139,9 @@ if !(hasInterface) exitWith {}; ["CAManBase", "respawn", LINKFUNC(handleRespawn)] call CBA_fnc_addClassEventHandler; // Add status effect to block hunger/thirst updates - ["field_rations_blockUpdates", false, []] call EFUNC(common,statusEffect_addType); + ["field_rations_blockUpdates", false, [], false, QGVAR(blockUpdates)] call EFUNC(common,statusEffect_addType); - [QEGVAR(common,field_rations_blockUpdates), { + [QGVAR(blockUpdates), { params ["_object", "_set"]; TRACE_2("blockUpdates EH",_object,_set); _object setVariable [QGVAR(blockUpdates), _set > 0]; From bfa5bdc913bebabddc3a61f294cedfd5ee82ce21 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:45:10 -0300 Subject: [PATCH 6/8] Update addons/field_rations/initSettings.inc.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/field_rations/initSettings.inc.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/field_rations/initSettings.inc.sqf b/addons/field_rations/initSettings.inc.sqf index 422cdc74c1e..82d9f6243f6 100644 --- a/addons/field_rations/initSettings.inc.sqf +++ b/addons/field_rations/initSettings.inc.sqf @@ -108,5 +108,5 @@ [LSTRING(ZeusUpdates_DisplayName), LSTRING(ZeusUpdates_Description)], LSTRING(DisplayName), false, - true + 1 ] call CBA_fnc_addSetting; From a47e76acd744434de450298ebd3eaae80b9593e2 Mon Sep 17 00:00:00 2001 From: Dart <59131299+DartRuffian@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:54:00 -0600 Subject: [PATCH 7/8] Update setting description Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/field_rations/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/field_rations/stringtable.xml b/addons/field_rations/stringtable.xml index 628e0086f57..c8ba9bfdd16 100644 --- a/addons/field_rations/stringtable.xml +++ b/addons/field_rations/stringtable.xml @@ -1283,7 +1283,7 @@ 饮用水补给 - If enabled, players will need to eat and drink while in Zeus. + If enabled, hunger and thirst will continue to increase while the Zeus interface is open. Update Hunger And Thirst In Zeus From fe34a585fdfc8553714fab7f61426d8811150089 Mon Sep 17 00:00:00 2001 From: Dart <59131299+DartRuffian@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:19:43 -0600 Subject: [PATCH 8/8] Update addons/field_rations/stringtable.xml Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/field_rations/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/field_rations/stringtable.xml b/addons/field_rations/stringtable.xml index c8ba9bfdd16..e3d1e572985 100644 --- a/addons/field_rations/stringtable.xml +++ b/addons/field_rations/stringtable.xml @@ -1286,7 +1286,7 @@ If enabled, hunger and thirst will continue to increase while the Zeus interface is open. - Update Hunger And Thirst In Zeus + Update Hunger and Thirst in Zeus