Author Topic: Brick laying  (Read 1646 times)

Whats the function for planting a brick?

servercmdPlantBrick(%client)


fxDtsBrick::plant(%brick);
fxDtsBrick::onPlant(%data,%brick);

Bricks take time to update the brick tree, so delay a bit before making any operations on the brick. (schedule)

Is there a way to check if its actually been laid without the stuff like overlap and stuff?

Sorry, it was fxDTSBrickData:plant/onPlant.

I think ::plant returns a number whether it had an error, what error it was or not. Try adding package overrides/echos/etc.

Are they functions? As in function fxDTSBrickData:onPlant?

Yes. Put them in a package to check stuff.

Code: [Select]
package noPlant
{
 function fxDTSbrickdata::onPlant(%data,%brick)
 {
  Parent::onPlant(%data,%brick);
  schedule(100,0,brickCheck,%brick);
 }
 function brickCheck(%brick)
 {
  if(!%brick.getGroup().client.isSuperAdmin && $Pref::Server::BricksOff)
  {
   commandtoclient(%brick.getGroup().client,'centerprint',"You must be an admin to place bricks.");
   %brick.killbrick();
  }
 }
 function servercmdBricks(%client)
 {
  if(%client.isSuperAdmin)
  {
   $Pref::Server::BricksOff = !$Pref::Server::BricksOff;
   messageall('',"\c2Non-admin building is now \c3" @ ($Pref::Server::BricksOff ? "OFF" : "ON"));
  }
 }
};
activatePackage(noPlant);

Checks whether the client is a Super admin; deletes brick if it isn't.