mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
StaticService can now use mobileTemplates
Just put a mobileTemplate in place of the objectTemplate.
This commit is contained in:
@@ -172,7 +172,6 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
@NotPersistent
|
||||
private transient ScheduledFuture<?> spectatorTask;
|
||||
|
||||
private boolean staticNPC = false; // temp
|
||||
@NotPersistent
|
||||
private transient int flourishCount = 0;
|
||||
@NotPersistent
|
||||
@@ -1488,14 +1487,6 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
getClient().getSession().write(new PlayMusicMessage(sndFile, targetId, 1, false));
|
||||
}
|
||||
|
||||
public boolean getStaticNPC() {
|
||||
return staticNPC;
|
||||
}
|
||||
|
||||
public boolean setStaticNPC(boolean staticNPC) {
|
||||
return this.staticNPC = staticNPC;
|
||||
}
|
||||
|
||||
public boolean getGroupDance() {
|
||||
synchronized(objectMutex) {
|
||||
return groupDance;
|
||||
|
||||
@@ -101,7 +101,6 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
private byte junkType = -1;
|
||||
private int junkDealerPrice = 0;
|
||||
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
@NotPersistent
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SpawnService {
|
||||
}
|
||||
}
|
||||
|
||||
public CreatureObject spawnCreature(String template, String planetName, long cellId, float x, float y, float z, float qW, float qX, float qY, float qZ, short level) {
|
||||
public CreatureObject spawnCreature(String template, long objectId, String planetName, long cellId, float x, float y, float z, float qW, float qX, float qY, float qZ, short level) {
|
||||
|
||||
Planet planet = core.terrainService.getPlanetByName(planetName);
|
||||
MobileTemplate mobileTemplate = mobileTemplates.get(template);
|
||||
@@ -85,7 +85,7 @@ public class SpawnService {
|
||||
return null;
|
||||
}
|
||||
|
||||
CreatureObject creature = (CreatureObject) core.objectService.createObject(mobileTemplate.getTemplates().get(new Random().nextInt(mobileTemplate.getTemplates().size())), 0, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ));
|
||||
CreatureObject creature = (CreatureObject) core.objectService.createObject(mobileTemplate.getTemplates().get(new Random().nextInt(mobileTemplate.getTemplates().size())), objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ));
|
||||
|
||||
if(creature == null)
|
||||
return null;
|
||||
@@ -211,6 +211,10 @@ public class SpawnService {
|
||||
return creature;
|
||||
}
|
||||
|
||||
public CreatureObject spawnCreature(String template, String planetName, long cellId, float x, float y, float z, float qW, float qX, float qY, float qZ, short level) {
|
||||
return spawnCreature(template, 0L, planetName, cellId, x, y, z, qW, qX, qY, qZ, level);
|
||||
}
|
||||
|
||||
public CreatureObject spawnCreature(String mobileTemplate, String planetName, long cellId, float x, float y, float z, float qW, float qX, float qY, float qZ, int level) {
|
||||
return spawnCreature(mobileTemplate, planetName, cellId, x, y, z, 1, 0, 0, 0, (short) level);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user