duu
This commit is contained in:
parent
88f618cadf
commit
8f9f5b5100
108 changed files with 2139 additions and 1500 deletions
|
|
@ -50,6 +50,9 @@
|
|||
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;
|
||||
},
|
||||
dailyTemperatureWave(progress = 0) {
|
||||
const hour = ((((Number(progress) || 0) % 1) + 1) % 1) * 24;
|
||||
const minHour = 5.0; // \u671D\u65B9\u306B\u6700\u4F4E\u6C17\u6E29
|
||||
|
|
@ -86,6 +89,7 @@
|
|||
} else {
|
||||
temp = (CONFIG.standardTemperature ?? 15) + this.annualTemperatureOffset() + dailyWave * dailyRange * 0.5;
|
||||
}
|
||||
temp += this.seasonTemperatureBias?.() ?? 0;
|
||||
this.temperatureDailyRange = dailyRange;
|
||||
return this.climateTemperature(temp);
|
||||
},
|
||||
|
|
@ -193,6 +197,24 @@
|
|||
label: discomfort <= 0 ? "\u5FEB\u9069" : (direction === "cold" ? (harmExcess > 0 ? "\u5371\u967A\u306A\u5BD2\u3055" : "\u5BD2\u3044") : (harmExcess > 0 ? "\u5371\u967A\u306A\u6691\u3055" : "\u6691\u3044")),
|
||||
};
|
||||
},
|
||||
temperatureComfortCandidateItems(direction = "") {
|
||||
const bucketed = typeof this.itemsOfType === "function";
|
||||
if (!bucketed) return this.items || [];
|
||||
const types = ["nest_box", "pipe"];
|
||||
if (direction === "cold") types.push("stove");
|
||||
else if (direction === "hot") types.push("dry_ice", "fan");
|
||||
else types.push("stove", "dry_ice", "fan");
|
||||
const seen = new Set();
|
||||
const out = [];
|
||||
for (const type of types) {
|
||||
for (const it of this.itemsOfType(type) || []) {
|
||||
if (!it || it.dead || seen.has(it)) continue;
|
||||
seen.add(it);
|
||||
out.push(it);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
},
|
||||
findComfortTemperatureSpot(actor, opts = {}) {
|
||||
if (!actor || actor.dead) return null;
|
||||
const current = this.feltTemperatureFor?.(actor) ?? this.temperatureAt(actor.x, actor.y, actor);
|
||||
|
|
@ -218,7 +240,7 @@
|
|||
}
|
||||
}
|
||||
const itemRange = Math.max(24, CONFIG.temperatureItemRange ?? 190);
|
||||
for (const it of this.items || []) {
|
||||
for (const it of this.temperatureComfortCandidateItems?.(currentStatus.direction) || this.items || []) {
|
||||
if (!it || it.dead) continue;
|
||||
if (it.type === "nest_box" || it.type === "pipe") {
|
||||
const shelterTemp = it.type === "pipe" && this.pipeInteriorTemperatureFor
|
||||
|
|
@ -281,12 +303,19 @@
|
|||
const current = this.feltTemperatureFor?.(actor) ?? this.temperatureAt?.(actor.x, actor.y, actor);
|
||||
const currentStatus = this.temperatureStatusFor?.(current, actor);
|
||||
if (!currentStatus || currentStatus.comfortable) return false;
|
||||
if (!this.hasReachableComfortTemperatureSpot?.(actor)) return false;
|
||||
const temp = item.type === "pipe" && this.pipeInteriorTemperatureFor
|
||||
? this.pipeInteriorTemperatureFor(item, actor)
|
||||
: this.temperatureAt?.(item.x, item.y, actor);
|
||||
const status = this.temperatureStatusFor?.(temp, actor);
|
||||
return Boolean(status && !status.comfortable);
|
||||
if (!status || status.comfortable) return false;
|
||||
// A nest/pipe is still a valid night shelter when it improves a bad
|
||||
// temperature, even if it cannot make the interior fully comfortable.
|
||||
if (item.type === "nest_box" || item.type === "pipe") {
|
||||
if (currentStatus.direction === "cold" && temp > current + 0.45) return false;
|
||||
if (currentStatus.direction === "hot" && temp < current - 0.45) return false;
|
||||
}
|
||||
if (!this.hasReachableComfortTemperatureSpot?.(actor)) return false;
|
||||
return true;
|
||||
},
|
||||
}));
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue