feat(environment): add wind-driven cloud system

This commit is contained in:
Tom Boullay
2026-05-27 00:33:53 +02:00
parent a6787a7ecb
commit 4ebb5b8c25
6 changed files with 250 additions and 0 deletions
@@ -1,4 +1,5 @@
import { create } from "zustand";
import { CLOUD_DEFAULTS, type CloudState } from "@/data/world/cloudConfig";
import { WIND_DEFAULTS, type WindState } from "@/data/world/windConfig";
import {
GRAPHICS_DEFAULTS,
@@ -6,11 +7,13 @@ import {
} from "@/data/world/graphicsConfig";
interface WorldSettingsState {
clouds: CloudState;
wind: WindState;
graphics: GraphicsState;
}
interface WorldSettingsActions {
setClouds: (clouds: Partial<CloudState>) => void;
setWind: (wind: Partial<WindState>) => void;
setWindSpeed: (speed: number) => void;
setWindDirection: (direction: number) => void;
@@ -27,6 +30,7 @@ interface WorldSettingsActions {
type WorldSettingsStore = WorldSettingsState & WorldSettingsActions;
const DEFAULT_STATE: WorldSettingsState = {
clouds: { ...CLOUD_DEFAULTS },
wind: { ...WIND_DEFAULTS },
graphics: { ...GRAPHICS_DEFAULTS },
};
@@ -34,6 +38,11 @@ const DEFAULT_STATE: WorldSettingsState = {
export const useWorldSettingsStore = create<WorldSettingsStore>()((set) => ({
...DEFAULT_STATE,
setClouds: (cloudsUpdate) =>
set((state) => ({
clouds: { ...state.clouds, ...cloudsUpdate },
})),
setWind: (windUpdate) =>
set((state) => ({
wind: { ...state.wind, ...windUpdate },