Author Topic: What happened to fxDTSbrick::onPlant()??????? - Solved. It was the gamemode sys.  (Read 903 times)

It doesn't seem to exist anymore. I packaged it like I used to do but now the code doesn't seem to be called even with just an echo.

Code: [Select]
package blahblah{
function fxDTSbrick::onPlant(%this) {
Parent::onPlant(%this);
echo(%this @ " and that");
}
};
activatePackage(blahblah);

Plant a brick anywhere and no echo. Use trace(1); and onPlant() is never called!
« Last Edit: January 01, 2016, 08:51:03 AM by Pastrey Crust »

Try FxDTSBrickData::onPlant


You are not executing your code properly or some other add-on is (somehow) messing it up. These definitely still exist.

Ended up using fxDTSbrick::onLoadPlant(%this);

onPlant doesn't exist anymore. I am certain that I'm executing the code properly.

Ended up using fxDTSbrick::onLoadPlant(%this);

onPlant doesn't exist anymore. I am certain that I'm executing the code properly.

onPlant is and has always been (well, for years) only for bricks that are planted directly (not by loading).

Code: [Select]
Window reactivating...
Window reactivating...
==>deactivatePackage(MeinPackage);
De-activating package: MeinPackage
Pie Crust: Planting a brick. 2x4.
==>trace(1);
   Console trace is on.
Leaving ConsoleEntry::eval() - return
Entering toggleConsole(1)
   Entering [ORBS_Modules_Client_ConnectClient]Canvas::popDialog(Canvas, ConsoleDlg)
      Entering [CanvasCursor]GuiCanvas::popDialog(Canvas, ConsoleDlg)
         Entering [lob_client]GuiControl::onSleep(8389)
         Leaving [lob_client]GuiControl::onSleep() - return
         Entering [lob_client]GuiControl::onSleep(8388)
         Leaving [lob_client]GuiControl::onSleep() - return
         Entering [lob_client]GuiControl::onSleep(8390)
         Leaving [lob_client]GuiControl::onSleep() - return
         Entering [lob_client]GuiControl::onSleep(8387)
         Leaving [lob_client]GuiControl::onSleep() - return
         Entering [lob_client]GuiControl::onSleep(8386)
         Leaving [lob_client]GuiControl::onSleep() - return
         Entering [CanvasCursor]GuiCanvas::checkCursor(Canvas)
            Entering cursorOff()
            Leaving cursorOff() - return
            Entering [CanvasCursor]GuiCanvas::checkTabFocus(Canvas)
            Leaving [CanvasCursor]GuiCanvas::checkTabFocus() - return
         Leaving [CanvasCursor]GuiCanvas::checkCursor() - return
      Leaving [CanvasCursor]GuiCanvas::popDialog() - return
      Entering ORBSCC_NotificationManager::refocus(ORBSCC_NotificationManager)
      Leaving ORBSCC_NotificationManager::refocus() - return
   Leaving [ORBS_Modules_Client_ConnectClient]Canvas::popDialog() - return
Leaving toggleConsole() - return
Entering toggleConsole(0)
Leaving toggleConsole() - return 1743416
Entering [buildbot]plantBrick(1)
   Entering plantBrick(1)
   Leaving plantBrick() - return
Leaving [buildbot]plantBrick() - return
Entering [Duplorcator]servercmdPlantBrick(23626)
   Entering servercmdPlantBrick(23626)
      Entering fxDTSBrick::onAdd(27473)
      Leaving fxDTSBrick::onAdd() - return
      Entering [Duplorcator]fxDTSBrick::setTransform(27473, -5.5 2 0.3 0 0 1 1.5708)
      Leaving [Duplorcator]fxDTSBrick::setTransform() - return 27473
      Entering fxDTSBrick::onColorChange(27473)
         Entering fxDTSBrickData::onColorChange(211, 27473)
         Leaving fxDTSBrickData::onColorChange() - return 211
      Leaving fxDTSBrick::onColorChange() - return 211
      Entering fxDTSBrick::onLoadPlant(27473)
      Leaving fxDTSBrick::onLoadPlant() - return
      Entering QueueSO::push(25816, 27473^PLANT)
      Leaving QueueSO::push() - return 25816
      Entering fxDTSBrick::trustCheckFinished(27473)
      Leaving fxDTSBrick::trustCheckFinished() - return
      Entering ServerPlay3D(brickPlantSound, -5.5 2 0.3 0 0 1 1.5708)
      Leaving ServerPlay3D() - return
   Leaving servercmdPlantBrick() - return 27473
