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 - Improve and add setting for needs consequence #10675

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Revert "Improve vehicle water actions"
This reverts commit eb1a282.
mrschick committed Jan 19, 2025
commit a50cb381549064c57c43309a763ba12f8663de69
8 changes: 4 additions & 4 deletions addons/field_rations/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ if !(hasInterface) exitWith {};
};

// Compile water source actions
GVAR(mainAction) = [
private _mainAction = [
QGVAR(waterSource),
LLSTRING(WaterSource),
QPATHTOF(ui\icon_water_tap.paa),
@@ -38,7 +38,7 @@ if !(hasInterface) exitWith {};
[false, false, false, false, true]
] call EFUNC(interact_menu,createAction);

GVAR(subActions) = [
private _subActions = [
[
QGVAR(checkWater),
LLSTRING(CheckWater),
@@ -68,10 +68,10 @@ if !(hasInterface) exitWith {};
];

// Add water source actions to helper
[QGVAR(helper), 0, [], GVAR(mainAction)] call EFUNC(interact_menu,addActionToClass);
[QGVAR(helper), 0, [], _mainAction] call EFUNC(interact_menu,addActionToClass);
{
[QGVAR(helper), 0, [QGVAR(waterSource)], _x] call EFUNC(interact_menu,addActionToClass);
} forEach GVAR(subActions);
} forEach _subActions;

// Add inventory context menu option to consume items
private _eatOrDrinkCondition = [
32 changes: 8 additions & 24 deletions addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf
Original file line number Diff line number Diff line change
@@ -18,9 +18,10 @@

params ["_interactionType"];

// Ignore during self-interaction or when water source actions are disabled
// Ignore when self-interaction, mounted vehicle interaction, or water source actions are disabled
if (
_interactionType != 0
|| {!isNull objectParent ACE_player}
|| {XGVAR(waterSourceActions) == 0}
) exitWith {};

@@ -48,30 +49,13 @@ TRACE_1("Starting interact PFH",_interactionType);

if (_waterRemaining != REFILL_WATER_DISABLED) then {
private _offset = [_x] call FUNC(getActionOffset);
if (_offset isEqualTo [0,0,0]) then {
if !(_x getVariable [QGVAR(waterSourceActionsAdded), false]) then {
private _vehicle = _x;
_vehicle setVariable [QGVAR(waterSource), _vehicle];
_sourcesHelped pushBack _vehicle;
// Add water source actions to the vehicle itself
private _mainAction = [_vehicle, 0, ["ACE_MainActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToObject);
private _selfAction = [_vehicle, 1, ["ACE_SelfActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToObject);
{
[_vehicle, 0, _mainAction, _x] call EFUNC(interact_menu,addActionToObject);
[_vehicle, 1, _selfAction, _x] call EFUNC(interact_menu,addActionToObject);
} forEach GVAR(subActions);
_vehicle setVariable [QGVAR(waterSourceActionsAdded), true];
TRACE_3("Added interaction to vehicle",_x,typeOf _x,_waterRemaining);
};
} else {
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
_helper setVariable [QGVAR(waterSource), _x];
_helper attachTo [_x, _offset];
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
_helper setVariable [QGVAR(waterSource), _x];
_helper attachTo [_x, _offset];

_addedHelpers pushBack _helper;
_sourcesHelped pushBack _x;
TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining);
};
_addedHelpers pushBack _helper;
_sourcesHelped pushBack _x;
TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining);
};
};
} forEach nearestObjects [ACE_player, [], 15];
4 changes: 1 addition & 3 deletions addons/field_rations/functions/fnc_checkWater.sqf
Original file line number Diff line number Diff line change
@@ -34,7 +34,5 @@ params ["_player", "_source"];
};
},
{},
LLSTRING(CheckingWater),
{true},
["isNotInside"]
LLSTRING(CheckingWater)
] call EFUNC(common,progressBar);
3 changes: 1 addition & 2 deletions addons/field_rations/functions/fnc_drinkFromSource.sqf
Original file line number Diff line number Diff line change
@@ -76,6 +76,5 @@ private _progressText = if (isNull _sourceConfig) then {
_fnc_onSuccess,
_fnc_onFailure,
_progressText,
_fnc_condition,
["isNotInside"]
_fnc_condition
] call EFUNC(common,progressBar);
3 changes: 1 addition & 2 deletions addons/field_rations/functions/fnc_refillItem.sqf
Original file line number Diff line number Diff line change
@@ -78,6 +78,5 @@ private _fnc_condition = {
_fnc_onSuccess,
_fnc_onFailure,
LLSTRING(Refilling),
_fnc_condition,
["isNotInside"]
_fnc_condition
] call EFUNC(common,progressBar);