Author Topic: Planting a brick regardless of plant errors  (Read 1777 times)

I know of function fxDTSBrick::onPlant(%this) and that it is called when you plant a brick, but how would i force a brick to be planted without errors, mainly meaning overlapping, floating and buried..

Also, would changing the hammerprojectile::OnCollision(%args) to delete floating bricks be effective?


note:
- Did not help
« Last Edit: October 31, 2012, 01:00:30 AM by MARBLE MAN »

Just create a new brick using the data from your ghost brick when you package serverCmdPlantBrick

Just create a new brick using the data from your ghost brick when you package serverCmdPlantBrick
hm, not bad, will do

What are the variables for a %client's ghost brick?

What are the variables for a %client's ghost brick?
%client.player.tempBrick

Also, if you didn't know, on the new brick you'll want to set isPlanted=1; so that it'll still plant on ::plant regardless of errors.
« Last Edit: October 31, 2012, 06:36:21 PM by Trinick »

%client.player.tempBrick

Also, if you didn't know, on the new brick you'll want to set isPlanted=1; so that it'll still plant on ::plant regardless of errors.
Thanks,
would %client.player.tempbrick.getPosition() return the ghost's location?

Thanks,
would %client.player.tempbrick.getPosition() return the ghost's location?
Yup. But you don't need to individually set the variables. You can use parenting to copy the brick.

Code: [Select]
%tempBrick.setName("CopyBrick");
%brick = new fxDTSBrick(CopiedBrick:CopyBrick) { isPlanted = 1; }.setName("");
%tempBrick.setName("");

Then you can do stuff like %brick.setTrusted(1); and %brick.plant(); and add it to the clients brickgroup etc.

Yup. But you don't need to individually set the variables. You can use parenting to copy the brick.

Code: [Select]
%tempBrick.setName("CopyBrick");
%brick = new fxDTSBrick(CopiedBrick:CopyBrick) { isPlanted = 1; }.setName("");
%tempBrick.setName("");

Then you can do stuff like %brick.setTrusted(1); and %brick.plant(); and add it to the clients brickgroup etc.
totally making a teleport to temp brick script now :3
Also, for some reason, it says servercmdplantbrick(%client, %brick) doesnt exist?

Also, for some reason, it says servercmdplantbrick(%client, %brick) doesnt exist?
Post your code.

I'm pretty sure serverCmdPlantBrick only has a client argument

I'm pretty sure serverCmdPlantBrick only has a client argument
Yes it does.

totally making a teleport to temp brick script now :3
Also, for some reason, it says servercmdplantbrick(%client, %brick) doesnt exist?

Package it
.

Post your code.

function serverCmdFPToggle(%client) {
if(isObject(%client.player))
{
      if(%client.isForcePlacing){
         %client.chatmessage("<color:ffffff>ForcePlace is on!");
         %client.isForcePlacing = 0;}
      else {
         %client.chatmessage("<color:ffffff>ForcePlace is off!");
         %client.isForcePlacing = 1;}
   }
}

function fxDTSBrick::onPlant(%brick)
{
if(%client.isForcePlanting)
{
%temp = %client.player.tempBrick;
%temp.setName("CopyBrick");
%brick = new fxDTSBrick(CopiedBrick:CopyBrick)
{
isPlanted = 1;
}.setName("");
%tempBrick.setName("");
}
Parent::servercmdPlantbrick(%brick);
}


 
Package it
I have

I'm pretty sure serverCmdPlantBrick only has a client argument
should i be using
fxDTSBrick::onPlant(%this) ?
^^^ How would i get the client of the brick owner?
« Last Edit: November 01, 2012, 10:43:58 AM by MARBLE MAN »

should i be using
fxDTSBrick::onPlant(%this) ?
No. You shouldn't be, that's your problem.

Code: [Select]
function serverCmdFPToggle(%client) {
if(isObject(%client.player))
{
      if(%client.isForcePlacing){
         %client.chatmessage("<color:ffffff>ForcePlace is on!");
         %client.isForcePlacing = 0;}
      else {
         %client.chatmessage("<color:ffffff>ForcePlace is off!");
         %client.isForcePlacing = 1;}
   }
}

package forcePlant {
function serverCmdPlantBrick(%client)
{
if(%client.isForcePlanting)
{
%temp = %client.player.tempBrick;
%temp.setName("CopyBrick");
%brick = new fxDTSBrick(CopiedBrick:CopyBrick)
{
isPlanted = 1;
}.setName("");
%tempBrick.setName("");
%brick.setTrusted(1);
%brick.plant();
return;
}
Parent::servercmdPlantbrick(%brick);
}
};
activatePackage(forcePlant);

No. You shouldn't be, that's your problem.
Code: [Select]
-snip-
That wont let me place at all?!