Author Topic: Toppling entire structures with fakeKillBrick.  (Read 848 times)

Correct me if I'm wrong, but shouldn't there be a way to fake kill entire structures, possibly from the baseplate upwards? If there is a way, would it be laggy at all? I mean, certainly, if there are a good amount of bricks, I mean just in general.

It wouldn't be laggy server-side at all, it'd just be a simple loop.
You might see what exactly this does:
fxDtsBrick::getUpBrick(%brick, %index) - Returns up brick at given index.

It wouldn't be laggy server-side at all, it'd just be a simple loop.
You might see what exactly this does:
fxDtsBrick::getUpBrick(%brick, %index) - Returns up brick at given index.
ah yes i had known about getUpBrick but hadn't known what exactly the arguments were.


okay, I think I understand fairly well, I'll try that out. thanks!

edit:
the way i'm doing it is doing is doing a loop for getNumUpBricks and doing fakekill on each object getUpBrick is returning. it's only of course doing the bricks that are literally right atop the brick. that was expected, though.

what can i do to completely topple it efficiently, or am i missing something
« Last Edit: August 29, 2011, 10:14:56 PM by otto-san »

Make sure you recurse all the way up the structure before you start killing things, that might help.

Make sure you recurse all the way up the structure before you start killing things, that might help.
I may just be too tired to think, but this is the code I have right now.

Code: [Select]
function testTopple(%obj) { if(%obj.getClassName() $= "fxDTSBrick") { for(%i = 0; %i < %obj.getNumUpBricks(); %i++) { %obj.getUpBrick(%i).fakeKillBrick("0 0 0", 15); } } }

I helped him on ietherpad

I may just be too tired to think, but this is the code I have right now.

Code: [Select]
function testTopple(%obj) { if(%obj.getClassName() $= "fxDTSBrick") { for(%i = 0; %i < %obj.getNumUpBricks(); %i++) { %obj.getUpBrick(%i).fakeKillBrick("0 0 0", 15); } } }

Up bricks are only the bricks that are touching a brick on top.  This is what I did for my Client_Duplicator:


Code: [Select]
for(%a=0; %a<buildbot_SavingSO.brickcount; %a++)
{
if(%a >= $buildbot::maxdup)
{
buildbot_SavingSO.brickcount = %a;
break;
}
%homebrick = buildbot_SavingSO.brick[%a];

if(%a) //don't want to get bricks below first one.
{
for(%b=0; %b<%homebrick.getnumdownbricks(); %b++)
{
%testbrick = %homebrick.getdownbrick(%b);

if(buildbot_SavingSO.brickid[%testbrick] $= "")
{
buildbot_SavingSO.brick[buildbot_SavingSO.brickcount] = %testbrick;
buildbot_SavingSO.brickid[%testbrick] = true;
buildbot_SavingSO.brickcount++;
}
}
}

for(%b=0; %b<%homebrick.getnumupbricks(); %b++)
{
%testbrick = %homebrick.getupbrick(%b);

if(buildbot_SavingSO.brickid[%testbrick] $= "")
{
buildbot_SavingSO.brick[buildbot_SavingSO.brickcount] = %testbrick;
buildbot_SavingSO.brickid[%testbrick] = true;
buildbot_SavingSO.brickcount++;
}
}
}

To adapt this code, you would the loop through all the bricks that were added to buildbot_savingso and fake kill them.

I was adapting it into something that looks similar to that. Thanks to the both of you.

It won't be laggy unless it's a massive structure, and note that there's a limit to the amount of fake killed bricks that will have physics applied to them.

It won't be laggy unless it's a massive structure, and note that there's a limit to the amount of fake killed bricks that will have physics applied to them.
Wasn't it 400? Let me double check.

Edit: Close.

$pref::Physics::MaxBricks = 300;
This is what it gets set to when you set it to 'best'.
I'm not sure if tweaking this would do anything.
« Last Edit: August 30, 2011, 10:17:19 AM by Chrono »

ah, i had forgotten about that limit.

i play with physics off, so i guess i just hadn't noticed yet.