Files

60 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# npc.js — startExplodeCountdown() (satır 214)
[← npc.js](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](startExplodeCountdown-2.md)
```javascript
function startExplodeCountdown(c)
{
var guards = c.getServer().getEntities("@e[type=minecraft:armor_stand,name=" + GUARD_NAME + "]");
if (guards.size() === 0) return 0;
var count = guards.size();
// fitil ateşleme sesi
var w0 = c.getWorld();
for (var i = 0; i < guards.size(); i++)
{
var g0 = guards.get(i);
if (!g0) continue;
var p0 = g0.getPosition();
w0.playSound("minecraft:entity.tnt.primed", p0.x, p0.y + 1, p0.z, 1.5, 1.0);
}
var flame = mappet.getParticleType("flame");
var smoke = mappet.getParticleType("largesmoke");
function tick(ctx, left)
{
var w = ctx.getWorld();
var gs = ctx.getServer().getEntities("@e[type=minecraft:armor_stand,name=" + GUARD_NAME + "]");
// muhafız kalmadıysa geri sayımı iptal et
if (gs.size() === 0)
{
mappet.set("hector_exploding", false);
return;
}
// fitil efekti (patlamaya yaklaştıkça yoğunlaşır)
var n = 4 + Math.floor((COUNTDOWN_TICKS - left) / 8);
for (var i = 0; i < gs.size(); i++)
{
var g = gs.get(i);
if (!g) continue;
var p = g.getPosition();
var hy = p.y + g.getHeight();
w.spawnParticles(flame, true, p.x, hy, p.z, n, 0.25, 0.25, 0.25, 0.02);
w.spawnParticles(smoke, true, p.x, hy + 0.3, p.z, 2, 0.1, 0.1, 0.1, 0.01);
}
// her saniye geri sayım sesi (perde yükselir)
if (left % 20 === 0)
{
var sec = left / 20;
var pitch = 0.5 + (5 - sec) * 0.2;
```