-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ryceg/master
update
- Loading branch information
Showing
10 changed files
with
798 additions
and
550 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
EssentialEstablishmentGenerator/Settings/StoryStuff/StoryData.twee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:: StoryData | ||
{ | ||
"ifid": "f7166797-ffa0-4ec8-a0b6-fbb555954c13" | ||
} |
5 changes: 0 additions & 5 deletions
5
EssentialEstablishmentGenerator/Settings/StoryStuff/StorySettings.twee
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.