mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-07-14 00:03:01 -04:00
Merged loading buildouts and snapshots to one config entry
This commit is contained in:
@@ -95,8 +95,7 @@ public class ObjectManager extends Manager {
|
||||
registerForIntent(PlayerEventIntent.TYPE);
|
||||
registerForIntent(ObjectTeleportIntent.TYPE);
|
||||
objectAwareness.initialize();
|
||||
loadBuildouts();
|
||||
loadSnapshots();
|
||||
loadClientObjects();
|
||||
maxObjectId = 1000000000; // Gets over all the buildouts/snapshots
|
||||
loadObjects();
|
||||
return super.initialize();
|
||||
@@ -124,66 +123,61 @@ public class ObjectManager extends Manager {
|
||||
System.out.printf("ObjectManager: Finished loading %d objects. Time: %fms%n", database.size(), loadTime);
|
||||
}
|
||||
|
||||
private void loadBuildouts() {
|
||||
private void loadClientObjects() {
|
||||
Config c = getConfig(ConfigFile.PRIMARY);
|
||||
if (c.getBoolean("LOAD-BUILDOUTS", false)) {
|
||||
long startLoad = System.nanoTime();
|
||||
System.out.println("ObjectManager: Loading buildouts...");
|
||||
Log.i("ObjectManager", "Loading buildouts...");
|
||||
String terrain = c.getString("LOAD-BUILDOUTS-FOR", "");
|
||||
BuildoutLoader loader = new BuildoutLoader();
|
||||
if (Terrain.doesTerrainExistForName(terrain))
|
||||
loader.loadBuildoutsForTerrain(Terrain.getTerrainFromName(terrain));
|
||||
else {
|
||||
if (!terrain.isEmpty()) {
|
||||
System.err.println("ObjectManager: Unknown terrain '" + terrain + "'");
|
||||
Log.e("ObjectManager", "Unknown terrain: %s", terrain);
|
||||
}
|
||||
loader.loadAllBuildouts();
|
||||
if (c.getBoolean("LOAD-OBJECTS", true)) {
|
||||
String terrainStr = c.getString("LOAD-OBJECTS-FOR", "");
|
||||
Terrain terrain = null;
|
||||
if (Terrain.doesTerrainExistForName(terrainStr))
|
||||
terrain = Terrain.getTerrainFromName(terrainStr);
|
||||
else if (!terrainStr.isEmpty()) {
|
||||
System.err.println("ObjectManager: Unknown terrain '" + terrain + "'");
|
||||
Log.e("ObjectManager", "Unknown terrain: %s", terrain);
|
||||
}
|
||||
List <SWGObject> buildouts = loader.getObjects();
|
||||
for (SWGObject obj : buildouts) {
|
||||
loadBuildout(obj);
|
||||
}
|
||||
objectMap.putAll(loader.getObjectTable());
|
||||
double loadTime = (System.nanoTime() - startLoad) / 1E6;
|
||||
System.out.printf("ObjectManager: Finished loading %d buildouts. Time: %fms%n", buildouts.size(), loadTime);
|
||||
Log.i("ObjectManager", "Finished loading buildouts. Time: %fms", loadTime);
|
||||
loadBuildouts(terrain);
|
||||
loadSnapshots(terrain);
|
||||
} else {
|
||||
Log.w("ObjectManager", "Did not load buildouts. Reason: Disabled.");
|
||||
System.out.println("ObjectManager: Buildouts not loaded. Reason: Disabled!");
|
||||
Log.w("ObjectManager", "Did not load client objects. Reason: Disabled.");
|
||||
System.out.println("ObjectManager: Did not load client objects. Reason: Disabled!");
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSnapshots() {
|
||||
Config c = getConfig(ConfigFile.PRIMARY);
|
||||
if (c.getBoolean("LOAD-SNAPSHOTS", false)) {
|
||||
long startLoad = System.nanoTime();
|
||||
System.out.println("ObjectManager: Loading snapshots...");
|
||||
Log.i("ObjectManager", "Loading snapshots...");
|
||||
String terrain = c.getString("LOAD-SNAPSHOTS-FOR", "");
|
||||
SnapshotLoader loader = new SnapshotLoader();
|
||||
if (Terrain.doesTerrainExistForName(terrain))
|
||||
loader.loadSnapshotsForTerrain(Terrain.getTerrainFromName(terrain));
|
||||
else {
|
||||
if (!terrain.isEmpty()) {
|
||||
System.err.println("ObjectManager: Unknown terrain '" + terrain + "'");
|
||||
Log.e("ObjectManager", "Unknown terrain: %s", terrain);
|
||||
}
|
||||
loader.loadAllSnapshots();
|
||||
}
|
||||
List <SWGObject> snapshots = loader.getObjects();
|
||||
for (SWGObject obj : snapshots) {
|
||||
loadSnapshot(obj);
|
||||
}
|
||||
objectMap.putAll(loader.getObjectTable());
|
||||
double loadTime = (System.nanoTime() - startLoad) / 1E6;
|
||||
System.out.printf("ObjectManager: Finished loading %d snapshots. Time: %fms%n", snapshots.size(), loadTime);
|
||||
Log.i("ObjectManager", "Finished loading snapshots. Time: %fms", loadTime);
|
||||
} else {
|
||||
Log.w("ObjectManager", "Did not load snapshots. Reason: Disabled.");
|
||||
System.out.println("ObjectManager: Snapshots not loaded. Reason: Disabled!");
|
||||
private void loadBuildouts(Terrain terrain) {
|
||||
long startLoad = System.nanoTime();
|
||||
System.out.println("ObjectManager: Loading buildouts...");
|
||||
Log.i("ObjectManager", "Loading buildouts...");
|
||||
BuildoutLoader loader = new BuildoutLoader();
|
||||
if (terrain == null)
|
||||
loader.loadBuildoutsForTerrain(terrain);
|
||||
else
|
||||
loader.loadAllBuildouts();
|
||||
List <SWGObject> buildouts = loader.getObjects();
|
||||
for (SWGObject obj : buildouts) {
|
||||
loadBuildout(obj);
|
||||
}
|
||||
objectMap.putAll(loader.getObjectTable());
|
||||
double loadTime = (System.nanoTime() - startLoad) / 1E6;
|
||||
System.out.printf("ObjectManager: Finished loading %d buildouts. Time: %fms%n", buildouts.size(), loadTime);
|
||||
Log.i("ObjectManager", "Finished loading buildouts. Time: %fms", loadTime);
|
||||
}
|
||||
|
||||
private void loadSnapshots(Terrain terrain) {
|
||||
long startLoad = System.nanoTime();
|
||||
System.out.println("ObjectManager: Loading snapshots...");
|
||||
Log.i("ObjectManager", "Loading snapshots...");
|
||||
SnapshotLoader loader = new SnapshotLoader();
|
||||
if (terrain != null)
|
||||
loader.loadSnapshotsForTerrain(terrain);
|
||||
else
|
||||
loader.loadAllSnapshots();
|
||||
List <SWGObject> snapshots = loader.getObjects();
|
||||
for (SWGObject obj : snapshots) {
|
||||
loadSnapshot(obj);
|
||||
}
|
||||
objectMap.putAll(loader.getObjectTable());
|
||||
double loadTime = (System.nanoTime() - startLoad) / 1E6;
|
||||
System.out.printf("ObjectManager: Finished loading %d snapshots. Time: %fms%n", snapshots.size(), loadTime);
|
||||
Log.i("ObjectManager", "Finished loading snapshots. Time: %fms", loadTime);
|
||||
}
|
||||
|
||||
private void loadBuildout(SWGObject obj) {
|
||||
|
||||
Reference in New Issue
Block a user