diff --git a/changelog.md b/changelog.md
index 94775a3..c650942 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,6 @@
#The Modding Tree changelog:
+##v2.0
Added clickables, a more generalized variant of buyables!
Support for multiple completions of challenges.
Added getter/setter functions for buyable amount and such
@@ -13,14 +14,18 @@ effectDisplay in Challenges and Upgrades no longer takes an argument, as well as
Buyable cost can take an argument for amount of buyables, but if one is not supplied it should do the cost of the next buyable.
All displays will update correctly.
Changelog is no longer in index.html at all.
+Generation of Points now happens in the main game loop (not in a layer update function), enabled by canGenPoints in game.js
+
##v1.3.5
+
- Completely automated convertToDecimal, now you never have to worry about it again.
- Branches can be defined without a color id. But they can also use hex values for color ids!
- Created a tutorial for getting started with TMT and Github.
- Page title is now automatically taken from mod name.
##v1.3.4: 10/8/20
+
- Added "midsection" feature to add things to a tab's layout while still keeping the standard layout.
- Fix for being able to buy more buyables than you should.
diff --git a/index.html b/index.html
index 1243f00..da90b19 100644
--- a/index.html
+++ b/index.html
@@ -108,7 +108,7 @@
{{format(player.points)}}
{{modInfo.pointsName}}
- ({{format(getPointGen())}}/sec)
+ ({{format(getPointGen())}}/sec)
|
diff --git a/js/game.js b/js/game.js
index b58aa90..ac45790 100644
--- a/js/game.js
+++ b/js/game.js
@@ -22,13 +22,13 @@ let VERSION = {
}
// Determines if it should show points/sec
-function showPointGen(){
- return (tmp.pointGen.neq(new Decimal(0)))
-}
+function canGenPoints(){
+ return hasUpg("c", 11)
+}
// Calculate points/sec!
function getPointGen() {
- if(!hasUpg("c", 11))
+ if(!canGenPoints())
return new Decimal(0)
let gain = new Decimal(1)
@@ -38,15 +38,6 @@ function getPointGen() {
-// Function to determine if the player is in a challenge
-function inChallenge(layer, id){
- let chall = player[layer].active
- if (chall==toNumber(id)) return true
-
- if (layers[layer].challs[chall].countsAs)
- return layers[layer].challs[id].countsAs.includes(id)
-}
-
function getResetGain(layer, useType = null) {
let type = useType
if (!useType) type = layers[layer].type
@@ -304,7 +295,7 @@ function gameLoop(diff) {
if (player.devSpeed) diff *= player.devSpeed
addTime(diff)
-
+ player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
for (layer in layers){
if (layers[layer].update) layers[layer].update(diff);
}
diff --git a/js/layers.js b/js/layers.js
index cb714c2..f41816b 100644
--- a/js/layers.js
+++ b/js/layers.js
@@ -178,9 +178,6 @@ addLayer("c", {
if(layers[resettingLayer].row > this.row) fullLayerReset(this.layer) // This is actually the default behavior
},
layerShown() {return true}, // Condition for when layer appears on the tree
- update(diff) {
- if (player[this.layer].upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
- }, // Do any gameloop things (e.g. resource generation) inherent to this layer
automate() {
}, // Do any automation inherent to this layer if appropriate
resetsNothing() {return false},
diff --git a/js/utils.js b/js/utils.js
index 7e5fc6f..3834f38 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -477,6 +477,15 @@ function clickClickable(layer, id) {
updateClickableTemp(layer)
}
+// Function to determine if the player is in a challenge
+function inChallenge(layer, id){
+ let chall = player[layer].active
+ if (chall==toNumber(id)) return true
+
+ if (layers[layer].challs[chall].countsAs)
+ return layers[layer].challs[id].countsAs.includes(id)
+}
+
// ************ Misc ************
var onTreeTab = true