mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 23:11:12 -08:00
Wave versions
This commit is contained in:
parent
68ab48a1d3
commit
44286cee59
12 changed files with 33 additions and 22 deletions
|
|
@ -463,7 +463,7 @@ load = Load
|
||||||
save = Save
|
save = Save
|
||||||
fps = FPS: {0}
|
fps = FPS: {0}
|
||||||
ping = Ping: {0}ms
|
ping = Ping: {0}ms
|
||||||
language.restart = Please restart your game for the language settings to take effect.
|
language.restart = Restart your game for the language settings to take effect.
|
||||||
settings = Settings
|
settings = Settings
|
||||||
tutorial = Tutorial
|
tutorial = Tutorial
|
||||||
tutorial.retake = Re-Take Tutorial
|
tutorial.retake = Re-Take Tutorial
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ public class Vars implements Loadable{
|
||||||
public static ContentLoader content;
|
public static ContentLoader content;
|
||||||
public static GameState state;
|
public static GameState state;
|
||||||
public static EntityCollisions collisions;
|
public static EntityCollisions collisions;
|
||||||
public static DefaultWaves defaultWaves;
|
public static Waves waves;
|
||||||
public static LoopControl loops;
|
public static LoopControl loops;
|
||||||
public static Platform platform = new Platform(){};
|
public static Platform platform = new Platform(){};
|
||||||
public static Mods mods;
|
public static Mods mods;
|
||||||
|
|
@ -256,7 +256,7 @@ public class Vars implements Loadable{
|
||||||
|
|
||||||
content = new ContentLoader();
|
content = new ContentLoader();
|
||||||
loops = new LoopControl();
|
loops = new LoopControl();
|
||||||
defaultWaves = new DefaultWaves();
|
waves = new Waves();
|
||||||
collisions = new EntityCollisions();
|
collisions = new EntityCollisions();
|
||||||
world = new World();
|
world = new World();
|
||||||
universe = new Universe();
|
universe = new Universe();
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||||
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
||||||
dialog.cont.row();
|
dialog.cont.row();
|
||||||
dialog.cont.button("@settings.reset", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
dialog.cont.button("@settings.reset", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||||
groups = JsonIO.copy(defaultWaves.get());
|
groups = JsonIO.copy(waves.get());
|
||||||
buildGroups();
|
buildGroups();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}));
|
}));
|
||||||
|
|
@ -98,7 +98,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||||
if(experimental){
|
if(experimental){
|
||||||
buttons.button("Random", Icon.refresh, () -> {
|
buttons.button("Random", Icon.refresh, () -> {
|
||||||
groups.clear();
|
groups.clear();
|
||||||
groups = DefaultWaves.generate(1f / 10f);
|
groups = Waves.generate(1f / 10f);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}).width(200f);
|
}).width(200f);
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? defaultWaves.get() : state.rules.spawns);
|
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? waves.get() : state.rules.spawns);
|
||||||
|
|
||||||
cont.clear();
|
cont.clear();
|
||||||
cont.stack(new Table(Tex.clear, main -> {
|
cont.stack(new Table(Tex.clear, main -> {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import mindustry.world.blocks.power.*;
|
||||||
import mindustry.world.blocks.production.*;
|
import mindustry.world.blocks.production.*;
|
||||||
import mindustry.world.blocks.sandbox.*;
|
import mindustry.world.blocks.sandbox.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.*;
|
import java.util.zip.*;
|
||||||
|
|
@ -297,7 +298,8 @@ public class Schematics implements Loadable{
|
||||||
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
|
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
|
||||||
|
|
||||||
//make sure a core exists, and that the schematic is small enough.
|
//make sure a core exists, and that the schematic is small enough.
|
||||||
if(core == null || (validate && (s.width > core.block.size + maxLoadoutSchematicPad *2 || s.height > core.block.size + maxLoadoutSchematicPad *2))) return;
|
if(core == null || (validate && (s.width > core.block.size + maxLoadoutSchematicPad *2 || s.height > core.block.size + maxLoadoutSchematicPad *2
|
||||||
|
|| s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly)))) return;
|
||||||
|
|
||||||
//place in the cache
|
//place in the cache
|
||||||
loadouts.get((CoreBlock)core.block, Seq::new).add(s);
|
loadouts.get((CoreBlock)core.block, Seq::new).add(s);
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ public class SectorInfo{
|
||||||
public float secondsPassed;
|
public float secondsPassed;
|
||||||
/** Display name. */
|
/** Display name. */
|
||||||
public @Nullable String name;
|
public @Nullable String name;
|
||||||
|
/** Version of generated waves. When it doesn't match, new waves are generated. */
|
||||||
|
public int waveVersion = -1;
|
||||||
|
|
||||||
/** Special variables for simulation. */
|
/** Special variables for simulation. */
|
||||||
public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope;
|
public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope;
|
||||||
|
|
@ -118,6 +120,11 @@ public class SectorInfo{
|
||||||
state.rules.winWave = winWave;
|
state.rules.winWave = winWave;
|
||||||
state.rules.attackMode = attack;
|
state.rules.attackMode = attack;
|
||||||
|
|
||||||
|
//assign new wave patterns when the version changes
|
||||||
|
if(waveVersion != Waves.waveVersion && state.rules.sector.preset == null){
|
||||||
|
state.rules.spawns = Waves.generate(state.rules.sector.baseCoverage);
|
||||||
|
}
|
||||||
|
|
||||||
CoreBuild entity = state.rules.defaultTeam.core();
|
CoreBuild entity = state.rules.defaultTeam.core();
|
||||||
if(entity != null){
|
if(entity != null){
|
||||||
entity.items.clear();
|
entity.items.clear();
|
||||||
|
|
@ -143,6 +150,7 @@ public class SectorInfo{
|
||||||
spawnPosition = entity.pos();
|
spawnPosition = entity.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waveVersion = Waves.waveVersion;
|
||||||
waveSpacing = state.rules.waveSpacing;
|
waveSpacing = state.rules.waveSpacing;
|
||||||
wave = state.wave;
|
wave = state.wave;
|
||||||
winWave = state.rules.winWave;
|
winWave = state.rules.winWave;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ import mindustry.type.*;
|
||||||
|
|
||||||
import static mindustry.content.UnitTypes.*;
|
import static mindustry.content.UnitTypes.*;
|
||||||
|
|
||||||
public class DefaultWaves{
|
public class Waves{
|
||||||
|
public static final int waveVersion = 1;
|
||||||
|
|
||||||
private Seq<SpawnGroup> spawns;
|
private Seq<SpawnGroup> spawns;
|
||||||
|
|
||||||
public Seq<SpawnGroup> get(){
|
public Seq<SpawnGroup> get(){
|
||||||
|
|
@ -337,7 +339,7 @@ public class DefaultWaves{
|
||||||
step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty));
|
step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty));
|
||||||
}
|
}
|
||||||
|
|
||||||
int bossWave = (int)(rand.random(30, 60) * Mathf.lerp(1f, 0.7f, difficulty));
|
int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||||
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||||
|
|
||||||
//main boss progression
|
//main boss progression
|
||||||
|
|
@ -107,7 +107,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||||
state.wavetime = map.getFloat("wavetime", state.rules.waveSpacing);
|
state.wavetime = map.getFloat("wavetime", state.rules.waveSpacing);
|
||||||
state.stats = JsonIO.read(GameStats.class, map.get("stats", "{}"));
|
state.stats = JsonIO.read(GameStats.class, map.get("stats", "{}"));
|
||||||
state.rules = JsonIO.read(Rules.class, map.get("rules", "{}"));
|
state.rules = JsonIO.read(Rules.class, map.get("rules", "{}"));
|
||||||
if(state.rules.spawns.isEmpty()) state.rules.spawns = defaultWaves.get();
|
if(state.rules.spawns.isEmpty()) state.rules.spawns = waves.get();
|
||||||
lastReadBuild = map.getInt("build", -1);
|
lastReadBuild = map.getInt("build", -1);
|
||||||
|
|
||||||
if(!headless){
|
if(!headless){
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class Map implements Comparable<Map>, Publishable{
|
||||||
//this replacement is a MASSIVE hack but it fixes some incorrect overwriting of team-specific rules.
|
//this replacement is a MASSIVE hack but it fixes some incorrect overwriting of team-specific rules.
|
||||||
//may need to be tweaked later
|
//may need to be tweaked later
|
||||||
Rules result = JsonIO.read(Rules.class, base, tags.get("rules", "{}").replace("teams:{2:{infiniteAmmo:true}},", ""));
|
Rules result = JsonIO.read(Rules.class, base, tags.get("rules", "{}").replace("teams:{2:{infiniteAmmo:true}},", ""));
|
||||||
if(result.spawns.isEmpty()) result.spawns = Vars.defaultWaves.get();
|
if(result.spawns.isEmpty()) result.spawns = Vars.waves.get();
|
||||||
return result;
|
return result;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
//error reading rules. ignore?
|
//error reading rules. ignore?
|
||||||
|
|
|
||||||
|
|
@ -420,7 +420,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||||
state.rules.waves = sector.info.waves = true;
|
state.rules.waves = sector.info.waves = true;
|
||||||
|
|
||||||
//TODO better waves
|
//TODO better waves
|
||||||
state.rules.spawns = DefaultWaves.generate(difficulty);
|
state.rules.spawns = Waves.generate(difficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ public class ContentParser{
|
||||||
group.type = unit;
|
group.type = unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.defaultWaves.get().addAll(groups);
|
Vars.waves.get().addAll(groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
readFields(unit, value, true);
|
readFields(unit, value, true);
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||||
UIInterfaceOrientation o = UIApplication.getSharedApplication().getStatusBarOrientation();
|
UIInterfaceOrientation o = UIApplication.getSharedApplication().getStatusBarOrientation();
|
||||||
return forced && (o == UIInterfaceOrientation.Portrait || o == UIInterfaceOrientation.PortraitUpsideDown);
|
return forced && (o == UIInterfaceOrientation.Portrait || o == UIInterfaceOrientation.PortraitUpsideDown);
|
||||||
});
|
});
|
||||||
t.add("Please rotate the device to landscape orientation to use the editor.").wrap().grow();
|
t.add("Rotate the device to landscape orientation to use the editor.").wrap().grow();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ public class ServerControl implements ApplicationListener{
|
||||||
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
||||||
autosaveDate = DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss");
|
autosaveDate = DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss");
|
||||||
|
|
||||||
private final CommandHandler handler = new CommandHandler("");
|
public final CommandHandler handler = new CommandHandler("");
|
||||||
private final Fi logFolder = Core.settings.getDataDirectory().child("logs/");
|
public final Fi logFolder = Core.settings.getDataDirectory().child("logs/");
|
||||||
|
|
||||||
private Fi currentLogFile;
|
private Fi currentLogFile;
|
||||||
private boolean inExtraRound;
|
private boolean inExtraRound;
|
||||||
|
|
@ -55,8 +55,7 @@ public class ServerControl implements ApplicationListener{
|
||||||
private Thread socketThread;
|
private Thread socketThread;
|
||||||
private ServerSocket serverSocket;
|
private ServerSocket serverSocket;
|
||||||
private PrintWriter socketOutput;
|
private PrintWriter socketOutput;
|
||||||
|
private String suggested;
|
||||||
private String yes;
|
|
||||||
|
|
||||||
public ServerControl(String[] args){
|
public ServerControl(String[] args){
|
||||||
Core.settings.defaults(
|
Core.settings.defaults(
|
||||||
|
|
@ -916,10 +915,10 @@ public class ServerControl implements ApplicationListener{
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("yes", "Run the last suggested incorrect command.", arg -> {
|
handler.register("yes", "Run the last suggested incorrect command.", arg -> {
|
||||||
if(yes == null){
|
if(suggested == null){
|
||||||
err("There is nothing to say yes to.");
|
err("There is nothing to say yes to.");
|
||||||
}else{
|
}else{
|
||||||
handleCommandString(yes);
|
handleCommandString(suggested);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -953,7 +952,7 @@ public class ServerControl implements ApplicationListener{
|
||||||
|
|
||||||
if(closest != null){
|
if(closest != null){
|
||||||
err("Command not found. Did you mean \"" + closest.text + "\"?");
|
err("Command not found. Did you mean \"" + closest.text + "\"?");
|
||||||
yes = line.replace(response.runCommand, closest.text);
|
suggested = line.replace(response.runCommand, closest.text);
|
||||||
}else{
|
}else{
|
||||||
err("Invalid command. Type 'help' for help.");
|
err("Invalid command. Type 'help' for help.");
|
||||||
}
|
}
|
||||||
|
|
@ -962,7 +961,7 @@ public class ServerControl implements ApplicationListener{
|
||||||
}else if(response.type == ResponseType.manyArguments){
|
}else if(response.type == ResponseType.manyArguments){
|
||||||
err("Too many command arguments. Usage: " + response.command.text + " " + response.command.paramText);
|
err("Too many command arguments. Usage: " + response.command.text + " " + response.command.paramText);
|
||||||
}else if(response.type == ResponseType.valid){
|
}else if(response.type == ResponseType.valid){
|
||||||
yes = null;
|
suggested = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue