diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 7146a525af..f43517e27c 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -672,7 +672,7 @@ sector.extractionOutpost.description = A remote outpost, constructed by the enem sector.impact0078.description = Here lie remnants of the interstellar transport vessel that first entered this system.\n\nSalvage as much as possible from the wreckage. Research any intact technology. sector.planetaryTerminal.description = The final target.\n\nThis coastal base contains a structure capable of launching Cores to local planets. It is extremely well guarded.\n\nProduce naval units. Eliminate the enemy as quickly as possible. Research the launch structure. -sector.onset.name = Onset +sector.onset.name = The Onset status.burning.name = Burning status.freezing.name = Freezing diff --git a/core/src/mindustry/ai/types/GroundAI.java b/core/src/mindustry/ai/types/GroundAI.java index 5e2c561d79..80c5da653a 100644 --- a/core/src/mindustry/ai/types/GroundAI.java +++ b/core/src/mindustry/ai/types/GroundAI.java @@ -34,6 +34,11 @@ public class GroundAI extends AIController{ if(spawner == null && core == null) move = false; } + //no reason to move if there's nothing there + if(core == null && (!state.rules.waves || getClosestSpawner() == null)){ + move = false; + } + if(move) pathfind(Pathfinder.fieldCore); } diff --git a/core/src/mindustry/content/ErekirTechTree.java b/core/src/mindustry/content/ErekirTechTree.java index bff8fc6be4..ef60a72ba6 100644 --- a/core/src/mindustry/content/ErekirTechTree.java +++ b/core/src/mindustry/content/ErekirTechTree.java @@ -16,6 +16,7 @@ public class ErekirTechTree{ var costMultipliers = new ObjectFloatMap(); costMultipliers.put(Items.silicon, 7); costMultipliers.put(Items.surgeAlloy, 4); + costMultipliers.put(Items.phaseFabric, 4); costMultipliers.put(Items.thorium, 8); costMultipliers.put(Items.graphite, 6); diff --git a/core/src/mindustry/content/Items.java b/core/src/mindustry/content/Items.java index 403271ebcf..c0a27302f9 100644 --- a/core/src/mindustry/content/Items.java +++ b/core/src/mindustry/content/Items.java @@ -1,6 +1,7 @@ package mindustry.content; import arc.graphics.*; +import arc.struct.*; import mindustry.type.*; public class Items{ @@ -9,6 +10,9 @@ public class Items{ phaseFabric, surgeAlloy, sporePod, sand, blastCompound, pyratite, metaglass, beryllium, tungsten, oxide, carbide, fissileMatter, dormantCyst; + //TODO remove, these are for debugging only + public static final Seq serpuloItems = new Seq<>(), erekirItems = new Seq<>(); + public static void load(){ copper = new Item("copper", Color.valueOf("d99d73")){{ hardness = 1; @@ -124,5 +128,15 @@ public class Items{ dormantCyst = new Item("dormant-cyst", Color.valueOf("df824d")){{ flammability = 0.1f; }}; + + serpuloItems.addAll( + scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium, + phaseFabric, surgeAlloy, sporePod, sand, blastCompound, pyratite, metaglass + ); + + erekirItems.addAll( + scrap, graphite, thorium, silicon, phaseFabric, surgeAlloy, sand, + beryllium, tungsten, oxide, carbide, fissileMatter, dormantCyst + ); } } diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index 2edc41ed9f..c3e61ff5c8 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -1,6 +1,7 @@ package mindustry.content; import arc.*; +import arc.func.*; import arc.scene.style.*; import arc.struct.*; import arc.util.*; @@ -140,6 +141,14 @@ public class TechTree{ all.add(this); } + /** Recursively iterates through everything that is a child of this node. Includes itself. */ + public void each(Cons consumer){ + consumer.get(this); + for(var child : children){ + child.each(consumer); + } + } + public Drawable icon(){ return icon == null ? new TextureRegionDrawable(content.uiIcon) : icon; } diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index 6df756df91..13e864bc80 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -76,6 +76,14 @@ public class MobileInput extends InputHandler implements GestureListener{ /** Control building last tapped. */ public @Nullable Building buildingTapped; + { + Events.on(UnitDestroyEvent.class, e -> { + if(e.unit != null && e.unit.isPlayer() && e.unit.getPlayer().isLocal() && e.unit.type.weapons.contains(w -> w.bullet.killShooter)){ + manualShooting = false; + } + }); + } + //region utility methods /** Check and assign targets for a specific position. */ diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index 76a28600cd..4bd8ea9c2c 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -247,7 +247,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ } //TODO test, different placement - //TODO this biome should have more blocks in gneeral + //TODO this biome should have more blocks in general if(block == Blocks.regolithWall && rand.chance(0.2) && nearAir(x, y) && !near(x, y, 3, Blocks.crystalBlocks)){ block = Blocks.crystalBlocks; } @@ -294,7 +294,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ //it is very hot state.rules.attributes.set(Attribute.heat, 0.8f); - state.rules.environment = Env.scorching | Env.terrestrial | Env.groundWater; + state.rules.environment = Env.scorching | Env.terrestrial; Schematics.placeLaunchLoadout(spawnX, spawnY); state.rules.showSpawns = true; diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index e56828db12..90c29872f4 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -82,13 +82,13 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ any = true; } + if(Structs.contains(tile.tiles, s -> sector.planet.getSector(s).id == sector.planet.startSector)) return; + if(noise < 0.16){ for(Ptile other : tile.tiles){ var osec = sector.planet.getSector(other); - //no sectors near start sector! if( - osec.id == sector.planet.startSector || //near starting sector osec.generateEnemyBase && poles < 0.85 || //near other base (sector.preset != null && noise < 0.11) //near preset ){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 2e5263f42b..4011c54e3c 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -176,6 +176,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ settings.put("lastplanet", state.planet.name); } + if(!selectable(state.planet)){ + state.planet = Planets.serpulo; + } + rebuildButtons(); mode = look; state.otherCamPos = null; @@ -255,7 +259,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ dialog.add("@sectors.captured"); } - //TODO unimplemented, cutscene needed + //TODO not fully implemented, cutscene needed public void showPlanetLaunch(Sector sector, Cons listener){ selected = null; hovered = null; @@ -263,11 +267,20 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ this.listener = listener; launchSector = sector; - //automatically select next planets; TODO pan! + //automatically select next planets; if(sector.planet.launchCandidates.size == 1){ state.planet = sector.planet.launchCandidates.first(); state.otherCamPos = sector.planet.position; state.otherCamAlpha = 0f; + + //unlock and highlight sector + var destSec = state.planet.sectors.get(state.planet.startSector); + var preset = destSec.preset; + if(preset != null){ + preset.unlock(); + } + selected = destSec; + updateSelected(); } //TODO pan over to correct planet @@ -471,7 +484,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ //TODO what if any sector is selectable? //TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable? if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet); - return planet == state.planet || (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase); + return (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase); } void setup(){ @@ -690,6 +703,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ state.camPos.set(Tmp.v31.set(state.otherCamPos).lerp(state.planet.position, state.otherCamAlpha).add(state.camPos).sub(state.planet.position)); state.otherCamPos = null; + //announce new sector + newPresets.add(state.planet.sectors.get(state.planet.startSector)); + } } diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index ea864a0064..6b2974166f 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -116,6 +116,7 @@ public class SettingsMenuDialog extends BaseDialog{ t.button("@settings.clearresearch", Icon.trash, style, () -> { ui.showConfirm("@confirm", "@settings.clearresearch.confirm", () -> { + Core.settings.put("lastplanet", "serpulo"); universe.clearLoadoutInfo(); for(TechNode node : TechTree.all){ node.reset(); diff --git a/core/src/mindustry/world/blocks/sandbox/ItemSource.java b/core/src/mindustry/world/blocks/sandbox/ItemSource.java index dc2cfbf2a3..ace6b1850b 100644 --- a/core/src/mindustry/world/blocks/sandbox/ItemSource.java +++ b/core/src/mindustry/world/blocks/sandbox/ItemSource.java @@ -81,7 +81,10 @@ public class ItemSource extends Block{ while(counter >= limit){ items.set(outputItem, 1); - dump(outputItem); + if(dump(outputItem)){ + //for debugging only + produced(outputItem); + } items.set(outputItem, 0); counter -= limit; }