User:Soniccuz: Difference between revisions

Content deleted Content added
imported>Soniccuz
imported>Soniccuz
m Local server:: Looking at setMovement method.
Line 128:
 
==Local server:==
/**
Eclipse is a go finally!
* moves to the given entity. When the distance to the destination is
Learning to manipulate NPC dialog, and realizing an old quest idea of mine.
* between <code>min</code> and <code>max</code> and this entity does
* not have a path already one is searched and saved.
Current issue is that Waerryna has no long term memory.
* <p>
* <b>Note:</b> When the distance to the destination is less than
* <code>min</code> the path is removed. <b>Warning:</b> The pathfinder
* is not asynchronous, so this thread is blocked until a path is found.
*
* @param destEntity
* the destination entity
* @param min
* minimum distance to the destination entity
* @param max
* maximum distance to the destination entity
* @param maxPathRadius
* the maximum radius in which a path is searched
*/
public void setMovement(final Entity destEntity, final double min, final double max,
final double maxPathRadius) {
if (nextTo(destEntity, min)) {
stop();
 
if (hasPath()) {
logger.debug("Removing path because nextto("
+ destEntity.getX() + "," + destEntity.getY() + ","
+ min + ") of (" + getX() + "," + getY() + ")");
clearPath();
}
} else if ((squaredDistance(destEntity) > max)) {
logger.debug("Creating path because (" + getX() + "," + getY()
+ ") distance(" + destEntity.getX() + ","
+ destEntity.getY() + ")>" + max);
final List<Node> path = Path.searchPath(this, destEntity, maxPathRadius);
setPath(new FixedPath(path, false));
}
}
 
<gallery>