From 473f9d58d9ea32d0f0154d28834103ec8b6cb4dc Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sat, 5 Dec 2020 14:52:29 -0500 Subject: [PATCH] A lot --- changelog.md | 6 ++++++ demo.html | 9 ++------- docs/custom-tab-layouts.md | 4 +++- docs/main-mod-info.md | 3 ++- index.html | 9 ++------- js/Demo/demoLayers.js | 1 - js/Demo/demoMod.js | 9 +++++++-- js/components.js | 6 +++--- js/game.js | 2 +- js/mod.js | 8 +++++++- js/technical/layerSupport.js | 30 ++++++++++++++++++++++++++++-- js/technical/systemComponents.js | 14 +++++++------- js/technical/temp.js | 1 - js/utils.js | 6 ++++++ 14 files changed, 74 insertions(+), 34 deletions(-) diff --git a/changelog.md b/changelog.md index 123f407..751b2d0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # The Modding Tree changelog: +- The changelog tab is back, and can be set in mod.js. +- The victory screen text is configurable. +- Added an argument to use specific rows in an "upgrades" component. +- Added the ability to easily make a tab that is a collection of layers in subtabs. +- Improved spacing for embedding layers with subtabs into subtabs. + ### v2.2.8 12/03/20 - Double-clicking a layer node brings you to the main subtab for that layer. - Attempted to fix challenges visually updating a different way. diff --git a/demo.html b/demo.html index 8339bdd..06e8696 100644 --- a/demo.html +++ b/demo.html @@ -28,10 +28,9 @@

{{modInfo.name}} {{VERSION.withoutName}}



-

Congratulations! You have reached the end and beaten this game, but for now...


+


Please check the Discord to see if there are new content updates!



It took you {{formatTime(player.timePlayed)}} to beat the game.
-
Make sure that you record the time in your stream or else your speedrun won't count!

    


@@ -39,14 +38,10 @@ The Modding Tree Discord
Main Prestige Tree server


- If you would like to speedrun this, press Play Again and record your attempt, then submit on the Discord Server in the channel #speedrun-submissions. -


-

Oh, you are still reading this?

-
-
{{VERSION.withoutName}}
+
{{VERSION.withoutName}}

