Browse Source

Siege mob slot position properly rotated.

master
MagicBot 1 year ago
parent
commit
3e7b4cf30c
  1. 27
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java

27
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -148,30 +148,35 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (mobBase == 0) if (mobBase == 0)
return true; return true;
Mob toCreate = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1); Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
if (toCreate == null) if (siegeMob == null)
return true; return true;
// toCreate.despawn(); // toCreate.despawn();
if (toCreate != null) { if (siegeMob != null) {
toCreate.setSpawnTime(10); siegeMob.setSpawnTime(10);
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID()); Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
int slot = ((NPC) toCreate.npcOwner).getSiegeMinionMap().get(toCreate); int slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob);
Vector3fImmutable slotLocation; Vector3fImmutable slotLocation;
toCreate.building = building; siegeMob.building = building;
toCreate.parentZone = zone; siegeMob.parentZone = zone;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot); BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
slotLocation = building.getLoc().add(buildingLocation.getLocation()); slotLocation = building.getLoc().add(buildingLocation.getLocation());
toCreate.setBindLoc(slotLocation);
zone.zoneMobSet.add(toCreate); // Rotate slot position by the building rotation
toCreate.setLoc(toCreate.getBindLoc());
//MovementManager.translocate(toCreate, toCreate.getBindLoc(), toCreate.npcOwner.region); slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
siegeMob.setEndLoc(new Vector3fImmutable(slotLocation));
siegeMob.setBindLoc(slotLocation);
zone.zoneMobSet.add(siegeMob);
siegeMob.setLoc(siegeMob.getBindLoc());
} }
} }

Loading…
Cancel
Save