forked from MagicBane/Server
Merge remote-tracking branch 'origin/bugfix-stuck-location'
This commit is contained in:
@@ -1612,7 +1612,7 @@ public class Enum {
|
|||||||
ESTATE(64f, 64f),
|
ESTATE(64f, 64f),
|
||||||
FORTRESS(64f, 64f),
|
FORTRESS(64f, 64f),
|
||||||
CITADEL(64f, 64f),
|
CITADEL(64f, 64f),
|
||||||
WALLSTRAIGHTTOWER(16f, 64),
|
WALLSTRAIGHTTOWER(32F, 64),
|
||||||
WALLSTAIRS(64, 64);
|
WALLSTAIRS(64, 64);
|
||||||
|
|
||||||
private final Vector2f extents;
|
private final Vector2f extents;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import engine.job.JobContainer;
|
|||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.UpgradeBuildingJob;
|
import engine.jobs.UpgradeBuildingJob;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Quaternion;
|
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
@@ -72,21 +71,6 @@ public enum BuildingManager {
|
|||||||
return buildingLocation;
|
return buildingLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Quaternion getSlotRotation(Building building, int slot) {
|
|
||||||
|
|
||||||
if (slot == -1)
|
|
||||||
return new Quaternion();
|
|
||||||
|
|
||||||
BuildingLocation buildingLocation;
|
|
||||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
|
||||||
|
|
||||||
if (buildingLocation == null) {
|
|
||||||
Logger.error("Invalid slot rotation for building: " + building.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildingLocation.getRotation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean playerCanManage(PlayerCharacter player, Building building) {
|
public static boolean playerCanManage(PlayerCharacter player, Building building) {
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
|
|||||||
@@ -1245,6 +1245,10 @@ public class Building extends AbstractWorldObject {
|
|||||||
stuckLocation = stuckLocations.get(ThreadLocalRandom.current().nextInt(stuckLocations.size())).getLocation();
|
stuckLocation = stuckLocations.get(ThreadLocalRandom.current().nextInt(stuckLocations.size())).getLocation();
|
||||||
stuckLocation = this.getLoc().add(stuckLocation);
|
stuckLocation = this.getLoc().add(stuckLocation);
|
||||||
|
|
||||||
|
// Rotate stuck position by the building rotation
|
||||||
|
|
||||||
|
stuckLocation = Vector3fImmutable.rotateAroundPoint(this.getLoc(), stuckLocation, this.getBounds().getQuaternion().angleY);
|
||||||
|
|
||||||
return stuckLocation;
|
return stuckLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -922,11 +922,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
this.bindLoc = building.getLoc().add(slotLocation);
|
this.bindLoc = building.getLoc().add(slotLocation);
|
||||||
|
|
||||||
// Rotate MOB by slot rotation
|
|
||||||
|
|
||||||
slotRotation = BuildingManager.getSlotLocation(building, slot).getRotation();
|
|
||||||
this.setRot(new Vector3f(0, slotRotation.y, 0));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotate slot position by the building rotation
|
// Rotate slot position by the building rotation
|
||||||
|
|||||||
@@ -814,11 +814,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
this.loc = new Vector3fImmutable(bindLoc);
|
this.loc = new Vector3fImmutable(bindLoc);
|
||||||
|
|
||||||
// Rotate NPC by slot rotation
|
|
||||||
|
|
||||||
slotRotation = BuildingManager.getSlotLocation(building, slot).getRotation();
|
|
||||||
this.setRot(new Vector3f(0, slotRotation.y, 0));
|
|
||||||
|
|
||||||
// Rotate NPC rotation by the building's rotation
|
// Rotate NPC rotation by the building's rotation
|
||||||
|
|
||||||
slotRotation = new Quaternion().fromAngles(0, acos(this.getRot().y) * 2, 0);
|
slotRotation = new Quaternion().fromAngles(0, acos(this.getRot().y) * 2, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user