1
Modification Help / Saving Bricks
« on: October 26, 2007, 12:51:55 AM »
This works but freezes on huge builds. Just wondering if anybody could make use of it and/or edit it.
Code: [Select]
datablock itemData(decollideItem)
{
category = "";
className = "";
shapeFile = "base/data/shapes/empty.dts";
mass = 1;
density = 1;
elasticity = 1;
friction = 1;
emap = true;
uiName = "Decollide";
iconName = "";
doColorShift = true;
colorShiftColor = "1 1 1 1";
canDrop = true;
};
function decollideItem::onPickup(%this)
{
return;
}
function decollideItem::onAdd(%this, %object, %continue)
{
if(%continue !$= "true")
{
%this.schedule(100, "onAdd", %this, %object, true);
return;
}
for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
for(%b = 0; %b < mainBrickGroup.getObject(%a).getCount(); %b++)
{
if(mainBrickGroup.getObject(%a).getObject(%b).item == %object)
{
mainBrickGroup.getObject(%a).getObject(%b).setColliding(true);
}
}
}
}
function decollideItem::onRemove(%this, %object)
{
if(%continue !$= "true")
{
%this.schedule(100, "onRemove", %this, %object, true);
return;
}
for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
for(%b = 0; %b < mainBrickGroup.getObject(%a).getCount(); %b++)
{
if(mainBrickGroup.getObject(%a).getObject(%b).item == %object)
{
mainBrickGroup.getObject(%a).getObject(%b).setColliding(false);
}
}
}
}