diff --git a/core/assets/planets/TODO.dat b/core/assets/planets/TODO.dat index 481f8038b4..7aa92b9a42 100644 Binary files a/core/assets/planets/TODO.dat and b/core/assets/planets/TODO.dat differ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index c1d648b534..46c818fc07 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -302,6 +302,10 @@ public class PlanetDialog extends FloatingDialog{ stable.addButton("Launch", () -> { if(selected != null){ + if(selected.hasAttribute(SectorAttribute.naval)){ + ui.showInfo("You need a naval loadout to launch here."); + return; + } control.playSector(selected); hide(); } diff --git a/tools/src/mindustry/tools/SectorDataGenerator.java b/tools/src/mindustry/tools/SectorDataGenerator.java index efaa6254c2..23e6eb0150 100644 --- a/tools/src/mindustry/tools/SectorDataGenerator.java +++ b/tools/src/mindustry/tools/SectorDataGenerator.java @@ -10,10 +10,12 @@ import mindustry.*; import mindustry.content.*; import mindustry.core.*; import mindustry.ctype.*; +import mindustry.game.*; import mindustry.net.Net; import mindustry.type.*; import mindustry.type.Sector.*; import mindustry.world.*; +import mindustry.world.blocks.storage.CoreBlock.*; import static mindustry.Vars.*; @@ -50,7 +52,7 @@ public class SectorDataGenerator{ ObjectSet content = new ObjectSet<>(); world.loadSector(sector); - int waterFloors = 0, totalFloors = 0; + float waterFloors = 0, totalFloors = 0; state.rules.sector = sector; for(Tile tile : world.tiles){ @@ -66,7 +68,7 @@ public class SectorDataGenerator{ if(!tile.block().isStatic()){ totalFloors ++; if(liquid == Liquids.water){ - waterFloors ++; + waterFloors += tile.floor().isDeep() ? 1f : 0.5f; } floors.increment(tile.floor()); if(tile.overlay() != Blocks.air){ @@ -75,6 +77,27 @@ public class SectorDataGenerator{ } } + CoreEntity entity = Team.sharded.core(); + int cx = entity.tileX(), cy = entity.tileY(); + + int nearTiles = 0; + int waterCheckRad = 5; + + //check for water presence + for(int rx = -waterCheckRad; rx <= waterCheckRad; rx++){ + for(int ry = -waterCheckRad; ry <= waterCheckRad; ry++){ + Tile tile = world.tile(cx + rx, cy + ry); + if(tile == null || tile.floor().liquidDrop != null){ + nearTiles ++; + } + } + } + + //naval sector guaranteed + if(nearTiles >= 4){ + waterFloors = totalFloors; + } + //sort counts in descending order Array> entries = floors.entries().toArray(); entries.sort(e -> -e.value); @@ -91,8 +114,7 @@ public class SectorDataGenerator{ data.resources = content.asArray().sort(Structs.comps(Structs.comparing(Content::getContentType), Structs.comparingInt(c -> c.id))).toArray(UnlockableContent.class); //50% water -> naval attribute - //TODO also select sectors with water spawns - if((float)waterFloors / totalFloors >= 0.6f){ + if(waterFloors / totalFloors >= 0.6f){ data.attributes |= (1 << SectorAttribute.naval.ordinal()); }