diff --git a/addons/field_rations/XEH_postInit.sqf b/addons/field_rations/XEH_postInit.sqf
index 9fc8406abaf..d11c4b44501 100644
--- a/addons/field_rations/XEH_postInit.sqf
+++ b/addons/field_rations/XEH_postInit.sqf
@@ -6,6 +6,8 @@ if !(hasInterface) exitWith {};
// Exit if not enabled
if (!XGVAR(enabled)) exitWith {};
+ XGVAR(lastUnconEvent) = 0;
+
// Add Advanced Fatigue duty factor
if (XGVAR(affectAdvancedFatigue) && {missionNamespace getVariable [QEGVAR(advanced_fatigue,enabled), false]}) then {
[QUOTE(ADDON), {
@@ -15,7 +17,7 @@ if !(hasInterface) exitWith {};
};
// Compile water source actions
- private _mainAction = [
+ GVAR(mainAction) = [
QGVAR(waterSource),
LLSTRING(WaterSource),
QPATHTOF(ui\icon_water_tap.paa),
@@ -38,7 +40,7 @@ if !(hasInterface) exitWith {};
[false, false, false, false, true]
] call EFUNC(interact_menu,createAction);
- private _subActions = [
+ GVAR(subActions) = [
[
QGVAR(checkWater),
LLSTRING(CheckWater),
@@ -68,10 +70,10 @@ if !(hasInterface) exitWith {};
];
// Add water source actions to helper
- [QGVAR(helper), 0, [], _mainAction] call EFUNC(interact_menu,addActionToClass);
+ [QGVAR(helper), 0, [], GVAR(mainAction)] call EFUNC(interact_menu,addActionToClass);
{
[QGVAR(helper), 0, [QGVAR(waterSource)], _x] call EFUNC(interact_menu,addActionToClass);
- } forEach _subActions;
+ } forEach GVAR(subActions);
// Add inventory context menu option to consume items
["ACE_ItemCore", ["CONTAINER"], LSTRING(EatDrink), [], QPATHTOF(ui\icon_survival.paa),
diff --git a/addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf b/addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf
index d45ea877ca0..52e1254f0f8 100644
--- a/addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf
+++ b/addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf
@@ -18,10 +18,9 @@
params ["_interactionType"];
-// Ignore when self-interaction, mounted vehicle interaction, or water source actions are disabled
+// Ignore during self-interaction or when water source actions are disabled
if (
_interactionType != 0
- || {vehicle ACE_player != ACE_player}
|| {XGVAR(waterSourceActions) == 0}
) exitWith {};
@@ -49,13 +48,30 @@ TRACE_1("Starting interact PFH",_interactionType);
if (_waterRemaining != REFILL_WATER_DISABLED) then {
private _offset = [_x] call FUNC(getActionOffset);
- private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
- _helper setVariable [QGVAR(waterSource), _x];
- _helper attachTo [_x, _offset];
+ 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];
- _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];
diff --git a/addons/field_rations/functions/fnc_checkWater.sqf b/addons/field_rations/functions/fnc_checkWater.sqf
index 32167e61140..12a831a627b 100644
--- a/addons/field_rations/functions/fnc_checkWater.sqf
+++ b/addons/field_rations/functions/fnc_checkWater.sqf
@@ -34,5 +34,7 @@ params ["_player", "_source"];
};
},
{},
- LLSTRING(CheckingWater)
+ LLSTRING(CheckingWater),
+ {true},
+ ["isNotInside"]
] call EFUNC(common,progressBar);
diff --git a/addons/field_rations/functions/fnc_drinkFromSource.sqf b/addons/field_rations/functions/fnc_drinkFromSource.sqf
index cf0d18018b1..6199eaee7bc 100644
--- a/addons/field_rations/functions/fnc_drinkFromSource.sqf
+++ b/addons/field_rations/functions/fnc_drinkFromSource.sqf
@@ -76,5 +76,6 @@ private _progressText = if (isNull _sourceConfig) then {
_fnc_onSuccess,
_fnc_onFailure,
_progressText,
- _fnc_condition
+ _fnc_condition,
+ ["isNotInside"]
] call EFUNC(common,progressBar);
diff --git a/addons/field_rations/functions/fnc_handleEffects.sqf b/addons/field_rations/functions/fnc_handleEffects.sqf
index ad60a743ad0..6fb6468b919 100644
--- a/addons/field_rations/functions/fnc_handleEffects.sqf
+++ b/addons/field_rations/functions/fnc_handleEffects.sqf
@@ -27,12 +27,31 @@ if ((_thirst > 99.9 || {_hunger > 99.9}) && {random 1 < 0.5}) exitWith {
// Exit if unit is not awake, below are animation based consequences
if !(_player call EFUNC(common,isAwake)) exitWith {};
-// Set unit unconscious (chance based on how high thirst/hunger are)
+// Make unit moan from high hunger/thirst
if (
GETEGVAR(medical,enabled,false) &&
- {(_thirst > 85 || {_hunger > 85}) && {random 1 < linearConversion [85, 100, _thirst max _hunger, 0.05, 0.1, true]}}
+ {(_thirst > 70) || {_hunger > 70}} &&
+ {random 1 < linearConversion [70, 100, _thirst max _hunger, 0.05, 0.2, true]}
+) then {
+ [ACE_Player, "moan", round (linearConversion [70, 90, _thirst max _hunger, 0, 2, true])] call EFUNC(medical_feedback,playInjuredSound);
+};
+
+// Trigger high thirst/hunger consequence
+if (
+ GETEGVAR(medical,enabled,false) &&
+ {(_thirst > 85 || {_hunger > 85})} &&
+ {random 1 < linearConversion [85, 100, _thirst max _hunger, 0.05, 0.1, true]}
) exitWith {
- [_player, true, 5, true] call EFUNC(medical,setUnconscious);
+ if (XGVAR(nearDepletedConsequence) == 1) then { // Set unit unconscious with a 45s cooldown
+ if (CBA_missionTime - XGVAR(lastUnconEvent) > 45) then {
+ [_player, true, 5, true] call EFUNC(medical,setUnconscious);
+ XGVAR(lastUnconEvent) = CBA_missionTime;
+ };
+ } else { // Add pain
+ if (ACE_Player getVariable [QEGVAR(medical,pain), 0] < 0.1) then {
+ [ACE_Player, 0.1] call ace_medical_fnc_adjustPainLevel;
+ };
+ };
};
// Make unit fall if moving fast
diff --git a/addons/field_rations/functions/fnc_refillItem.sqf b/addons/field_rations/functions/fnc_refillItem.sqf
index 91542e60b42..7e34ea1228e 100644
--- a/addons/field_rations/functions/fnc_refillItem.sqf
+++ b/addons/field_rations/functions/fnc_refillItem.sqf
@@ -78,5 +78,6 @@ private _fnc_condition = {
_fnc_onSuccess,
_fnc_onFailure,
LLSTRING(Refilling),
- _fnc_condition
+ _fnc_condition,
+ ["isNotInside"]
] call EFUNC(common,progressBar);
diff --git a/addons/field_rations/initSettings.inc.sqf b/addons/field_rations/initSettings.inc.sqf
index 16e2d4eb2d6..173d5aec161 100644
--- a/addons/field_rations/initSettings.inc.sqf
+++ b/addons/field_rations/initSettings.inc.sqf
@@ -45,6 +45,15 @@
true
] call CBA_fnc_addSetting;
+[
+ QXGVAR(nearDepletedConsequence),
+ "LIST",
+ [LSTRING(NearDepletedConsequence_DisplayName), LSTRING(NearDepletedConsequence_Description)],
+ LSTRING(DisplayName),
+ [[0, 1], [LSTRING(NearDepletedConsequence_Pain), LSTRING(NearDepletedConsequence_Unconsciousness)], 1],
+ true
+] call CBA_fnc_addSetting;
+
[
QXGVAR(waterSourceActions),
"LIST",
diff --git a/addons/field_rations/stringtable.xml b/addons/field_rations/stringtable.xml
index 2b443ccc3c0..180dcd80b42 100644
--- a/addons/field_rations/stringtable.xml
+++ b/addons/field_rations/stringtable.xml
@@ -115,6 +115,21 @@
Tiempo sin agua
Susuz Kalma Süresi
+
+ Consequence of extreme thirst/hunger
+ Folge von extremen Durst/Hunger
+ Conseguenze di sete/fame estrema
+
+
+ Pain
+ Schmerzen
+ Dolore
+
+
+ Fainting
+ Ohnmacht
+ Svenimenti
+
How long should a person be able to go without water (hours).
一個單位脫水之前能支撐多久(單位為小時)。