Author Topic: Container box searches?  (Read 1631 times)

Code: [Select]
      %pos = %plantedBrick.getPosition();

      %box = "32.1 32.1 0.1";

      %mask = $TypeMasks::FxBrickAlwaysObjectType;



      %plantX = getWord(%plantedBrick.getPosition(), 0);

      %plantY = getWord(%plantedBrick.getPosition(), 1);



      initContainerBoxSearch(%pos, %box, %mask);

   while (%searchObj = containerSearchNext())

   {

         if(%searchObj.getDataBlock().getID() != brick64x64fData.getID())

            continue;



         if(%searchObj.getDistanceFromGround() != 0)

            continue;



         if(!%searchObj.isPlanted())

            continue;

         

         if(%searchObj.isDead())

            continue;



         if(%searchObj == %plantedBrick)

            continue;



         //To be lined up, the x or y position must be the same

         %searchX = getWord(%searchObj.getPosition(), 0);

         %searchY = getWord(%searchObj.getPosition(), 1);



         if(mAbs(%searchX - %plantX) < 0.05 ||               // Note: We compare with subtraction like this because direct comparison with "==" on floating point numbers is not reliable

            mAbs(%searchY - %plantY) < 0.05 )

            return;

From what I understand, the box is 32.1 x 32.1 x .1.  Converted to studs, that's 16.02 x 16.02 x ~.15.  Now, how exactly does this work - since we're dealing with 64x baseplates, wouldn't it be 128.1 x 128.1 x .2?  I don't quite see how this works.

What exactly is your problem? You might want to look at Badspot's Terrain Build rules code. Tell me your problem!

Well I don't quite understand how the boxes are sized - see bottom of my post.  And that is his code in my post.