its functionning

This commit is contained in:
math-pixel
2026-06-02 00:23:43 +02:00
parent d975aac018
commit a3e8e732f1
9 changed files with 407 additions and 68 deletions
+13 -2
View File
@@ -1,4 +1,5 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { CLOUD_DEFAULTS, type CloudState } from "@/data/world/cloudConfig";
import { FOG_CONFIG, type FogState } from "@/data/world/fogConfig";
import { WIND_DEFAULTS, type WindState } from "@/data/world/windConfig";
@@ -46,7 +47,9 @@ const DEFAULT_STATE: WorldSettingsState = {
graphics: { ...GRAPHICS_DEFAULTS },
};
export const useWorldSettingsStore = create<WorldSettingsStore>()((set) => ({
export const useWorldSettingsStore = create<WorldSettingsStore>()(
persist(
(set) => ({
...DEFAULT_STATE,
setClouds: (cloudsUpdate) =>
@@ -115,4 +118,12 @@ export const useWorldSettingsStore = create<WorldSettingsStore>()((set) => ({
})),
resetToDefaults: () => set(DEFAULT_STATE),
}));
}),
{
name: "la-fabrik-world-settings",
// Persist only graphics settings (preset + options) — fog/wind/clouds
// reset to defaults on each session.
partialize: (state) => ({ graphics: state.graphics }),
},
),
);