I think I have a mining script hiding somewhere.
For a brick to respawn after being mined, the following function should be scheduled 10000 milliseconds after the brick is removed. Note that you'll need a brick4x4x2rockdata and a 4x4x2rock.blb.
function RespawnRock(%pos, %color, %Client,%rank)
{
%rock = new FXDTSBrick()
{
datablock = "brick4x4x2rockData";
};
%rock.settransform(%pos);
%rock.client = %client;
%rock.stackBL_ID = %client.bl_id;
%rock.plant();
%rock.setcolor(%color);
%rock.isPlanted = 1;
%rock.rank = %rank;
}
And for your mining script I would use the following. You'll need ore item datablocks however.
I haven't tested it
function MineRock(%this,%obj,%col,%fade,%pos,%normal){
%player = %obj.client.player;
%client = %obj.client;
%rank = %obj.client.miningskill;
if(%col.rank $= ""){
%col.rank= 5;
}
if(%rank $= ""){
%obj.client.rpc_minerank = 1;
%rank = 1;
}
%colData = %col.getDataBlock();
%colDataClass = %colData.classname;
if(%col.getDataBlock().getname() $= "brick4x4x5rockData" || %col.getDataBlock().getname() $= "brick4x4x2rockData"){
%col.totalHits = %col.totalHits + %rank;
if(%col.totalHits >= %col.rank){
schedule(10000, 0, "RespawnRock", %col.getTransform(), %col.getColorID(), %col.client, %col.rank);
%col.killbrick();
if(%client.money $= ""){
%client.money = 0;
}
%random = getRandom(1,3);
switch$(%random-%random2){
case 1:
messageclient(%obj.client, "","\c2You have revealed a chunk of iron ore!");
%trans = vectorAdd(%col.gettransform(), "0 0 2");
%p = new item()
{
datablock = ironore;
};
%p.setTransform(%trans);
case 2:
messageclient(%obj.client, "","\c2You have revealed a chunk of silver ore!");
%trans = vectorAdd(%col.gettransform(), "0 0 2");
%p = new item()
{
datablock = silverore;
};
%p.setTransform(%trans);
case 3:
messageclient(%obj.client, "","\c2You have revealed a chunk of gold ore!");
%trans = vectorAdd(%col.gettransform(), "0 0 2");
%p = new item()
{
datablock = goldore;
};
%p.setTransform(%trans);
}
}
}
Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}