This commit is contained in:
33333-33333 2026-07-03 20:57:02 +09:00
commit 88f618cadf
55 changed files with 1299 additions and 447 deletions

View file

@ -127,7 +127,7 @@
const halfWidth = 28 + along * 0.72;
if (lateral > halfWidth) continue;
const edge = Math.pow(clamp(1 - along / fanRange, 0, 1), 0.62) * Math.pow(clamp(1 - lateral / Math.max(1, halfWidth), 0, 1), 0.30);
temp -= 4 * edge;
temp -= 5 * edge;
continue;
}
const d = distXY(x, y, it.x, it.y);
@ -155,7 +155,7 @@
const base = this.temperatureAt?.(pipe.x, pipe.y, null);
const temp = this.temperatureNumber(base, this.currentTemperature ?? CONFIG.standardTemperature ?? 15);
const toward = 20 - temp;
return this.temperatureNumber(temp + clamp(toward, -7, 7));
return this.temperatureNumber(temp + clamp(toward, -5, 5));
},
feltTemperatureFor(actor, x = actor?.x, y = actor?.y) {
if (!actor) return this.temperatureAt(x, y);
@ -204,10 +204,12 @@
const rings = [72, 128, 196, 288, 392];
const dirs = 18;
const candidates = [];
const pushCandidate = (x, y, extra = 0) => candidates.push({
const pushCandidate = (x, y, extra = 0, targetItem = null, tempOverride = null) => candidates.push({
x: clamp(x, radius + 8, (this.w || 1000) - radius - 8),
y: clamp(y, radius + 8, (this.h || 720) - radius - 8),
extra,
targetItem,
tempOverride,
});
for (const ring of rings) {
for (let i = 0; i < dirs; i++) {
@ -217,7 +219,20 @@
}
const itemRange = Math.max(24, CONFIG.temperatureItemRange ?? 190);
for (const it of this.items || []) {
if (!it || it.dead || (it.type !== "dry_ice" && it.type !== "stove" && it.type !== "fan")) continue;
if (!it || it.dead) continue;
if (it.type === "nest_box" || it.type === "pipe") {
const shelterTemp = it.type === "pipe" && this.pipeInteriorTemperatureFor
? this.pipeInteriorTemperatureFor(it, actor)
: this.temperatureAt?.(it.x, it.y, actor);
if (!Number.isFinite(Number(shelterTemp))) continue;
const shelterStatus = this.temperatureStatusFor(shelterTemp, actor);
if (currentStatus.direction === "cold" && shelterTemp <= current + 0.6 && !shelterStatus.comfortable) continue;
if (currentStatus.direction === "hot" && shelterTemp >= current - 0.6 && !shelterStatus.comfortable) continue;
const entry = this.nestBoxEntryPoint?.(it) || { x: it.x, y: it.y };
pushCandidate(entry.x, entry.y, shelterStatus.comfortable ? -96 : -44, it, shelterTemp);
continue;
}
if (it.type !== "dry_ice" && it.type !== "stove" && it.type !== "fan") continue;
if (currentStatus.direction === "cold" && it.type !== "stove") continue;
if (currentStatus.direction === "hot" && it.type !== "dry_ice" && it.type !== "fan") continue;
if (it.type === "fan") {
@ -236,7 +251,7 @@
let bestScore = Infinity;
for (const c of candidates) {
if (this.pointBlockedByObstacle?.(c.x, c.y, Math.max(14, radius * 0.72), { exclude: actor })) continue;
const temp = this.temperatureAt(c.x, c.y, actor);
const temp = Number.isFinite(Number(c.tempOverride)) ? Number(c.tempOverride) : this.temperatureAt(c.x, c.y, actor);
const status = this.temperatureStatusFor(temp, actor);
if (currentStatus.direction === "cold" && temp <= current + 0.6 && !status.comfortable) continue;
if (currentStatus.direction === "hot" && temp >= current - 0.6 && !status.comfortable) continue;
@ -245,7 +260,9 @@
const score = status.discomfort * 110 + Math.abs(temp - targetTemp) * 2.8 + d * 0.22 + blockedPenalty + (c.extra || 0);
if (score < bestScore) {
bestScore = score;
best = { x: c.x, y: c.y, dead: false, detour: true, temperatureTarget: true, temperature: temp, label: "\u5FEB\u9069\u306A\u6E29\u5EA6\u5E2F" };
const shelterLabel = c.targetItem?.type === "pipe" ? "土管" : (c.targetItem?.type === "nest_box" ? "巣箱" : "快適な温度帯");
best = { x: c.x, y: c.y, dead: false, detour: !c.targetItem, temperatureTarget: true, temperature: temp, label: shelterLabel };
if (c.targetItem) best.shelterItem = c.targetItem;
}
}
if (!best) return null;