61
Modification Help / Brick Buy Done
« on: July 22, 2013, 06:24:49 PM »
I want to prevent people from buying bricks from the B bricks menu. What function do I not parent?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
initContainerRadiusSearch(%startB,5,$TypeMasks::fxBrickObjectType);
%mats = containerSearchNext();
This only gives me the closest one.
//get brick color
%brickRGBA = getColorIDTable(%brick.getColorId());
%r = getWord(%brickRGBA, 0);
%g = getWord(%brickRGBA, 1);
%b = getWord(%brickRGBA, 2);
//echo("brick rgb = " @ %r SPC %g SPC %b);
//echo("brick hsv " @ RGBtoHSV(%r,%g,%b));
%brickH = getWord(RGBtoHSV(%r,%g,%b), 0);
%brickRGB = %r SPC %g SPC %b;
%brickRGB = vectorNormalize(%brickRGB);
//get mat color
%matRGBA = %matColor;
%r = getWord(%matRGBA, 0);
%g = getWord(%matRGBA, 1);
%b = getWord(%matRGBA, 2);
//echo("mat rgb = " @ %r SPC %g SPC %b);
//echo("mat hsv " @ RGBtoHSV(%r,%g,%b));
%matH = getWord(RGBtoHSV(%r,%g,%b), 0);
%matRGB = %r SPC %g SPC %b;
%matRGB = vectorNormalize(%matRGB);
//compare
%hDiff = mAbs(%matH - %brickH);
if(%hDiff > 0.5)
// %hDiff = 1 - %hDiff;
if(%hDiff < 0)
%hDiff = vectorScale(%hDiff,-1);
//echo("hDiff = " @ %hDiff);
bottomPrint(%obj.client,"<font:impact:24><br><br><br><br><color:FFF200><just:right>hDiff = " @ %hDiff SPC "",1);
%obj.isBright=0;
if(%brickRGB $= "1 0 0" || %brickRGB $= "1 0 1" || %brickRGB $= "1 1 1" || %brickRGB $= "0 1 0" || %brickRGB $= "0 1 1" || %brickRGB $= "0 0 1" || %brickRGB $= "0 0 0")
{
echo("isBright");
%obj.isBright=1;
}
isBright only becomes 1 with colors like blue and green, but for black it just doesn't call it.
datablock PlayerData(PlayerCrafting : PlayerStandardArmor)
{
canJet = 0;
canCraft = 1;
uiName = "Crafting Player";
showEnergyBar = false;
};
package CraftAdd
{
function Armor::onAdd(%data,%obj)
{
parent::onAdd(%data,%obj);
if(%data.canCraft)
{
applyDefaultCharacterPrefs(%obj);
talk("found Crafting Player");
}
}
};activatePackage(CraftAdd);
The talk gets called, but the default character prefs part doesn't.