fixed #325, fixed ai warping to 0 0 0

This commit is contained in:
Light2
2014-03-31 02:58:29 +02:00
parent b3bdad4b9a
commit 8a0bc99eb5
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ public class SimulationService implements INetworkDispatch {
public void insertSnapShotObjects() {
List<SWGObject> objectList = new ArrayList<SWGObject>(core.objectService.getObjectList().values());
for(SWGObject obj : objectList) {
if(obj.getParentId() == 0 && (obj.isInSnapshot() || obj.getAttachment("isBuildout") != null))
if(obj.getParentId() == 0 && /*(*/obj.isInSnapshot() /*|| obj.getAttachment("isBuildout") != null)*/)
add(obj, obj.getPosition().x, obj.getPosition().z);
}
}
+1 -1
View File
@@ -187,7 +187,7 @@ public abstract class AIState {
Point3D newPosition = new Point3D();
boolean foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition);
if(!foundNewPos)
if(!foundNewPos || (newPosition.x == 0 && newPosition.z == 0))
return;
Point3D newWorldPos = newPosition.getWorldPosition();
+6 -5
View File
@@ -176,9 +176,7 @@ public class ObjectService implements INetworkDispatch {
public void loadServerTemplates() {
System.out.println("Loading server templates...");
for(Runnable r : loadServerTemplateTasks) {
r.run();
}
loadServerTemplateTasks.forEach(Runnable::run);
loadServerTemplateTasks.clear();
System.out.println("Finished loading server templates...");
}
@@ -882,8 +880,8 @@ public class ObjectService implements INetworkDispatch {
if (duplicate.containsKey(containerId)) {
containerId = duplicate.get(containerId);
}
if (objectId != 0 && getObject(objectId) != null) {
String planetName = planet.getName();
if (objectId != 0 && getObject(objectId) != null && (planetName.contains("dungeon") || planetName.contains("adventure"))) {
SWGObject container = getObject(containerId);
int x = ((int) (px + ((container == null) ? x1 : container.getPosition().x)));
int z = ((int) (pz + ((container == null) ? z1 : container.getPosition().z)));
@@ -907,6 +905,8 @@ public class ObjectService implements INetworkDispatch {
SWGObject object;
if(objectId != 0 && containerId == 0) {
if(portalCRC != 0) {
if (core.getBuildingODB().contains(objectId, Long.class, BuildingObject.class) && !duplicate.containsValue(objectId))
continue;
containers.add(objectId);
object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz), null, true, false);
object.setAttachment("childObjects", null);
@@ -960,6 +960,7 @@ public class ObjectService implements INetworkDispatch {
building.createTransaction(core.getBuildingODB().getEnvironment());
core.getBuildingODB().put(building, Long.class, BuildingObject.class, building.getTransaction());
building.getTransaction().commitSync();
destroyObject(building);
}
}