From 4588cf24dcaf6851c53156fcf9fce07c9a14be7f Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sat, 17 Oct 2020 00:21:59 -0400 Subject: [PATCH] Rearranged files and made tweaks --- changelog.md | 4 ++++ index.html | 5 +++-- js/game.js | 45 ++++++--------------------------------------- js/mod.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ js/temp.js | 5 +++++ js/utils.js | 2 +- style.css | 2 +- 7 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 js/mod.js diff --git a/changelog.md b/changelog.md index 9ccf918..d3d4e44 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # The Modding Tree changelog: +- Moved most of the code users will want to edit to mod.js. +- Added getStartPoints() +- Fixed issues with version number + ### v2.0.5 - 10/16/20 - Made more features (including prestige parameters) able to be dynamic. - Layer nodes can be hidden but still take up space with "ghost" visibility diff --git a/index.html b/index.html index 7cdfef7..e9438ba 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ + @@ -48,7 +49,7 @@

{{VERSION.withName}}


- The Modding Tree {{VERSION.tmtNum}} by Acamaeda + The Modding Tree {{TMT_VERSION.tmtNum}} by Acamaeda
The Prestige Tree made by Jacorb and Aarex
@@ -90,7 +91,7 @@
-
{{VERSION.withoutName}}
+
{{VERSION.withoutName}}

i
diff --git a/js/game.js b/js/game.js index 29a67d7..aeaeafb 100644 --- a/js/game.js +++ b/js/game.js @@ -3,43 +3,10 @@ var needCanvasUpdate = true; var NaNalert = false; var gameEnded = false; - -let modInfo = { - name: "The Modding Tree", - id: "modbase", - pointsName: "points", - discordName: "", - discordLink: "", - changelogLink: "https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md", - offlineLimit: 1 // In hours -} - -// Set your version in num and name, but leave the tmt values so people know what version it is -let VERSION = { - num: "2.0.5.1", - name: "Pinnacle of Achievement Mountain", - tmtNum: "2.0.5.1", - tmtName: "Pinnacle of Achievement Mountain" -} - -// Determines if it should show points/sec -function canGenPoints(){ - return hasUpgrade("c", 11) -} - -// Calculate points/sec! -function getPointGen() { - if(!canGenPoints()) - return new Decimal(0) - - let gain = new Decimal(1) - if (hasUpgrade("c", 12)) gain = gain.times(upgradeEffect("c", 12)) - return gain -} - -// You can change this if you have things that can be messed up by long tick lengths -function maxTickLength() { - return(3600000) // Default is 1 hour which is just arbitrarily large +// Don't change this +const TMT_VERSION = { + tmtNum: "2.1", + tmtName: "Non-nonsensical" } function getResetGain(layer, useType = null) { @@ -214,7 +181,7 @@ function doReset(layer, force=false) { } prevOnReset = {...player} //Deep Copy - player.points = (row == 0 ? new Decimal(0) : new Decimal(10)) + player.points = (row == 0 ? new Decimal(0) : getStartPoints()) for (let x = row; x >= 0; x--) rowReset(x, layer) rowReset("side", layer) @@ -235,7 +202,7 @@ function resetRow(row) { player[layer].unlocked = false if (player[layer].unlockOrder) player[layer].unlockOrder = 0 } - player.points = new Decimal(10) + player.points = getStartPoints() updateTemp(); resizeCanvas(); } diff --git a/js/mod.js b/js/mod.js new file mode 100644 index 0000000..0f0f62a --- /dev/null +++ b/js/mod.js @@ -0,0 +1,47 @@ +let modInfo = { + name: "The Modding Tree", + id: "modbase", + pointsName: "points", + discordName: "", + discordLink: "", + changelogLink: "https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md", + offlineLimit: 1, // In hours + initialStartPoints: new Decimal (10) // Used for hard resets and new players +} + +// Set your version in num and name +let VERSION = { + num: "2.1", + name: "Non-nonsensical!", +} + +// Add the names of functions that do something when you call them here. (The ones here are examples) +var doNotCallTheseFunctionsEveryTick = ["doReset", "buy", "onPurchase", "blowUpEverything"] + +function getStartPoints(){ + return new Decimal(modInfo.initialStartPoints) +} + +// Determines if it should show points/sec +function canGenPoints(){ + return hasUpgrade("c", 11) +} + +// Calculate points/sec! +function getPointGen() { + if(!canGenPoints()) + return new Decimal(0) + + let gain = new Decimal(1) + if (hasUpgrade("c", 12)) gain = gain.times(upgradeEffect("c", 12)) + return gain +} + + + +// Less important things beyond this point! + +// You can change this if you have things that can be messed up by long tick lengths +function maxTickLength() { + return(3600000) // Default is 1 hour which is just arbitrarily large +} \ No newline at end of file diff --git a/js/temp.js b/js/temp.js index 9be2010..3cdc961 100644 --- a/js/temp.js +++ b/js/temp.js @@ -6,6 +6,11 @@ var activeFunctions = [ "buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress", "onClick", "masterButtonPress" ] +var noCall = doNotCallTheseFunctionsEveryTick +for (item in noCall) { + activeFunctions.push(noCall[item]) +} + function setupTemp() { tmp = {} setupTempData(layers, tmp) diff --git a/js/utils.js b/js/utils.js index 7b7d20d..f22cd2d 100644 --- a/js/utils.js +++ b/js/utils.js @@ -79,7 +79,7 @@ function startPlayerBase() { keepGoing: false, hasNaN: false, hideChallenges: false, - points: new Decimal(10), + points: modInfo.initialStartPoints, subtabs: {}, } } diff --git a/style.css b/style.css index 9154a29..3264d6b 100644 --- a/style.css +++ b/style.css @@ -318,7 +318,7 @@ h1, h2, h3, b, input { } #version:hover { - transform: scale(1.2, 1.2); + transform: scale(1.1, 1.1); right: 4.8px; }