Author Topic: Created Brick Trust Problems  (Read 1338 times)

Well, for a mod I'm making, I use this code:
Code: [Select]
            %newBrick = new fxDTSBrick()
            {
               position = %pos;
               rotation = %rot;
               angleID = %angleID;
               colorID = %colorID;
               colorFXID = %colorFXID;
               shapeFXID = %shapeFXID;
               printID = %printID;
               dataBlock = %datablock;
               isBasePlate = %isBasePlate;
       isPlanted = 1;
               scale = "1 1 1";
               client = %client;
            };
To create a new brick. But for some reason, you can plant another brick inside a brick using this even though Badspot said:
It is implemented in c++ when you call .plant on a brick.
To me asking:
Quote from: Me
I was wondering if you could tell me your method of detecting if a brick being planted is overlapping another brick. I was planning on using a box search, but I wanted to see what you did first so I can do it the right way. How would I do this?

Thanks.
I don't know why .plant isn't detecting overlapping bricks when you plant it. I was trying to use box searches and whatnot, but turns out that Box searches are
Quote from: Orion Ezel at Garage Games
The world has a grid of "bins" overlaid on it, which is used to dramatically speed up proximity searches,
so this is probably returning the first object in the "first" bin which is in the container,
where "first" bin is in bin-order, which, yeah, is probably world-aligned.
So box searches aren't as accurate as I need them to be for this search. If I use a search, if a brick is near, it won't plant because it's in the same "bin" as the search and will think that it's overlapping.

I don't know how I would fix this, or what I'm doing wrong to make the .plant() method not work for detection of Overlapping. Or if Badspot said something that I'm not getting. I don't know what other options I have, so I need some help.

My code is this:
« Last Edit: August 06, 2009, 12:51:40 PM by AGlass0fMilk »

When you call .plant() it should return a number depending on what happens. I think I got this bit of code from the beta forum somewhere.

//0 = plant successful
//1 = blocked by brick
//2 = no attachment points
//3 = blocked by something else
//4 = ground not level (baseplates only)
//5 = burried

Something like %error = %newBrick.plant();
then if(%error == 1) should check if it is overlapping.

Oh so it does return something. Thanks, this will be very useful info even outside of this mod.

Thanks Nit and Chrono.

Chrono your avatar looks like a hat smelling a nacho ever time I glance at it.

I have a new problem, when using this command when hosting an Internet server, the person who uses the command to re-create their brick doesn't get trust for it.

I don't know how to make it so they're trust with it, but I have set it so the Client of the brick is the %client of the server command. But for some reason, this doesn't work.

Without trust this is utterly useless. So I need more help sorting out these trust issues :<

My code is as stated above.

Add the brick to the client's brickgroup.

Oh, that might work.

Would I do it like:  %client.getGroup().add(%brickobject);
?
« Last Edit: August 06, 2009, 02:38:27 PM by AGlass0fMilk »

%client.brickgroup.add(%brickobject);

For some reason now when I add it to the clients brick group, it always says that when you plant a brick near another brick it says it's overlapping >:C

I don't know what could be causing this problem.


For some reason, when I don't do:
Code: [Select]
%newBrick.setTrusted(1);
It does the error described above, but with it, I'm good. But when I do
Code: [Select]
talk(isFunction(setTrusted));
In the console, it says it's not a function. What???

I'll just keep it since it makes it work.
« Last Edit: August 06, 2009, 04:49:22 PM by AGlass0fMilk »

setTrusted is a method...

I was thinking that same thing, but is there a way to see if a method is real?

The ShapeFX ID 2 is water.

Why don't we have a water paint thing? Undulo is close though...
« Last Edit: August 06, 2009, 05:23:10 PM by AGlass0fMilk »

I was thinking that same thing, but is there a way to see if a method is real?
Code: [Select]
talk(isFunction(fxDtsBrick::setTrusted));

I know, I tried that before, but it gave me a syntax error, so I put it in quotes and it said no.

Meh, I don't really need to know.

[any brick].dump(); gives you a list of all its methods and variables.