Files

59 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 2/8 · [önceki](startLoop.md) · [sonraki](startLoop-3.md)
```javascript
var k = keyOf(dim, x, y, z);
if (seen[k]) continue;
seen[k] = true;
var v = claims.get(k);
if (v !== null && v !== undefined && String(v).indexOf(name + "#") !== 0) continue;
claims.put(k, token);
stuck.push({
k: k, dim: dim, x: x, y: y, z: z, id: f[4], meta: Number(f[5]),
ps: makeState(f[6], Number(f[7])), pid: f[6], pmeta: Number(f[7]),
t: 0, dead: false, tries: 0, retryAt: 0, strict: strict || f[8] === "s"
});
live++;
}
}
var adoptSeen = {};
adopt(sstates.getString(S_PENDING + name), false, adoptSeen);
if (p0) adopt(p0.getStates().getString(K_PENDING), true, adoptSeen);
function report(e) {
if (errored) return;
errored = true;
try { mappet.getLogger().error("[chroma_trail] " + name + ": " + e); } catch (e2) {}
}
function worldOf(dim) {
if (worlds[dim] === undefined) {
try { worlds[dim] = server.getWorld(dim); } catch (e) { worlds[dim] = null; }
}
return worlds[dim];
}
function changed() {
dirtyS = true;
dirtyM = true;
}
function restoreItem(it, t) {
if (mine[it.k] === it) delete mine[it.k];
var v = claims.get(it.k);
if (v === null || v === undefined || String(v) !== token) {
live--;
changed();
return;
}
var r = -1;
try {
r = putBack(worldOf(it.dim), it.x, it.y, it.z, it.id, it.meta, it.ps, !!it.strict);
} catch (e) {
report(e);
}
```