/** Find objects that are in visibility range. */ protected void findVisibleObjects() { if (owner == null || !owner.isSpawned()) { return; } MapRegion[] regions = owner.getActiveRegion().getNeighbours(); for (int i = 0; i < regions.length; i++) { MapRegion r = regions[i]; FastMap<Integer, VisibleObject> objects = r.getObjects(); for (FastMap.Entry<Integer, VisibleObject> e = objects.head(), mapEnd = objects.tail(); (e = e.getNext()) != mapEnd; ) { VisibleObject newObject = e.getValue(); if (newObject == owner || newObject == null) { continue; } if (!isAwareOf(newObject)) { continue; } if (knownObjects.containsKey(newObject.getObjectId())) { continue; } if (!checkObjectInRange(newObject) && !newObject.getKnownList().checkReversedObjectInRange(owner)) { continue; } /** New object is not known. */ if (add(newObject)) { newObject.getKnownList().add(owner); } } } }
/** Do KnownList update. */ public final synchronized void updateKnownList() { if ((System.currentTimeMillis() - lastUpdate) < 100 || !owner.getActiveRegion().isActive()) return; updateKnownListImpl(); lastUpdate = System.currentTimeMillis(); }