Files

62 lines
1.9 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.
# chroma_trail.js — startLoop() (satır 438)
[← chroma_trail.js](index.md) · [← Master](../../wiki.md)
Parça 7/8 · [önceki](startLoop-6.md) · [sonraki](startLoop-8.md)
```javascript
flushAll(t);
}
lifeMs = getLife(st) * 1000;
var on = st.getNumber(K_ON) === 1;
if (on) placeUnder(pp, st, t);
return on;
}
// Kuyruk: suresi dolanlari en eskiden baslayarak aninda geri koy
function drain(t) {
while (head < queue.length) {
var it = queue[head];
if (!it.dead && t - it.t < lifeMs) break;
head++;
if (!it.dead) restoreItem(it, t);
}
if (head > 512) {
queue = queue.slice(head);
head = 0;
}
retryStuck(t, false);
}
function loop(ctx) {
if (Number(mappet.get(G_GEN + name)) !== gen) {
// Yeni bir loop devraldi: kendi bloklarini geri koy, state'e dokunma
try { flushAll(now()); } catch (e0) {}
return;
}
mappet.set(G_HB + name, worldTick(server));
worlds = {};
placedNow = false;
var t = now();
var pp = null;
try { pp = server.getPlayer(name); } catch (e1) {}
var on = false;
try { on = handlePlayer(pp, t); } catch (e2) { report(e2); }
try {
var od = pp ? pp.getWorld().getDimensionId() : null;
if (od !== ownerDim) {
sweepAway(od, t);
ownerDim = od;
}
} catch (e3) { report(e3); }
try { drain(t); } catch (e4) { report(e4); }
mappet.set(G_COUNT + name, live);
tick++;
try {
// Yeni blok konduysa ayni tick'te kaydet: sunucu o an kapanir ya
// da coker ise liste blokla birlikte diske gider. Sadece geri
```