fix: add missing LootInventory type and lootInventory state
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m15s
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m15s
- Added LootInventory interface to types.ts with materials and blueprints - Added lootInventory field to GameState interface - Added default lootInventory state to makeInitial() in store.ts - Added lootInventory to persist partialize function - Fixes prerender error: 'Cannot read properties of undefined (reading materials)'
This commit is contained in:
@@ -504,6 +504,12 @@ function makeInitial(overrides: Partial<GameState> = {}): GameState {
|
|||||||
|
|
||||||
blueprints: {},
|
blueprints: {},
|
||||||
|
|
||||||
|
// Loot inventory
|
||||||
|
lootInventory: {
|
||||||
|
materials: {},
|
||||||
|
blueprints: [],
|
||||||
|
},
|
||||||
|
|
||||||
schedule: [],
|
schedule: [],
|
||||||
autoSchedule: false,
|
autoSchedule: false,
|
||||||
studyQueue: [],
|
studyQueue: [],
|
||||||
@@ -1707,6 +1713,8 @@ export const useGameStore = create<GameStore>()(
|
|||||||
designProgress: state.designProgress,
|
designProgress: state.designProgress,
|
||||||
preparationProgress: state.preparationProgress,
|
preparationProgress: state.preparationProgress,
|
||||||
applicationProgress: state.applicationProgress,
|
applicationProgress: state.applicationProgress,
|
||||||
|
// Loot inventory
|
||||||
|
lootInventory: state.lootInventory,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -252,6 +252,12 @@ export interface BlueprintDef {
|
|||||||
learned: boolean;
|
learned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loot inventory for materials and blueprints
|
||||||
|
export interface LootInventory {
|
||||||
|
materials: Record<string, number>; // materialId -> count
|
||||||
|
blueprints: string[]; // blueprint IDs discovered
|
||||||
|
}
|
||||||
|
|
||||||
export type GameAction = 'meditate' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant';
|
export type GameAction = 'meditate' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant';
|
||||||
|
|
||||||
export interface ScheduleBlock {
|
export interface ScheduleBlock {
|
||||||
@@ -342,6 +348,9 @@ export interface GameState {
|
|||||||
// Blueprints
|
// Blueprints
|
||||||
blueprints: Record<string, BlueprintDef>;
|
blueprints: Record<string, BlueprintDef>;
|
||||||
|
|
||||||
|
// Loot Inventory
|
||||||
|
lootInventory: LootInventory;
|
||||||
|
|
||||||
// Schedule
|
// Schedule
|
||||||
schedule: ScheduleBlock[];
|
schedule: ScheduleBlock[];
|
||||||
autoSchedule: boolean;
|
autoSchedule: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user