1.8 KiB
1.8 KiB
radiation_explosion.js — destroyShell() (satır 156)
← radiation_explosion.js · ← Master
function destroyShell(c, world, shells, saved, cx, cy, cz, r)
{
if (r > BLAST_RADIUS) return;
var cells = shells[r];
for (var i = 0; i < cells.length; i++)
{
var x = cells[i][0], y = cells[i][1], z = cells[i][2];
var block = world.getBlock(x, y, z);
if (block === null) continue; // chunk yüklü değil
if (block.isAir()) continue; // zaten hava
// Yedekle (geri getirmek için)
var rec = { x: x, y: y, z: z, id: block.getBlockId(), meta: block.getMeta(), tile: null };
if (world.hasTileEntity(x, y, z))
{
var te = world.getTileEntity(x, y, z);
if (te !== null) rec.tile = te.getData().stringify();
}
saved[r].push(rec);
// Efektli yok et: az sayıda blok enkaz olarak yukarı fırlasın
if (Math.random() < DEBRIS_CHANCE)
{
var fb = world.summonFallingBlock(x + 0.5, y + 0.5, z + 0.5, rec.id, rec.meta);
if (fb !== null)
{
fb.addMotion((Math.random() - 0.5) * 0.6, 0.4 + Math.random() * 0.5, (Math.random() - 0.5) * 0.6);
}
}
world.removeBlock(x, y, z);
}
// Bu kabuğun yüzeyinde patlama + yeşil parçacık (sadece dış yüzeyde, performans için)
ringParticles(world, cx, cy, cz, r);
if (r % 4 === 0)
world.playSound("minecraft:entity.generic.explode", cx, cy, cz, 4.0, 0.6 + r * 0.02);
// Bir sonraki kabuğu bir tick sonra
c.scheduleScript(1, function (ctx) {
destroyShell(ctx, ctx.getWorld(), shells, saved, cx, cy, cz, r + 1);
});
}