Skip to content

Commit

Permalink
fix(compile): check the number of lights directly in the llf data ins…
Browse files Browse the repository at this point in the history
…tead of loading a json
  • Loading branch information
meszaros-lajos-gyorgy committed Aug 24, 2023
1 parent 06fabfc commit 424c4f7
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ const compileDLF = async (settings: Settings, dlf: ArxDLF) => {
.pipe(fs.createWriteStream(path.join(dlfPath, `level${settings.levelIdx}.dlf`)))
}

const hasLights = async (settings: Settings) => {
const llfPath = path.join(settings.outputDir, `graph/levels/level${settings.levelIdx}`)
const llfJSONRaw = await fs.promises.readFile(path.join(llfPath, `level${settings.levelIdx}.llf.json`), 'utf-8')
const llfJSON = JSON.parse(llfJSONRaw) as ArxLLF

return llfJSON.lights.length > 0
}

const hasDotnet6OrNewer = async () => {
try {
const { stdout } = await promisify(exec)(`dotnet --version`)
Expand Down Expand Up @@ -140,7 +132,7 @@ const calculateLighting = async (settings: Settings) => {
export const compile = async (settings: Settings, { dlf, llf, fts }: { dlf: ArxDLF; llf: ArxLLF; fts: ArxFTS }) => {
await Promise.allSettled([compileFTS(settings, fts), compileLLF(settings, llf), compileDLF(settings, dlf)])

if (settings.calculateLighting && (await hasLights(settings))) {
if (settings.calculateLighting && llf.lights.length > 0) {
await calculateLighting(settings)
}
}

0 comments on commit 424c4f7

Please sign in to comment.