Various campaign-related tweaks

This commit is contained in:
Anuken
2020-05-13 17:04:59 -04:00
parent c432639dfa
commit 04dc701c25
15 changed files with 77 additions and 36 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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());
}

View File

@ -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;

View File

@ -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();

View File

@ -142,6 +142,20 @@ public class Logic implements ApplicationListener{
}
private void checkGameOver(){
//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));
}
//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));
@ -158,17 +172,15 @@ public class Logic implements ApplicationListener{
}
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));
}
state.gameOver = true;
}
}
}
}
private void updateWeather(){
for(WeatherEntry entry : state.rules.weather){

View File

@ -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. */

View File

@ -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;
}

View File

@ -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),

View File

@ -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)){

View File

@ -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<Tile> cores, Tile spawn, Team team, Sector sector){
for(Tile tile : cores){
tile.clearOverlay();
tile.setBlock(Blocks.coreShard, team);
}
}
}

View File

@ -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<Room> 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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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) -> {