Fix connected blocks not being detected in prefabs

Apparently they're processed, unlike in my save
This commit is contained in:
Norbi Peti 2020-06-03 01:49:54 +02:00
parent dba7c0a46f
commit 5660bfc28d
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

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;
}