44 lines
1.4 KiB
Markdown
44 lines
1.4 KiB
Markdown
# radiation_explosion.js — radiationDamage() (satır 104)
|
||
|
||
[← radiation_explosion.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function radiationDamage(c, world, caster, cx, cy, cz, radius, n)
|
||
{
|
||
var entities = world.getEntities(cx + 0.5, cy + 0.5, cz + 0.5, radius);
|
||
|
||
if (n < RAD_PULSES)
|
||
{
|
||
for (var i = 0; i < entities.size(); i++)
|
||
{
|
||
var e = entities.get(i);
|
||
if (!e.isLivingBase()) continue;
|
||
if (caster !== null && !DAMAGE_CASTER && e.isSame(caster)) continue;
|
||
|
||
e.damage(RAD_PULSE_DAMAGE); // 1x hasar
|
||
greenBurst(world, e); // üstünden yeşil radyasyon çıksın
|
||
}
|
||
|
||
world.playSound("minecraft:block.note.snare", cx, cy, cz, 1.0, 0.5);
|
||
|
||
c.scheduleScript(RAD_PULSE_INTERVAL, function (ctx) {
|
||
radiationDamage(ctx, ctx.getWorld(), caster, cx, cy, cz, radius, n + 1);
|
||
});
|
||
return;
|
||
}
|
||
|
||
// Son darbe — bir anda 500 hasar
|
||
for (var j = 0; j < entities.size(); j++)
|
||
{
|
||
var t = entities.get(j);
|
||
if (!t.isLivingBase()) continue;
|
||
if (caster !== null && !DAMAGE_CASTER && t.isSame(caster)) continue;
|
||
|
||
greenBurst(world, t);
|
||
greenBurst(world, t);
|
||
t.damage(FINAL_DAMAGE);
|
||
}
|
||
world.playSound("minecraft:entity.generic.explode", cx, cy, cz, 3.0, 0.4);
|
||
}
|
||
```
|