Files

1.3 KiB
Raw Permalink Blame History

alan2.js — runShockwave() (satır 231)

← alan2.js · ← Master

function runShockwave(c) {
    var world = c.getWorld();
    var radius = c.getValue("shockwaveRadius");
    var cx = c.getValue("hitCx");
    var cy = c.getValue("hitCy");
    var cz = c.getValue("hitCz");

    if (radius === null || cx === null || cy === null || cz === null) {
        return;
    }

    var maxRadius = AREA_CONFIG.MAX_RADIUS + 5.0;
    if (radius > maxRadius) {
        return;
    }

    var p1 = AREA_CONFIG.PARTICLE_EXPLODE_1;
    var p2 = AREA_CONFIG.PARTICLE_EXPLODE_3;

    var count = Math.floor(radius * 6.0);
    if (count > 220) count = 220;

    for (var i = 0; i < count; i++) {
        var angle = (i / count) * 2.0 * Math.PI;
        var px = cx + radius * Math.cos(angle);
        var pz = cz + radius * Math.sin(angle);

        spawnAreaParticle(world, p1, px, cy + 0.15, pz, 1, 0, 0, 0, 0);
        if (Math.random() < 0.35) {
            spawnAreaParticle(world, p2, px, cy + 0.15, pz, 1, 0, 0, 0, 0);
        }
    }

    if (Math.floor(radius) % 8 === 0) {
        world.playSound("minecraft:entity.enderdragon.flap", cx, cy, cz, 2.5, 1.1);
    }

    c.setValue("shockwaveRadius", radius + 4.5);
    c.scheduleScript("runShockwave", 1);
}