Misc polish stuff

This commit is contained in:
Anuken
2022-04-17 17:12:01 -04:00
parent 95c34996af
commit b5b4edcb67
7 changed files with 84 additions and 45 deletions

View File

@@ -403,6 +403,10 @@ waves.health = health: {0}%
waves.perspawn = per spawn waves.perspawn = per spawn
waves.shields = shields/wave waves.shields = shields/wave
waves.to = to waves.to = to
waves.spawn = spawn:
waves.spawn.all = <all>
waves.spawn.select = Spawn Select
waves.spawn.none = [scarlet]no spawns found in map
waves.max = max units waves.max = max units
waves.guardian = Guardian waves.guardian = Guardian
waves.preview = Preview waves.preview = Preview
@@ -971,6 +975,7 @@ setting.lasersopacity.name = Power Laser Opacity
setting.bridgeopacity.name = Bridge Opacity setting.bridgeopacity.name = Bridge Opacity
setting.playerchat.name = Display Player Bubble Chat setting.playerchat.name = Display Player Bubble Chat
setting.showweather.name = Show Weather Graphics setting.showweather.name = Show Weather Graphics
setting.hidedisplays.name = Hide Logic Displays
public.confirm = Do you want to make your game public?\n[accent]Anyone will be able to join your games.\n[lightgray]This can be changed later in Settings->Game->Public Game Visibility. public.confirm = Do you want to make your game public?\n[accent]Anyone will be able to join your games.\n[lightgray]This can be changed later in Settings->Game->Public Game Visibility.
public.confirm.really = If you want to play with friends, use [green]Invite Friend[] instead of a [scarlet]Public server[]!\nAre you sure you want to make your game [scarlet]public[]? public.confirm.really = If you want to play with friends, use [green]Invite Friend[] instead of a [scarlet]Public server[]!\nAre you sure you want to make your game [scarlet]public[]?
public.beta = Note that beta versions of the game cannot make public lobbies. public.beta = Note that beta versions of the game cannot make public lobbies.

View File