i
diff --git a/docs/custom-tab-layouts.md b/docs/custom-tab-layouts.md index 20860a1..1cc4a08 100644 --- a/docs/custom-tab-layouts.md +++ b/docs/custom-tab-layouts.md @@ -41,7 +41,9 @@ These are the existing components, but you can create more in [components.js](/j - prestige-button: The argument is a string that the prestige button should say before the amount of currency you will gain. It can also be a function that returns updating text. -- upgrades, milestones, challenges, achievements: Display the upgrades, milestones, and challenges for a layer, as appropriate. +- upgrades: The layer's upgrades. The argument is optional, and is a the list of rows this component should include, if it doesn't have all of them. + +- milestones, challenges, achievements: Display the upgrades, milestones, and challenges for a layer, as appropriate. - buyables, clickables: Display all of the buyables/clickables for this layer, as appropriate. The argument is optional and is the size of the boxes in pixels. diff --git a/docs/main-mod-info.md b/docs/main-mod-info.md index 8c03cec..e11f455 100644 --- a/docs/main-mod-info.md +++ b/docs/main-mod-info.md @@ -13,7 +13,6 @@ Here's a breakdown of what's in it: "discordName" is the text on the link, and "discordLink" is the url of an invite. If you're using a Discord invite, please make sure it's set to never expire. - - changelogLink: You can use this to set a link to a page where your changelog for the game is displayed. - offlineLimit: The maximum amount of offline time that the player can accumulate, in hours. Any extra time is lost. (a number) This is useful because most of these mods are fast-paced enough that too much offline time ruins the balance, such as the time in between updates. That is why I suggest developers disable offline time on their own savefile. @@ -24,6 +23,8 @@ Here's a breakdown of what's in it: - num: The mod's version number, displayed at the top right of the tree tab. - name: The version's name, displayed alongside the number in the info tab. +- changelog is the HTML displayed in the changelog tab. + - doNotCallTheseFunctionsEveryTick is very important. TMT calls every function anywhere in "layers" every tick to store the result, unless specifically told not to. Functions that have are used to do an action need to be identified. "Official" functions (those in the documentation) are all fine, but if you make any new ones, add their names to this array. ```js diff --git a/index.html b/index.html index 169fa1f..52fa6d2 100644 --- a/index.html +++ b/index.html @@ -28,10 +28,9 @@

{{modInfo.name}} {{VERSION.withoutName}}



-

Congratulations! You have reached the end and beaten this game, but for now...


+


Please check the Discord to see if there are new content updates!



It took you {{formatTime(player.timePlayed)}} to beat the game.
-
Make sure that you record the time in your stream or else your speedrun won't count!

    


@@ -39,14 +38,10 @@ The Modding Tree Discord
Main Prestige Tree server


- If you would like to speedrun this, press Play Again and record your attempt, then submit on the Discord Server in the channel #speedrun-submissions. -


-

Oh, you are still reading this?

-
-
{{VERSION.withoutName}}
+
{{VERSION.withoutName}}

i
diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index 0c4bbc0..d396350 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -395,7 +395,6 @@ addLayer("f", { tooltipLocked() { // Optional, tooltip displays when the layer is locked return ("This weird farmer dinosaur will only see you if you have at least " + this.requires() + " candies. You only have " + formatWhole(player.points)) }, - midsection: [ "blank", ['display-image', 'https://images.beano.com/store/24ab3094eb95e5373bca1ccd6f330d4406db8d1f517fc4170b32e146f80d?auto=compress%2Cformat&dpr=1&w=390'], ["display-text", "Bork bork!"] diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 1d58ef6..4e4fb4c 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -4,7 +4,6 @@ let modInfo = { pointsName: "points", discordName: "", discordLink: "", - changelogLink: "https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md", initialStartPoints: new Decimal (10), // Used for hard resets and new players offlineLimit: 1, // In hours @@ -12,10 +11,16 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.2.8", + num: "2.2.9", name: "Uprooted", } +let changelog = `

Changelog:


+

v0.0


+ - Added things.
+ - Added stuff.` + +let winText = `Congratulations! You have reached the end and beaten this game, but for now...` // If you add new functions anywhere inside of a layer, and those functions have an effect when called, add them here. // (The ones here are examples, all official functions are already taken care of) var doNotCallTheseFunctionsEveryTick = ["doReset", "buy", "onPurchase", "blowUpEverything"] diff --git a/js/components.js b/js/components.js index 03d2a16..f5933b6 100644 --- a/js/components.js +++ b/js/components.js @@ -134,10 +134,10 @@ function loadVue() { }) Vue.component('upgrades', { - props: ['layer'], + props: ['layer', 'data'], template: `
-
+
@@ -320,7 +320,7 @@ function loadVue() {
- +
diff --git a/js/game.js b/js/game.js index 090d2ad..8548eac 100644 --- a/js/game.js +++ b/js/game.js @@ -4,7 +4,7 @@ var gameEnded = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.2.8", + tmtNum: "2.2.9", tmtName: "Uprooted" } diff --git a/js/mod.js b/js/mod.js index 9c1dc5b..cb83298 100644 --- a/js/mod.js +++ b/js/mod.js @@ -5,7 +5,6 @@ let modInfo = { pointsName: "points", discordName: "", discordLink: "", - changelogLink: "https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md", initialStartPoints: new Decimal (10), // Used for hard resets and new players offlineLimit: 1, // In hours @@ -17,6 +16,13 @@ let VERSION = { name: "Literally nothing", } +let changelog = `

Changelog:


+

v0.0


+ - Added things.
+ - Added stuff.` + +let winText = `Congratulations! You have reached the end and beaten this game, but for now...` + // If you add new functions anywhere inside of a layer, and those functions have an effect when called, add them here. // (The ones here are examples, all official functions are already taken care of) var doNotCallTheseFunctionsEveryTick = ["blowUpEverything"] diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index 910cfc3..72f73d4 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -144,6 +144,7 @@ function updateLayers(){ if(layers[layer].softcap === undefined) layers[layer].softcap = new Decimal("e1e7") if(layers[layer].softcapPower === undefined) layers[layer].softcapPower = new Decimal("0.5") if(layers[layer].displayRow === undefined) layers[layer].displayRow = layers[layer].row + if(layers[layer].name === undefined) layers[layer].name = layer let row = layers[layer].row @@ -180,9 +181,30 @@ function updateLayers(){ updateHotkeys() } -function addLayer(layerName, layerData){ // Call this to add layers from a different file! + +function addLayer(layerName, layerData, tabLayers = null){ // Call this to add layers from a different file! layers[layerName] = layerData layers[layerName].isLayer = true + if (tabLayers !== null) + { + let format = {} + for (id in tabLayers) { + layer = tabLayers[id] + format[(layers[layer].name ? layers[layer].name : layer)] = { + embedLayer: layer, + buttonStyle() { + if (!tmp[this.embedLayer].nodeStyle) return {'border-color': tmp[this.embedLayer].color} + else { + style = tmp[this.embedLayer].nodeStyle + if (style['border-color'] === undefined) style['border-color'] = tmp[this.embedLayer].color + return style + } + }, + unlocked() {return tmp[this.embedLayer].layerShown}, + } + } + layers[layerName].tabFormat = format + } } function addNode(layerName, layerData){ // Does the same thing, but for non-layer nodes @@ -190,7 +212,6 @@ function addNode(layerName, layerData){ // Does the same thing, but for non-laye layers[layerName].isLayer = false } - // If data is a function, return the result of calling it. Otherwise, return the data. function readData(data, args=null){ if (!!(data && data.constructor && data.call && data.apply)) @@ -222,4 +243,9 @@ addLayer("info-tab", { addLayer("options-tab", { tabFormat: ["options-tab"], row: "otherside" +}) + +addLayer("changelog-tab", { + tabFormat() {return ([["raw-html", modInfo.changelog]])}, + row: "otherside" }) \ No newline at end of file diff --git a/js/technical/systemComponents.js b/js/technical/systemComponents.js index 853a8ec..a07bdd7 100644 --- a/js/technical/systemComponents.js +++ b/js/technical/systemComponents.js @@ -51,7 +51,7 @@ var systemComponents = { 'layer-tab': { - props: ['layer', 'back', 'spacing'], + props: ['layer', 'back', 'spacing', 'embedded'], template: `
@@ -78,10 +78,10 @@ var systemComponents = {
-
+
- +
@@ -122,17 +122,17 @@ var systemComponents = { Made by {{modInfo.author}}
- The Modding Tree {{TMT_VERSION.tmtNum}} by Acamaeda + The Modding Tree {{TMT_VERSION.tmtNum}} by Acamaeda
The Prestige Tree made by Jacorb and Aarex
Original idea by papyrus (on discord) -

- Changelog
+

+
{{modInfo.discordName}}
The Modding Tree Discord
Main Prestige Tree server
-

+

Time Played: {{ formatTime(player.timePlayed) }}

Hotkeys



{{key.description}}
diff --git a/js/technical/temp.js b/js/technical/temp.js index 92e47a2..f319ba7 100644 --- a/js/technical/temp.js +++ b/js/technical/temp.js @@ -129,7 +129,6 @@ function updateChallengeTemp(layer) function updateChallengeDisplay(layer) { for (id in player[layer].challenges) { let style = "locked" - console.log(layer + " " + id) if (player[layer].activeChallenge == id && canCompleteChallenge(layer, id)) style = "canComplete" else if (hasChallenge(layer, id)) style = "done" tmp[layer].challenges[id].defaultStyle = style diff --git a/js/utils.js b/js/utils.js index 0a8adec..262c72e 100644 --- a/js/utils.js +++ b/js/utils.js @@ -256,6 +256,7 @@ function load() { changeTheme(); changeTreeQuality(); updateLayers() + setupModInfo() setupTemp(); updateTemp(); @@ -263,6 +264,11 @@ function load() { loadVue(); } +function setupModInfo() { + modInfo.changelog = changelog + modInfo.winText = winText ? winText : `Congratulations! You have reached the end and beaten this game, but for now...` + +} function fixNaNs() { NaNcheck(player)