From 9a4302b56a3f8631ba7df4b02c0445826487bd8c Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sun, 25 Oct 2020 22:25:42 -0400 Subject: [PATCH] Updated docs, made layer type default to none --- changelog.md | 2 ++ docs/!general-info.md | 19 ++++++++++++++----- docs/bars.md | 4 ++-- docs/clickables.md | 2 ++ docs/infoboxes.md | 34 ++++++++++++++++++++++++++++++++++ docs/layer-features.md | 7 ++++--- js/Demo/demoLayers.js | 3 +-- js/layerSupport.js | 1 + 8 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 docs/infoboxes.md diff --git a/changelog.md b/changelog.md index 04a72a8..05c57e0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # The Modding Tree changelog: +- Added an infobox component. Thank you to thepaperpilot for this contribution! +- Layer type is now optional, and defaults to "none". - Fixed the "blank" component breaking if only specifying the height. - Fixed some numbers not displaying with enough digits. - Made a few more things able to be functions. diff --git a/docs/!general-info.md b/docs/!general-info.md index 4d1e17b..1620881 100644 --- a/docs/!general-info.md +++ b/docs/!general-info.md @@ -22,23 +22,32 @@ that returns what the value should be at any given time. All display text can be basic HTML instead (But you can't use most Vue features there). -## Table of Contents: +# Table of Contents: + +## General: - [Getting Started](getting-started.md): Getting your own copy of the code set up with Github Desktop. - [Main mod info](main-mod-info.md): How to set up general things for your mod in mod.js. - [Basic layer breakdown](basic-layer-breakdown.md): Breaking down the components of a layer with minimal features. - [Layer features](layer-features.md): Explanations of all of the different properties that you can give a layer. +- [Custom Tab Layouts](custom-tab-layouts.md): An optional way to give your tabs a different layout. + You can even create entirely new components to use. +- [Updating TMT](updating-tmt.md): Using Github Desktop to update your mod's version of TMT. + +## Common components + - [Upgrades](upgrades.md): How to create upgrades for a layer. - [Milestones](milestones.md): How to create milestones for a layer. -- [Challenges](challenges.md): How to create challenges for a layer. - [Buyables](buyables.md): Create rebuyable upgrades for your layer (with the option to make them respec-able). Can be used to make Enhancers or Space Buildings. - [Clickables](clickables.md): A more generalized variant of buyables, for any kind of thing that is sometimes clickable. Between these and Buyables, you can do just about anything. + +## Other components + +- [Challenges](challenges.md): How to create challenges for a layer. - [Bars](bars.md): Display some information as a progress bar, gague, or similar. They are highly customizable, and can be horizontal and vertical as well. -- [Custom Tab Layouts](custom-tab-layouts.md): An optional way to give your tabs a different layout. - You can even create entirely new components to use. - [Subtabs and Microtabs](subtabs-and-microtabs.md): Create subtabs for your tabs, as well as "microtab" components that you can put inside the tabs. - [Achievements](milestones.md): How to create achievements for a layer (or for the whole game). -- [Updating TMT](updating-tmt.md): Using Github Desktop to update your mod's version of TMT. +- [Infoboxes](infoboxes.md): Boxes containing text that can be shown or hidden. diff --git a/docs/bars.md b/docs/bars.md index 6cbb85a..3ede504 100644 --- a/docs/bars.md +++ b/docs/bars.md @@ -1,4 +1,4 @@ -# Buyables +# Bars Bars let you display information in a more direct way. It can be a progress bar, health bar, capacity gague, or anything else. @@ -26,7 +26,7 @@ Features: - display(): **optional**, A function that returns text to be displayed on top of the bar, can use HTML. -- unlocked(): **optional**, A function returning a bool to determine if the buyable is visible or not. Default is unlocked. +- unlocked(): **optional**, A function returning a bool to determine if the bar is visible or not. Default is unlocked. - baseStyle, fillStyle, borderStyle, textStyle: **Optional**, Apply CSS to the unfilled portion, filled portion, border, and display text on the bar, in the form of an object where the keys are CSS attributes, and the values are the diff --git a/docs/clickables.md b/docs/clickables.md index 63a631a..9fc6af0 100644 --- a/docs/clickables.md +++ b/docs/clickables.md @@ -2,6 +2,8 @@ Clickables are any kind of thing that you can click for an effect. They're a more generalized version of Buyables. +DO NOT USE THESE TO MAKE THINGS THAT YOU CLICK REPEATEDLY FOR A BONUS BECAUSE THOSE ARE AWFUL. + There are several differences between the two. One is that a buyable's saved data is its amount as a Decimal, while Clickables store a "state" which can be a number or string, but not Decimal, array, or object). Buyables have a number of extra features which you can see on their page. diff --git a/docs/infoboxes.md b/docs/infoboxes.md new file mode 100644 index 0000000..70f97c2 --- /dev/null +++ b/docs/infoboxes.md @@ -0,0 +1,34 @@ +# Infoboxes + +Infoboxes are good for displaying "lore", or story elements, as well as for explaining complicated things. + +In the default tab layout, the first infobox will be displayed at the very top of the tab. + +Infoboxes are defined like other Big Features: + +```js + infoboxes: { + infobox: { + display() {return "Blah"}, + etc + } + etc + } +``` + +Features: + +- title: The text displayed above the main box. Can be a function to be dynamic, and can use basic HTML. + +- body: The text displayed inside the box. Can be a function to be dynamic, and can use basic HTML. + +- style, titleStyle, bodyStyle: **Optional**, Apply CSS to the infobox, or to the title button or body of the infobox, + in the form of an object where the keys are CSS attributes, and the values are the Values for + those attributes (both as strings). + +- unlocked(): **optional**, A function returning a bool to determine if the infobox is visible or not. Default is unlocked. + +- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar + +- id: **Assigned automagically**. It's the "key" which the bar was stored under, for convenient access. + The bar in the example's id is "bigBar". \ No newline at end of file diff --git a/docs/layer-features.md b/docs/layer-features.md index 6209ecc..6392d0d 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -46,8 +46,6 @@ Key: - effectDescription: **optional**, A function that returns a description of this effect. If the text stays constant, it can just be a string. -- lore: **optional**, Displays some text (can use basic HTML) in a box at the top of the layer tab, unless the player has hidden the lore in the settings. - - layerShown(): A function returning a bool which determines if this layer's node should be visible on the tree. It can also return "ghost", which will hide the layer, but its node will still take up space in the tree. @@ -96,10 +94,13 @@ Key: - achievements: Kind of like milestones, but with a different display style and some other differences. Extra features are on the way at a later date! [Explanations are in a separate file.](achievements.md) +- infoboxes: Displays some text in a box that can be shown or hidden. + [Explanations are in a separate file.](infoboxes.md) + ## Prestige formula features -- type: Determines which prestige formula you use. +- type: **optional**, Determines which prestige formula you use. Defaults to "none". "normal": The amount of currency you gain is independent of its current amount (like Prestige). formula before bonuses is based on `baseResource^exponent` "static": The cost is dependent on your total after reset. diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index af4a9c3..08f0b27 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -468,7 +468,7 @@ addLayer("f", { }, ) -// A side layer with achievements +// A side layer with achievements, with no prestige addLayer("a", { startData() { return { unlocked: true, @@ -476,7 +476,6 @@ addLayer("a", { }}, color: "yellow", resource: "achievement power", - type: "none", row: "side", layerShown() {return true}, tooltip() { // Optional, tooltip displays when the layer is locked diff --git a/js/layerSupport.js b/js/layerSupport.js index 75976d0..afbddb2 100644 --- a/js/layerSupport.js +++ b/js/layerSupport.js @@ -126,6 +126,7 @@ function updateLayers(){ if(layers[layer].unlockOrder === undefined) layers[layer].unlockOrder = [] if(layers[layer].gainMult === undefined) layers[layer].gainMult = new Decimal(1) if(layers[layer].gainExp === undefined) layers[layer].gainExp = new Decimal(1) + if(layers[layer].type === undefined) layers[layer].type = "none" let row = layers[layer].row if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}