@@ -53,11 +53,29 @@ function extend(/*Base, ..., def*/){
const extendContent = extend; const extendContent = extend;
importPackage(Packages.arc) importPackage(Packages.arc)
importPackage(Packages.arc.audio)
importPackage(Packages.arc.func)
importPackage(Packages.arc.graphics) importPackage(Packages.arc.graphics)
importPackage(Packages.arc.graphics.g2d) importPackage(Packages.arc.graphics.g2d)
importPackage(Packages.arc.graphics.gl) importPackage(Packages.arc.graphics.gl)
importPackage(Packages.arc.input)
importPackage(Packages.arc.math) importPackage(Packages.arc.math)
importPackage(Packages.arc.math.geom)
importPackage(Packages.arc.scene)
importPackage(Packages.arc.scene.actions)
importPackage(Packages.arc.scene.event)
importPackage(Packages.arc.scene.style)
importPackage(Packages.arc.scene.ui)
importPackage(Packages.arc.scene.ui.layout)
importPackage(Packages.arc.scene.utils)
importPackage(Packages.arc.struct)
importPackage(Packages.arc.util) importPackage(Packages.arc.util)
importPackage(Packages.arc.util.async)
importPackage(Packages.arc.util.io)
importPackage(Packages.arc.util.noise)
importPackage(Packages.arc.util.pooling)
importPackage(Packages.arc.util.serialization)
importPackage(Packages.arc.util.viewport)
importPackage(Packages.mindustry) importPackage(Packages.mindustry)
importPackage(Packages.mindustry.ai) importPackage(Packages.mindustry.ai)
importPackage(Packages.mindustry.ai.types) importPackage(Packages.mindustry.ai.types)

View File

@@ -46,7 +46,7 @@ public class Renderer implements ApplicationListener{
public @Nullable Bloom bloom; public @Nullable Bloom bloom;
public @Nullable FrameBuffer backgroundBuffer; public @Nullable FrameBuffer backgroundBuffer;
public FrameBuffer effectBuffer = new FrameBuffer(); public FrameBuffer effectBuffer = new FrameBuffer();
public boolean animateShields, drawWeather = true, drawStatus, enableEffects; public boolean animateShields, drawWeather = true, drawStatus, enableEffects, drawDisplays = true;
public float weatherAlpha; public float weatherAlpha;
/** minZoom = zooming out, maxZoom = zooming in */ /** minZoom = zooming out, maxZoom = zooming in */
public float minZoom = 1.5f, maxZoom = 6f; public float minZoom = 1.5f, maxZoom = 6f;
@@ -171,6 +171,7 @@ public class Renderer implements ApplicationListener{
animateShields = settings.getBool("animatedshields"); animateShields = settings.getBool("animatedshields");
drawStatus = Core.settings.getBool("blockstatus"); drawStatus = Core.settings.getBool("blockstatus");
enableEffects = settings.getBool("effects"); enableEffects = settings.getBool("effects");
drawDisplays = !settings.getBool("hidedisplays");
if(landTime > 0){ if(landTime > 0){
if(!state.isPaused()){ if(!state.isPaused()){

View File

@@ -338,55 +338,60 @@ public class WaveInfoDialog extends BaseDialog{
setColor(Color.white); setColor(Color.white);
}}).width(300f).height(44f); }}).width(300f).height(44f);
}).row(); }).row();
}
t.table(a -> { t.table(a -> {
a.add("spawn: "); a.add("@waves.spawn").padRight(8);
a.button("", () -> { a.button("", () -> {
if(!checkedSpawns){ if(!checkedSpawns){
//recalculate waves when changed //recalculate waves when changed
Vars.spawner.reset(); Vars.spawner.reset();
checkedSpawns = true; checkedSpawns = true;
}
BaseDialog dialog = new BaseDialog("@waves.spawn.select");
dialog.cont.pane(p -> {
p.background(Tex.button).margin(10f);
int i = 0;
int cols = 4;
int max = 20;
if(spawner.getSpawns().size >= max){
p.add("[lightgray](first " + max + ")").colspan(cols).padBottom(4).row();
} }
BaseDialog dialog = new BaseDialog("Spawn Select"); for(var spawn : spawner.getSpawns()){
dialog.cont.pane(p -> { p.button(spawn.x + ", " + spawn.y, Styles.clearTogglet, () -> {
p.background(Tex.button).margin(10f); group.spawn = Point2.pack(spawn.x, spawn.y);
int i = 0; dialog.hide();
int cols = 4; }).size(110f, 45f).checked(spawn.pos() == group.spawn);
int max = 20;
if(spawner.getSpawns().size >= max){ if(++i % cols == 0){
p.add("[lightgray](first " + max + ")").colspan(cols).padBottom(4).row(); p.row();
} }
for(var spawn : spawner.getSpawns()){ //only display first 20 spawns, you don't need to see more.
p.button(spawn.x + ", " + spawn.y, Styles.clearTogglet, () -> { if(i >= 20){
group.spawn = Point2.pack(spawn.x, spawn.y); break;
dialog.hide();
}).size(110f, 45f).checked(spawn.pos() == group.spawn);
if(++i % cols == 0){
p.row();
}
//only display first 20 spawns, you don't need to see more.
if(i >= 20){
break;
}
} }
}
if(spawner.getSpawns().isEmpty()){ p.button("@waves.spawn.all", Styles.clearTogglet, () -> {
p.add("[scarlet]no spawns found in map"); group.spawn = -1;
} dialog.hide();
}); }).size(110f, 45f).checked(-1 == group.spawn);
dialog.setFillParent(false);
dialog.addCloseButton();
dialog.show();
}).width(160f).height(36f).get().getLabel().setText(() -> group.spawn == -1 ? "<all>" : Point2.x(group.spawn) + ", " + Point2.y(group.spawn));
}).padBottom(8f).row(); if(spawner.getSpawns().isEmpty()){
} p.add("@waves.spawn.none");
}
});
dialog.setFillParent(false);
dialog.addCloseButton();
dialog.show();
}).width(160f).height(36f).get().getLabel().setText(() -> group.spawn == -1 ? "@waves.spawn.all" : Point2.x(group.spawn) + ", " + Point2.y(group.spawn));
}).padBottom(8f).row();
} }
}).width(340f).pad(8); }).width(340f).pad(8);

