forked from MagicBane/Server
shape
This commit is contained in:
@@ -1345,14 +1345,14 @@ public class MobAI {
|
||||
|
||||
public static void aiMove(Mob mob, boolean isWalking, float offset) {
|
||||
|
||||
if(mob.navPath.isEmpty() || mob.navPath.size() == 1){
|
||||
NavigationManager.pathfind(mob,mob.destination);
|
||||
return;
|
||||
}
|
||||
if(mob.isMoving()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.navPath.isEmpty()){
|
||||
NavigationManager.pathfind(mob,mob.destination);
|
||||
return;
|
||||
}
|
||||
Vector3fImmutable PathPoint = mob.navPath.get(0);
|
||||
if(mob.loc.distanceSquared(mob.destination) > mob.loc.distanceSquared2D(mob.destination)) {
|
||||
mob.navPath.remove(0);
|
||||
@@ -1393,6 +1393,46 @@ public class MobAI {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
MovementManager.movement(msg, mob);
|
||||
} catch (MsgSendException e) {
|
||||
// TODO Figure out how we want to handle the msg send exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void directMove(Mob mob,boolean isWalking){
|
||||
//update our walk/run state.
|
||||
if (isWalking && !mob.isWalk()) {
|
||||
mob.setWalkMode(true);
|
||||
MovementManager.sendRWSSMsg(mob);
|
||||
} else if (!isWalking && mob.isWalk()) {
|
||||
mob.setWalkMode(false);
|
||||
MovementManager.sendRWSSMsg(mob);
|
||||
}
|
||||
mob.endLoc = mob.destination;
|
||||
|
||||
MoveToPointMsg msg = new MoveToPointMsg();
|
||||
|
||||
msg.setSourceType(Enum.GameObjectType.Mob.ordinal());
|
||||
msg.setSourceID(mob.getObjectUUID());
|
||||
msg.setStartCoord(mob.loc);
|
||||
msg.setEndCoord(mob.destination);
|
||||
Regions region = Regions.getRegionAtLocation(mob.destination);
|
||||
if(region != null){
|
||||
msg.setInBuildingFloor(region.room);
|
||||
msg.setInBuilding(region.level);
|
||||
msg.setStartLocType(0);
|
||||
msg.setInBuildingUUID(region.parentBuildingID);
|
||||
} else{
|
||||
msg.setInBuildingFloor(-1);
|
||||
msg.setInBuilding(-1);
|
||||
msg.setStartLocType(0);
|
||||
msg.setInBuildingUUID(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
MovementManager.movement(msg, mob);
|
||||
} catch (MsgSendException e) {
|
||||
|
||||
Reference in New Issue
Block a user