Leaving [Duplorcator]servercmdPlantBrick() - return 27473
Entering [buildbot]plantBrick(0)
   Entering plantBrick(0)
   Leaving plantBrick() - return 0
Leaving [buildbot]plantBrick() - return 0
Entering repeatBrickPlant(59)
Leaving repeatBrickPlant() - return 0
Entering toggleConsole(1)
   Entering [GlassUpdaterSupportPackage]Canvas::pushDialog(Canvas, ConsoleDlg)
      Entering [ORBS_Modules_Client_ConnectClient]Canvas::pushDialog(Canvas, ConsoleDlg)
         Entering [CanvasCursor]GuiCanvas::pushDialog(Canvas, ConsoleDlg)
            Entering [CanvasCursor]GuiCanvas::checkCursor(Canvas)
               Entering cursorOn()
               Leaving cursorOn() - return
               Entering [CanvasCursor]GuiCanvas::checkTabFocus(Canvas)
               Leaving [CanvasCursor]GuiCanvas::checkTabFocus() - return
            Leaving [CanvasCursor]GuiCanvas::checkCursor() - return
         Leaving [CanvasCursor]GuiCanvas::pushDialog() - return
         Entering ORBSCC_NotificationManager::refocus(ORBSCC_NotificationManager)
         Leaving ORBSCC_NotificationManager::refocus() - return
      Leaving [ORBS_Modules_Client_ConnectClient]Canvas::pushDialog() - return
   Leaving [GlassUpdaterSupportPackage]Canvas::pushDialog() - return
Leaving toggleConsole() - return
Entering toggleConsole(0)
Leaving toggleConsole() - return 1744974
Entering GameConnection::spamMessageTimeout(23626)
Leaving GameConnection::spamMessageTimeout() - return 0
Entering ConsoleEntry::eval()
   ==>trace(0);
Console trace is off.
Window reactivating...
Window reactivating...



You're obviously doing something wrong.

::onLoadPlant is called instead of ::onPlant if $Server_LoadFileObj is set to your brick.

asdf you're right. With a plain "vanilla" game, it indeed calls onPlant. I wonder why it would call onLoadPlant() with the gamemode. Does making a new brick script-wise have anything to do with it?

You'll have to post said code.

Code: [Select]
function buildStructure(%brick, %rotation, %number, %client, %ghost) {
if(!isObject(%brick.getDatablock().structure)) { echo("Structural-less base!"); return; }
%structure = %brick.getDatablock().structure;
if(%structure.noRot)
%rotation = 0;
echo("Structure " @ %structure.complexBuild[%number, %rotation]);
%data = getField(%structure.complexBuild[%number, %rotation], 0);
%rx = getField(%structure.brick[%number, %rotation], 1);
%ry = getField(%structure.brick[%number, %rotation], 2);
%rz = getField(%structure.brick[%number, %rotation], 3);
%ro1 = getField(%structure.brick[%number, %rotation], 4);
%ro2 = getField(%structure.brick[%number, %rotation], 5);
%ro3 = getField(%structure.brick[%number, %rotation], 6);
%ro4 = getField(%structure.brick[%number, %rotation], 7);
%col = getField(%structure.brick[%number, %rotation], 8);
//echo("Data");

%colfx = getField(%structure.complexBuild[%number, %rotation], 9);
%printID = getField(%structure.complexBuild[%number, %rotation], 10);

%newbrick = new fxDTSBrick() {
dataBlock = %data;
scale = "1 1 1";
client = %client;
stackBL_ID = %client.BL_ID;
angleID = "0";
colorID = %col;
colorFXID = %colfx;
printID = %printid;
shapeFXID = "0";
rotation = %ro1 SPC %ro2 SPC %ro3 SPC %ro4;
};
%pos = strreplace(%brick.getposition(), " ", "\t");
%bx = getField(%pos,0);
%by = getField(%pos,1);
%bz = getField(%pos,2);
%newbrick.setTransform(%bx+%rx SPC %by+%ry SPC %bz+%rz SPC %ro1 SPC %ro2 SPC %ro3 SPC %ro4);
if(!%ghost) {
%newbrick.plant();
%newbrick.setTrusted(1);
}
%newbrick.parent = %brick;
%brick.children[0] = %brick.children[0] + 1;
%brick.children[%number] = %newBrick;
%client.brickGroup.add(%newbrick);
if(!%ghost)
schedule(0,0,"removeGhost",%newbrick);
%number = %number + 1;
if(%number < %structure.complexBuild[0])
schedule(0,0,"buildStructure",%brick,%rotation,%number,%client,%ghost);
}

