y
This commit is contained in:
parent
61718e2981
commit
f657b6a4a4
94 changed files with 3970 additions and 1241 deletions
|
|
@ -18,13 +18,15 @@
|
|||
return clamp(v, CONFIG.climateTemperatureMin ?? -20, CONFIG.climateTemperatureMax ?? 50);
|
||||
},
|
||||
seasonIndex() {
|
||||
return Math.floor((((Number(this.day) || 1) - 1) % 20) / 5);
|
||||
const elapsedDays = Number.isFinite(Number(this.elapsedDays)) ? Math.max(0, Number(this.elapsedDays) || 0) : Math.max(0, (Number(this.day) || 1) - 1);
|
||||
return Math.floor((elapsedDays % 20) / 5);
|
||||
},
|
||||
seasonLabel() {
|
||||
return ["\u6625", "\u590F", "\u79CB", "\u51AC"][this.seasonIndex()] || "\u6625";
|
||||
},
|
||||
seasonDay() {
|
||||
return ((((Number(this.day) || 1) - 1) % 5) + 1);
|
||||
const elapsedDays = Number.isFinite(Number(this.elapsedDays)) ? Math.max(0, Number(this.elapsedDays) || 0) : Math.max(0, (Number(this.day) || 1) - 1);
|
||||
return (elapsedDays % 5) + 1;
|
||||
},
|
||||
seasonDayString() {
|
||||
return `${this.seasonLabel()}${this.seasonDay()}\u65E5`;
|
||||
|
|
@ -44,14 +46,19 @@
|
|||
},
|
||||
annualTemperatureOffset() {
|
||||
const dayLength = Math.max(1, CONFIG.dayLength || 120);
|
||||
const totalDays = Math.max(0, Number(this.time || 0) / dayLength);
|
||||
const progress = ((Number(this.time || 0) % dayLength) + dayLength) % dayLength / dayLength;
|
||||
const completedDays = Number.isFinite(Number(this.elapsedDays)) ? Math.max(0, Number(this.elapsedDays) || 0) : Math.max(0, Math.floor(Number(this.time || 0) / dayLength));
|
||||
const totalDays = completedDays + progress;
|
||||
const phase = ((totalDays % 20) + 20) % 20 / 20;
|
||||
const range = Number.isFinite(Number(this.temperatureAnnualRange)) ? Number(this.temperatureAnnualRange) : 30;
|
||||
const wave = Math.sin(phase * Math.PI * 2 - Math.PI * 0.25);
|
||||
return wave * range * 0.5;
|
||||
},
|
||||
seasonTemperatureBias() {
|
||||
return this.seasonIndex?.() === 1 ? (CONFIG.summerTemperatureBoost ?? 5) : 0;
|
||||
// Seasons are derived from elapsed days, but no season receives a flat
|
||||
// temperature offset. Annual and daily waves remain the only climate
|
||||
// temperature variation.
|
||||
return 0;
|
||||
},
|
||||
dailyTemperatureWave(progress = 0) {
|
||||
const hour = ((((Number(progress) || 0) % 1) + 1) % 1) * 24;
|
||||
|
|
@ -126,7 +133,7 @@
|
|||
if ((this.groundType || "soil") === "ice") temp -= 5;
|
||||
const range = Math.max(24, CONFIG.temperatureItemRange ?? 190);
|
||||
const fanRange = 320;
|
||||
for (const it of this.nearbyItems(x, y, Math.max(range + 8, fanRange + 40))) {
|
||||
for (const it of this.nearbyNonGrassItems?.(x, y, Math.max(range + 8, fanRange + 40)) || this.nearbyItems(x, y, Math.max(range + 8, fanRange + 40))) {
|
||||
if (!it || it.dead || (it.type !== "dry_ice" && it.type !== "stove" && it.type !== "fan")) continue;
|
||||
if (global.TarinaiSignalSystem?.powerOverride?.(it) === false) continue;
|
||||
if (it.type === "fan") {
|
||||
|
|
@ -141,7 +148,7 @@
|
|||
temp += (it.type === "stove" ? 10 : -10) * edge;
|
||||
}
|
||||
const nestWarmthLimit = 5;
|
||||
for (const box of this.nearbyItems?.(x, y, 86) || []) {
|
||||
for (const box of this.nearbyNonGrassItems?.(x, y, 86) || []) {
|
||||
if (!box || box.dead || box.type !== "nest_box") continue;
|
||||
const r = Math.max(36, Number(box.r || 42) || 42);
|
||||
const base = this.nestBoxBaseRect?.(box) || null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue