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:
ebaydayz
2017-01-01 16:55:00 -05:00
parent 30f1827509
commit e4aeee37fd
10 changed files with 102 additions and 146 deletions

View File

@@ -1,6 +1,6 @@
private ["_bb","_dir","_nearWaterHole","_w2m"];
private ["_bb","_dir","_nearWaterHole","_pond","_well","_w2m"];
_nearWaterHole = false;
_nearWaterHole = [false,false];
{
{
@@ -12,13 +12,15 @@ _nearWaterHole = false;
_dir = _dir - 360;
};
if ((abs _dir < 45 && {_x distance player < 2.22}) // wells, kasna, pumpa
or {("" == typeOf _x && (_w2m select 2 < 0.05)) && {(abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1))}}) exitWith { // ponds
_nearWaterHole = true;
_well = (abs _dir < 45 && {_x distance player < 2.22}); // wells, kasna, pumpa
_pond = (("" == typeOf _x && (_w2m select 2 < 0.05)) && {(abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1))});
if (_well or _pond) exitWith {
_nearWaterHole = [true,_pond];
};
} count (nearestObjects [_x, [], 1]);
if (_nearWaterHole) exitWith {};
if (_nearWaterHole select 0) exitWith {};
} forEach (nearestObjects [player, ["waterHoleProxy"], 50]);
_nearWaterHole

View File

@@ -99,9 +99,9 @@ if ((_primaryWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {_inVe
/*
//FPS killer. Moved to CfgVehicles for Land_pumpa
if (_canDo && !_inVehicle && !dayz_isSwimming && (call fn_nearWaterHole)) then {
if (_canDo && !_inVehicle && !dayz_isSwimming && ((call fn_nearWaterHole) select 0)) then {
if (s_player_Drinkfromhands < 0) then {
s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf","hands", 0.5, false, true];
};
} else {
if (s_player_Drinkfromhands >= 0) then {

View File

@@ -34,7 +34,7 @@ if (isNil "keyboard_keys") then {
dayz_autoRunThread = [] spawn {
while {dayz_autoRun} do {
// SurfaceIsWater does not work for ponds
if (player != vehicle player or (surfaceIsWater getPosASL player) or (call fn_nearWaterHole) or r_fracture_legs) exitWith {
if (player != vehicle player or (surfaceIsWater getPosASL player) or ((call fn_nearWaterHole) select 0) or r_fracture_legs) exitWith {
call dayz_autoRunOff;
};
player playAction "FastF";