private List <Entity> SpawnEntities(List <EntitySpawnPoint> entitySpawnPoints, DeterministicBatchGenerator deterministicBatchGenerator, Entity parentEntity = null) { List <Entity> entities = new List <Entity>(); foreach (EntitySpawnPoint esp in entitySpawnPoints) { if (esp.Density > 0) { List <UwePrefab> prefabs = prefabFactory.GetPossiblePrefabs(esp.BiomeType); if (prefabs.Count > 0) { entities.AddRange(SpawnEntitiesUsingRandomDistribution(esp, prefabs, deterministicBatchGenerator, parentEntity)); } else if (esp.ClassId != null) { entities.AddRange(SpawnEntitiesStaticly(esp, deterministicBatchGenerator, parentEntity)); } } } return(entities); }
public List <Entity> LoadUnspawnedEntities(Int3 batchId) { lock (parsedBatches) { if (parsedBatches.Contains(batchId)) { return(new List <Entity>()); } parsedBatches.Add(batchId); } DeterministicBatchGenerator deterministicBatchGenerator = new DeterministicBatchGenerator(batchId); List <Entity> entities = new List <Entity>(); List <EntitySpawnPoint> spawnPoints = batchCellsParser.ParseBatchData(batchId); foreach (EntitySpawnPoint esp in spawnPoints) { if (esp.Density > 0) { List <UwePrefab> prefabs = prefabFactory.GetPossiblePrefabs(esp.BiomeType); if (prefabs.Count > 0) { entities.AddRange(SpawnEntitiesUsingRandomDistribution(esp, prefabs, deterministicBatchGenerator)); } else if (esp.ClassId != null) { entities.AddRange(SpawnEntitiesStaticly(esp, deterministicBatchGenerator)); } } } if (entities.Count == 0) { lock (emptyBatches) { emptyBatches.Add(batchId); } } else { Log.Info("Spawning " + entities.Count + " entities from " + spawnPoints.Count + " spawn points in batch " + batchId); } return(entities); }