Skip to content

Commit dccdae2

Browse files
committed
Many minor fixes, updated b_e
1 parent 5180497 commit dccdae2

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

changelog.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# The Modding Tree changelog:
22

3-
3+
- Added option for shift-clicking nodes toggling their tooltips.
4+
- Fixed NaN check for setting Decimal values with text boxes.
45
- Added display-image, h-line, and v-line to documentation.
5-
6+
- Fixed an issue with subtab glow colors.
7+
- Fixed being able to buy upgrades on deactivated layers.
8+
- Updated break_eternity library.
9+
- Cleaned up buyable/clickable code.
610

711
# v2.6.5.1 - 7/13/21
812
- Fixed offline production more.

js/components.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ function loadVue() {
254254
`
255255
})
256256

257-
// data = button size, in px
258257
Vue.component('buyables', {
259258
props: ['layer', 'data'],
260259
template: `
@@ -271,11 +270,11 @@ function loadVue() {
271270
})
272271

273272
Vue.component('buyable', {
274-
props: ['layer', 'data', 'size'],
273+
props: ['layer', 'data'],
275274
template: `
276275
<div v-if="tmp[layer].buyables && tmp[layer].buyables[data]!== undefined && tmp[layer].buyables[data].unlocked" style="display: grid">
277276
<button v-bind:class="{ buyable: true, tooltipBox: true, can: tmp[layer].buyables[data].canBuy, locked: !tmp[layer].buyables[data].canBuy, bought: player[layer].buyables[data].gte(tmp[layer].buyables[data].purchaseLimit)}"
278-
v-bind:style="[tmp[layer].buyables[data].canBuy ? {'background-color': tmp[layer].color} : {}, size ? {'height': size, 'width': size} : {}, tmp[layer].componentStyles.buyable, tmp[layer].buyables[data].style]"
277+
v-bind:style="[tmp[layer].buyables[data].canBuy ? {'background-color': tmp[layer].color} : {}, tmp[layer].componentStyles.buyable, tmp[layer].buyables[data].style]"
279278
v-on:click="if(!interval) buyBuyable(layer, data)" :id='"buyable-" + layer + "-" + data' @mousedown="start" @mouseleave="stop" @mouseup="stop" @touchstart="start" @touchend="stop" @touchcancel="stop">
280279
<span v-if= "tmp[layer].buyables[data].title"><h2 v-html="tmp[layer].buyables[data].title"></h2><br></span>
281280
<span v-bind:style="{'white-space': 'pre-line'}" v-html="run(layers[layer].buyables[data].display, layers[layer].buyables[data])"></span>
@@ -333,12 +332,12 @@ function loadVue() {
333332

334333
// data = id of clickable
335334
Vue.component('clickable', {
336-
props: ['layer', 'data', 'size'],
335+
props: ['layer', 'data'],
337336
template: `
338337
<button
339338
v-if="tmp[layer].clickables && tmp[layer].clickables[data]!== undefined && tmp[layer].clickables[data].unlocked"
340339
v-bind:class="{ upg: true, tooltipBox: true, can: tmp[layer].clickables[data].canClick, locked: !tmp[layer].clickables[data].canClick}"
341-
v-bind:style="[tmp[layer].clickables[data].canClick ? {'background-color': tmp[layer].color} : {}, size ? {'height': size, 'width': size} : {}, tmp[layer].clickables[data].style]"
340+
v-bind:style="[tmp[layer].clickables[data].canClick ? {'background-color': tmp[layer].color} : {}, tmp[layer].clickables[data].style]"
342341
v-on:click="if(!interval) clickClickable(layer, data)" :id='"clickable-" + layer + "-" + data' @mousedown="start" @mouseleave="stop" @mouseup="stop" @touchstart="start" @touchend="stop" @touchcancel="stop">
343342
<span v-if= "tmp[layer].clickables[data].title"><h2 v-html="tmp[layer].clickables[data].title"></h2><br></span>
344343
<span v-bind:style="{'white-space': 'pre-line'}" v-html="run(layers[layer].clickables[data].display, layers[layer].clickables[data])"></span>
@@ -376,7 +375,7 @@ function loadVue() {
376375
})
377376

378377

379-
// data = button size, in px
378+
// data = optionally, array of rows for the grid to show
380379
Vue.component('grid', {
381380
props: ['layer', 'data'],
382381
template: `
@@ -428,7 +427,7 @@ function loadVue() {
428427
},
429428
})
430429

431-
// data = button size, in px
430+
// data = id of microtab family
432431
Vue.component('microtabs', {
433432
props: ['layer', 'data'],
434433
computed: {

js/technical/break_eternity.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,8 @@
18201820
var a = this;
18211821
var b = decimal;
18221822

1823-
//special case: if a is 0, then return 0
1824-
if (a.sign === 0) { return a; }
1823+
//special case: if a is 0, then return 0 (UNLESS b is 0, then return 1)
1824+
if (a.sign === 0) { return b.eq(0) ? FC_NN(1, 0, 1) : a; }
18251825
//special case: if a is 1, then return 1
18261826
if (a.sign === 1 && a.layer === 0 && a.mag === 1) { return a; }
18271827
//special case: if b is 0, then return 1
@@ -1831,7 +1831,7 @@
18311831

18321832
var result = (a.absLog10().mul(b)).pow10();
18331833

1834-
if (this.sign === -1 && b.toNumber() % 2 === 1) {
1834+
if (this.sign === -1 && Math.abs(b.toNumber() % 2) === 1) {
18351835
return result.neg();
18361836
}
18371837

@@ -2739,4 +2739,4 @@ for (var i = 0; i < 10; ++i)
27392739

27402740
return Decimal;
27412741

2742-
}));
2742+
}));

js/technical/systemComponents.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var systemComponents = {
55
<div class="upgRow">
66
<div v-for="tab in Object.keys(data)">
77
<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)}"
8-
v-bind:style="[{'border-color': tmp[layer].color}, (subtabShouldNotify(layer, name, tab) ? {'box-shadow': 'var(--hqProperty2a), 0 0 20px ' + data[tab].glowColor || defaultGlow} : {}), tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]"
8+
v-bind:style="[{'border-color': tmp[layer].color}, (subtabShouldNotify(layer, name, tab) ? {'box-shadow': 'var(--hqProperty2a), 0 0 20px ' + (data[tab].glowColor || defaultGlow)} : {}), tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]"
99
v-on:click="function(){player.subtabs[layer][name] = tab; updateTabFormats(); needCanvasUpdate = true;}">{{tab}}</button>
1010
</div>
1111
</div>
@@ -18,7 +18,7 @@ var systemComponents = {
1818
<button v-if="nodeShown(layer)"
1919
v-bind:id="layer"
2020
v-on:click="function() {
21-
if (shiftDown) player[layer].forceTooltip = !player[layer].forceTooltip
21+
if (shiftDown && options.forceTooltips) player[layer].forceTooltip = !player[layer].forceTooltip
2222
else if(tmp[layer].isLayer) {
2323
if (tmp[layer].leftTab) {
2424
showNavTab(layer, prev)
@@ -169,7 +169,8 @@ var systemComponents = {
169169
<tr>
170170
<td><button class="opt" onclick="toggleOpt('hideChallenges')">Completed Challenges: {{ options.hideChallenges?"HIDDEN":"SHOWN" }}</button></td>
171171
<td><button class="opt" onclick="toggleOpt('forceOneTab'); needsCanvasUpdate = true">Single-Tab Mode: {{ options.forceOneTab?"ALWAYS":"AUTO" }}</button></td>
172-
</tr>
172+
<td><button class="opt" onclick="toggleOpt('forceTooltips'); needsCanvasUpdate = true">Shift-Click to Toggle Tooltips: {{ options.forceTooltips?"ON":"OFF" }}</button></td>
173+
</tr>
173174
</table>`
174175
},
175176

js/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function buyUpgrade(layer, id) {
5353
function buyUpg(layer, id) {
5454
if (!tmp[layer].upgrades || !tmp[layer].upgrades[id]) return
5555
let upg = tmp[layer].upgrades[id]
56-
if (!player[layer].unlocked) return
56+
if (!player[layer].unlocked || player[layer].deactivated) return
5757
if (!tmp[layer].upgrades[id].unlocked) return
5858
if (player[layer].upgrades.includes(id)) return
5959
if (upg.canAfford === false) return
@@ -346,7 +346,7 @@ document.title = modInfo.name
346346
function toValue(value, oldValue) {
347347
if (oldValue instanceof Decimal) {
348348
value = new Decimal (value)
349-
if (value.eq(decimalNaN)) return decimalZero
349+
if (checkDecimalNaN(value)) return decimalZero
350350
return value
351351
}
352352
if (!isNaN(oldValue))

js/utils/options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function getStartOptions() {
1313
showStory: true,
1414
forceOneTab: false,
1515
oldStyle: false,
16+
tooltipForcing: true,
1617
}
1718
}
1819

0 commit comments

Comments
 (0)