wobblyhead hg > minor_monsters
diff game/js/tower.js @ 13:8df95050fc8b
no more build during pause; tower popup closes on any click outside it
| author | ark |
|---|---|
| date | 2026-10-19 21:59 +0200 |
| parents | 910b26feca76 |
| children | c1c7e4f54bf6 |
line wrap: on
line diff
--- a/game/js/tower.js Mon Oct 19 20:41:45 2026 +0200 +++ b/game/js/tower.js Mon Oct 19 21:59:53 2026 +0200 @@ -19,9 +19,7 @@ x: x, y: y, sides: sides || [true, true, true, true], - // purchases, {cost, pause}: pause is the number of the pause - // the purchase was made in, 0 while the game ran - paid: [], + paid: 0, // coins paid for building and upgrades angle: -Math.PI / 2, cooldown: 0, burst: 0 @@ -35,16 +33,9 @@ } // coins back for selling the tower: half of everything paid for it, - // rounded down, except purchases made during the current pause, which - // come back in full. pause is the number of the current pause, 0 while - // the game runs. - function refund(t, pause) { - var rest = 0, full = 0; - t.paid.forEach(function (p) { - if (pause && p.pause === pause) full += p.cost; - else rest += p.cost; - }); - return Math.floor(rest * cfg.tower_rules.sell_refund) + full; + // rounded down + function refund(t) { + return Math.floor(t.paid * cfg.tower_rules.sell_refund); } function sprite(t) {
