Author Topic: How do I make it so that a brick can't be painted?  (Read 1442 times)

^ Also how do I pre-set a brick's color?

to make it so that the brick can't be painted, tinker with this function in packaging

Code: [Select]
function PaintProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
for example:

Code: [Select]
package blah {
  function PaintProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
  {
    if(%col.getClassName() == fxDTSBrick && %col.colorID == 0)
    {
      return;
    }
    Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
  }
};

^ above code makes it so that red bricks (or whatever bricks with the first paint color) can't be recolored.
i'm a bit busy right now, so i can't test it for you sorry, but if anything goes wrong then it shouldn't be hard to fix

No I mean a specific brick.

No I mean a specific brick.
He gave you the function and an example of what you need to do already, what more do you need?
Hint: %col.getDatablock()
$= not ==
>.>

So instead of the colorID thing, do I do if(%col.getClassName() == fxdtsbrick && %col.getDatablock() $= "Brick")

?

Change "Brick" to your brick's datablock name (assuming you only want one brick that's unpaintable) and yeah
And you can get rid of the classname check
« Last Edit: February 07, 2015, 10:50:58 PM by Headcrab Zombie »

Change "Brick" to your brick's datablock name (assuming you only want one brick that's unpaintable) and yeah
No. Do if(%col.getDatablock().getName() $= "Brick") and then change "Brick" To your brick's datablock name. Just doing .getDatablock() will give you the datablocks ID. You have to do .getDataBlock().getName().

It makes a lot more sense to package fxDTSBrick::setColor, so that you cant set its color by events either. However if you want to be able to modify the color later in scripts, you'll need to make a work around.

It makes a lot more sense to package fxDTSBrick::setColor, so that you cant set its color by events either.

This is what I was going to say. Simply package fxDTSBrick::setColor(%this, %colorID) and check if %this is unpaintable and return.