Browse Source

Fix connected blocks not being detected in prefabs

Apparently they're processed, unlike in my save
tags/v1.2.0
NorbiPeti 4 years ago
parent
commit
5660bfc28d
Signed by: NorbiPeti <szatmari.norbert.peter@gmail.com> GPG Key ID: DBA4C4549A927E56
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      GamecraftModdingAPI/Blocks/BlockEngine.cs

+ 11
- 5
GamecraftModdingAPI/Blocks/BlockEngine.cs View File

@@ -39,11 +39,17 @@ namespace GamecraftModdingAPI.Blocks
{
if (!BlockExists(blockID)) return new Block[0];
Stack<uint> cubeStack = new Stack<uint>();
FasterList<uint> cubesToProcess = new FasterList<uint>();
ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID.entityID, cubeStack, cubesToProcess, (in GridConnectionsEntityStruct g) => { return false; });
var ret = new Block[cubesToProcess.count];
for (int i = 0; i < cubesToProcess.count; i++)
ret[i] = new Block(cubesToProcess[i]);
FasterList<uint> cubes = new FasterList<uint>(10);
var coll = entitiesDB.QueryEntities<GridConnectionsEntityStruct>(CommonExclusiveGroups
.OWNED_BLOCKS_GROUP);
for (int i = 0; i < coll.count; i++)
coll[i].isProcessed = false;

ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID.entityID, cubeStack, cubes, (in GridConnectionsEntityStruct g) => { return false; });

var ret = new Block[cubes.count];
for (int i = 0; i < cubes.count; i++)
ret[i] = new Block(cubes[i]);
return ret;
}



Loading…
Cancel
Save