private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
while {true} do{
_playerPos = getPosATL player;
_canDrink = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;
_pondPos = [];
_objectsWell = [];
if (!_canDrink) then {
_objectsWell = nearestObjects [_playerPos, [], 4];
{
//Check for Well
_isWell = ["_well",str(_x),false] call fnc_inString;
if (_isWell) then {_canDrink = true};
} forEach _objectsWell;
};
if (!_canDrink) then {
_objectsPond = nearestObjects [_playerPos, [], 50];
{
//Check for pond
_isPond = ["pond",str(_x),false] call fnc_inString;
if (_isPond) then {
_pondPos = (_x worldToModel _playerPos) select 2;
if (_pondPos < 0) then {
_canDrink = true;
};
};
} forEach _objectsPond;
};
if (_canDrink) then {
if (s_player_drinkWater < 0) then {
s_player_drinkWater = player addaction[("Drink"),"drink_water.sqf"];
};
} else {
player removeAction s_player_drinkWater;
s_player_drinkWater = -1;
};
sleep 2;
};