diff --git a/README.md b/README.md index b33a96a73bd2b9a825f399b67dbc87dcf98cfb70..3440d8c0eaa3915c788fcd6eda18a4bbf704497d 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,8 @@ How to mod (basic doc): Linux: Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!) - Ensure executable permission on file "compile" - In the root dir of sources (where you see src, devTools, bin...) run command "./compile" from console - compile-git will produce the same result file but with current commit hash in filename. + Ensure executable permission on file "compile.sh" + In the root dir of sources (where you see src, devTools, bin...) run command "./compile.sh" from console Mac: Not supported directly (I don't have access to Mac for testing). diff --git a/compile b/compile deleted file mode 100755 index fe95b68a0c2cc46d8d16fb5fb59e71400a310561..0000000000000000000000000000000000000000 --- a/compile +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -mkdir -p bin - -while [[ "$1" ]] -do - case $1 in - --insane) - insane="true" - ;; - *) - echo "Unknown argument $1" - exit 1 - esac - shift -done - -# Find and insert current commit -COMMIT=$(git rev-parse --short HEAD) -sed -Ei "s/build .releaseID/\0 commit $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw - -if [[ ! "$insane" ]] -then - # Run sanity check. - ./sanityCheck -fi - -export TWEEGO_PATH=devTools/tweeGo/storyFormats -TWEEGO_EXE="tweego" - -if hash $TWEEGO_EXE 2>/dev/null; then - echo "system tweego binary" -else - case "$(uname -m)" in - x86_64|amd64) - echo "x64 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" - fi - ;; - x86|i[3-6]86) - echo "x86 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" - fi - ;; - *) - echo "No system tweego binary found, and no precompiled binary for your platform available" - echo "Please compile tweego and put the executable in PATH" - exit 2 - esac -fi - -$TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ --head devTools/head.html || build_failed="true" - -# Revert AlphaDisclaimer for next compilation -git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw - -if [ "$build_failed" = "true" ] -then - exit 1 -fi - -#Make the output prettier, replacing \t with a tab and \n with a newline -sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \ - && mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html - -ln -s ../resources bin/ 2> /dev/null - -echo "bin/FC_pregmod.html compilation finished." diff --git a/compile-git b/compile-git deleted file mode 100755 index 2897281674b89f2d84eb41a552367f5c6f384ab9..0000000000000000000000000000000000000000 --- a/compile-git +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -mkdir -p bin - -# Run sanity check. -./sanityCheck - -HASH="$(git rev-list -n 1 --abbrev-commit HEAD)" - -export TWEEGO_PATH=devTools/tweeGo/storyFormats -TWEEGO_EXE="tweego" - -if hash $TWEEGO_EXE 2>/dev/null; then - echo "system tweego binary" -else - case "$(uname -m)" in - x86_64|amd64) - echo "x64 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" - fi - ;; - x86|i[3-6]86) - echo "x86 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" - fi - ;; - *) - echo "No system tweego binary found, and no precompiled binary for your platform available" - echo "Please compile tweego and put the executable in PATH" - exit 2 - esac -fi - -$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true" - -#Make the output prettier, replacing \t with a tab and \n with a newline -sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \ - && mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html" - -ln -s ../resources bin/ 2> /dev/null - -echo "bin/FC_pregmod_$HASH.html compilation finished." diff --git a/compile-git+java-sanityCheck.sh b/compile-git+java-sanityCheck.sh deleted file mode 100755 index 2fd438b3d4fc537d84bc99bd3fefc7604167077b..0000000000000000000000000000000000000000 --- a/compile-git+java-sanityCheck.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -mkdir -p bin - -# Run sanity check. -./java+gitGrep-sanityCheck.sh - -HASH="$(git rev-list -n 1 --abbrev-commit HEAD)" - -export TWEEGO_PATH=devTools/tweeGo/storyFormats -TWEEGO_EXE="tweego" - -if hash $TWEEGO_EXE 2>/dev/null; then - echo "system tweego binary" -else - case "$(uname -m)" in - x86_64|amd64) - echo "x64 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" - fi - ;; - x86|i[3-6]86) - echo "x86 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" - fi - ;; - *) - echo "No system tweego binary found, and no precompiled binary for your platform available" - echo "Please compile tweego and put the executable in PATH" - exit 2 - esac -fi - -$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true" - -#Make the output prettier, replacing \t with a tab and \n with a newline -sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \ - && mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html" - -ln -s ../resources bin/ 2> /dev/null - -echo "FC_pregmod_$HASH.html compilation finished." diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000000000000000000000000000000000000..9754f807d1704f1d2587f030edc412e8e28d9185 --- /dev/null +++ b/compile.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +output=/dev/stdout + +# displays help text +function displayHelp { + cat << HelpText +Usage: compile.sh [OPTION]... + +Options: + -d, --dry Do not compile + -g, --git Add hash of HEAD to filename + -h, --help Show this help text + -j, --java Run sanityCheck based on java + -p, --python Run sanityCheck based on python + -q, --quiet Suppress terminal output +HelpText +} + +#display an error message +function echoError { + echo -e "\033[0;31m$@\033[0m" +} + +#display message +function echoMessage { + echo "$1" > "${output}" +} + +#compile the HTML file +function compile { + + mkdir -p bin + + export TWEEGO_PATH=devTools/tweeGo/storyFormats + TWEEGO_EXE="tweego" + + if hash $TWEEGO_EXE 2>/dev/null; then + echoMessage "system tweego binary" + else + case "$(uname -m)" in + x86_64|amd64) + echoMessage "x64 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" + fi + ;; + x86|i[3-6]86) + echoMessage "x86 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" + fi + ;; + *) + echoError "No system tweego binary found, and no precompiled binary for your platform available." + echoError "Please compile tweego and put the executable in PATH." + exit 2 + esac + fi + + if [[ "$usehash" ]]; then + HASH="$(git rev-list -n 1 --abbrev-commit HEAD)" + + $TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true" + + if [ "$build_failed" = "true" ] + then + echoError "Build failed." + exit 1 + fi + + #Make the output prettier, replacing \t with a tab and \n with a newline + sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \ + && mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html" + + ln -s ../resources bin/ 2> /dev/null + + echoMessage "Saved to bin/FC_pregmod_$HASH.html." + + else + # Find and insert current commit + COMMIT=$(git rev-parse --short HEAD) + sed -Ei "s/build .releaseID/\0 commit $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw + + $TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ --head devTools/head.html || build_failed="true" + + # Revert AlphaDisclaimer for next compilation + git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw + + if [ "$build_failed" = "true" ] + then + echoError "Build failed." + exit 1 + fi + + #Make the output prettier, replacing \t with a tab and \n with a newline + sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \ + && mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html + + ln -s ../resources bin/ 2> /dev/null + + echoMessage "Saved to bin/FC_pregmod.html." + fi +} + +if [[ "$1" == "" ]]; then + #tip if no option + echoMessage "For more options see compile.sh -h." +else + #parse options + while [[ "$1" ]] + do + case $1 in + -d|--dry) + dry="true" + ;; + -g|--git) + usehash="true" + ;; + -h|--help) + displayHelp + exit 0 + ;; + -j|--java) + java="true" + ;; + -p|--python) + python="true" + ;; + -q|--quiet) + output=/dev/null + ;; + *) + echoError "Unknown argument $1." + displayHelp + exit 1 + esac + shift + done +fi + +# Run sanity check. +[ -n "$java" ] && ./java+gitGrep-sanityCheck.sh + +[ -n "$python" ] && ./sanityCheck + +#compile +if [[ "$dry" ]]; then + echoMessage "Dry run finished." +else + compile + echoMessage "Compilation finished." +fi diff --git a/src/events/intro/introSummary.tw b/src/events/intro/introSummary.tw index cd7ab5fe9d3aae52b17a3fc2e8d4e6316be4c801..9e89d02cb1ffb8758fb6ac7719dfae83b7ffc0fd 100644 --- a/src/events/intro/introSummary.tw +++ b/src/events/intro/introSummary.tw @@ -212,6 +212,14 @@ __''General slave settings''__ <</options>> <<if $familyTesting == 1>> + <br> + <<options $showDistantRelatives>> + <<option 0 "Disable distant relatives">> + Distant relatives ''will not'' be tracked. + <<option 1 "Enable distant relatives">> + Distant relatives ''will'' be tracked. + <</options>> + <br> <<options $inbreeding>> <<option 0 "Disable inbreeding damage">> diff --git a/src/js/slaveGenerationJS.js b/src/js/slaveGenerationJS.js index 5df0c67dffb8c41d57398a7a570cff594b4c4268..d87b6c35d4829b6e35ac15e55329fcbc94354599 100644 --- a/src/js/slaveGenerationJS.js +++ b/src/js/slaveGenerationJS.js @@ -8,7 +8,8 @@ window.raceToNationality = /** @param {App.Entity.SlaveState} slave */ function const V = State.variables; slave.nationality = hashChoice(V.nationalities); /* Maximum of 100 attempts */ - for (let i = 0; setup.raceSelector[slave.nationality] && !(slave.race in setup.raceSelector[slave.nationality]) && i < 100; i++) { + let i = 0; + for (; setup.raceSelector[slave.nationality] && !(slave.race in setup.raceSelector[slave.nationality]) && i < 100; i++) { slave.nationality = hashChoice(V.nationalities); } /* No success after 100 attempts, so just randomize according to race */ diff --git a/src/uncategorized/descriptionOptions.tw b/src/uncategorized/descriptionOptions.tw index 681831c400791a20c40d6ad00e7409bf1443d7c9..3a962e19135b8d5144bb3e36dd7b7ae50c347d00 100644 --- a/src/uncategorized/descriptionOptions.tw +++ b/src/uncategorized/descriptionOptions.tw @@ -109,9 +109,9 @@ Attractiveness and Sexual scores are Names will <<if $surnameOrder == 0>> - adhere to a slave's country of origin. //[[Force name surname|Intro Summary][$surnameOrder = 1]]// | //[[Force surname name|Intro Summary][$surnameOrder = 2]]// + adhere to a slave's country of origin. //[[Force name surname|Description Options][$surnameOrder = 1]]// | //[[Force surname name|Intro Summary][$surnameOrder = 2]]// <<elseif $surnameOrder == 1>> always be name surname. //[[Allow nationality name order|Description Options][$surnameOrder = 0]]// | //[[Force surname name|Intro Summary][$surnameOrder = 2]]// <<elseif $surnameOrder == 2>> - always be name surname. //[[Allow nationality name order|Intro Summary][$surnameOrder = 0]]// | //[[Force name surname|Intro Summary][$surnameOrder = 1]]// + always be name surname. //[[Allow nationality name order|Description Options][$surnameOrder = 0]]// | //[[Force name surname|Intro Summary][$surnameOrder = 1]]// <</if>> diff --git a/src/uncategorized/endWeek.tw b/src/uncategorized/endWeek.tw index e66d3f0d7e8aaeb6516cfe47f3bcc8e958fcf7c6..489fea5e476d89a4f92444f1643c4ef5f256cee2 100644 --- a/src/uncategorized/endWeek.tw +++ b/src/uncategorized/endWeek.tw @@ -45,13 +45,13 @@ <<if $organs.length > 0>> <<run $organs.forEach(function(o) { - if ($organs[o].weeksToCompletion > 0) { + if (o.weeksToCompletion > 0) { if ($organFarmUpgrade == 3) { - $organs[o].weeksToCompletion -= 4; + o.weeksToCompletion -= 4; } else if ($organFarmUpgrade == 2) { - $organs[o].weeksToCompletion -= 2; + o.weeksToCompletion -= 2; } else { - $organs[o].weeksToCompletion--; + o.weeksToCompletion--; } } })>> @@ -59,13 +59,13 @@ <<if $incubatorOrgans.length > 0>> <<run $incubatorOrgans.forEach(function(io) { - if ($incubatorOrgans[io].weeksToCompletion > 0) { + if (io.weeksToCompletion > 0) { if ($organFarmUpgrade == 3) { - $incubatorOrgans[io].weeksToCompletion -= 4; + io.weeksToCompletion -= 4; } else if ($organFarmUpgrade == 2) { - $incubatorOrgans[io].weeksToCompletion -= 2; + io.weeksToCompletion -= 2; } else { - $incubatorOrgans[io].weeksToCompletion--; + io.weeksToCompletion--; } } })>> @@ -74,13 +74,13 @@ /* for potential future use <<if $nurseryOrgans.length > 0>> <<run $nurseryOrgans.forEach(function(no) { - if ($nurseryOrgans[no].weeksToCompletion > 0) { + if (no.weeksToCompletion > 0) { if ($organFarmUpgrade == 3) { - $nurseryOrgans[no].weeksToCompletion -= 4; + no.weeksToCompletion -= 4; } else if ($organFarmUpgrade == 2) { - $nurseryOrgans[no].weeksToCompletion -= 2; + no.weeksToCompletion -= 2; } else { - $nurseryOrgans[no].weeksToCompletion--; + no.weeksToCompletion--; } } })>> @@ -89,10 +89,10 @@ <<if $limbs.length > 0>> <<run $limbs.forEach(function(l) { - if ($limbs[l].weeksToCompletion > 0) { - $limbs[l].weeksToCompletion--; + if (l.weeksToCompletion > 0) { + l.weeksToCompletion--; } - if ($limbs[l].weeksToCompletion == 0) { + if (l.weeksToCompletion == 0) { $limbsCompleted++; } })>>