Skip to content

Commit

Permalink
fix: lint, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-85 committed Oct 24, 2024
1 parent 767d76f commit c7a4a98
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/api/world-compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ const getBiomeBoundsInfluences = (bounds: Box2) => {
}
const boundsPoints = getPatchBoundingPoints(bounds)
const boundsInfluences = {} as PatchBoundingBiomes
;[xMyM, xMyP, xPyM, xPyP].map(key => {
const boundPos = boundsPoints[key] as Vector2
const biomeInfluence = Biome.instance.getBiomeInfluence(asVect3(boundPos))
boundsInfluences[key] = biomeInfluence
// const block = computeGroundBlock(asVect3(pos), biomeInfluence)
return biomeInfluence
})
;[xMyM, xMyP, xPyM, xPyP].map(key => {
const boundPos = boundsPoints[key] as Vector2
const biomeInfluence = Biome.instance.getBiomeInfluence(asVect3(boundPos))
boundsInfluences[key] = biomeInfluence
// const block = computeGroundBlock(asVect3(pos), biomeInfluence)
return biomeInfluence
})
const allEquals =
equals(boundsInfluences[xMyM], boundsInfluences[xPyM]) &&
equals(boundsInfluences[xMyM], boundsInfluences[xMyP]) &&
Expand Down Expand Up @@ -121,7 +121,7 @@ export const computeGroundBlock = (
if (nominalConf.next?.data) {
const variation = Biome.instance.posRandomizer.eval(
blockPos.clone().multiplyScalar(50),
)
)
const min = new Vector2(nominalConf.data.x, nominalConf.data.y)
const max = new Vector2(nominalConf.next.data.x, nominalConf.next.data.y)
const rangeBox = new Box2(min, max)
Expand Down Expand Up @@ -187,7 +187,7 @@ export const computeBlocksBatch = async (
biomeBoundsInfluences,
)
block.data = computeGroundBlock(block.pos, blockBiome)
// const {level, type } =
// const {level, type } =
// override with last block if specified
if (params.includeEntitiesBlocks) {
const lastBlockData = await queryLastBlockData(asVect2(block.pos))
Expand Down
13 changes: 6 additions & 7 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import {
LandscapesConf,
} from './types'

const typesNumbering = (types: Record<string, number>, offset = 0) => Object.keys(types).forEach(
(key, i) => (types[key] = offset + i),
)
const typesNumbering = (types: Record<string, number>, offset = 0) =>
Object.keys(types).forEach((key, i) => (types[key] = offset + i))

// Clamp number between two values:
const clamp = (num: number, min: number, max: number) =>
Expand Down Expand Up @@ -365,10 +364,10 @@ const parseBox3Stub = (stub: Box3) => {
const parseThreeStub = (stub: any) => {
return stub
? parseBox3Stub(stub) ||
parseVect3Stub(stub) ||
parseBox2Stub(stub) ||
parseVect2Stub(stub) ||
stub
parseVect3Stub(stub) ||
parseBox2Stub(stub) ||
parseVect2Stub(stub) ||
stub
: stub
}

Expand Down
6 changes: 4 additions & 2 deletions src/procgen/Biome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ export enum BiomeType {
export const BiomeNumericType: Record<BiomeType, number> = {
[BiomeType.Temperate]: 0,
[BiomeType.Artic]: 0,
[BiomeType.Desert]: 0
[BiomeType.Desert]: 0,
}
Utils.typesNumbering(BiomeNumericType)
export const ReverseBiomeNumericType: Record<number, BiomeType> = {}
Object.keys(BiomeNumericType).forEach((type, i) => ReverseBiomeNumericType[i] = type as BiomeType)
Object.keys(BiomeNumericType).forEach((type, i) => {
ReverseBiomeNumericType[i] = type as BiomeType
})

type Contribution = Record<Level, number>

Expand Down

0 comments on commit c7a4a98

Please sign in to comment.