Update guided help
This commit is contained in:
parent
8ca064aab3
commit
bec532952a
|
@ -96,17 +96,28 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||||
Messaging.sendTr(player, Messages.GUIDED_WAYPOINT_EDITOR_BEGIN);
|
Messaging.sendTr(player, Messages.GUIDED_WAYPOINT_EDITOR_BEGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createWaypointMarkers() {
|
private void createDestinationMarker(Waypoint element) {
|
||||||
for (Waypoint waypoint : waypoints()) {
|
NPC npc = createMarker(element);
|
||||||
createWaypointMarkerWithData(waypoint);
|
if (npc != null) {
|
||||||
|
npc.data().set(NPC.Metadata.GLOWING, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createWaypointMarkerWithData(Waypoint element) {
|
private NPC createMarker(Waypoint element) {
|
||||||
Entity entity = markers.createMarker(element, element.getLocation().clone().add(0, 1, 0));
|
Entity entity = markers.createMarker(element, element.getLocation().clone().add(0, 1, 0));
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return null;
|
||||||
((NPCHolder) entity).getNPC().data().setPersistent("waypointhashcode", element.hashCode());
|
((NPCHolder) entity).getNPC().data().setPersistent("waypointhashcode", element.hashCode());
|
||||||
|
return ((NPCHolder) entity).getNPC();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createWaypointMarkers() {
|
||||||
|
for (Waypoint waypoint : guides) {
|
||||||
|
createMarker(waypoint);
|
||||||
|
}
|
||||||
|
for (Waypoint waypoint : destinations) {
|
||||||
|
createDestinationMarker(waypoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,7 +179,11 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||||
Messaging.sendTr(player, Messages.GUIDED_WAYPOINT_EDITOR_ADDED_GUIDE);
|
Messaging.sendTr(player, Messages.GUIDED_WAYPOINT_EDITOR_ADDED_GUIDE);
|
||||||
}
|
}
|
||||||
if (showPath) {
|
if (showPath) {
|
||||||
createWaypointMarkerWithData(element);
|
if (player.isSneaking()) {
|
||||||
|
createDestinationMarker(element);
|
||||||
|
} else {
|
||||||
|
createMarker(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rebuildTree();
|
rebuildTree();
|
||||||
}
|
}
|
||||||
|
@ -304,6 +319,7 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||||
|
|
||||||
private class GuidedAIGoal implements Goal {
|
private class GuidedAIGoal implements Goal {
|
||||||
private GuidedPlan plan;
|
private GuidedPlan plan;
|
||||||
|
private Waypoint target;
|
||||||
|
|
||||||
public void onProviderChanged() {
|
public void onProviderChanged() {
|
||||||
if (plan == null)
|
if (plan == null)
|
||||||
|
@ -317,11 +333,15 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
plan = null;
|
plan = null;
|
||||||
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(GoalSelector selector) {
|
public void run(GoalSelector selector) {
|
||||||
if (plan == null || plan.isComplete()) {
|
if (plan == null || plan.isComplete()) {
|
||||||
|
if (plan.isComplete()) {
|
||||||
|
target.onReach(npc);
|
||||||
|
}
|
||||||
selector.finish();
|
selector.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +363,7 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||||
if (paused || destinations.size() == 0 || !npc.isSpawned() || npc.getNavigator().isNavigating())
|
if (paused || destinations.size() == 0 || !npc.isSpawned() || npc.getNavigator().isNavigating())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Waypoint target = destinations.get(Util.getFastRandom().nextInt(destinations.size()));
|
this.target = destinations.get(Util.getFastRandom().nextInt(destinations.size()));
|
||||||
plan = ASTAR.runFully(new GuidedGoal(target), new GuidedNode(null, new Waypoint(npc.getStoredLocation())));
|
plan = ASTAR.runFully(new GuidedGoal(target), new GuidedNode(null, new Waypoint(npc.getStoredLocation())));
|
||||||
return plan != null;
|
return plan != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,7 +419,7 @@ citizens.editors.waypoints.wander.added-region=[[Added]] wanderable region at ({
|
||||||
citizens.editors.waypoints.wander.removed-region=[[Removed]] wanderable region at ({0}) ([[{1}]] remaining).
|
citizens.editors.waypoints.wander.removed-region=[[Removed]] wanderable region at ({0}) ([[{1}]] remaining).
|
||||||
citizens.editors.waypoints.wander.editing-regions=Now editing regions!<br> [[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.<br> [[Right click]] an existing marker to remove that region.<br> Type [[regions]] to stop or simply exit the editor. Regions should be overlap or touch each other.
|
citizens.editors.waypoints.wander.editing-regions=Now editing regions!<br> [[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.<br> [[Right click]] an existing marker to remove that region.<br> Type [[regions]] to stop or simply exit the editor. Regions should be overlap or touch each other.
|
||||||
citizens.editors.waypoints.guided.end=Exited the guided waypoint editor.
|
citizens.editors.waypoints.guided.end=Exited the guided waypoint editor.
|
||||||
citizens.editors.waypoints.guided.begin=Entered the guided waypoint editor! The NPC will randomly walk to a [[destination]] waypoint following the nearest [[guide]] point. For example, try putting guide points on a road and destinations inside houses!<br> [[Left click]] to add a guide waypoint and [[right click]] to remove an existing waypoint.<br> [[Sneak]] while left clicking to add a destination waypoint.<br> Type [[toggle path]] to toggle showing entities at waypoints.<br> Type [[clear]] to clear all waypoints.
|
citizens.editors.waypoints.guided.begin=Entered the guided waypoint editor! The NPC will randomly walk to a [[destination]] waypoint following the nearest [[guide]] point. For example, try putting guide points on a road and destinations inside houses!<br> [[Left click]] to add a guide waypoint and [[right click]] to remove.<br> [[Sneak]] while left clicking to add a destination waypoint.<br> Type [[toggle path]] to toggle showing entities at waypoints.<br> Type [[clear]] to clear all waypoints.<br> Type [[distance <distance>]] to adjust the pathfinding range.
|
||||||
citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint which the NPC will follow on the way to their destination.
|
citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint which the NPC will follow on the way to their destination.
|
||||||
citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint which the NPC will randomly pathfind between.
|
citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint which the NPC will randomly pathfind between.
|
||||||
citizens.editors.waypoints.guided.already-taken=There is already a waypoint here.
|
citizens.editors.waypoints.guided.already-taken=There is already a waypoint here.
|
||||||
|
|
Loading…
Reference in New Issue