This was kinda neat. I used getFileCRC() to check if there are any duplicate .dts shapes in my project.
function KitchenCRCs()
{
%fo = new FileObject();
%fo.openforwrite("Add-Ons/Map_Kitchen/crc.txt");
%fo.writeline("CRC CHECK "@getDateTime());
%file = findFirstFile("Add-Ons/Map_Kitchen/shapes/*.dts");
while(isFile(%file))
{
%name = filename(%file);
%crc = getfileCRC(%file);
for(%i=0;%i<%x;%i++)
{
if(%fo.filecrc[%i] == %crc)
{
%colname = %fo.filename[%i];
%col = 1;
}
}
if(!%col)
{
%x++;
%fo.filename[%x] = %name;
%fo.filecrc[%x] = %crc;
}
%fo.writeline(%col ? %name TAB %crc TAB "SAME AS "@%colname : %name TAB %crc);
%col = 0;
%file = findNextFile("Add-Ons/Map_Kitchen/shapes/*.dts");
}
%fo.close();
%fo.delete();
}
Turns out, there are at least two unneeded shapes.
COLKITCHEN.247.dts 1046767046
COLKITCHEN.246.dts -240051424
COLKITCHEN.245.dts -1316678859
...
COLKITCHEN.242.dts 1227677682
COLKITCHEN.241.dts -240051424 SAME AS COLKITCHEN.246.dts
COLKITCHEN.240.dts 671798253
...
COLKITCHEN.431.dts -866669123
COLKITCHEN.430.dts -438330304
COLKITCHEN.429.dts 1247631198
...
COLDRAWERLEFT.049.dts -710672885
COLDRAWERLEFT.048.dts -438330304 SAME AS COLKITCHEN.430.dts
COLDRAWERLEFT.047.dts -903340297
Those shapes are almost exactly the same in blender. The only difference is their position.
So... in the future, if I make a map out of a bunch of similar shapes, I can use this sort of script to check for similar objects, and reduce the file count a little.
It's not perfect though. The file CRC check will detect the difference in vertex order. So if I rotate a cube object by 90 degrees, it will sense that change and declare that the objects are different. Even if they are functionally the same. :c
I also discovered a small difference between TSStatic and StaticShapes. While in a vehicle, StaticShapes do not block camera movement, while TSStatic shapes do.
This may be up to Blockland creating a LOSCollision layer out of the Collision layer when creating a TSStatic shape, or it may just be a difference between how the camera interacts with the two objects.
Because of this I've changed all collision objects to TSStatic, instead of StaticShapes.
Great work Tendon! I can't wait to play.
^-^
I finished the collision on the sink.
I released the collision test version:
https://forum.blockland.us/index.php?topic=309342.0