|
|
@ -11,6 +11,7 @@ package engine.net.client.handlers; |
|
|
|
|
|
|
|
|
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.exception.MsgSendException; |
|
|
|
import engine.exception.MsgSendException; |
|
|
|
|
|
|
|
import engine.gameManager.BuildingManager; |
|
|
|
import engine.gameManager.ChatManager; |
|
|
|
import engine.gameManager.ChatManager; |
|
|
|
import engine.CollisionEngine.CollisionManager; |
|
|
|
import engine.CollisionEngine.CollisionManager; |
|
|
|
import engine.gameManager.MovementManager; |
|
|
|
import engine.gameManager.MovementManager; |
|
|
@ -43,16 +44,27 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { |
|
|
|
Line2D travelLine = new Line2D.Float(); |
|
|
|
Line2D travelLine = new Line2D.Float(); |
|
|
|
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getEndLat(),msg.getEndAlt(),msg.getEndLon()); |
|
|
|
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getEndLat(),msg.getEndAlt(),msg.getEndLon()); |
|
|
|
travelLine.setLine(pc.loc.x,pc.loc.z,endLoc.x,endLoc.z); |
|
|
|
travelLine.setLine(pc.loc.x,pc.loc.z,endLoc.x,endLoc.z); |
|
|
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(pc.loc, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
if(BuildingManager.getBuildingAtLocation(pc.loc) != null){ |
|
|
|
for(AbstractWorldObject awo : awoList){ |
|
|
|
Building current = BuildingManager.getBuildingAtLocation(pc.loc); |
|
|
|
Building building = (Building)awo; |
|
|
|
if (CollisionManager.CollisionDetected(current, travelLine, pc.getCharacterHeight(), pc.loc.y)) { |
|
|
|
if(CollisionManager.CollisionDetected(building, travelLine,pc.getCharacterHeight(),pc.loc.y)){ |
|
|
|
ChatManager.chatSystemInfo(pc, "Collision Detected With : " + current.getName() + " Rect: " + current.buildingRect); |
|
|
|
ChatManager.chatSystemInfo(pc, "Collision Detected"); |
|
|
|
|
|
|
|
//msg.setEndCoord();
|
|
|
|
//msg.setEndCoord();
|
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(pc.loc, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
|
|
|
|
for(AbstractWorldObject awo : awoList){ |
|
|
|
|
|
|
|
Building building = (Building)awo; |
|
|
|
|
|
|
|
if(travelLine.intersects(building.buildingRect) || building.buildingRect.contains(travelLine.getP1()) || building.buildingRect.contains(travelLine.getP2())) { |
|
|
|
|
|
|
|
if (CollisionManager.CollisionDetected(building, travelLine, pc.getCharacterHeight(), pc.loc.y)) { |
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(pc, "Collision Detected With : " + building.getName() + " Rect: " + building.buildingRect); |
|
|
|
|
|
|
|
//msg.setEndCoord();
|
|
|
|
|
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//ChatManager.chatSystemInfo(pc, "No Collision Detected");
|
|
|
|
//ChatManager.chatSystemInfo(pc, "No Collision Detected");
|
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|