Author Topic: Creating bricks via .save() and exec()  (Read 1570 times)

Code: [Select]
function Chunky::loadChunk(%this, %id)
{
announce("calling load" SPC %id);
%file = strreplace(%id, " ", "/");
%id = strreplace(%id, " ", "_");
%id = strreplace(%id, "-", "_");
if(%id $= "")
{
return false;
}

%seed = $Blockscape::Perlin.seed;
if(%seed $= "")
{
BS_createPerlin();
%seed = $Blockscape::Perlin.seed;
if(%seed $= "")
{
error("Chunky::loadChunk(int id): Unable to fetch perlin seed");
return;
}
}

announce("seed is" SPC %seed);

%file = "base/server/blockscape/chunky/" @ %seed @ "/" @ %file @ ".cs";
if(!isFile(%file))
{
return false;
}

announce("file is" SPC %file);

exec(%file);

%obj = "Chunky_Chunk_" @ %id;

announce("obj is" SPC %obj);

if(isObject(%obj))
{
%obj.chainMethodCall("setTrusted", 1);
%obj.chainMethodCall("plant");

announce("yep, it's defo an object mang");

return true;
}
return false;
}

The file executed is a standard output of .save()

Code: [Select]
//--- OBJECT WRITE BEGIN ---
new ScriptGroup(Chunky_Chunk_2_1) {
      chain_schedule = "61235";

   new fxDTSBrick() {
      position = "64 32 20000";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "BrickBlockscapeData";
      angleID = "0";
      colorID = "49";
      printID = "0";
      colorFxID = "0";
      shapeFxID = "0";
      isBasePlate = "0";
      isPlanted = "1";
      client = "-1";
      stackBL_ID = "888888";
         maxDamage = "10";
         blockType = "Cobblestone";
   };
...

Everything in the .loadChunk() code is announced as supposed to.

SimGroup::chainMethodCall() is by Greek2Me.

The bricks created seem to have failing collision hat only works like 3% of the time. The rest of the time you just slip through.
« Last Edit: April 13, 2014, 03:21:53 AM by Subpixel »

The bricks created seem to have failing collision hat only works like 3% of the time. The rest of the time you just slip through.

I've found this happen when you create a brick that isn't correctly on the brick-grid. All the clients thinks the brick is there, but it isn't there on the server, so you stand on it, the client-sided prediction code makes you land on it, then you just teleport through as if you never landed on it.

does chainmethodcall have any scheduling? some weird things like this can happen if you try to do anything with too many bricks at once

does chainmethodcall have any scheduling? some weird things like this can happen if you try to do anything with too many bricks at once

No, I've had the same problem before: http://forum.blockland.us/index.php?topic=249201.0

Never found a solution.

Locking. I created my own compact format, works great.