Move curios into the main bworld mod
This commit is contained in:
@@ -202,7 +202,7 @@ export class GameServer {
|
||||
if (entity instanceof ServerPlayer) this.#kill(entity, source);
|
||||
},
|
||||
});
|
||||
this.mods.storage = saved?.mod_storage ?? {};
|
||||
this.mods.storage = upgrade_mod_storage(saved?.mod_storage ?? {});
|
||||
if (saved) {
|
||||
this.world.load_chunks(save?.chunks ?? [], saved.worldgen);
|
||||
}
|
||||
@@ -1700,6 +1700,17 @@ interface SavedLevelV4 extends Omit<SavedLevel, "version" | "entities"> {
|
||||
}[];
|
||||
}
|
||||
|
||||
// curios was a mod of its own before it became part of the base game: which container is each player's curios moves
|
||||
// into the base game's storage
|
||||
function upgrade_mod_storage(storage: Record<string, Record<string, unknown>>) {
|
||||
const curios = storage.curios?.containers;
|
||||
if (curios !== undefined && storage.bworld?.curios === undefined) {
|
||||
(storage.bworld ??= {}).curios = curios;
|
||||
delete storage.curios;
|
||||
}
|
||||
return storage;
|
||||
}
|
||||
|
||||
function upgrade_v4_entities(entities: SavedLevelV4["entities"]): SavedEntity[] {
|
||||
return (entities ?? []).map((entity): SavedItemEntity => ({
|
||||
id: ITEM_ENTITY_TYPE,
|
||||
|
||||
Reference in New Issue
Block a user