npc.getCitizen().getTrait(Anchors.class).addAnchor(id.asString(), location);
return;
case ASSUME:
{
Anchor n = npc.getCitizen().getTrait(Anchors.class)
.getAnchor(id.asString());
if (n == null)
dB.echoError(scriptEntry.getResidingQueue(), "Invalid anchor name '" + id.asString() + "'");
else
npc.getEntity().teleport(n.getLocation());
}
return;
case WALKNEAR:
{
Anchor n = npc.getCitizen().getTrait(Anchors.class)
.getAnchor(id.asString());
if (n == null)
dB.echoError(scriptEntry.getResidingQueue(), "Invalid anchor name '" + id.asString() + "'");
else if (range == null)
dB.echoError(scriptEntry.getResidingQueue(), "Must specify a range!");
else
npc.getNavigator().setTarget(
Utilities.getWalkableLocationNear(n.getLocation(), range.asInt()));
}
return;
case WALKTO:
{
Anchor n = npc.getCitizen().getTrait(Anchors.class)
.getAnchor(id.asString());
if (n == null)
dB.echoError(scriptEntry.getResidingQueue(), "Invalid anchor name '" + id.asString() + "'");
else
npc.getNavigator().setTarget(n.getLocation());
}
return;
case REMOVE:
{
Anchor n = npc.getCitizen().getTrait(Anchors.class)
.getAnchor(id.asString());
if (n == null)
dB.echoError(scriptEntry.getResidingQueue(), "Invalid anchor name '" + id.asString() + "'");
else
npc.getCitizen().getTrait(Anchors.class).removeAnchor(n);