diff --git a/core/assets/maps/planetaryTerminal.msav b/core/assets/maps/planetaryTerminal.msav index fed7751b31..b45600882a 100644 Binary files a/core/assets/maps/planetaryTerminal.msav and b/core/assets/maps/planetaryTerminal.msav differ diff --git a/core/src/mindustry/content/SectorPresets.java b/core/src/mindustry/content/SectorPresets.java index 70baee4ca0..ce80371f3f 100644 --- a/core/src/mindustry/content/SectorPresets.java +++ b/core/src/mindustry/content/SectorPresets.java @@ -164,7 +164,6 @@ public class SectorPresets{ difficulty = 10; }}; - //TODO: for wave survival sectors the capture wave is incorrect registerHiddenSectors(serpulo, 68, //Winter Forest by wpx: https://discord.com/channels/391020510269669376/1165421701362897000/1235654407006322700 241,//River Bastion by wpx: https://discord.com/channels/391020510269669376/1165421701362897000/1232658317126402050 diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index d793ef887e..9653fa21d5 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -11,6 +11,7 @@ import arc.math.geom.*; import arc.struct.*; import arc.util.*; import arc.util.noise.*; +import arc.util.serialization.*; import mindustry.content.*; import mindustry.content.TechTree.*; import mindustry.ctype.*; @@ -152,6 +153,8 @@ public class Planet extends UnlockableContent{ public boolean allowSelfSectorLaunch; /** If true, all content in this planet's tech tree will be assigned this planet in their shownPlanets. */ public boolean autoAssignPlanet = true; + /** Base64 encoded string to use as data for setting generateAttackSector status. See {@link #writeAttackSectorBits()}}*/ + public @Nullable String attackSectorBitString; /** Content (usually planet-specific) that is unlocked upon landing here. */ public Seq unlockedOnLand = new Seq<>(); /** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */ @@ -383,6 +386,14 @@ public class Planet extends UnlockableContent{ generator.generateSector(sector); } + if(attackSectorBitString != null){ + try{ + loadAttackBits(attackSectorBitString); + }catch(Exception e){ + Log.err(e); + } + } + updateBaseCoverage(); } @@ -580,4 +591,25 @@ public class Planet extends UnlockableContent{ Tmp.v31.set(Tmp.v32).rotate(Vec3.Y, -rotation).add(sector.tile.v).rotate(sector.tile.v, 90).sub(sector.tile.v).rotate(Vec3.Y, rotation).nor() ); } + + public String writeAttackSectorBits(){ + byte[] bits = new byte[Mathf.ceil(sectors.size / 8f)]; + for(int i = 0; i < sectors.size; i++){ + int bit = (i >> 3), mask = (i & 0b111); + if(sectors.get(i).generateEnemyBase){ + bits[bit] |= (1 << mask); + } + } + return new String(Base64Coder.encode(bits)); + } + + public void loadAttackBits(String str){ + byte[] bits = Base64Coder.decode(str); + for(int i = 0; i < sectors.size; i++){ + int bit = (i >> 3), mask = (i & 0b111); + if(bit < bits.length && (bits[bit] & (1 << mask)) != 0){ + sectors.get(i).generateEnemyBase = true; + } + } + } } diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index da138581e1..892315a2be 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -44,7 +44,7 @@ import static mindustry.ui.dialogs.PlanetDialog.Mode.*; public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ //if true, enables launching anywhere for testing - public static boolean debugSelect = false; + public static boolean debugSelect = false, debugSectorAttackEdit; public static float sectorShowDuration = 60f * 2.4f; public final FrameBuffer buffer = new FrameBuffer(2, 2, true); @@ -603,7 +603,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ addListener(new ElementGestureListener(){ @Override public void tap(InputEvent event, float x, float y, int count, KeyCode button){ - if(showing()) return; + if(showing() || button != KeyCode.mouseLeft) return; if(hovered != null && selected == hovered && count == 2){ playSelected(); @@ -617,6 +617,15 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ updateSelected(); } } + + @Override + public void touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){ + super.touchDown(event, x, y, pointer, button); + + if(debugSectorAttackEdit && button == KeyCode.mouseRight && hovered != null){ + hovered.generateEnemyBase = !hovered.generateEnemyBase; + } + } }); }