From 4d683e6055826ac9e207589ac8d3d84046ff96db Mon Sep 17 00:00:00 2001 From: vbawol Date: Tue, 13 Oct 2015 10:11:52 -0500 Subject: [PATCH] locality issue with fishing --- Sources/epoch_code/compile/EPOCH_fish.sqf | 17 ++++++++++++++--- .../compile/setup/EPOCH_masterLoop.sqf | 11 +++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Sources/epoch_code/compile/EPOCH_fish.sqf b/Sources/epoch_code/compile/EPOCH_fish.sqf index 23f35c23..fed7eb96 100644 --- a/Sources/epoch_code/compile/EPOCH_fish.sqf +++ b/Sources/epoch_code/compile/EPOCH_fish.sqf @@ -8,17 +8,28 @@ if (surfaceIsWater _currentPos) then { if (_objects isEqualTo []) then{ - _nearByBobbers = nearestObjects [position player,["Bobber_EPOCH"],12]; - if (_nearByBobbers isEqualTo []) then { + _nearByBobbers = nearestObjects [player,["Bobber_EPOCH"],12]; + _nearByBobbersLocal = []; + { + if (local _x) then { + _nearByBobbersLocal pushBack _x + }; + } forEach _nearByBobbers; + + if (_nearByBobbersLocal isEqualTo []) then { // Cast _bobber = createVehicle ["Bobber_EPOCH",_currentPos, [], 0, "CAN_COLLIDE"]; + + EPOCH_TEMPOBJ_PVS = [_bobber]; + publicVariableServer "EPOCH_TEMPOBJ_PVS" + _bobber setPosASL _currentPos; _bobber setVariable ["EPOCH_bobberTime", diag_tickTime]; } else { - _bobber = _nearByBobbers select 0; + _bobber = _nearByBobbersLocal select 0; // Reel in and delete Bobber if !(isNull _bobber) then { diff --git a/Sources/epoch_code/compile/setup/EPOCH_masterLoop.sqf b/Sources/epoch_code/compile/setup/EPOCH_masterLoop.sqf index b4bd2735..10ad6ce7 100644 --- a/Sources/epoch_code/compile/setup/EPOCH_masterLoop.sqf +++ b/Sources/epoch_code/compile/setup/EPOCH_masterLoop.sqf @@ -451,10 +451,17 @@ while {alive player} do { if ((_tickTime - _EPOCH_30) > 30) then { _EPOCH_30 = _tickTime; + _nearByBobbersLocal = []; _nearByBobbers = player nearEntities[["Bobber_EPOCH"], 12]; - if !(_nearByBobbers isEqualTo []) then { + { + if (local _x) then { + _nearByBobbersLocal pushBack _x + } + } forEach _nearByBobbers; + + if !(_nearByBobbersLocal isEqualTo []) then { if ((random 100) < 50) then { - _bobber = _nearByBobbers select floor(random(count _nearByBobbers)); + _bobber = _nearByBobbersLocal select floor(random(count _nearByBobbers)); _bobber setVelocity [0,-1,-1]; _bobber setVariable ["EPOCH_fishOnLine" , diag_tickTime]; };