Then I've got this package:

Code: [Select]
package MeinPackage{

function fxDTSbrickData::onPlant(%brick) {
Parent::onPlant(%brick);
%client = %brick.getGroup().client;
echo("Brick is " @ %brick @ "; Client is " @ %client);
destroyChildren(%brick);
if(isObject(%brick.getDatablock().structure)) {
plantStruct(%brick,%client);
%brick.setColor(%brick.dataBlock.structure.baseCol);
}
}

function fxDTSbrick::onLoadPlant(%this) {
Parent::onLoadPlant(%this);
echo("Brick planted!");
%client = %this.getGroup().client;
echo("Brick is " @ %this @ "; Client is " @ %client);
destroyChildren(%this);
if(isObject(%this.getDatablock().structure)) {
plantStruct(%this,%client);
%this.setColor(%this.dataBlock.structure.baseCol);
}
}

function brickDeployProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal) {
Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
%client = %obj.client;
%player = %client.player;
%tmpBrick = %player.tempBrick;
destroyChildren(%tmpbrick);
if(isObject(%tmpbrick.getDatablock().structure)) {
if(%tmpBrick.rotation $= "1 0 0 0") {
%rt = 0;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == -1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 1;
} else if(%tmpBrick.rotation $= "0 0 1 180") {
%rt = 2;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == 1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 3;
}
%client.structureRotation = %rt;
//echo("Tempbrickdasd = " @ %tmpBrick);
buildStructure(%tmpBrick,%rt,1,%client, true);
}
}

function serverCmdShiftBrick(%client,%shiftx,%shifty,%shiftz) {
Parent::serverCmdShiftBrick(%client,%shiftx,%shifty,%shiftz);
%tmpBrick = %client.player.tempBrick;
//echo("Shifting Brick." SPC %tmpBrick);
destroyChildren(%tmpbrick);
if(%tmpBrick.getDatablock().structural) {
buildStructure(%tmpBrick,%rt,1,%client, true);
}
}

function serverCmdSuperShiftBrick(%client,%shiftx,%shifty,%shiftz) {
Parent::serverCmdSuperShiftBrick(%client,%shiftx,%shifty,%shiftz);
%tmpBrick = %client.player.tempBrick;
destroyChildren(%tmpbrick);
if(%tmpBrick.getDatablock().structural) {
buildStructure(%tmpBrick,%rt,1,%client, true);
}
}

function fxDTSBrick::setDatablock(%this,%data) {
Parent::setDatablock(%this,%data);
%client = %this.getGroup().client;
%tmpBrick = %this;
destroyChildren(%tmpbrick);
if(%tmpBrick.getDatablock().structural) {
if(%tmpBrick.rotation $= "1 0 0 0") {
%rt = 0;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == -1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 1;
} else if(%tmpBrick.rotation $= "0 0 1 180") {
%rt = 2;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == 1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 3;
}
%client.structureRotation = %rt;
buildStructure(%tmpBrick,%rt,1,%client, true);
}
}

function servercmdRotateBrick(%client,%side) {
Parent::serverCmdRotateBrick(%client,%side);
%player = %client.player;
%tmpBrick = %player.tempBrick;
destroyChildren(%tmpbrick);
if(%tmpBrick.getDatablock().structural) {
if(%tmpBrick.rotation $= "1 0 0 0") {
%rt = 0;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == -1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 1;
} else if(%tmpBrick.rotation $= "0 0 1 180") {
%rt = 2;
} else if(getField(strreplace(%tmpBrick.rotation," ", "\t"),2) == 1 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) > 89 && getField(strreplace(%tmpBrick.rotation," ", "\t"),3) < 91) {
%rt = 3;
}
%client.structureRotation = %rt;
buildStructure(%tmpBrick,%rt,1,%client, true);
}
}

function fxDTSBrick::onRemove(%id) {
destroyChildren(%id);
Parent::onRemove(%id);
}
};
activatePackage(MeinPackage);

With this enabled or disabled, it will call onLoadPlant() when planting any brick. With it enabled, it calls onLoadPlant() when planting any brick.

Do you have $Server_LoadFileObj set to something when this code runs?

No and I don't even know what it is.

Well put something to check whether it's set to something??

30317 but that isn't any block ID.