removed unused processesseessess

This commit is contained in:
33333-33333 2026-06-29 16:21:58 +09:00
commit 4fdc567e08
158 changed files with 1317 additions and 3351 deletions

View file

@ -1,67 +1,66 @@
"use strict";
(function (global) {
const WEATHER_STATES = Object.freeze(["sunny", "cloudy", "light_rain"]);
function chooseNext(current = "sunny") {
const choices = current === "light_rain"
? ["sunny", "cloudy"]
: ["sunny", "cloudy", "light_rain"];
return pick(choices);
}
const WeatherSystem = Object.freeze({
states: WEATHER_STATES,
function resetTimer() {
return rand(CONFIG.weatherChangeMin, CONFIG.weatherChangeMax);
}
chooseNext(current = "sunny") {
const choices = current === "light_rain"
? ["sunny", "cloudy"]
: ["sunny", "cloudy", "light_rain"];
return pick(choices);
},
function fixedWeatherFor(worldRef) {
const fixed = global.TarinaiGround.fixedWeather(worldRef?.groundType || "soil") || "";
return fixed || null;
}
resetTimer() {
return rand(CONFIG.weatherChangeMin, CONFIG.weatherChangeMax);
},
function enforceFixedWeather(worldRef) {
const fixed = fixedWeatherFor(worldRef);
if (!fixed || !worldRef) return false;
const previous = worldRef.weather || "sunny";
worldRef.weather = fixed;
worldRef.nextWeatherChange = resetTimer();
if (previous !== fixed) {
worldRef.emit?.("weather:changed", { previous, next: fixed });
worldRef.log?.(`天気: ${weatherLabel(fixed)}`);
}
return true;
}
fixedWeatherFor(worldRef) {
const fixed = global.TarinaiGround?.fixedWeather?.(worldRef?.groundType || "soil") || "";
return fixed || null;
},
function shouldDropRainWater(worldRef, dt = 0) {
return Boolean(
worldRef?.weather === "light_rain" &&
Math.random() < Math.max(0, Number(dt) || 0) * 0.12
);
}
enforceFixedWeather(worldRef) {
const fixed = this.fixedWeatherFor(worldRef);
if (!fixed || !worldRef) return false;
const previous = worldRef.weather || "sunny";
worldRef.weather = fixed;
worldRef.nextWeatherChange = this.resetTimer();
if (previous !== fixed) {
worldRef.emit?.("weather:changed", { previous, next: fixed });
worldRef.log?.(`\u5929\u6c17: ${weatherLabel(fixed)}`);
}
return true;
},
function createRainWaterItem(worldRef) {
const drop = new Item("water", rand(58, worldRef.w - 58), rand(58, worldRef.h - 58));
drop.amount = rand(24, 58);
return drop;
}
shouldDropRainWater(worldRef, dt = 0) {
return Boolean(
worldRef?.weather === "light_rain" &&
Math.random() < Math.max(0, Number(dt) || 0) * 0.12
);
},
function applyNextWeather(worldRef) {
if (!worldRef) return null;
if (enforceFixedWeather(worldRef)) return worldRef.weather || "sunny";
const previous = worldRef.weather || "sunny";
const next = chooseNext(previous);
worldRef.weather = next;
worldRef.nextWeatherChange = resetTimer();
if (next !== previous) {
worldRef.emit?.("weather:changed", { previous, next });
worldRef.log?.(`天気: ${weatherLabel(next)}`);
}
return next;
}
createRainWaterItem(worldRef) {
const drop = new Item("water", rand(58, worldRef.w - 58), rand(58, worldRef.h - 58));
drop.amount = rand(24, 58);
return drop;
},
applyNextWeather(worldRef) {
if (!worldRef) return null;
if (this.enforceFixedWeather(worldRef)) return worldRef.weather || "sunny";
const previous = worldRef.weather || "sunny";
const next = this.chooseNext(previous);
worldRef.weather = next;
worldRef.nextWeatherChange = this.resetTimer();
if (next !== previous) {
worldRef.emit?.("weather:changed", { previous, next });
worldRef.log?.(`\u5929\u6c17: ${weatherLabel(next)}`);
}
return next;
},
global.TarinaiWeatherSystem = Object.freeze({
enforceFixedWeather,
shouldDropRainWater,
createRainWaterItem,
applyNextWeather,
});
global.TarinaiWeatherSystem = WeatherSystem;
})(typeof window !== "undefined" ? window : globalThis);