From d63f48af85a5608d65b87245d25b1e6d0f476d9d Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Mon, 25 Apr 2016 21:53:24 -0400 Subject: [PATCH] Fix pond detection in player_goFishing Fixes #1678 Fixed for vanilla too: https://github.com/DayZMod/DayZ/commit/8a18fe957c1de25c39628bfb4589e0d41e39fd34 Ponds and lakes were not being detected at all, neither on foot nor in a boat. Tested land (failure), pond, lake and shore both on foot and in a boat. Working as intended now. --- CHANGE LOG 1.0.6.txt | 1 + .../Category/FriendlyCookedMeats.hpp | 6 ++-- SQF/dayz_code/actions/player_goFishing.sqf | 33 +++++++------------ 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 5162d25f6..438019729 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -79,6 +79,7 @@ [FIXED] DZE_BuildingLimit now counts buildables only instead of all object types. Thanks jOoPs @ebaydayz [FIXED] Reworked death messages. Fixed messages not always showing, undefined errors and wrong distance bug. Added bled out, killed by zombie, etc. MPHit event handler (fnc_plyrHit) is no longer needed. @ebaydayz [FIXED] Player no longer hears radiation sound when changing clothes. @ebaydayz +[FIXED] Ponds and lakes are now detected correctly in player_goFishing. #1678 @ebaydayz [UPDATED] .hpp files updated in dayz_epoch_b CfgLootPos > CfgBuildingPos. @Uro1 [UPDATED] .bat files updated in Config-Examples @Raziel23x diff --git a/SQF/dayz_code/Configs/CfgServerTrader/Category/FriendlyCookedMeats.hpp b/SQF/dayz_code/Configs/CfgServerTrader/Category/FriendlyCookedMeats.hpp index 828488b63..db348f95e 100644 --- a/SQF/dayz_code/Configs/CfgServerTrader/Category/FriendlyCookedMeats.hpp +++ b/SQF/dayz_code/Configs/CfgServerTrader/Category/FriendlyCookedMeats.hpp @@ -29,17 +29,17 @@ class Category_630 { buy[] = {2,"ItemSilverBar10oz"}; sell[] = {1,"ItemSilverBar10oz"}; }; - class FishCookedTrout { + class FishCookedTrout { // most common type = "trade_items"; buy[] = {2,"ItemGoldBar"}; sell[] = {1,"ItemSilverBar10oz"}; }; - class FishCookedSeaBass { + class FishCookedSeaBass { // less common type = "trade_items"; buy[] = {3,"ItemGoldBar"}; sell[] = {2,"ItemSilverBar10oz"}; }; - class FishCookedTuna { + class FishCookedTuna { // rarest type = "trade_items"; buy[] = {4,"ItemGoldBar"}; sell[] = {1,"ItemGoldBar"}; diff --git a/SQF/dayz_code/actions/player_goFishing.sqf b/SQF/dayz_code/actions/player_goFishing.sqf index b398356fc..71448a545 100644 --- a/SQF/dayz_code/actions/player_goFishing.sqf +++ b/SQF/dayz_code/actions/player_goFishing.sqf @@ -22,10 +22,18 @@ _linecastmax = 67; _isOk = false; _inBoat = (player != vehicle player) && {(vehicle player) isKindOf "Ship"}; +_ispond = false; +{ + if (["pond", str _x] call fnc_inString && {((getPosASL player) select 2 < ((getPosASL _x) select 2)) or _inBoat}) exitWith { + _ispond = true; + _num = ceil (random (player distance _x)); + }; +} count nearestObjects [player, [], 50]; + for "_i" from 1 to 10 do { - _num = floor(random (2 * _linecastmax / 3) + _linecastmax / 3); + if (!_ispond) then {_num = floor(random (2 * _linecastmax / 3) + _linecastmax / 3);}; _position = if (_inBoat) then { (vehicle player) modeltoworld [-_num, 0 ,0] } else { player modeltoworld [0,_num,0] }; - _elevation = _position select 2; + //_elevation = _position select 2; /* _position set [ 2, 1 ]; _position = ASLToATL _position; @@ -36,25 +44,8 @@ for "_i" from 1 to 10 do { else { tutu setPosATL _position; }; - */ - _ispond = if (_elevation < 0.5 or surfaceIsWater _position) then { false } else { // riverbed must be at 0.5 m depth at least - private [ "_ret","_bb","_w2m" ]; - _position set [ 2, _elevation - 0.5 ]; - _ret = false; - { - { - _w2m = _x worldToModel _position; - _bb = (boundingbox _x) select 1; - _linecastmax = _linecastmax min ((_bb select 0) min (_bb select 1)); - //_dir = [player, _x] call BIS_fnc_relativeDirTo; if (_dir > 180) then {_dir = _dir - 360}; - if ((("" == typeOf _x) and ((_w2m select 2) < 0.5)) and {((abs(_w2m select 0) < (_bb select 0)) and (abs(_w2m select 1) < (_bb select 1)))}) exitWith { // ponds - _ret = true; - }; - } count (nearestObjects [_x, [], 2]); // find ponds - if (_ret) exitWith {}; - } forEach nearestObjects [_position, ["waterHoleProxy"], 45]; // find waterholeproxy close to pond centers - _ret - }; + */ + // diag_log [ _position, _elevation, surfaceIsWater _position, _linecastmax, _ispond, "=>", ((surfaceIsWater _position or _ispond) and ((player == vehicle player) or {((vehicle player) isKindOf "Ship")})) ]; if ((surfaceIsWater _position or _ispond) && ((player == vehicle player) or {(vehicle player) isKindOf "Ship"})) exitWith { _isOk = true;