forked from MagicBane/Server
shape
This commit is contained in:
@@ -18,6 +18,7 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.Threads.Respawner;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.PathingUtilities;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
@@ -1348,60 +1349,14 @@ public class MobAI {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
if(offset > 0){
|
||||
PathPoint= Vector3fImmutable.getRandomPointInCircle(PathPoint, offset);
|
||||
}
|
||||
mob.endLoc = PathPoint;
|
||||
|
||||
MoveToPointMsg msg = new MoveToPointMsg();
|
||||
|
||||
msg.setSourceType(Enum.GameObjectType.Mob.ordinal());
|
||||
msg.setSourceID(mob.getObjectUUID());
|
||||
msg.setStartCoord(mob.loc);
|
||||
msg.setEndCoord(PathPoint);
|
||||
Regions region = Regions.getRegionAtLocation(PathPoint);
|
||||
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) {
|
||||
// TODO Figure out how we want to handle the msg send exception
|
||||
e.printStackTrace();
|
||||
if(!mob.isPathing){
|
||||
ArrayList<PathingUtilities.Node> path = PathingUtilities.getPath(mob.loc,mob.destination);
|
||||
if(path != null && path.size() > 0)
|
||||
PathingUtilities.followPath(mob,path);
|
||||
}
|
||||
}
|
||||
|
||||
public static void directMove(Mob mob,boolean isWalking){
|
||||
public static void directMove(AbstractCharacter mob,boolean isWalking){
|
||||
//update our walk/run state.
|
||||
if (isWalking && !mob.isWalk()) {
|
||||
mob.setWalkMode(true);
|
||||
|
||||
Reference in New Issue
Block a user