1.2 KiB
1.2 KiB
Darklord.js — bloodSpreadLoop() (satır 1234)
function bloodSpreadLoop(c, ownerName, runId, tick)
{
var pool = getBloodPool(ownerName);
if (!pool || !pool.active) return;
if (getBloodPoolRun(ownerName) !== Number(runId)) return;
var world = c.getWorld();
var changed = false;
if (pool.restoring)
{
changed = restoreBloodSpreadBatch(world, pool);
if (!pool.active)
{
setBloodPool(ownerName, pool);
return;
}
}
else if (!pool.spreadDone)
{
changed = spreadBloodBatch(world, pool);
if (pool.spreadDone)
{
pool.holdUntil = pool.permanent ? 9999999999999 : nowMs() + Number(pool.durationMs || BLOOD_POOL_LIFE_MS);
}
}
else if (!pool.permanent && Number(pool.holdUntil || 0) <= nowMs())
{
pool.restoring = true;
changed = true;
}
spawnBloodPool(world, pool, tick);
if (changed || tick % 8 === 0) setBloodPool(ownerName, pool);
c.scheduleScript(BLOOD_POOL_LOOP_TICKS, function(ctx) {
bloodSpreadLoop(ctx, ownerName, runId, tick + 1);
});
}