Skip to content

Commit

Permalink
Added check whether an asteroid with a given Entity ID already exists.
Browse files Browse the repository at this point in the history
It wont be generated if another asteroid with the same id already exists.
  • Loading branch information
thorwin99 committed May 21, 2022
1 parent fab1a42 commit 51a4b0c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ public override void GenerateLoadedCellObjects()
MyGamePruningStructure.GetAllVoxelMapsInBox(ref bounds, tmp_voxelMaps);

string storageName = string.Format("Asteroid_{0}_{1}_{2}_{3}_{4}", seed.CellId.X, seed.CellId.Y, seed.CellId.Z, seed.Params.Index, seed.Params.Seed);
long id = GetAsteroidEntityId(storageName);

if (MyEntities.EntityExists(id)) continue;

bool exists = false;
foreach(var tmp in tmp_voxelMaps)
Expand Down Expand Up @@ -179,7 +182,7 @@ public override void GenerateLoadedCellObjects()

MyVoxelMap voxelMap;

voxelMap = MyWorldGenerator.AddVoxelMap(storageName, storage, pos, GetAsteroidEntityId(storageName));
voxelMap = MyWorldGenerator.AddVoxelMap(storageName, storage, pos, id);
if (voxelMap == null) continue;

MyVoxelBase.StorageChanged del = null;
Expand Down

0 comments on commit 51a4b0c

Please sign in to comment.