fulfillment
This commit is contained in:
parent
e8f1d1db1e
commit
2e90add2e1
67 changed files with 5427 additions and 690 deletions
30
js/render.js
30
js/render.js
|
|
@ -249,8 +249,8 @@ const terrainCache = {
|
|||
|
||||
function isCachedTerrainItem(it) {
|
||||
if (!it || it.dead) return false;
|
||||
if (it.machineProduced) return false;
|
||||
if (it.type === "grass" || it.type === "trace" || it.type === "splat") return true;
|
||||
if (it.type === "zunchi") return Math.hypot(it.vx || 0, it.vy || 0) < 0.08;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -740,15 +740,6 @@ function render() {
|
|||
for (const ef of world.effects) {
|
||||
if (ef.type === "bleed" && isEntityVisibleInRect(ef, visibleRect)) ef.draw(ctx);
|
||||
}
|
||||
for (const it of world.items) {
|
||||
if (isCachedTerrainItem(it)) continue;
|
||||
if (isPinType(it.type) && it.pinState === "lodged") continue;
|
||||
if (it.type !== "zunchi" && isEntityVisibleInRect(it, visibleRect)) it.draw(ctx, world.time, lighting);
|
||||
}
|
||||
for (const it of world.items) {
|
||||
if (it.type === "zunchi" && isEntityVisibleInRect(it, visibleRect)) it.draw(ctx, world.time, lighting);
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
ctx.lineWidth = 1.15;
|
||||
ctx.setLineDash([4, 4]);
|
||||
|
|
@ -765,13 +756,20 @@ function render() {
|
|||
ctx.setLineDash([]);
|
||||
ctx.restore();
|
||||
|
||||
const sorted = world.sortedDrawList ? world.sortedDrawList() : world.tarinai;
|
||||
for (const t of sorted) {
|
||||
if (isEntityVisibleInRect(t, visibleRect)) t.draw(ctx, world.time, lighting);
|
||||
}
|
||||
for (const it of world.items) {
|
||||
if (isPinType(it.type) && it.pinState === "lodged" && isEntityVisibleInRect(it, visibleRect)) it.draw(ctx, world.time, lighting);
|
||||
const fieldEntries = [];
|
||||
const pushFieldEntry = (entity, kind, order = 0) => {
|
||||
if (!entity || entity.dead || !isEntityVisibleInRect(entity, visibleRect)) return;
|
||||
fieldEntries.push({ entity, kind, order, y: Number.isFinite(entity.y) ? entity.y : 0 });
|
||||
};
|
||||
for (const it of world.items || []) {
|
||||
if (isCachedTerrainItem(it)) continue;
|
||||
const layerOffset = it.type === "plushie" && it.onHead ? 999 : (it.type === "bed" ? -1.0 : ((typeof isMachineType === "function" && isMachineType(it.type)) ? (it.r || 42) * 0.58 : (isPinType(it.type) && it.pinState === "lodged" ? 0.15 : 0)));
|
||||
pushFieldEntry(it, "item", layerOffset);
|
||||
}
|
||||
for (const t of world.tarinai || []) pushFieldEntry(t, "actor", 0.1);
|
||||
for (const a of world.ants || []) pushFieldEntry(a, "actor", 0.05);
|
||||
fieldEntries.sort((a, b) => ((a.y + a.order) - (b.y + b.order)));
|
||||
for (const entry of fieldEntries) entry.entity.draw(ctx, world.time, lighting);
|
||||
for (const ef of world.effects) {
|
||||
if (ef.type !== "bleed" && isEntityVisibleInRect(ef, visibleRect)) ef.draw(ctx);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue