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{
_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 {

View File

@ -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];
};