Fixed crash caused by buildings, fixed weapon object superclass, added equipment and appearance equipment deltas

This commit is contained in:
Light2
2013-12-14 21:25:31 +01:00
parent 3fc02b8f1f
commit 896b342972
22 changed files with 298 additions and 109 deletions
+9 -5
View File
@@ -46,6 +46,7 @@ import engine.clients.Client;
import engine.resources.common.Event;
import engine.resources.common.Mesh3DTriangle;
import engine.resources.common.Ray;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
@@ -188,8 +189,10 @@ public class SimulationService implements INetworkDispatch {
Collection<SWGObject> newAwareObjects = get(object.getPlanet(), x, y, 512);
for(Iterator<SWGObject> it = newAwareObjects.iterator(); it.hasNext();) {
SWGObject obj = it.next();
if(obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance(pos) > 200)
if((obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance2D(pos) > 200) || obj == object)
continue;
//if(!obj.isInSnapshot())
// System.out.println(obj.getTemplate());
if(object.getClient() != null)
object.makeAware(obj);
if(obj.getClient() != null)
@@ -246,7 +249,8 @@ public class SimulationService implements INetworkDispatch {
public boolean remove(SWGObject object, float x, float y, boolean notifyObservers) {
boolean success = quadTrees.get(object.getPlanet().getName()).remove(x, y, object);
if(success) {
object.setIsInQuadtree(success);
if(success && notifyObservers) {
HashSet<Client> oldObservers = new HashSet<Client>(object.getObservers());
for(Iterator<Client> it = oldObservers.iterator(); it.hasNext();) {
Client observerClient = it.next();
@@ -586,12 +590,12 @@ public class SimulationService implements INetworkDispatch {
// object.getContainer().remove(object);
//}
core.objectService.destroyObject(object);
object.createTransaction(core.getCreatureODB().getEnvironment());
core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction());
object.getTransaction().commitSync();
core.objectService.destroyObject(object);
core.getActiveConnectionsMap().remove((Integer) session.getAttribute("connectionId"));
}
@@ -612,8 +616,9 @@ public class SimulationService implements INetworkDispatch {
Collection<SWGObject> newAwareObjects = get(object.getPlanet(), pos.x, pos.z, 512);
for(Iterator<SWGObject> it = newAwareObjects.iterator(); it.hasNext();) {
SWGObject obj = it.next();
if(obj.getAttachment("bigSpawnRange") == null & obj.getWorldPosition().getDistance(pos) > 200)
if(obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance(pos) > 200)
continue;
System.out.println(obj.getTemplate());
object.makeAware(obj);
if(obj.getClient() != null)
obj.makeAware(object);
@@ -689,7 +694,6 @@ public class SimulationService implements INetworkDispatch {
}
public void openContainer(SWGObject requester, SWGObject container) {
if(container.getPermissions().canView(requester, container)) {