Skip to content

Commit

Permalink
Add status effect
Browse files Browse the repository at this point in the history
  • Loading branch information
DartRuffian committed Oct 30, 2024
1 parent 48f8bbc commit f6585a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions addons/field_rations/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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;

Expand Down
7 changes: 6 additions & 1 deletion addons/field_rations/functions/fnc_update.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit f6585a9

Please sign in to comment.