diff game/js/map.js @ 14:7fda634d15ad

adjustments to wave logic, tower pivot points
author ark
date 2026-10-19 22:50 +0200
parents 22b604680c5a
children
line wrap: on
line diff
--- a/game/js/map.js	Mon Oct 19 21:59:53 2026 +0200
+++ b/game/js/map.js	Mon Oct 19 22:50:52 2026 +0200
@@ -217,5 +217,16 @@
         });
     };
 
+    // index of the shortest route, leaving out routes with a fixed weight
+    // of 0 in routes.toml
+    GameMap.prototype.shortestRoute = function () {
+        var best = -1;
+        this.routes.forEach(function (r, i) {
+            if (r.weight === 0) return;
+            if (best < 0 || r.length < this.routes[best].length) best = i;
+        }, this);
+        return best;
+    };
+
     return GameMap;
 })();