mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-02 03:15:52 -04:00
Minor movement changes for vehicles
This commit is contained in:
@@ -341,9 +341,9 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
CreatureObject creature = (CreatureObject) client.getParent();
|
||||
|
||||
CreatureObject object = (CreatureObject) client.getParent();
|
||||
CreatureObject object = creature;
|
||||
|
||||
if (core.mountService.isMounted(object)) {
|
||||
if (core.mountService.isMounted(creature) && creature.getObjectID() == ((CreatureObject) creature.getContainer()).getOwnerId()) {
|
||||
object = (CreatureObject) object.getContainer();
|
||||
}
|
||||
|
||||
@@ -371,59 +371,41 @@ public class SimulationService implements INetworkDispatch {
|
||||
add(object, newPos.x, newPos.z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//object.setParentId(0);
|
||||
//object.setParent(null);
|
||||
// System.out.println("Parsed Height: " + core.terrainService.getHeight(object.getPlanetId(), dataTransform.getXPosition(), dataTransform.getZPosition())
|
||||
// + " should be: " + dataTransform.getYPosition());
|
||||
UpdateTransformMessage utm = new UpdateTransformMessage(object.getObjectID(), dataTransform.getTransformedX(), dataTransform.getTransformedY(), dataTransform.getTransformedZ(), dataTransform.getMovementCounter(), (byte) dataTransform.getMovementAngle(), dataTransform.getSpeed());
|
||||
|
||||
List<SWGObject> newAwareObjects = get(object.getPlanet(), newPos.x, newPos.z, 512);
|
||||
ArrayList<SWGObject> oldAwareObjects = new ArrayList<SWGObject>(object.getAwareObjects());
|
||||
@SuppressWarnings("unchecked") Collection<SWGObject> updateAwareObjects = CollectionUtils.intersection(oldAwareObjects, newAwareObjects);
|
||||
object.notifyObservers(utm, false);
|
||||
|
||||
|
||||
List<SWGObject> newAwareObjects = get(creature.getPlanet(), newPos.x, newPos.z, 512);
|
||||
ArrayList<SWGObject> oldAwareObjects = new ArrayList<SWGObject>(creature.getAwareObjects());
|
||||
@SuppressWarnings("unchecked") Collection<SWGObject> updateAwareObjects = CollectionUtils.intersection(oldAwareObjects, newAwareObjects);
|
||||
|
||||
for(int i = 0; i < oldAwareObjects.size(); i++) {
|
||||
SWGObject obj = oldAwareObjects.get(i);
|
||||
if(!updateAwareObjects.contains(obj) && obj != object && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() /*&& obj.getParentId() == 0*/) {
|
||||
if(!updateAwareObjects.contains(obj) && obj != creature && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() /*&& obj.getParentId() == 0*/) {
|
||||
if(obj.getAttachment("bigSpawnRange") != null && obj.getWorldPosition().getDistance2D(newPos) < 512)
|
||||
continue;
|
||||
object.makeUnaware(obj);
|
||||
creature.makeUnaware(obj);
|
||||
if(obj.getClient() != null)
|
||||
obj.makeUnaware(object);
|
||||
} else if(obj != object && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() && obj.getAttachment("bigSpawnRange") == null) {
|
||||
object.makeUnaware(obj);
|
||||
obj.makeUnaware(creature);
|
||||
} else if(obj != creature && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() && obj.getAttachment("bigSpawnRange") == null) {
|
||||
creature.makeUnaware(obj);
|
||||
if(obj.getClient() != null)
|
||||
obj.makeUnaware(object);
|
||||
obj.makeUnaware(creature);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < newAwareObjects.size(); i++) {
|
||||
SWGObject obj = newAwareObjects.get(i);
|
||||
//System.out.println(obj.getTemplate());
|
||||
if(!updateAwareObjects.contains(obj) && obj != object && !object.getAwareObjects().contains(obj) && obj.getContainer() != object && obj.isInQuadtree()) {
|
||||
if(!updateAwareObjects.contains(obj) && obj != creature && !creature.getAwareObjects().contains(obj) && obj.getContainer() != creature && obj.isInQuadtree()) {
|
||||
if(obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance2D(newPos) > 200)
|
||||
continue;
|
||||
//object.makeAware(obj);
|
||||
|
||||
if (object.getOption(Options.MOUNT)){
|
||||
CreatureObject owner = (CreatureObject) core.objectService.getObject(object.getOwnerId());
|
||||
owner.makeAware(obj);
|
||||
}
|
||||
else {
|
||||
object.makeAware(obj);
|
||||
}
|
||||
|
||||
if(obj.getClient() != null){
|
||||
if (object.getOption(Options.MOUNT)){
|
||||
CreatureObject owner = (CreatureObject) core.objectService.getObject(object.getOwnerId());
|
||||
obj.makeAware(owner);
|
||||
}
|
||||
else {
|
||||
obj.makeAware(object);
|
||||
}
|
||||
}
|
||||
creature.makeAware(obj);
|
||||
if(obj.getClient() != null)
|
||||
obj.makeAware(creature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,8 +416,7 @@ public class SimulationService implements INetworkDispatch {
|
||||
object.getEventBus().publish(event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
objControllerOpcodes.put(ObjControllerOpcodes.DATA_TRANSFORM_WITH_PARENT, new INetworkRemoteEvent() {
|
||||
@@ -485,7 +466,7 @@ public class SimulationService implements INetworkDispatch {
|
||||
if(object.getContainer() != null)
|
||||
object.getContainer()._remove(object);
|
||||
if (object.getClient().isGM() && parent != null && parent instanceof CellObject && parent.getContainer() != null)
|
||||
object.sendSystemMessage("BuildingId Hex: " + Long.toHexString(parent.getContainer().getObjectID()) + " CellNumber: " + ((CellObject) parent).getCellNumber(), DisplayType.Broadcast);
|
||||
object.sendSystemMessage("BuildingId - Dec: " + parent.getContainer().getObjectID() + " Hex: " + Long.toHexString(parent.getContainer().getObjectID()) + " CellNumber: " + ((CellObject) parent).getCellNumber(), DisplayType.Broadcast);
|
||||
parent._add(object);
|
||||
}
|
||||
object.setPosition(newPos);
|
||||
@@ -767,6 +748,7 @@ public class SimulationService implements INetworkDispatch {
|
||||
return new Point3D(x, y, z);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Moved this to ConnectionService which will disconnect them
|
||||
* from the server if they don't send packets for 5 minutes or more
|
||||
|
||||
Reference in New Issue
Block a user