stable
This commit is contained in:
parent
86226ccc94
commit
077d4ab9ac
71 changed files with 2905 additions and 1063 deletions
|
|
@ -17,6 +17,24 @@
|
|||
return rand(CONFIG.weatherChangeMin, CONFIG.weatherChangeMax);
|
||||
},
|
||||
|
||||
fixedWeatherFor(worldRef) {
|
||||
const fixed = global.TarinaiGround?.fixedWeather?.(worldRef?.groundType || "soil") || "";
|
||||
return fixed || null;
|
||||
},
|
||||
|
||||
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?.(`天気: ${weatherLabel(fixed)}`);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
shouldDropRainWater(worldRef, dt = 0) {
|
||||
return Boolean(
|
||||
worldRef?.weather === "light_rain" &&
|
||||
|
|
@ -32,6 +50,7 @@
|
|||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue