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

Field Rations - Add setting to disable in Zeus #10462

Merged
merged 8 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
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: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_addType.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Arguments:
* 0: Status Effect Name, this should match a corresponding event name <STRING>
* 1: Send event globally <BOOL>
* 2: Common Effect Reaons to pre-seed durring init <ARRAY>
* 2: Common Effect Reasons to pre-seed during init <ARRAY>
* 3: Send event to JIP (requires sending event globally) <BOOL>
*
* Return Value:
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_get.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Retrives list of current status effects
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
*
* Return Value:
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_localEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: isLocal <BOOL>
*
* Return Value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* None
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_respawnEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Handles the Respawn Event Handler to reset effects.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* None
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_set.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
* 2: Unique Reason ID <STRING>
* 3: Is Set (true adds/false removes) <BOOL>
Expand Down
9 changes: 9 additions & 0 deletions addons/field_rations/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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, [], false, QGVAR(blockUpdates)] call EFUNC(common,statusEffect_addType);

[QGVAR(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;

Expand Down
9 changes: 7 additions & 2 deletions addons/field_rations/functions/fnc_update.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ 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}} ||
{_player getVariable [QGVAR(blockUpdates), false]}
) exitWith {
[LINKFUNC(update), _nextMpSync, 1] call CBA_fnc_waitAndExecute;
QGVAR(hud) cutFadeOut 0.5;
};
Expand Down
9 changes: 9 additions & 0 deletions addons/field_rations/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
1
] call CBA_fnc_addSetting;
6 changes: 6 additions & 0 deletions addons/field_rations/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1282,5 +1282,11 @@
<Chinese>飲用水補給</Chinese>
<Chinesesimp>饮用水补给</Chinesesimp>
</Key>
<Key ID="STR_ACE_Field_Rations_ZeusUpdates_Description">
<English>If enabled, hunger and thirst will continue to increase while the Zeus interface is open.</English>
</Key>
<Key ID="STR_ACE_Field_Rations_ZeusUpdates_DisplayName">
<English>Update Hunger And Thirst In Zeus</English>
DartRuffian marked this conversation as resolved.
Show resolved Hide resolved
</Key>
</Package>
</Project>