diff --git a/.env.sample b/.env.sample index b7e5837..3c64ce0 100644 --- a/.env.sample +++ b/.env.sample @@ -9,3 +9,21 @@ levelIdx=1 outputDir=C:\\Program\ Files\\Arx\ Libertatis\\ seed=12345 + +# can be either "normal" or "premium" +# the default value is "normal" +variant=normal + +# can be either "true" or "false" +# the default value is "true" +# if the map has no light entities, then the value will get +# overriden to be false +calculateLighting=true + +# can be either "production" or "development" +# the default value is "production" +mode=production + +# points to the pkware-test-files repo's folder +# default value is "../pkware-test-files" +originalLevelFiles=../pkware-test-files diff --git a/package-lock.json b/package-lock.json index 0aaa27e..087588b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,16 +9,16 @@ "version": "1.0.0", "license": "GPL-3.0-or-later", "dependencies": { - "arx-level-generator": "^1.1.0", + "arx-level-generator": "^1.10.1", "dotenv": "^16.3.1", "three": "^0.155.0" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.2.0", - "@types/node": "^20.4.9", - "@types/three": "^0.155.0", + "@types/node": "^20.5.6", + "@types/three": "^0.155.1", "tsc-alias": "^1.8.7", - "typescript": "^5.1.6" + "typescript": "^5.2.2" }, "engines": { "node": ">=18.0.0", @@ -310,9 +310,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz", - "integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==", + "version": "20.5.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz", + "integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==", "dev": true }, "node_modules/@types/stats.js": { @@ -322,9 +322,9 @@ "dev": true }, "node_modules/@types/three": { - "version": "0.155.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.155.0.tgz", - "integrity": "sha512-IzdbqXsGsbG0flvq9D5L9pZRwySQQps2bGcizLYEsfvK3dM+B0sqKR6S+xAOXbouXemfDmHttrcQjVOM46YnAw==", + "version": "0.155.1", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.155.1.tgz", + "integrity": "sha512-uNUwnz/wWRxahjIqTtDYQ1qdE1R1py21obxfuILkT+kKrjocMwRLQQA1l8nMxfQU7VXb7CXu04ucMo8OqZt4ZA==", "dev": true, "dependencies": { "@tweenjs/tween.js": "~18.6.4", @@ -391,9 +391,9 @@ } }, "node_modules/arx-convert": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/arx-convert/-/arx-convert-7.0.1.tgz", - "integrity": "sha512-NAgY3lbLXaUTT0W5kKEwADR4yXXdLodSjoyse5f2foulg+oRxBof4QDMRRerPT9PdUuvkCwd9zJ/P0+82QxISA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/arx-convert/-/arx-convert-7.1.0.tgz", + "integrity": "sha512-0Zs4BEgKiYoiGdGUBzweOtydO0fTQIDbo/rHwB/ePu+yV+rhHBnxR8bQGMGTUHWbnASGQdkUFLOYrZx4wvb+uA==", "dependencies": { "minimist-lite": "^2.2.1", "yaml": "^2.3.1" @@ -418,16 +418,16 @@ } }, "node_modules/arx-level-generator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arx-level-generator/-/arx-level-generator-1.1.0.tgz", - "integrity": "sha512-hd/VNo+UWCkdIK5q+J8LSeA62xIfokKq6JXYE3/lgak2tEPYyoKa5aKcH4xijClaQtadcWJYvLMdydNsO16wtw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/arx-level-generator/-/arx-level-generator-1.10.1.tgz", + "integrity": "sha512-PmQrq/7+QGTTptghbDhRqyvJE0uj2VruO0806Au8XJamBGzuSO8wNBMyy86BaUCaWXFjauRqeGiEsoCzhZAqdg==", "dependencies": { - "arx-convert": "^7.0.1", + "arx-convert": "^7.1.0", "arx-header-size": "^2.2.0", "color-rgba": "^2.4.0", "node-pkware": "^3.0.4", "seedrandom": "^3.0.5", - "sharp": "^0.32.4", + "sharp": "^0.32.5", "sharp-bmp": "^0.1.5", "three": "^0.155.0" }, @@ -1360,9 +1360,9 @@ } }, "node_modules/sharp": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.4.tgz", - "integrity": "sha512-exUnZewqVZC6UXqXuQ8fyJJv0M968feBi04jb9GcUHrWtkRoAKnbJt8IfwT4NJs7FskArbJ14JAFGVuooszoGg==", + "version": "0.32.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.5.tgz", + "integrity": "sha512-0dap3iysgDkNaPOaOL4X/0akdu0ma62GcdC2NBQ+93eqpePdDdr2/LM0sFdDSMmN7yS+odyZtPsb7tx/cYBKnQ==", "hasInstallScript": true, "dependencies": { "color": "^4.2.3", @@ -1571,9 +1571,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -1829,9 +1829,9 @@ "dev": true }, "@types/node": { - "version": "20.4.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz", - "integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==", + "version": "20.5.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz", + "integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==", "dev": true }, "@types/stats.js": { @@ -1841,9 +1841,9 @@ "dev": true }, "@types/three": { - "version": "0.155.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.155.0.tgz", - "integrity": "sha512-IzdbqXsGsbG0flvq9D5L9pZRwySQQps2bGcizLYEsfvK3dM+B0sqKR6S+xAOXbouXemfDmHttrcQjVOM46YnAw==", + "version": "0.155.1", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.155.1.tgz", + "integrity": "sha512-uNUwnz/wWRxahjIqTtDYQ1qdE1R1py21obxfuILkT+kKrjocMwRLQQA1l8nMxfQU7VXb7CXu04ucMo8OqZt4ZA==", "dev": true, "requires": { "@tweenjs/tween.js": "~18.6.4", @@ -1903,9 +1903,9 @@ "dev": true }, "arx-convert": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/arx-convert/-/arx-convert-7.0.1.tgz", - "integrity": "sha512-NAgY3lbLXaUTT0W5kKEwADR4yXXdLodSjoyse5f2foulg+oRxBof4QDMRRerPT9PdUuvkCwd9zJ/P0+82QxISA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/arx-convert/-/arx-convert-7.1.0.tgz", + "integrity": "sha512-0Zs4BEgKiYoiGdGUBzweOtydO0fTQIDbo/rHwB/ePu+yV+rhHBnxR8bQGMGTUHWbnASGQdkUFLOYrZx4wvb+uA==", "requires": { "minimist-lite": "^2.2.1", "yaml": "^2.3.1" @@ -1920,16 +1920,16 @@ } }, "arx-level-generator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arx-level-generator/-/arx-level-generator-1.1.0.tgz", - "integrity": "sha512-hd/VNo+UWCkdIK5q+J8LSeA62xIfokKq6JXYE3/lgak2tEPYyoKa5aKcH4xijClaQtadcWJYvLMdydNsO16wtw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/arx-level-generator/-/arx-level-generator-1.10.1.tgz", + "integrity": "sha512-PmQrq/7+QGTTptghbDhRqyvJE0uj2VruO0806Au8XJamBGzuSO8wNBMyy86BaUCaWXFjauRqeGiEsoCzhZAqdg==", "requires": { - "arx-convert": "^7.0.1", + "arx-convert": "^7.1.0", "arx-header-size": "^2.2.0", "color-rgba": "^2.4.0", "node-pkware": "^3.0.4", "seedrandom": "^3.0.5", - "sharp": "^0.32.4", + "sharp": "^0.32.5", "sharp-bmp": "^0.1.5", "three": "^0.155.0" } @@ -2578,9 +2578,9 @@ } }, "sharp": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.4.tgz", - "integrity": "sha512-exUnZewqVZC6UXqXuQ8fyJJv0M968feBi04jb9GcUHrWtkRoAKnbJt8IfwT4NJs7FskArbJ14JAFGVuooszoGg==", + "version": "0.32.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.5.tgz", + "integrity": "sha512-0dap3iysgDkNaPOaOL4X/0akdu0ma62GcdC2NBQ+93eqpePdDdr2/LM0sFdDSMmN7yS+odyZtPsb7tx/cYBKnQ==", "requires": { "color": "^4.2.3", "detect-libc": "^2.0.2", @@ -2730,9 +2730,9 @@ } }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true }, "util-deprecate": { diff --git a/package.json b/package.json index 212d9e6..fd1f9f5 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,14 @@ "node": ">=18.0.0" }, "scripts": { - "dev": "npm run generate && npm run rungame", - "generate": "tsc && tsc-alias && node -r dotenv/config ./dist/src/index.js", - "rungame": "~/projektek/arx/ArxLibertatis/build/arx --loadlevel 1" + "generate": "tsc && tsc-alias && node ./dist/src/index.js", + "generate:with-dotenv": "tsc && tsc-alias && node -r dotenv/config ./dist/src/index.js", + "rungame": "~/projektek/arx/insanity/ArxLibertatis/build/arx --loadlevel 1", + "rungame:noclip": "~/projektek/arx/insanity/ArxLibertatis/build/arx --loadlevel 1 --noclip", + "dev": "npm run generate:with-dotenv && npm run rungame", + "dev:noclip": "npm run generate:with-dotenv && npm run rungame:noclip", + "prod": "export mode=\"production\" && npm run generate:with-dotenv && npm run rungame", + "release:normal": "npm run generate" }, "repository": { "type": "git", @@ -27,15 +32,15 @@ }, "homepage": "https://github.com/meszaros-lajos-gyorgy/arx-map-ambience-gallery#readme", "dependencies": { - "arx-level-generator": "^1.1.0", + "arx-level-generator": "^1.10.1", "dotenv": "^16.3.1", "three": "^0.155.0" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.2.0", - "@types/node": "^20.4.9", - "@types/three": "^0.155.0", + "@types/node": "^20.5.6", + "@types/three": "^0.155.1", "tsc-alias": "^1.8.7", - "typescript": "^5.1.6" + "typescript": "^5.2.2" } } diff --git a/src/globals.d.ts b/src/globals.d.ts index 2da798b..6cd3538 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -4,6 +4,10 @@ declare global { outputDir?: string levelIdx?: string seed?: string + variant?: string + calculateLighting?: string + mode?: string + originalLevelFiles?: string } } } diff --git a/src/index.ts b/src/index.ts index 62a7ba8..521f908 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ import { import { Interactivity } from 'arx-level-generator/scripting/properties' import { createLight, createZone } from 'arx-level-generator/tools' import { loadOBJ } from 'arx-level-generator/tools/mesh' -import { applyTransformations, compile } from 'arx-level-generator/utils' +import { applyTransformations } from 'arx-level-generator/utils' import { times } from 'arx-level-generator/utils/faux-ramda' import { pickRandom, randomBetween } from 'arx-level-generator/utils/random' import { MathUtils } from 'three' @@ -30,12 +30,15 @@ const settings = new Settings({ levelIdx: parseInt(process.env.levelIdx ?? '1'), outputDir: process.env.outputDir, seed: process.env.seed, + variant: process.env.variant === 'premium' ? 'premium' : 'normal', + calculateLighting: process.env.calculateLighting === 'false' ? false : true, + mode: process.env.mode === 'development' ? 'development' : 'production', + originalLevelFiles: process.env.originalLevelFiles, }) // ------------------------ const map = new ArxMap() -map.meta.mapName = 'Ambience Gallery' map.config.offset = new Vector3(2000, 0, 2000) map.player.position.adjustToPlayerHeight() map.player.orientation.y = MathUtils.degToRad(-90) @@ -170,7 +173,7 @@ smoothMeshes.flat().forEach((mesh) => { const tree = await loadOBJ('models/tree/tree', { position: new Vector3(4770, -10, 1450), scale: new Vector3(0.8, 0.7, 0.8), - rotation: new Rotation(0, MathUtils.degToRad(70), 0), + orientation: new Rotation(0, MathUtils.degToRad(70), 0), fallbackTexture: Texture.l2TrollWoodPillar08, }) @@ -185,6 +188,4 @@ importedModels.forEach((mesh) => { map.finalize() await map.saveToDisk(settings) -await compile(settings) - console.log('done')