diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 2ab507d35b..83265db1ac 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -596,7 +596,6 @@ bar.liquid = Liquid bar.heat = Heat bar.power = Power bar.progress = Build Progress -bar.spawned = Units: {0}/{1} bar.input = Input bar.output = Output @@ -715,7 +714,7 @@ keybind.toggle_block_status.name = Toggle Block Statuses keybind.move_x.name = Move X keybind.move_y.name = Move Y keybind.mouse_move.name = Follow Mouse -keybind.dash.name = Dash +keybind.boost.name = Boost keybind.schematic_select.name = Select Region keybind.schematic_menu.name = Schematic Menu keybind.schematic_flip_x.name = Flip Schematic X diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index 76625b2c8c..8eb322a1ef 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -126,6 +126,10 @@ public class Vars implements Loadable{ public static boolean steam; /** whether typing into the console is enabled - developers only */ public static boolean enableConsole = false; + /** whether to clear sector saves when landing */ + public static boolean clearSectors = false; + /** whether any light rendering is enabled */ + public static boolean enableLight = true; /** application data directory, equivalent to {@link Settings#getDataDirectory()} */ public static Fi dataDirectory; /** data subdirectory used for screenshots */ diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index c159294876..efb3cd6ffb 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -335,6 +335,7 @@ public class BlockIndexer{ typeMap.put(tile.pos(), new TileIndex(tile.block().flags, tile.team())); } + if(!activeTeams.contains(tile.team())){ activeTeams.add(tile.team()); } diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index a23cfa2975..01bacd44a5 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -117,7 +117,7 @@ public class Bullets implements ContentList{ frontColor = Pal.missileYellow; }}; - artilleryUnit = new ArtilleryBulletType(2f, 0, "shell"){{ + artilleryUnit = new ArtilleryBulletType(2f, 8, "shell"){{ hitEffect = Fx.blastExplosion; knockback = 0.8f; lifetime = 90f; diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 65698bff5a..8cc8138969 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -263,9 +263,7 @@ public class Control implements ApplicationListener, Loadable{ ui.loadAnd(() -> { ui.planet.hide(); SaveSlot slot = sector.save; - //TODO comment for new sector states - //slot = null; - if(slot != null){ + if(slot != null && !clearSectors){ try{ net.reset(); slot.load(); diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 55ef78647e..3dadc5e81e 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -142,31 +142,43 @@ public class Logic implements ApplicationListener{ } private void checkGameOver(){ - if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){ - state.gameOver = true; - Events.fire(new GameOverEvent(state.rules.waveTeam)); - }else if(state.rules.attackMode){ - Team alive = null; - - for(TeamData team : state.teams.getActive()){ - if(team.hasCore()){ - if(alive != null){ - return; - } - alive = team.team; - } + //campaign maps do not have a 'win' state! + if(state.isCampaign()){ + //gameover only when cores are dead + if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){ + state.gameOver = true; + Events.fire(new GameOverEvent(state.rules.waveTeam)); } - if(alive != null && !state.gameOver){ - if(state.isCampaign() && alive == state.rules.defaultTeam){ - //in attack maps, a victorious game over is equivalent to a launch - Call.launchZone(); - }else{ - Events.fire(new GameOverEvent(alive)); - } + //check if there are no enemy spawns + if(state.rules.waves && spawner.countSpawns() + state.teams.cores(state.rules.waveTeam).size <= 0){ + //if yes, waves get disabled + state.rules.waves = false; + } + }else{ + if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){ state.gameOver = true; + Events.fire(new GameOverEvent(state.rules.waveTeam)); + }else if(state.rules.attackMode){ + Team alive = null; + + for(TeamData team : state.teams.getActive()){ + if(team.hasCore()){ + if(alive != null){ + return; + } + alive = team.team; + } + } + + if(alive != null && !state.gameOver){ + Events.fire(new GameOverEvent(alive)); + state.gameOver = true; + } } } + + } private void updateWeather(){ diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index ff45c93766..9f175203f3 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -59,7 +59,7 @@ public class Rules{ /** How many times longer a launch wave takes. */ public float launchWaveMultiplier = 2f; /** Base unit cap. Can still be increased by blocks. */ - public int unitCap = 10; + public int unitCap = 0; /** Sector for saves that have them.*/ public @Nullable Sector sector; /** Region that save is on. Indicates campaign. TODO not implemented. */ diff --git a/core/src/mindustry/graphics/LightRenderer.java b/core/src/mindustry/graphics/LightRenderer.java index 723e58f8b8..f36f3d35a4 100644 --- a/core/src/mindustry/graphics/LightRenderer.java +++ b/core/src/mindustry/graphics/LightRenderer.java @@ -1,19 +1,19 @@ package mindustry.graphics; import arc.*; -import arc.struct.*; import arc.graphics.*; import arc.graphics.g2d.*; import arc.graphics.gl.*; import arc.math.*; import arc.math.geom.*; +import arc.struct.*; import arc.util.*; +import mindustry.*; import static mindustry.Vars.state; /** Renders overlay lights. Client only. */ public class LightRenderer{ - public static boolean enable = true; private static final int scaling = 4; private float[] vertices = new float[24]; @@ -175,7 +175,7 @@ public class LightRenderer{ } public void draw(){ - if(!enable){ + if(!Vars.enableLight){ lights.clear(); return; } diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index 2231f6ccfa..cb66af4209 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -10,7 +10,7 @@ public enum Binding implements KeyBind{ move_x(new Axis(KeyCode.a, KeyCode.d), "general"), move_y(new Axis(KeyCode.s, KeyCode.w)), mouse_move(KeyCode.mouseBack), - dash(KeyCode.shiftLeft), + boost(KeyCode.shiftLeft), //TODO rename control(KeyCode.shiftLeft), select(KeyCode.mouseLeft), deselect(KeyCode.mouseRight), diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index af37b716aa..e122b911aa 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -174,7 +174,7 @@ public class DesktopInput extends InputHandler{ if((player.dead() || state.isPaused()) && !ui.chatfrag.shown()){ if(!(scene.getKeyboardFocus() instanceof TextField)){ //move camera around - float camSpeed = !Core.input.keyDown(Binding.dash) ? 3f : 8f; + float camSpeed = !Core.input.keyDown(Binding.boost) ? 3f : 8f; Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed)); if(Core.input.keyDown(Binding.mouse_move)){ diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java new file mode 100644 index 0000000000..278167baf4 --- /dev/null +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -0,0 +1,20 @@ +package mindustry.maps.generators; + +import arc.struct.*; +import mindustry.content.*; +import mindustry.game.*; +import mindustry.type.*; +import mindustry.world.*; + +public class BaseGenerator{ + + public void generate(Tiles tiles, Array cores, Tile spawn, Team team, Sector sector){ + + for(Tile tile : cores){ + tile.clearOverlay(); + tile.setBlock(Blocks.coreShard, team); + } + + + } +} diff --git a/core/src/mindustry/maps/planet/TODOPlanetGenerator.java b/core/src/mindustry/maps/planet/TODOPlanetGenerator.java index 7198afee5f..ac5f1cb158 100644 --- a/core/src/mindustry/maps/planet/TODOPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/TODOPlanetGenerator.java @@ -123,7 +123,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{ float constraint = 1.3f; float radius = width / 2f / Mathf.sqrt3; - int rooms = rand.random(2, 5) - 1; + int rooms = rand.random(2, 5); Array array = new Array<>(); for(int i = 0; i < rooms; i++){ @@ -262,6 +262,12 @@ public class TODOPlanetGenerator extends PlanetGenerator{ Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y); + if(sector.hostility > 0.02f){ + new BaseGenerator().generate(tiles, enemies.map(r -> tiles.getn(r.x, r.y)), tiles.get(spawn.x, spawn.y), state.rules.waveTeam, sector); + + state.rules.attackMode = true; + } + state.rules.waves = true; } diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 55d352e2c6..961140b235 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -273,7 +273,7 @@ public class PlanetDialog extends FloatingDialog{ } if(sec.hostility >= 0.02f){ - //drawSelection(sec, Color.scarlet, 0.11f * sec.hostility); + drawSelection(sec, Color.scarlet, 0.11f * sec.hostility); } } diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 859e6c1682..fce5726ea0 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -30,7 +30,7 @@ public class CoreBlock extends StorageBlock{ update = true; hasItems = true; flags = EnumSet.of(BlockFlag.core, BlockFlag.producer, BlockFlag.unitModifier); - unitCapModifier = 30; + unitCapModifier = 10; activeSound = Sounds.respawning; activeSoundVolume = 1f; } diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index 06ee604513..23fcb3bc3a 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -38,7 +38,8 @@ public class UnitFactory extends Block{ hasPower = true; hasItems = true; solid = false; - flags = EnumSet.of(BlockFlag.producer); + flags = EnumSet.of(BlockFlag.producer, BlockFlag.unitModifier); + unitCapModifier = 4; configurable = true; config(Integer.class, (tile, i) -> {