diff --git a/README.md b/README.md index 79da474..c9672b5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,2 @@ # launchpad-redirect -redirect all launchpads with 1 button - -mindustry mod (mod browser please pick this up) +redirect all launchpads with 1 button, now for v7 diff --git a/mod.hjson b/mod.hjson deleted file mode 100644 index e00bb57..0000000 --- a/mod.hjson +++ /dev/null @@ -1,8 +0,0 @@ -{ - name: "launchpad-redirect", - displayName: "Launchpad Redirect", - author: "QmelZ", - version: 2, - minGameVersion: 126, - hidden: true -} diff --git a/mod.json b/mod.json new file mode 100644 index 0000000..757cec1 --- /dev/null +++ b/mod.json @@ -0,0 +1,10 @@ +{ + "name": "launchpad-redirect-v7", + "displayName": "Launchpad Redirect", + "author": "QmelZ, MonoScyron", + "description": "Allows you to redirect all launchpads with one button. Original mod made by QmelZ, v7 port by MonoScyron.", + "version": 3.2, + "minGameVersion": 136, + "hidden": true, + "repo": "MonoScyron/launchpad-redirect-v7" +} diff --git a/scripts/main.js b/scripts/main.js index 4ec6bb4..ef2e1f5 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,19 +1,34 @@ Events.on(ClientLoadEvent, () => { let p = Vars.ui.planet; p.shown(() => { - if(p.mode === PlanetDialog.Mode.look){ + if (p.mode === PlanetDialog.Mode.look) { p.fill(cons(t => { - t.top().right(); + t.top().left(); + t.margin(10); t.defaults().size(200, 54); t.button("Redirect", Icon.upOpen, () => { - let s = Planets.serpulo.sectors; - p.showSelect(s.get(15), d => { - s.each(e => { - e.info.destination = d; + if (p.state.planet.equals(Planets.serpulo)) { + let s = Planets.serpulo.sectors; + let currSector = Vars.state.getSector(); + Vars.state.rules.sector = s.get(15); + p.showSelect(currSector == null ? s.get(15) : currSector, d => { + s.each(e => { + e.info.destination = d; + }); + Vars.state.rules.sector = currSector; }); - }); + if (t.getChildren().size > 1) { + t.reset(); + } + } + else { + if (t.getChildren().size <= 1) { + t.add("No launchpads here (yet)", Color.scarlet); + } + } }); + t.row(); })); } }); -}); +}); \ No newline at end of file