Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #1

Merged
merged 7 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:: StoryData
{
"ifid": "f7166797-ffa0-4ec8-a0b6-fbb555954c13"
}

This file was deleted.

2 changes: 1 addition & 1 deletion EssentialEstablishmentGenerator/Start/StoryInit.twee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

:: StoryInit

<<run State.initPRNG()>>
// <<run State.prng.init()>>
<<set Config.history.maxStates to 15>>
<<set $versionNumber to "2.3">>

Expand Down
21 changes: 21 additions & 0 deletions EssentialEstablishmentGenerator/Tools/weightRandom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @param specs Object containing elements as properties and their weight as value
*/
setup.weightRandom = function (specs) {
let sum = 0;
let r = Math.random();
let totalWeight = 0;

if (specs === null || typeof specs !== 'object') {
return null;
}

for (var prop in specs) {
totalWeight += specs[prop];
}

for (var prop in specs) {
sum += specs[prop] / totalWeight;
if (r <= sum) return prop;
}
}
2 changes: 1 addition & 1 deletion EssentialEstablishmentGenerator/Town/js/createTown.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ setup.createTown = function (base) {
town.politicalIdeology = town.politicalIdeology || town._politicalIdeology
town.politicalSource = town.politicalSource || town._politicalSource
town.origin = setup.townData.terrain[town.terrain].location[town.location].origin.seededrandom()
town.vegetation = setup.townData.terrain[town.terrain].location[town.location].vegetation.seededrandom()
town.vegetation = setup.weightRandom(setup.townData.terrain[town.terrain].location[town.location].vegetation)
town.possibleMaterials = setup.townData.terrain[town.terrain].location[town.location].possibleMaterials
town.materialProbability = setup.structure.material.types
Object.keys(town.roll).forEach(function (roll) {
Expand Down
212 changes: 181 additions & 31 deletions EssentialEstablishmentGenerator/Town/js/townData.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Once you've cloned the project, remember to `yarn install` or `npm install` to i
You will also need to download Tweego from [here.](https://www.motoslave.net/tweego/) and place the contents inside /Eigengrau-s-Essential-Establishment-Generator/.twine if the .twine folder does not already exist just create one.

* Use `npm test` to run tests.
* Use `npm build` to build the output files. The entire thing will output to the /gh-pages folder as the index.html file.
* Use `npm run-script build` to build the output files. (Note that this will return a File Not Found error, but it is working) The entire thing will output to the /gh-pages folder as the index.html file.
* Use `npm start` to automatically rebuild on file changes.


Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"chalk": "^2.4.2",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-jest": "^22.5.1",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"gh-pages": "^2.0.1",
"husky": "^2.3.0",
"jest": "^24.8.0",
"lint-staged": "^8.1.7",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.1.1",
"husky": "^2.7.0",
"jest": "^24.9.0",
"lint-staged": "^8.2.1",
"shelljs": "^0.8.3",
"yauzl": "^2.10.0"
}
Expand Down
12 changes: 6 additions & 6 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ module.exports = {
tweego: {
win32: {
x86:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-windows-x86.zip',
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-windows-x86.zip',
x64:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-windows-x64.zip'
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-windows-x64.zip'
},
darwin: {
x86:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-macos-x86.zip',
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-macos-x86.zip',
x64:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-macos-x64.zip'
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-macos-x64.zip'
},
linux: {
x86:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-linux-x86.zip',
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-linux-x86.zip',
x64:
'https://www.motoslave.net/tweego/download.php/tweego-1.3.0-linux-x64.zip'
'https://www.motoslave.net/tweego/download.php/tweego-2.0.0-linux-x64.zip'
}
},
storyFormats:
Expand Down
Loading