mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-04-17 09:53:21 +03:00
Use waterHoleProxy in drink water and fill water #1835
The slow searches are needed on other maps until waterHoleProxy objects are added for them. They need to be added at every pond and non-"Land_pumpa" well. Right now Chernarus is the only map that has them placed. Fixes #1835 Fixes #1841
This commit is contained in:
@@ -1,67 +1,31 @@
|
||||
#include "\z\addons\dayz_code\util\player.hpp"
|
||||
|
||||
private ["_water","_filled","_canFill","_infected","_well"];
|
||||
private ["_canFill","_water","_filled","_posASL","_posATL"];
|
||||
|
||||
call gear_ui_init;
|
||||
closeDialog 0;
|
||||
|
||||
if Player_IsOnLadder() exitWith { (localize "str_player_21") call dayz_rollingMessages; };
|
||||
|
||||
_water = call
|
||||
{
|
||||
private ["_canFill", "_infected"];
|
||||
|
||||
_canFill = count nearestObjects [player, ["Land_pumpa","Land_water_tank","Land_Barrel_water"], 4] > 0;
|
||||
|
||||
if (_canFill) exitWith { "safe" };
|
||||
|
||||
//Check for wells
|
||||
{
|
||||
if (["_well", str _x, false] call fnc_inString) exitWith
|
||||
{
|
||||
_canFill = true;
|
||||
};
|
||||
}
|
||||
foreach nearestObjects [player, [], 4];
|
||||
|
||||
if (_canFill) exitWith { "safe" };
|
||||
|
||||
_infected = false;
|
||||
|
||||
//Check for ponds and corpses
|
||||
{
|
||||
if (!_canFill) then
|
||||
{
|
||||
if (["pond", str _x, false] call fnc_inString && {((getPosASL player) select 2) < ((GetPosASL _x) select 2)}) then
|
||||
{
|
||||
_canFill = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (!_infected) then
|
||||
{
|
||||
if (["dead", str _x, false] call fnc_inString || {["massgrave", str _x, false] call fnc_inString}) then
|
||||
{
|
||||
_infected = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_canFill && {_infected}) exitWith {};
|
||||
}
|
||||
foreach nearestObjects [player, [], 50];
|
||||
|
||||
if (!_canFill) exitWith { nil };
|
||||
|
||||
if (_infected) exitWith { "infected" };
|
||||
|
||||
""
|
||||
_posASL = getPosASL player;
|
||||
_posATL = ASLtoATL _posASL;
|
||||
|
||||
_canFill = switch true do {
|
||||
//Return: [nearWaterHole, isPond]
|
||||
case (count nearestObjects [_posATL,["Land_pumpa","Land_Barrel_water"],4] > 0): {[true,false]}; //"Land_water_tank" has no spout or opening, doesn't make sense to include
|
||||
case (toLower worldName == "chernarus"): {(call fn_nearWaterHole)};
|
||||
//Slow searches for maps without waterHoleProxy objects added yet
|
||||
case ({["_well",str _x] call fnc_inString} count nearestObjects [_posATL,[],4] > 0): {[true,false]};
|
||||
case ({["pond",str _x] call fnc_inString && {_posASL select 2 < ((getPosASL _x) select 2)}} count nearestObjects [player,[],50] > 0): {[true,true]};
|
||||
default {[false,false]};
|
||||
};
|
||||
|
||||
if (isNil "_water") exitWith
|
||||
{
|
||||
(localize "str_player_20") call dayz_rollingMessages;
|
||||
if !(_canFill select 0) exitWith {
|
||||
localize "str_player_20" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
//Check if water source is infected only for ponds
|
||||
_water = if (dayz_infectiousWaterholes && {_canFill select 1} && {count nearestObjects [_posATL,["Body","Body1","Body2","Mass_grave"],50] > 0}) then {"infected"} else {"safe"};
|
||||
_water = "containerwater" + _water;
|
||||
_filled = 0;
|
||||
|
||||
@@ -74,9 +38,6 @@ _filled = 0;
|
||||
{
|
||||
player playActionNow "PutDown";
|
||||
};
|
||||
|
||||
[player, "fillwater", 0, false, 5] call dayz_zombieSpeak;
|
||||
[player, 5, true, getPosATL player] call player_alertZombies;
|
||||
};
|
||||
|
||||
_filled = _filled + 1;
|
||||
@@ -87,6 +48,10 @@ _filled = 0;
|
||||
}
|
||||
foreach magazines player;
|
||||
|
||||
if (_filled > 0)
|
||||
then { (format [localize "str_player_01", _filled]) call dayz_rollingMessages; }
|
||||
else { (localize "str_player_02") call dayz_rollingMessages; };
|
||||
if (_filled > 0) then {
|
||||
[player, "fillwater", 0, false, 5] call dayz_zombieSpeak;
|
||||
[player, 5, true, _posATL] call player_alertZombies;
|
||||
format [localize "str_player_01", _filled] call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "str_player_02" call dayz_rollingMessages;
|
||||
};
|
||||
Reference in New Issue
Block a user