mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-22 00:21:32 +00:00
Added standardized automation
This commit is contained in:
parent
6506f81556
commit
f0c3942253
9 changed files with 49 additions and 16 deletions
|
@ -1,9 +1,12 @@
|
|||
# The Modding Tree changelog:
|
||||
|
||||
### v2.2.1 - 11/7/20
|
||||
- Added a small highlight to layers you can meaningfully prestige on.
|
||||
- Added passiveGeneration and autoPrestige features to standardize prestige automation. (The old ways still work, but the new ones work better with other things)
|
||||
- Improved milestones visually a bit.
|
||||
- "best" and "total" are now only displayed if present in startData.
|
||||
- Fixed issues with things not updating visually. (Thank you to to Jacorb!)
|
||||
- Side layers and button nodes can now be highlighted.
|
||||
- Updated docs on the new tree-related features.
|
||||
|
||||
## v2.2: Uprooted - 11/7/20
|
||||
|
|
|
@ -104,6 +104,12 @@ You can make almost any value dynamic by using a function in its place, includin
|
|||
|
||||
- prestigeButtonText(): **sometimes required**. Use this to make the entirety of the text a Prestige button contains. Only required for custom layers, but usable by all types.
|
||||
|
||||
- passiveGain(): **optional**, returns a regular number. You automatically generate your gain times this number every second (does nothing if absent)
|
||||
This is good for automating Normal layers.
|
||||
|
||||
- autoPrestige(): **optional**, returns a boolean, if true, the layer will always automatically do a prestige if it can.
|
||||
This is good for automating Static layers.
|
||||
|
||||
## Tree/node features
|
||||
|
||||
- symbol: **optional**. The text that appears on this layer's node. Default is the layer id with the first letter capitalized.
|
||||
|
@ -122,9 +128,9 @@ You can make almost any value dynamic by using a function in its place, includin
|
|||
|
||||
If you want to keep things, determine what to keep based on `resettingLayer`, `milestones`, and such, then call `layerDataReset(layer, keep)`, where `layer` is this layer, and `keep` is an array of the names of things to keep. It can include things like "points", "best", "total" (for this layer's prestige currency), "upgrades", any unique variables like "generatorPower", etc. If you want to only keep specific upgrades or something like that, save them in a separate variable, then call `layerDataReset`, and then set `player[this.layer].upgrades` to the saved upgrades.
|
||||
|
||||
- update(diff): **optional**. This function is called every game tick. Use it for any passive resource production or time-based things. `diff` is the time since the last tick. Suggestion: use `addPoints(layer, gain)` when generating points to automatically update the best and total amounts.
|
||||
- update(diff): **optional**. This function is called every game tick. Use it for any passive resource production or time-based things. `diff` is the time since the last tick.
|
||||
|
||||
- automate(): **optional**. This function is called every game tick, after production. Use it to activate any autobuyers or auto-resets or similar on this layer, if appropriate.
|
||||
- automate(): **optional**. This function is called every game tick, after production. Use it to activate automation things other than prestige, if appropriate.
|
||||
|
||||
- resetsNothing: **optional**. Returns true if this layer shouldn't trigger any resets when you prestige.
|
||||
|
||||
|
@ -148,3 +154,6 @@ componentStyles: {
|
|||
- getNextAt(canMax=false): **for custom prestige type**. Returns how many of the base currency you need to get to the next point. `canMax` is an optional variable used with Static-ish layers to differentiate between if it's looking for the first point you can reset at, or the requirement for any gain at all (Supporting both is good). You can also call `getNextAt(this.layer, canMax=false, useType = "static")` or similar to calculate what your next at would be under another prestige type (provided you have all of the required features in the layer).
|
||||
|
||||
- canReset(): **for custom prestige type**. Return true only if you have the resources required to do a prestige here.
|
||||
|
||||
- prestigeNotify(): **mostly for custom prestige types**, returns true if this layer should be subtly highlighted to indicate you
|
||||
can prestige for a meaningful gain.
|
|
@ -379,7 +379,7 @@ addLayer("f", {
|
|||
resource: "farm points",
|
||||
baseResource: "candies",
|
||||
baseAmount() {return player.points},
|
||||
type: "custom", // A "Custom" type which is effectively static
|
||||
type: "static",
|
||||
exponent: 0.5,
|
||||
base: 3,
|
||||
roundUpCost: true,
|
||||
|
|
|
@ -430,6 +430,8 @@ function loadVue() {
|
|||
hasChallenge,
|
||||
maxedChallenge,
|
||||
canAffordUpgrade,
|
||||
subtabShouldNotify,
|
||||
subtabResetNotify,
|
||||
VERSION,
|
||||
LAYERS,
|
||||
hotkeys
|
||||
|
|
|
@ -290,6 +290,7 @@ function gameLoop(diff) {
|
|||
for (x = 0; x <= maxRow; x++){
|
||||
for (item in TREE_LAYERS[x]) {
|
||||
let layer = TREE_LAYERS[x][item]
|
||||
if (tmp[layer].passiveGeneration) generatePoints(layer, diff*tmp[layer].passiveGeneration);
|
||||
if (layers[layer].update) layers[layer].update(diff);
|
||||
}
|
||||
}
|
||||
|
@ -297,6 +298,7 @@ function gameLoop(diff) {
|
|||
for (row in OTHER_LAYERS){
|
||||
for (item in OTHER_LAYERS[row]) {
|
||||
let layer = OTHER_LAYERS[row][item]
|
||||
if (tmp[layer].passiveGeneration) generatePoints(layer, diff*tmp[layer].passiveGeneration);
|
||||
if (layers[layer].update) layers[layer].update(diff);
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +306,7 @@ function gameLoop(diff) {
|
|||
for (x = maxRow; x >= 0; x--){
|
||||
for (item in TREE_LAYERS[x]) {
|
||||
let layer = TREE_LAYERS[x][item]
|
||||
if (tmp[layer].autoPrestige && tmp[layer].canReset) doReset(layer);
|
||||
if (layers[layer].automate) layers[layer].automate();
|
||||
}
|
||||
}
|
||||
|
@ -311,6 +314,7 @@ function gameLoop(diff) {
|
|||
for (row in OTHER_LAYERS){
|
||||
for (item in OTHER_LAYERS[row]) {
|
||||
let layer = OTHER_LAYERS[row][item]
|
||||
if (tmp[layer].autoPrestige && tmp[layer].canReset) doReset(layer);
|
||||
if (layers[layer].automate) layers[layer].automate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ var systemComponents = {
|
|||
template: `
|
||||
<div class="upgRow">
|
||||
<div v-for="tab in Object.keys(data)">
|
||||
<button v-if="data[tab].unlocked == undefined || data[tab].unlocked" v-bind:class="{tabButton: true, notify: subtabShouldNotify(layer, name, tab)}" v-bind:style="[{'border-color': tmp[layer].color}, tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]" v-on:click="player.subtabs[layer][name] = tab">{{tab}}</button>
|
||||
<button v-if="data[tab].unlocked == undefined || data[tab].unlocked" v-bind:class="{tabButton: true, notify: subtabShouldNotify(layer, name, tab), resetNotify: subtabResetNotify(layer, name, tab)}" v-bind:style="[{'border-color': tmp[layer].color}, tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]" v-on:click="player.subtabs[layer][name] = tab">{{tab}}</button>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
@ -58,6 +58,7 @@ var systemComponents = {
|
|||
hidden: !tmp[layer].layerShown,
|
||||
locked: !player[layer].unlocked && !tmp[layer].baseAmount.gte(tmp[layer].requires),
|
||||
notify: tmp[layer].notify,
|
||||
resetNotify: tmp[layer].prestigeNotify,
|
||||
can: player[layer].unlocked,
|
||||
}"
|
||||
v-bind:style="[layerunlocked(layer) ? {
|
||||
|
|
|
@ -23,8 +23,9 @@ function setupTemp() {
|
|||
tmp[layer].resetGain = {}
|
||||
tmp[layer].nextAt = {}
|
||||
tmp[layer].nextAtDisp = {}
|
||||
tmp[layer].notify = {}
|
||||
tmp[layer].canReset = {}
|
||||
tmp[layer].notify = {}
|
||||
tmp[layer].prestigeNotify = {}
|
||||
tmp[layer].prestigeButtonText = {}
|
||||
setupBarStyles(layer)
|
||||
}
|
||||
|
@ -63,8 +64,9 @@ function updateTemp() {
|
|||
tmp[layer].resetGain = getResetGain(layer)
|
||||
tmp[layer].nextAt = getNextAt(layer)
|
||||
tmp[layer].nextAtDisp = getNextAt(layer, true)
|
||||
tmp[layer].notify = shouldNotify(layer)
|
||||
tmp[layer].canReset = canReset(layer)
|
||||
tmp[layer].notify = shouldNotify(layer)
|
||||
tmp[layer].prestigeNotify = prestigeNotify(layer)
|
||||
tmp[layer].prestigeButtonText = prestigeButtonText(layer)
|
||||
constructBarStyles(layer)
|
||||
}
|
||||
|
|
20
js/utils.js
20
js/utils.js
|
@ -629,6 +629,14 @@ function layOver(obj1, obj2) {
|
|||
}
|
||||
}
|
||||
|
||||
function prestigeNotify(layer) {
|
||||
if (layers[layer].prestigeNotify) return layers[layer].prestigeNotify()
|
||||
else if (tmp[layer].autoPrestige || tmp[layer].passiveGeneration) return false
|
||||
else if (tmp[layer].type == "static") return tmp[layer].canReset
|
||||
else if (tmp[layer].type == "normal") return (tmp[layer].canReset && (tmp[layer].resetGain.gte(player[layer].points.div(10))))
|
||||
else return false
|
||||
}
|
||||
|
||||
function notifyLayer(name) {
|
||||
if (player.tab == name || !layerunlocked(name)) return
|
||||
player.notify[name] = 1
|
||||
|
@ -643,6 +651,14 @@ function subtabShouldNotify(layer, family, id){
|
|||
else return subtab.shouldNotify
|
||||
}
|
||||
|
||||
function subtabResetNotify(layer, family, id){
|
||||
let subtab = {}
|
||||
if (family == "mainTabs") subtab = tmp[layer].tabFormat[id]
|
||||
else subtab = tmp[layer].microtabs[family][id]
|
||||
if (subtab.embedLayer) return tmp[subtab.embedLayer].prestigeNotify
|
||||
else return false
|
||||
}
|
||||
|
||||
function nodeShown(layer) {
|
||||
if (tmp[layer].layerShown) return true
|
||||
switch(layer) {
|
||||
|
@ -742,10 +758,6 @@ function prestigeButtonText(layer)
|
|||
return layers[layer].prestigeButtonText()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function isFunction(obj) {
|
||||
return !!(obj && obj.constructor && obj.call && obj.apply);
|
||||
};
|
||||
|
|
10
style.css
10
style.css
|
@ -93,6 +93,7 @@ h1, h2, h3, b, input {
|
|||
|
||||
}
|
||||
|
||||
|
||||
.smallNode {
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
|
@ -123,10 +124,9 @@ h1, h2, h3, b, input {
|
|||
box-shadow: 0px 0px 20px var(--points)
|
||||
}
|
||||
|
||||
.treeNode.notify {
|
||||
transform: scale(1.1, 1.1);
|
||||
border-color: rgba(0, 0, 0, 0.125);
|
||||
box-shadow: var(--hqProperty2a), 0px 0px 20px #ff0000;
|
||||
|
||||
.resetNotify {
|
||||
box-shadow: var(--hqProperty2a), 0px 0px 8px #ffffff;
|
||||
z-index: 3
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ h1, h2, h3, b, input {
|
|||
z-index: 4
|
||||
}
|
||||
|
||||
.tabButton.notify {
|
||||
.notify {
|
||||
transform: scale(1.05, 1.05);
|
||||
border-color: rgba(0, 0, 0, 0.125);
|
||||
box-shadow: var(--hqProperty2a), 0px 0px 20px #ff0000;
|
||||
|
|
Loading…
Reference in a new issue