1. Replace the pcblock command by using pcblockmove
2. In Miner World.txt
// This process creates new mines where were exhausted
OnTimer360000: // Each 5 minutes the system check for destroyed mines and re-creates it in new coordinates
set .@tmr,0;
set .@Page,0;
set .@PageSize,10;
freeloop(1);
while (set(.@tot, query_sql("select map, mines, mtypes from mn_maps limit " + .@Page + "," + .@PageSize,.@map$,.@maxm,.@mtypes))) {
for (set .@x,0; .@x < .@tot; set .@x, .@x + 1) {
query_sql "select count(*) from mn_mine where map='" + .@map$[.@x] + "'",.@remain;
while (.@remain[0] < .@maxm[.@x]) {
query_sql "select mclass from mn_class" + (.@mtypes[.@x]==0?"":" where mclass & " + .@mtypes[.@x]) + " order by rand() limit 1",.@nClass;
set .@mx,-1;
while (.@mx<0) {
if (!checkcell (.@map$[.@x],set(.@mx,rand(1,500)),set(.@my,rand(1,500)),cell_chkpass)) set .@mx,-1;
}
// Probabilities of 30% to create a new mine at this pass... or will be created in a future process
if (rand(10) < 3) {
query_sql "insert into mn_mine (created, map, mclass, x, y, size) values (now(), '" + .@map$[.@x] + "'," + .@nClass[0] + "," + .@mx + "," + .@my + "," + rand(3,6) + ")";
debugmes "> Mine System: Creating a new mine in " + .@map$[.@x] + "...";
}
set .@remain[0], .@remain[0] + 1;
}
}
set .@Page, .@Page + .@PageSize;
}
freeloop(0);
initnpctimer;
}