This commit is contained in:
33333-33333 2026-07-01 14:41:05 +09:00
commit 4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions

View file

@ -73,8 +73,36 @@
}
}
function updateBurningLifecycle(item, dt, worldRef) {
if (!item || item.dead || item.type !== "zunchi" || !(item.burning || (item.burnTimer || 0) > 0.02)) return false;
item.burning = true;
item.burnTimer = Math.max(0, Number(item.burnTimer || 0) - dt);
item.spawnGrace = 0;
item.freshness = clamp((item.freshness ?? 1) - dt * 0.62, 0, 1);
item.amount = Math.max(0, Number(item.amount || 0) - dt * 30);
item.stageTimer = Math.max(0, Number(item.stageTimer || 0) + dt * 1.8);
if (item.stage === "fresh" && item.freshness < 0.45) { item.stage = "dry"; item.stageTimer = 0; }
if (item.stage === "dry" && item.freshness < 0.18) { item.stage = "decomposing"; item.stageTimer = 0; item.fertility = Math.max(item.fertility || 0, 0.18); }
if (worldRef?.effects && typeof Effect === "function" && global.deterministicChance(worldRef, "zunchi-fire-effect", dt * 1.15, item)) {
worldRef.effects.push(new Effect("flame", item.x + deterministicRange(worldRef, "zunchi-fire-x", -5, 5, item), item.y - Math.max(4, (item.r || 14) * 0.25), {
vx: deterministicRange(worldRef, "zunchi-fire-vx", -3, 3, item),
vy: deterministicRange(worldRef, "zunchi-fire-vy", -10, -4, item),
size: deterministicRange(worldRef, "zunchi-fire-size", 6, 12, item),
life: deterministicRange(worldRef, "zunchi-fire-life", 0.18, 0.34, item),
color: "rgba(236,46,24,0.72)",
}));
}
if (item.burnTimer <= 0.01) item.burning = false;
if ((item.amount || 0) <= 0.5) item.amount = 0;
worldRef?.markTerrainDirtyAt?.(item.x, item.y, Math.max(item.r || 15, 28), "zunchi-burning");
worldRef.drawListDirty = true;
return true;
}
function updateLifecycle(item, dt, worldRef) {
if (!item || item.dead || item.type !== "zunchi") return false;
updateBurningLifecycle(item, dt, worldRef);
const rainy = worldRef.weather === "light_rain";
const rainBoost = rainy ? 1.28 : 1;
const groundId = worldRef?.groundType || "soil";
@ -108,5 +136,5 @@
return true;
}
global.TarinaiItemDynamicZunchiSystem = Object.freeze({ updateMotion, updateLifecycle });
global.TarinaiItemDynamicZunchiSystem = Object.freeze({ updateMotion, updateLifecycle, updateBurningLifecycle });
})(typeof window !== "undefined" ? window : globalThis);