1.5 KiB
1.5 KiB
Darklord.js — restoreDomainBatch() (satır 2447)
function restoreDomainBatch(world, domain)
{
if (!domain.saved || domain.saved.length === 0)
{
domain.active = false;
domain.closing = false;
domain.plan = [];
domain.saved = [];
domain.savedMap = {};
domain.participants = {};
return true;
}
if (domain.restoreIndex === undefined || domain.restoreIndex === null || isNaN(Number(domain.restoreIndex)))
{
domain.restoreIndex = domain.saved.length - 1;
}
var changed = 0;
while (Number(domain.restoreIndex) >= 0 && changed < DOMAIN_RESTORE_BATCH)
{
var b = domain.saved[Number(domain.restoreIndex)];
domain.restoreIndex = Number(domain.restoreIndex) - 1;
if (!b) continue;
restoreBloodBlock(world, b);
if ((changed & 15) === 0) spawnDomainCloseFx(world, b.x, b.y, b.z);
changed++;
}
if (Number(domain.restoreIndex) < 0)
{
domain.active = false;
domain.closing = false;
domain.plan = [];
domain.saved = [];
domain.savedMap = {};
domain.participants = {};
play(world, "minecraft:block.beacon.deactivate", domain.x, domain.y + 2.0, domain.z, 1.0, 0.58);
play(world, "minecraft:block.glass.break", domain.x, domain.y + 2.0, domain.z, 0.8, 0.42);
}
return changed > 0;
}