locality issue with fishing

This commit is contained in:
vbawol 2015-10-13 10:11:52 -05:00
parent cddf397a4b
commit 4d683e6055
2 changed files with 23 additions and 5 deletions

View File

@ -8,17 +8,28 @@ if (surfaceIsWater _currentPos) then {
if (_objects isEqualTo []) then{ if (_objects isEqualTo []) then{
_nearByBobbers = nearestObjects [position player,["Bobber_EPOCH"],12]; _nearByBobbers = nearestObjects [player,["Bobber_EPOCH"],12];
if (_nearByBobbers isEqualTo []) then { _nearByBobbersLocal = [];
{
if (local _x) then {
_nearByBobbersLocal pushBack _x
};
} forEach _nearByBobbers;
if (_nearByBobbersLocal isEqualTo []) then {
// Cast // Cast
_bobber = createVehicle ["Bobber_EPOCH",_currentPos, [], 0, "CAN_COLLIDE"]; _bobber = createVehicle ["Bobber_EPOCH",_currentPos, [], 0, "CAN_COLLIDE"];
EPOCH_TEMPOBJ_PVS = [_bobber];
publicVariableServer "EPOCH_TEMPOBJ_PVS"
_bobber setPosASL _currentPos; _bobber setPosASL _currentPos;
_bobber setVariable ["EPOCH_bobberTime", diag_tickTime]; _bobber setVariable ["EPOCH_bobberTime", diag_tickTime];
} else { } else {
_bobber = _nearByBobbers select 0; _bobber = _nearByBobbersLocal select 0;
// Reel in and delete Bobber // Reel in and delete Bobber
if !(isNull _bobber) then { if !(isNull _bobber) then {

View File

@ -451,10 +451,17 @@ while {alive player} do {
if ((_tickTime - _EPOCH_30) > 30) then { if ((_tickTime - _EPOCH_30) > 30) then {
_EPOCH_30 = _tickTime; _EPOCH_30 = _tickTime;
_nearByBobbersLocal = [];
_nearByBobbers = player nearEntities[["Bobber_EPOCH"], 12]; _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 { 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 setVelocity [0,-1,-1];
_bobber setVariable ["EPOCH_fishOnLine" , diag_tickTime]; _bobber setVariable ["EPOCH_fishOnLine" , diag_tickTime];
}; };