import type { SerializedGolemDesign } from '../types/game'; export function addGolemDesign(set: (fn: (s: any) => any) => void, design: SerializedGolemDesign) { set((s: any) => { const golemDesigns = { ...s.golemancy.golemDesigns, [design.id]: design }; const entry = { designId: design.id, design, enabled: true }; const golemLoadout = [...s.golemancy.golemLoadout, entry]; return { golemancy: { ...s.golemancy, golemDesigns, golemLoadout } }; }); } export function removeGolemDesign(set: (fn: (s: any) => any) => void, designId: string) { set((s: any) => { const golemDesigns = { ...s.golemancy.golemDesigns }; delete golemDesigns[designId]; const golemLoadout = s.golemancy.golemLoadout.filter((e: any) => e.designId !== designId); return { golemancy: { ...s.golemancy, golemDesigns, golemLoadout } }; }); } export function toggleGolemLoadoutEntry(set: (fn: (s: any) => any) => void, designId: string) { set((s: any) => { const golemLoadout = s.golemancy.golemLoadout.map((e: any) => e.designId === designId ? { ...e, enabled: !e.enabled } : e, ); return { golemancy: { ...s.golemancy, golemLoadout } }; }); }