Contracted Mob/Npc rotation derived from slot position.

This commit is contained in:
2023-05-02 13:08:02 -04:00
parent a3c8241b8d
commit ce516f24c0
4 changed files with 32 additions and 6 deletions
+8 -1
View File
@@ -18,6 +18,7 @@ import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.UpgradeNPCJob;
import engine.math.Bounds;
import engine.math.Quaternion;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.net.ByteBufferWriter;
@@ -319,6 +320,7 @@ public class NPC extends AbstractCharacter {
int slot;
Vector3fImmutable slotLocation;
Quaternion slotRotation;
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
return;
@@ -358,7 +360,7 @@ public class NPC extends AbstractCharacter {
// Override bind and location for this npc derived
// from BuildingManager slot location data.
slotLocation = BuildingManager.getSlotLocation(building, slot);
slotLocation = BuildingManager.getSlotLocation(building, slot).getLocation();
this.bindLoc = building.getLoc().add(slotLocation);
@@ -368,6 +370,11 @@ public class NPC extends AbstractCharacter {
this.loc = new Vector3fImmutable(bindLoc);
// Rotate NPC by slot rotation
slotRotation = BuildingManager.getSlotLocation(building, slot).getRotation();
this.setRot(new Vector3f(0, slotRotation.y, 0));
// Configure region and floor/level for this NPC
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);