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.shields = shields/wave
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.guardian = Guardian
waves.preview = Preview
@ -971,6 +975,7 @@ setting.lasersopacity.name = Power Laser Opacity
setting.bridgeopacity.name = Bridge Opacity
setting.playerchat.name = Display Player Bubble Chat
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.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.

View File

@ -53,11 +53,29 @@ function extend(/*Base, ..., def*/){
const extendContent = extend;
importPackage(Packages.arc)
importPackage(Packages.arc.audio)
importPackage(Packages.arc.func)
importPackage(Packages.arc.graphics)
importPackage(Packages.arc.graphics.g2d)
importPackage(Packages.arc.graphics.gl)
importPackage(Packages.arc.input)
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.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.ai)
importPackage(Packages.mindustry.ai.types)

View File

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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ public class ServerControl implements ApplicationListener{
};
private Fi currentLogFile;
private boolean inExtraRound;
private boolean inGameOverWait;
private Task lastTask;
private Gamemode lastMode;
private @Nullable Map nextMapOverride;
@ -168,7 +168,7 @@ public class ServerControl implements ApplicationListener{
}
Events.on(GameOverEvent.class, event -> {
if(inExtraRound) return;
if(inGameOverWait) return;
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())));
}else{
@ -915,7 +915,7 @@ public class ServerControl implements ApplicationListener{
}
info("Core destroyed.");
inExtraRound = false;
inGameOverWait = false;
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){
inExtraRound = true;
inGameOverWait = true;
Runnable r = () -> {
WorldReloader reloader = new WorldReloader();
@ -1016,7 +1020,7 @@ public class ServerControl implements ApplicationListener{
logic.play();
reloader.end();
inExtraRound = false;
inGameOverWait = false;
};
if(wait){