mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +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:
@@ -39,6 +39,7 @@
|
||||
[FIXED] Filling fuel barrels takes the correct amount from fuel tanks now (210 instead of 40 litres). #1834 @schwanzkopfhegel @oiad
|
||||
[FIXED] Base objects duplicating when using "take ownership" on plot pole. #1811 @BNG-Lance @Clanwarfare
|
||||
[FIXED] Unable to sell some launchers like Javelin and Stinger which have the same classname for ammo and weapon. #1844 @ndavalos
|
||||
[FIXED] Long search delay when filling water bottles, drinking from hands and drinking from empty cans on Chernarus. #1835 @schwanzkopfhegel
|
||||
|
||||
[NOTE] The fixes below are included in the 1.0.6 Build C server package released December 29th, 2016 (http://dayzepoch.com/a2dayzepoch.php)
|
||||
[FIXED] Hive child 309 errors that resulted in broken saving of newly built storage object inventory. @icomrade
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
class Land_pumpa: House
|
||||
{
|
||||
class UserActions
|
||||
{
|
||||
class Drink
|
||||
{
|
||||
displayName = $STR_ACTIONS_DRINK2;
|
||||
displayNameDefault = $STR_ACTIONS_DRINK2;
|
||||
priority = 3;
|
||||
radius = 3;
|
||||
position = "";
|
||||
showWindow = 1;
|
||||
onlyForPlayer = 1;
|
||||
shortcut = "";
|
||||
condition = "(['Drink',this] call userActionConditions)";
|
||||
statement = "'hands' spawn player_drinkWater;";
|
||||
};
|
||||
};
|
||||
};
|
||||
39
SQF/dayz_code/Configs/CfgVehicles/Buildings/WaterSources.hpp
Normal file
39
SQF/dayz_code/Configs/CfgVehicles/Buildings/WaterSources.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
class Land_pumpa: House
|
||||
{
|
||||
class UserActions
|
||||
{
|
||||
class Drink
|
||||
{
|
||||
displayName = $STR_ACTIONS_DRINK2;
|
||||
displayNameDefault = $STR_ACTIONS_DRINK2;
|
||||
priority = 3;
|
||||
radius = 3;
|
||||
position = "";
|
||||
showWindow = 1;
|
||||
onlyForPlayer = 1;
|
||||
shortcut = "";
|
||||
condition = "(['Drink',this] call userActionConditions)";
|
||||
statement = "'Land_pumpa' spawn player_drinkWater;";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Land_Barrel_water: Thing
|
||||
{
|
||||
class UserActions
|
||||
{
|
||||
class Drink
|
||||
{
|
||||
displayName = $STR_ACTIONS_DRINK2;
|
||||
displayNameDefault = $STR_ACTIONS_DRINK2;
|
||||
priority = 3;
|
||||
radius = 3;
|
||||
position = "";
|
||||
showWindow = 1;
|
||||
onlyForPlayer = 1;
|
||||
shortcut = "";
|
||||
condition = "(['Drink',this] call userActionConditions)";
|
||||
statement = "'Land_Barrel_water' spawn player_drinkWater;";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -457,6 +457,7 @@ class CfgVehicles {
|
||||
class SpawnableWreck : House {};
|
||||
class Strategic;
|
||||
class NonStrategic;
|
||||
class Thing;
|
||||
// class Land_Fire;
|
||||
class BuiltItems;
|
||||
class Building;
|
||||
@@ -578,7 +579,7 @@ class CfgVehicles {
|
||||
#include "Buildings\Land_telek1.hpp"
|
||||
#include "Buildings\Land_VASICore.hpp"
|
||||
#include "Buildings\Land_Vysilac_FM.hpp"
|
||||
#include "Buildings\Land_pumpa.hpp"
|
||||
#include "Buildings\WaterSources.hpp"
|
||||
|
||||
//Duplicates of Epoch items in DZE\Prop_Defs.hpp
|
||||
//#include "CamoNetting.hpp"
|
||||
|
||||
@@ -1,61 +1,26 @@
|
||||
private ["_playerPos","_canFill","_isPond","_isWell","_pondPos","_objectsWell","_onLadder","_hasbottleitem","_config","_item","_text","_objectsPond","_qty","_dis","_sfx","_isInfected","_bodiesNear","_chance","_itemorignal","_well"];
|
||||
private ["_canFill","_onLadder","_chance","_posASL","_posATL"];
|
||||
|
||||
call gear_ui_init;
|
||||
closeDialog 0;
|
||||
_item = _this;
|
||||
_playerPos = getPosATL player;
|
||||
_canFill = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
|
||||
_isPond = false;
|
||||
_isWell = false;
|
||||
_isInfected = false;
|
||||
_pondPos = [];
|
||||
_objectsWell = [];
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
if (_onLadder) exitWith {localize "str_player_21" call dayz_rollingMessages;};
|
||||
|
||||
_itemorignal = _this;
|
||||
//diag_log(str(_itemorignal));
|
||||
_posASL = getPosASL player;
|
||||
_posATL = ASLtoATL _posASL;
|
||||
|
||||
if (!dayz_isSwimming) then {
|
||||
player playActionNow "PutDown";
|
||||
_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 (!_canFill) then {
|
||||
_objectsWell = nearestObjects [_playerPos, [], 4];
|
||||
{
|
||||
//Check for Well
|
||||
_isWell = ["_well",str(_x),false] call fnc_inString;
|
||||
if (_isWell) then {_canFill = true};
|
||||
} forEach _objectsWell;
|
||||
};
|
||||
|
||||
if (!_canFill) then {
|
||||
_objectsPond = nearestObjects [_playerPos, [], 100];
|
||||
{
|
||||
//Check for pond
|
||||
_isPond = ["pond",str(_x),false] call fnc_inString;
|
||||
//Check for Dead Bodies
|
||||
_bodiesNear = ["dead",str(_x),false] call fnc_inString;
|
||||
if (!_bodiesNear) then {
|
||||
_bodiesNear = ["massgrave",str(_x),false] call fnc_inString;
|
||||
};
|
||||
if (_bodiesNear) then {
|
||||
_isInfected = true;
|
||||
};
|
||||
if (_isPond) then {
|
||||
_pondPos = (_x worldToModel _playerPos) select 2;
|
||||
if (_pondPos < 0) then {
|
||||
_canFill = true;
|
||||
};
|
||||
};
|
||||
} forEach _objectsPond;
|
||||
};
|
||||
|
||||
if (_canFill) then {
|
||||
_chance = 0.1;
|
||||
|
||||
if (_itemorignal in boil_tin_cans) then {
|
||||
if (_canFill select 0) then {
|
||||
if (_this in boil_tin_cans) then {
|
||||
_chance = 0.06;
|
||||
["FoodDrink",0,[0,0,300,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
|
||||
} else {
|
||||
@@ -63,20 +28,22 @@ if (_canFill) then {
|
||||
["FoodDrink",0,[0,0,150,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
|
||||
};
|
||||
|
||||
[player,"drink",0,false,5] call dayz_zombieSpeak;
|
||||
[player,10,true,(getPosATL player)] call player_alertZombies;
|
||||
if (!dayz_isSwimming) then {
|
||||
player playActionNow "PutDown";
|
||||
};
|
||||
|
||||
if(!_isWell) then {
|
||||
if (_isInfected) then {
|
||||
[player,"drink",0,false,5] call dayz_zombieSpeak;
|
||||
[player,10,true,_posATL] call player_alertZombies;
|
||||
|
||||
//Check if water source is infected only for ponds
|
||||
if (dayz_infectiousWaterholes && {_canFill select 1} && {count nearestObjects [_posATL,["Body","Body1","Body2","Mass_grave"],50] > 0}) then {
|
||||
r_player_infected = true;
|
||||
} else {
|
||||
if ([_chance] call fn_chance) then {
|
||||
r_player_infected = true;
|
||||
player setVariable["USEC_infected",true,true];
|
||||
} else {
|
||||
if ([_chance] call fn_chance) then {
|
||||
r_player_infected = true;
|
||||
player setVariable["USEC_infected",true,true];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
localize "str_drinkwithhands" call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "str_player_32" call dayz_rollingMessages;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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
|
||||
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -51,4 +51,4 @@
|
||||
5 sideLogic !"{ \nBIS_MPF_ServerInitDone = true;\ncreatecenter sidelogic;\nBIS_MPF_dummygroup = createGroup sideLogic;" !"{ \nBIS_MPF_ServerInitDone = true;\ncreatecenter sidelogic;\n\n\nBIS_MPF_dummygroup = createGroup sideLogic;"
|
||||
5 switchCamera !"\"switchCamera\", \n\n\n\"fadeMusic\"," !="rswitchCamera = 'switchCamera'" !"rswitchCameracode" !"\"switchCamera\", \"taskHint\"," !="player switchCamera (Dayz_constructionContext select 2);" !="player switchCamera _currentCamera;"
|
||||
5 toString !="_skinToModel = toString (_finalArray);" !="{_textArrayTemp = _textArrayTemp + [tostring [_x]]} foreach _line;" !="_cmpt = toString _cmpt;" !="_objName = toLower(toString(_objName));" !"if (toString _hayArr != _needle) then {" !="_type = toString _typeA;" !="_anim4 = toString _anim4;" !"{(count _stance>17)}) then {toString [_stance select 17]}" !="lbAdd [7102, if (typeName _name == \"ARRAY\") then {toString _name} else {_name}];" !="lbAdd [7002, if (typeName _name == \"ARRAY\") then {toString _name} else {_name}];" !"if (isnil 'BIS_fnc_timeToString' || false) then {"
|
||||
5 worldTo !"ect 1;\n_inside = false;\n_offset = 1; \n\n_relPos = _building worldToModel _point;\n_boundingBox = boundingBox _building;\n\n_min = _" !"\n\n_new = getPosATL _obj;\n\nif (_isPlayer) then {\n_x = _pos worldToModel _new;\n_dir = _dir + (if ((_x select 1)==0) then { 0 } else" !"_pondPos = (_x worldToModel _playerPos) select 2;\n" !"ts [_new, [], 100];\n{\nif (((typeOf(_x) == \"\")\nAND {((((_x worldToModel _new) select 2) < 0))\nAND {([_x, _new] call _checkPerimete" !"t = _this select 1;\n_inside = false;\n\n_relPos = _building worldToModel _point;\n_boundingBox = boundingBox _building;\n\n_min = _bou" !"fascl,getDir _x,\"\",1];if(_fash==_forEachIndex)then{_fapos2D=worldtoscreen _fapos;if(count _fapos2D>=2)then{_fasp ctrlsetposition" !"_pondPos = (_x worldToModel _playerPos) select 2;\nif (_pondPos < 0) then {\n_canFill" !"_w2m = _x worldToModel (getPosATL player);\n_bb = (boundingbox _x) select 1;" !"_bn == 1) then { \n_bb = boundingBox _o;\n_h = _offset + ((_o worldToModel (getPosATL _o)) select 2);\n_p = [ (_bb select 0) select" !"if (_distance > 1 && _distance < 2500) then {\n_pos set [2,(_pos select 2) + 1.5];\n_screen = worldToScreen _pos;\n_text = composeText [image"
|
||||
5 worldTo !"ect 1;\n_inside = false;\n_offset = 1; \n\n_relPos = _building worldToModel _point;\n_boundingBox = boundingBox _building;\n\n_min = _" !"\n\n_new = getPosATL _obj;\n\nif (_isPlayer) then {\n_x = _pos worldToModel _new;\n_dir = _dir + (if ((_x select 1)==0) then { 0 } else" !"ts [_new, [], 100];\n{\nif (((typeOf(_x) == \"\")\nAND {((((_x worldToModel _new) select 2) < 0))\nAND {([_x, _new] call _checkPerimete" !"t = _this select 1;\n_inside = false;\n\n_relPos = _building worldToModel _point;\n_boundingBox = boundingBox _building;\n\n_min = _bou" !"fascl,getDir _x,\"\",1];if(_fash==_forEachIndex)then{_fapos2D=worldtoscreen _fapos;if(count _fapos2D>=2)then{_fasp ctrlsetposition" !"_w2m = _x worldToModel (getPosATL player);\n_bb = (boundingbox _x) select 1;" !"_bn == 1) then { \n_bb = boundingBox _o;\n_h = _offset + ((_o worldToModel (getPosATL _o)) select 2);\n_p = [ (_bb select 0) select" !"if (_distance > 1 && _distance < 2500) then {\n_pos set [2,(_pos select 2) + 1.5];\n_screen = worldToScreen _pos;\n_text = composeText [image"
|
||||
Reference in New Issue
Block a user