View File

@@ -450,6 +450,7 @@ public class SettingsMenuDialog extends BaseDialog{
} }
graphics.checkPref("skipcoreanimation", false); graphics.checkPref("skipcoreanimation", false);
graphics.checkPref("hidedisplays", false);
if(!mobile){ if(!mobile){
Core.settings.put("swapdiagonal", false); Core.settings.put("swapdiagonal", false);

View File

@@ -6,6 +6,7 @@ import arc.graphics.g2d.*;
import arc.graphics.gl.*; import arc.graphics.gl.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
@@ -59,6 +60,9 @@ public class LogicDisplay extends Block{
public void draw(){ public void draw(){
super.draw(); super.draw();
//don't even bother processing anything when displays are off.
if(!Vars.renderer.drawDisplays) return;
Draw.draw(Draw.z(), () -> { Draw.draw(Draw.z(), () -> {
if(buffer == null){ if(buffer == null){
buffer = new FrameBuffer(displaySize, displaySize); buffer = new FrameBuffer(displaySize, displaySize);
@@ -68,6 +72,7 @@ public class LogicDisplay extends Block{
} }
}); });
//don't bother processing commands if displays are off
if(!commands.isEmpty()){ if(!commands.isEmpty()){
Draw.draw(Draw.z(), () -> { Draw.draw(Draw.z(), () -> {
Tmp.m1.set(Draw.proj()); Tmp.m1.set(Draw.proj());

View File

@@ -54,7 +54,7 @@ public class ServerControl implements ApplicationListener{
}; };
private Fi currentLogFile; private Fi currentLogFile;
private boolean inExtraRound; private boolean inGameOverWait;
private Task lastTask; private Task lastTask;
private Gamemode lastMode; private Gamemode lastMode;
private @Nullable Map nextMapOverride; private @Nullable Map nextMapOverride;
@@ -168,7 +168,7 @@ public class ServerControl implements ApplicationListener{
} }
Events.on(GameOverEvent.class, event -> { Events.on(GameOverEvent.class, event -> {
if(inExtraRound) return; if(inGameOverWait) return;
if(state.rules.waves){ if(state.rules.waves){
info("Game over! Reached wave @ with @ players online on map @.", state.wave, Groups.player.size(), Strings.capitalize(Strings.stripColors(state.map.name()))); info("Game over! Reached wave @ with @ players online on map @.", state.wave, Groups.player.size(), Strings.capitalize(Strings.stripColors(state.map.name())));
}else{ }else{
@@ -915,7 +915,7 @@ public class ServerControl implements ApplicationListener{
} }
info("Core destroyed."); info("Core destroyed.");
inExtraRound = false; inGameOverWait = false;
Events.fire(new GameOverEvent(state.rules.waveTeam)); Events.fire(new GameOverEvent(state.rules.waveTeam));
}); });
@@ -1003,8 +1003,12 @@ public class ServerControl implements ApplicationListener{
} }
} }
public void setNextMap(Map map){
nextMapOverride = map;
}
private void play(boolean wait, Runnable run){ private void play(boolean wait, Runnable run){
inExtraRound = true; inGameOverWait = true;
Runnable r = () -> { Runnable r = () -> {
WorldReloader reloader = new WorldReloader(); WorldReloader reloader = new WorldReloader();
@@ -1016,7 +1020,7 @@ public class ServerControl implements ApplicationListener{
logic.play(); logic.play();
reloader.end(); reloader.end();
inExtraRound = false; inGameOverWait = false;
}; };
if(wait){ if(wait){