Skip to content

Commit

Permalink
use getMapgenValueDistribution in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Nov 11, 2024
1 parent a62cf95 commit c0ce028
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/types/item/spawnLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,9 @@ export function parseFurniturePalette(
const furniture = parsePlaceMappingAlternative(
palette.furniture,
function* (furn) {
const value = getMapgenValue(furn);
if (value) yield new Map([[value, { prob: 1, expected: 1 }]]);
const value = getMapgenValueDistribution(furn);
for (const [f, prob] of value.entries())
if (value) yield new Map([[f, { prob, expected: prob }]]);
}
);
const palettes = (palette.palettes ?? []).flatMap((val) => {
Expand Down Expand Up @@ -918,8 +919,9 @@ export function parseTerrainPalette(
const terrain = parsePlaceMappingAlternative(
palette.terrain,
function* (ter) {
const value = getMapgenValue(ter);
if (value) yield new Map([[value, { prob: 1, expected: 1 }]]);
const value = getMapgenValueDistribution(ter);
for (const [t, prob] of value.entries())
if (value) yield new Map([[t, { prob, expected: prob }]]);
}
);
const palettes = (palette.palettes ?? []).flatMap((val) => {
Expand Down

0 comments on commit c0ce028

Please sign in to comment.