mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-21 13:17:39 +07:00
Various campaign-related tweaks
This commit is contained in:
@ -596,7 +596,6 @@ bar.liquid = Liquid
|
|||||||
bar.heat = Heat
|
bar.heat = Heat
|
||||||
bar.power = Power
|
bar.power = Power
|
||||||
bar.progress = Build Progress
|
bar.progress = Build Progress
|
||||||
bar.spawned = Units: {0}/{1}
|
|
||||||
bar.input = Input
|
bar.input = Input
|
||||||
bar.output = Output
|
bar.output = Output
|
||||||
|
|
||||||
@ -715,7 +714,7 @@ keybind.toggle_block_status.name = Toggle Block Statuses
|
|||||||
keybind.move_x.name = Move X
|
keybind.move_x.name = Move X
|
||||||
keybind.move_y.name = Move Y
|
keybind.move_y.name = Move Y
|
||||||
keybind.mouse_move.name = Follow Mouse
|
keybind.mouse_move.name = Follow Mouse
|
||||||
keybind.dash.name = Dash
|
keybind.boost.name = Boost
|
||||||
keybind.schematic_select.name = Select Region
|
keybind.schematic_select.name = Select Region
|
||||||
keybind.schematic_menu.name = Schematic Menu
|
keybind.schematic_menu.name = Schematic Menu
|
||||||
keybind.schematic_flip_x.name = Flip Schematic X
|
keybind.schematic_flip_x.name = Flip Schematic X
|
||||||
|
@ -126,6 +126,10 @@ public class Vars implements Loadable{
|
|||||||
public static boolean steam;
|
public static boolean steam;
|
||||||
/** whether typing into the console is enabled - developers only */
|
/** whether typing into the console is enabled - developers only */
|
||||||
public static boolean enableConsole = false;
|
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()} */
|
/** application data directory, equivalent to {@link Settings#getDataDirectory()} */
|
||||||
public static Fi dataDirectory;
|
public static Fi dataDirectory;
|
||||||
/** data subdirectory used for screenshots */
|
/** data subdirectory used for screenshots */
|
||||||
|
@ -335,6 +335,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
typeMap.put(tile.pos(), new TileIndex(tile.block().flags, tile.team()));
|
typeMap.put(tile.pos(), new TileIndex(tile.block().flags, tile.team()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!activeTeams.contains(tile.team())){
|
if(!activeTeams.contains(tile.team())){
|
||||||
activeTeams.add(tile.team());
|
activeTeams.add(tile.team());
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class Bullets implements ContentList{
|
|||||||
frontColor = Pal.missileYellow;
|
frontColor = Pal.missileYellow;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
artilleryUnit = new ArtilleryBulletType(2f, 0, "shell"){{
|
artilleryUnit = new ArtilleryBulletType(2f, 8, "shell"){{
|
||||||
hitEffect = Fx.blastExplosion;
|
hitEffect = Fx.blastExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
|
@ -263,9 +263,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
ui.planet.hide();
|
ui.planet.hide();
|
||||||
SaveSlot slot = sector.save;
|
SaveSlot slot = sector.save;
|
||||||
//TODO comment for new sector states
|
if(slot != null && !clearSectors){
|
||||||
//slot = null;
|
|
||||||
if(slot != null){
|
|
||||||
try{
|
try{
|
||||||
net.reset();
|
net.reset();
|
||||||
slot.load();
|
slot.load();
|
||||||
|
@ -142,31 +142,43 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkGameOver(){
|
private void checkGameOver(){
|
||||||
if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){
|
//campaign maps do not have a 'win' state!
|
||||||
state.gameOver = true;
|
if(state.isCampaign()){
|
||||||
Events.fire(new GameOverEvent(state.rules.waveTeam));
|
//gameover only when cores are dead
|
||||||
}else if(state.rules.attackMode){
|
if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){
|
||||||
Team alive = null;
|
state.gameOver = true;
|
||||||
|
Events.fire(new GameOverEvent(state.rules.waveTeam));
|
||||||
for(TeamData team : state.teams.getActive()){
|
|
||||||
if(team.hasCore()){
|
|
||||||
if(alive != null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
alive = team.team;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alive != null && !state.gameOver){
|
//check if there are no enemy spawns
|
||||||
if(state.isCampaign() && alive == state.rules.defaultTeam){
|
if(state.rules.waves && spawner.countSpawns() + state.teams.cores(state.rules.waveTeam).size <= 0){
|
||||||
//in attack maps, a victorious game over is equivalent to a launch
|
//if yes, waves get disabled
|
||||||
Call.launchZone();
|
state.rules.waves = false;
|
||||||
}else{
|
}
|
||||||
Events.fire(new GameOverEvent(alive));
|
}else{
|
||||||
}
|
if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){
|
||||||
state.gameOver = true;
|
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(){
|
private void updateWeather(){
|
||||||
|
@ -59,7 +59,7 @@ public class Rules{
|
|||||||
/** How many times longer a launch wave takes. */
|
/** How many times longer a launch wave takes. */
|
||||||
public float launchWaveMultiplier = 2f;
|
public float launchWaveMultiplier = 2f;
|
||||||
/** Base unit cap. Can still be increased by blocks. */
|
/** Base unit cap. Can still be increased by blocks. */
|
||||||
public int unitCap = 10;
|
public int unitCap = 0;
|
||||||
/** Sector for saves that have them.*/
|
/** Sector for saves that have them.*/
|
||||||
public @Nullable Sector sector;
|
public @Nullable Sector sector;
|
||||||
/** Region that save is on. Indicates campaign. TODO not implemented. */
|
/** Region that save is on. Indicates campaign. TODO not implemented. */
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package mindustry.graphics;
|
package mindustry.graphics;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.gl.*;
|
import arc.graphics.gl.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
|
|
||||||
import static mindustry.Vars.state;
|
import static mindustry.Vars.state;
|
||||||
|
|
||||||
/** Renders overlay lights. Client only. */
|
/** Renders overlay lights. Client only. */
|
||||||
public class LightRenderer{
|
public class LightRenderer{
|
||||||
public static boolean enable = true;
|
|
||||||
private static final int scaling = 4;
|
private static final int scaling = 4;
|
||||||
|
|
||||||
private float[] vertices = new float[24];
|
private float[] vertices = new float[24];
|
||||||
@ -175,7 +175,7 @@ public class LightRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(){
|
public void draw(){
|
||||||
if(!enable){
|
if(!Vars.enableLight){
|
||||||
lights.clear();
|
lights.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public enum Binding implements KeyBind{
|
|||||||
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
||||||
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
||||||
mouse_move(KeyCode.mouseBack),
|
mouse_move(KeyCode.mouseBack),
|
||||||
dash(KeyCode.shiftLeft),
|
boost(KeyCode.shiftLeft), //TODO rename
|
||||||
control(KeyCode.shiftLeft),
|
control(KeyCode.shiftLeft),
|
||||||
select(KeyCode.mouseLeft),
|
select(KeyCode.mouseLeft),
|
||||||
deselect(KeyCode.mouseRight),
|
deselect(KeyCode.mouseRight),
|
||||||
|
@ -174,7 +174,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
if((player.dead() || state.isPaused()) && !ui.chatfrag.shown()){
|
if((player.dead() || state.isPaused()) && !ui.chatfrag.shown()){
|
||||||
if(!(scene.getKeyboardFocus() instanceof TextField)){
|
if(!(scene.getKeyboardFocus() instanceof TextField)){
|
||||||
//move camera around
|
//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));
|
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)){
|
if(Core.input.keyDown(Binding.mouse_move)){
|
||||||
|
20
core/src/mindustry/maps/generators/BaseGenerator.java
Normal file
20
core/src/mindustry/maps/generators/BaseGenerator.java
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -123,7 +123,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
float constraint = 1.3f;
|
float constraint = 1.3f;
|
||||||
float radius = width / 2f / Mathf.sqrt3;
|
float radius = width / 2f / Mathf.sqrt3;
|
||||||
int rooms = rand.random(2, 5) - 1;
|
int rooms = rand.random(2, 5);
|
||||||
Array<Room> array = new Array<>();
|
Array<Room> array = new Array<>();
|
||||||
|
|
||||||
for(int i = 0; i < rooms; i++){
|
for(int i = 0; i < rooms; i++){
|
||||||
@ -262,6 +262,12 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y);
|
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;
|
state.rules.waves = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(sec.hostility >= 0.02f){
|
if(sec.hostility >= 0.02f){
|
||||||
//drawSelection(sec, Color.scarlet, 0.11f * sec.hostility);
|
drawSelection(sec, Color.scarlet, 0.11f * sec.hostility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
update = true;
|
update = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
flags = EnumSet.of(BlockFlag.core, BlockFlag.producer, BlockFlag.unitModifier);
|
flags = EnumSet.of(BlockFlag.core, BlockFlag.producer, BlockFlag.unitModifier);
|
||||||
unitCapModifier = 30;
|
unitCapModifier = 10;
|
||||||
activeSound = Sounds.respawning;
|
activeSound = Sounds.respawning;
|
||||||
activeSoundVolume = 1f;
|
activeSoundVolume = 1f;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@ public class UnitFactory extends Block{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
solid = false;
|
solid = false;
|
||||||
flags = EnumSet.of(BlockFlag.producer);
|
flags = EnumSet.of(BlockFlag.producer, BlockFlag.unitModifier);
|
||||||
|
unitCapModifier = 4;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
|
||||||
config(Integer.class, (tile, i) -> {
|
config(Integer.class, (tile, i) -> {
|
||||||
|
Reference in New Issue
Block a user