StaticService can now use mobileTemplates

Just put a mobileTemplate in place of the objectTemplate.
This commit is contained in:
Treeku
2014-05-04 23:22:15 +01:00
parent 966f207d10
commit a5ee3ff2b4
4 changed files with 13 additions and 26 deletions
+7 -14
View File
@@ -36,8 +36,6 @@ import java.util.Map;
import resources.common.FileUtilities;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import resources.objects.tangible.TangibleObject;
import main.NGECore;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.PortalVisitor;
@@ -57,13 +55,6 @@ public class StaticService implements INetworkDispatch {
}
public void spawnStatics() {
for (SWGObject object : core.objectService.getObjectList().values()) {
if (object instanceof CreatureObject && ((CreatureObject) object).getStaticNPC()) {
((TangibleObject) object).setRespawnTime(0);
core.objectService.destroyObject(object);
}
}
for (Planet planet : core.terrainService.getPlanetList()) {
if (FileUtilities.doesFileExist("scripts/static_spawns/" + planet.getName())) {
Path p = Paths.get("scripts/static_spawns/" + planet.getName());
@@ -122,7 +113,13 @@ public class StaticService implements INetworkDispatch {
long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z);
SWGObject object = core.objectService.createObject(template, objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ), null, true, true);
SWGObject object;
if (core.spawnService.getMobileTemplate(template) != null) {
object = core.spawnService.spawnCreature(template, planetName, cellId, x, y, z, qW, qX, qY, qZ, (short) -1);
} else {
object = core.objectService.createObject(template, objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ), null, true, true);
}
if (object == null) {
System.err.println("Static object is null with id " + objectId + " and template " + template + ".");
@@ -133,10 +130,6 @@ public class StaticService implements INetworkDispatch {
System.err.println("StaticService: ObjectId " + objectId + " was taken for object with template " + object.getTemplate() + ". Replacement: " + object.getObjectID());
}
if (object instanceof CreatureObject) {
((CreatureObject) object).setStaticNPC(true);
}
boolean checkCells = false; // shouldn't be needed; for debugging
if (object instanceof BuildingObject && checkCells) {