Block City uses a relatively simple brick detection system to determine if a baseplate is next one that is trying to be planted so that lots are not mis-aligned. This current alignment system works but with an issue I am unable to determine. All baseplates can properly detect if other baseplates are on their sides except for the 64x64 Baseplate when it attempts to see if loaded baseplates are next to it. The 64x64 baseplate has no problem detecting if other baseplates are next to it if they were just planted and only occurs with loaded save baseplates. No other baseplate has this issue as well.
Any help would be appreciated.
function fxDTSBrick::getSurroundingBaseplateCount(%brick)
{
%hitCount = 0;
%sizex = %brick.getDatablock().bricksizex;
%sizey = %brick.getDatablock().bricksizey;
%startPos = posFromTransform(%brick.getTransform());
%lengthy = ((%sizey / 2) / 2) + 0.1;
%lengthx = ((%sizex / 2) / 2) + 0.1;
//Y+
%endPos = vectorAdd(%startPos,"0" SPC %lengthy SPC "0");
%object = firstWord(containerRaycast(%startPos,%endPos,$TypeMasks::FxBrickAlwaysObjectType,%brick));
if(isObject(%object))
{
%hitCount++;
}
//Y-
%endPos = vectorSub(%startPos,"0" SPC %lengthy SPC "0");
%object = firstWord(containerRaycast(%startPos,%endPos,$TypeMasks::FxBrickAlwaysObjectType,%brick));
if(isObject(%object))
{
%hitCount++;
}
//X+
%endPos = vectorAdd(%startPos,%lengthx SPC "0 0");
%object = firstWord(containerRaycast(%startPos,%endPos,$TypeMasks::FxBrickAlwaysObjectType,%brick));
if(isObject(%object))
{
%hitCount++;
}
//X-
%endPos = vectorSub(%startPos,%lengthx SPC "0 0");
%object = firstWord(containerRaycast(%startPos,%endPos,$TypeMasks::FxBrickAlwaysObjectType,%brick));
if(isObject(%object))
{
%hitCount++;
}
return %hitCount;
}