mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
443a60dc76
11 changed files with 82 additions and 47 deletions
|
|
@ -138,13 +138,13 @@ mods.reloadexit = Гра зараз закриється, щоби переза
|
|||
mod.installed = [[Установлено]
|
||||
mod.display = [gray]Модифікація:[orange] {0}
|
||||
mod.enabled = [lightgray]Увімкнено
|
||||
mod.disabled = [scarlet]Вимкнено
|
||||
mod.multiplayer.compatible = [gray]Сумісно з багатоосібною грою
|
||||
mod.disabled = [scarlet]Вимкнена
|
||||
mod.multiplayer.compatible = [gray]Доступна у багатоосібній грі
|
||||
mod.disable = Вимкнути
|
||||
mod.content = Зміст:
|
||||
mod.delete.error = Неможливо видалити модифікацію. Файл, можливо, використовується.
|
||||
mod.requiresversion = [scarlet]Необхідна мінімальна версія гри: [accent]{0}
|
||||
mod.outdatedv7 = [scarlet]Несумісно із сьомою версією \n(немає minGameVersion: 136)
|
||||
mod.outdatedv7 = [scarlet]Несумісна із сьомою версією \n(немає minGameVersion: 136)
|
||||
mod.missingdependencies = [scarlet]Відсутні залежності: {0}
|
||||
mod.erroredcontent = [scarlet]Помилки під час завантаження
|
||||
mod.errors = Виникли помилки під час завантаження змісту.
|
||||
|
|
@ -1781,7 +1781,7 @@ laccess.controller = Керувач одиницями. Якщо процесо
|
|||
laccess.dead = Чи є одиниця або будівля мертвою або недійсною.
|
||||
laccess.controlled = Повертає \n[accent]@ctrlProcessor[] якщо одиниця контролюється процесором;\n[accent]@ctrlPlayer[] якщо одиниця чи будівля контролюєть гравцем\n[accent]@ctrlFormation[] якщо одиниця у загоні (формуванні)\nІнакше — 0.
|
||||
laccess.progress = Прогрес дії, від 0 до 1.\nПовертає виробництво, перезавантаження башти або хід будівництва.
|
||||
laccess.speed = Top speed of a unit, in tiles/sec.
|
||||
laccess.speed = Максимальна швидкість одиниці, у плитках за секунду.
|
||||
lcategory.unknown = Невідома категорія
|
||||
lcategory.unknown.description = Команди без категорії.
|
||||
lcategory.io = Ввід та вивід
|
||||
|
|
|
|||
|
|
@ -294,7 +294,9 @@ public class MapGenerateDialog extends BaseDialog{
|
|||
}
|
||||
|
||||
t.button(Icon.copy, style, () -> {
|
||||
filters.insert(filters.indexOf(filter), filter);
|
||||
GenerateFilter copy = filter.copy();
|
||||
copy.randomize();
|
||||
filters.insert(filters.indexOf(filter) + 1, copy);
|
||||
rebuildFilters();
|
||||
update();
|
||||
}).tooltip("@editor.copy");
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@ public class LogicDialog extends BaseDialog{
|
|||
|
||||
addCloseListener();
|
||||
|
||||
shown(this::setup);
|
||||
hidden(() -> consumer.get(canvas.save()));
|
||||
onResize(() -> {
|
||||
setup();
|
||||
canvas.rebuild();
|
||||
});
|
||||
}
|
||||
|
||||
private void setup(){
|
||||
buttons.clearChildren();
|
||||
buttons.defaults().size(160f, 64f);
|
||||
buttons.button("@back", Icon.left, this::hide).name("back");
|
||||
|
||||
|
|
@ -204,10 +214,6 @@ public class LogicDialog extends BaseDialog{
|
|||
row();
|
||||
|
||||
add(buttons).growX().name("canvas");
|
||||
|
||||
hidden(() -> consumer.get(canvas.save()));
|
||||
|
||||
onResize(() -> canvas.rebuild());
|
||||
}
|
||||
|
||||
public void show(String code, LExecutor executor, boolean privileged, Cons<String> modified){
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ public abstract class FilterOption{
|
|||
table.button(b -> b.image(supplier.get().uiIcon).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().uiIcon)).size(iconSmall), () -> {
|
||||
BaseDialog dialog = new BaseDialog("@filter.option." + name);
|
||||
dialog.setFillParent(false);
|
||||
dialog.cont.pane(t -> {
|
||||
int i = 0;
|
||||
for(Block block : Vars.content.blocks()){
|
||||
|
|
@ -119,7 +118,8 @@ public abstract class FilterOption{
|
|||
});
|
||||
if(++i % 10 == 0) t.row();
|
||||
}
|
||||
});
|
||||
dialog.setFillParent(i > 100);
|
||||
}).padRight(8f).scrollX(false);
|
||||
|
||||
|
||||
dialog.addCloseButton();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import mindustry.gen.*;
|
|||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
public abstract class GenerateFilter{
|
||||
public abstract class GenerateFilter implements Cloneable{
|
||||
public int seed = 0;
|
||||
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
|
|
@ -128,6 +128,14 @@ public abstract class GenerateFilter{
|
|||
return Mathf.randomSeed(Pack.longInt(x, y + seed));
|
||||
}
|
||||
|
||||
public GenerateFilter copy(){
|
||||
try{
|
||||
return (GenerateFilter) clone();
|
||||
}catch(CloneNotSupportedException disgrace){
|
||||
throw new RuntimeException("java is the best language", disgrace);
|
||||
}
|
||||
}
|
||||
|
||||
/** an input for generating at a certain coordinate. should only be instantiated once. */
|
||||
public static class GenerateInput{
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ public class RiverNoiseFilter extends GenerateFilter{
|
|||
new SliderOption("octaves", () -> octaves, f -> octaves = f, 1f, 10f),
|
||||
new SliderOption("falloff", () -> falloff, f -> falloff = f, 0f, 1f),
|
||||
new BlockOption("target", () -> target, b -> target = b, anyOptional),
|
||||
new BlockOption("block", () -> block, b -> block = b, wallsOnly),
|
||||
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
|
||||
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOnly)
|
||||
new BlockOption("block", () -> block, b -> block = b, wallsOptional),
|
||||
new BlockOption("floor", () -> floor, b -> floor = b, floorsOptional),
|
||||
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOptional)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,13 @@ public class RiverNoiseFilter extends GenerateFilter{
|
|||
float noise = rnoise(in.x, in.y, (int)octaves, scl, falloff, 1f);
|
||||
|
||||
if(noise >= threshold && (target == Blocks.air || in.floor == target || in.block == target)){
|
||||
in.floor = floor;
|
||||
if(floor != Blocks.air) in.floor = floor;
|
||||
|
||||
if(in.block.solid){
|
||||
if(in.block.solid && block != Blocks.air && in.block != Blocks.air){
|
||||
in.block = block;
|
||||
}
|
||||
|
||||
if(noise >= threshold2){
|
||||
if(noise >= threshold2 && floor2 != Blocks.air){
|
||||
in.floor = floor2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@ import arc.func.*;
|
|||
import arc.math.*;
|
||||
import arc.net.*;
|
||||
import arc.net.FrameworkMessage.*;
|
||||
import arc.net.dns.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.Log.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.*;
|
||||
import mindustry.net.Net.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import net.jpountz.lz4.*;
|
||||
|
|
@ -17,6 +19,7 @@ import java.io.*;
|
|||
import java.net.*;
|
||||
import java.nio.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
|
@ -189,8 +192,27 @@ public class ArcNetProvider implements NetProvider{
|
|||
@Override
|
||||
public void pingHost(String address, int port, Cons<Host> valid, Cons<Exception> invalid){
|
||||
try{
|
||||
DatagramSocket socket = new DatagramSocket();
|
||||
var host = pingHostImpl(address, port);
|
||||
Core.app.post(() -> valid.get(host));
|
||||
}catch(IOException e){
|
||||
if(port == Vars.port){
|
||||
for(var record : ArcDns.getSrvRecords("_mindustry._tcp." + address)){
|
||||
try{
|
||||
var host = pingHostImpl(record.target, record.port);
|
||||
Core.app.post(() -> valid.get(host));
|
||||
return;
|
||||
}catch(IOException ignored){
|
||||
}
|
||||
}
|
||||
}
|
||||
Core.app.post(() -> invalid.get(e));
|
||||
}
|
||||
}
|
||||
|
||||
private Host pingHostImpl(String address, int port) throws IOException{
|
||||
try(DatagramSocket socket = new DatagramSocket()){
|
||||
long time = Time.millis();
|
||||
|
||||
socket.send(new DatagramPacket(new byte[]{-2, 1}, 2, InetAddress.getByName(address), port));
|
||||
socket.setSoTimeout(2000);
|
||||
|
||||
|
|
@ -199,10 +221,8 @@ public class ArcNetProvider implements NetProvider{
|
|||
|
||||
ByteBuffer buffer = ByteBuffer.wrap(packet.getData());
|
||||
Host host = NetworkIO.readServerData((int)Time.timeSinceMillis(time), packet.getAddress().getHostAddress(), buffer);
|
||||
|
||||
Core.app.post(() -> valid.get(host));
|
||||
}catch(Exception e){
|
||||
Core.app.post(() -> invalid.get(e));
|
||||
host.port = port;
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ public class Net{
|
|||
|
||||
/**
|
||||
* Pings a host in a pooled thread. If an error occurred, failed() should be called with the exception.
|
||||
* If the port is the default mindustry port, SRV records are checked too.
|
||||
*/
|
||||
public void pingHost(String address, int port, Cons<Host> valid, Cons<Exception> failed){
|
||||
pingExecutor.submit(() -> provider.pingHost(address, port, valid, failed));
|
||||
|
|
@ -375,7 +376,10 @@ public class Net{
|
|||
*/
|
||||
void discoverServers(Cons<Host> callback, Runnable done);
|
||||
|
||||
/** Ping a host. If an error occurred, failed() should be called with the exception. This method should block. */
|
||||
/**
|
||||
* Ping a host. If an error occurred, failed() should be called with the exception. This method should block.
|
||||
* If the port is the default mindustry port (6567), SRV records are checked too.
|
||||
*/
|
||||
void pingHost(String address, int port, Cons<Host> valid, Cons<Exception> failed);
|
||||
|
||||
/** Host a server at specified port. */
|
||||
|
|
@ -393,5 +397,4 @@ public class Net{
|
|||
closeServer();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class JoinDialog extends BaseDialog{
|
|||
if(!buttons[0].childrenPressed()){
|
||||
if(server.lastHost != null){
|
||||
Events.fire(new ClientPreConnectEvent(server.lastHost));
|
||||
safeConnect(server.ip, server.port, server.lastHost.version);
|
||||
safeConnect(server.lastHost.address, server.lastHost.port, server.lastHost.version);
|
||||
}else{
|
||||
connect(server.ip, server.port);
|
||||
}
|
||||
|
|
@ -410,7 +410,6 @@ public class JoinDialog extends BaseDialog{
|
|||
int resport = address.contains(":") ? Strings.parseInt(address.split(":")[1]) : port;
|
||||
net.pingHost(resaddress, resport, res -> {
|
||||
if(refreshes != cur) return;
|
||||
res.port = resport;
|
||||
|
||||
//add header
|
||||
if(groupTable[0] == null){
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class KeybindDialog extends Dialog{
|
|||
protected ObjectIntMap<Section> sectionControls = new ObjectIntMap<>();
|
||||
|
||||
public KeybindDialog(){
|
||||
super(bundle.get("keybind.title", "Rebind Keys"));
|
||||
super(bundle.get("keybind.title"));
|
||||
setup();
|
||||
addCloseButton();
|
||||
setFillParent(true);
|
||||
|
|
@ -154,7 +154,7 @@ public class KeybindDialog extends Dialog{
|
|||
openDialog(section, keybind);
|
||||
}).width(130f);
|
||||
}
|
||||
table.button("@settings.resetKey", tstyle, () -> keybinds.resetToDefault(section, keybind)).width(130f);
|
||||
table.button("@settings.resetKey", tstyle, () -> keybinds.resetToDefault(section, keybind)).width(130f).pad(2f).padLeft(4f);
|
||||
table.row();
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ public class KeybindDialog extends Dialog{
|
|||
}
|
||||
|
||||
private void openDialog(Section section, KeyBind name){
|
||||
rebindDialog = new Dialog(rebindAxis ? bundle.get("keybind.press.axis", "Press an axis or key...") : bundle.get("keybind.press", "Press a key..."));
|
||||
rebindDialog = new Dialog(rebindAxis ? bundle.get("keybind.press.axis") : bundle.get("keybind.press"));
|
||||
|
||||
rebindKey = name;
|
||||
|
||||
|
|
|
|||
|
|
@ -270,26 +270,26 @@ public class SettingsMenuDialog extends BaseDialog{
|
|||
|
||||
TextButtonStyle style = Styles.flatt;
|
||||
|
||||
float marg = 8f, isize = iconMed;
|
||||
float isize = iconMed;
|
||||
|
||||
menu.defaults().size(300f, 60f);
|
||||
menu.button("@settings.game", Icon.settings, style, isize, () -> visible(0)).marginLeft(marg).row();
|
||||
menu.button("@settings.graphics", Icon.image, style, isize, () -> visible(1)).marginLeft(marg).row();
|
||||
menu.button("@settings.sound", Icon.filters, style, isize, () -> visible(2)).marginLeft(marg).row();
|
||||
menu.button("@settings.language", Icon.chat, style, isize, ui.language::show).marginLeft(marg).row();
|
||||
menu.defaults().size(300f, 60f).marginLeft(8f);
|
||||
menu.button("@settings.game", Icon.settings, style, isize, () -> visible(0)).row();
|
||||
menu.button("@settings.graphics", Icon.image, style, isize, () -> visible(1)).row();
|
||||
menu.button("@settings.sound", Icon.filters, style, isize, () -> visible(2)).row();
|
||||
menu.button("@settings.language", Icon.chat, style, isize, ui.language::show).row();
|
||||
if(!mobile || Core.settings.getBool("keyboard")){
|
||||
menu.button("@settings.controls", Icon.move, style, isize, ui.controls::show).marginLeft(marg).row();
|
||||
menu.button("@settings.controls", Icon.move, style, isize, ui.controls::show).row();
|
||||
}
|
||||
|
||||
menu.button("@settings.data", Icon.save, style, isize, () -> dataDialog.show()).marginLeft(marg).row();
|
||||
menu.button("@settings.data", Icon.save, style, isize, () -> dataDialog.show()).row();
|
||||
|
||||
int i = 3;
|
||||
for(var cat : categories){
|
||||
int index = i;
|
||||
if(cat.icon == null){
|
||||
menu.button(cat.name, style, () -> visible(index)).marginLeft(marg).row();
|
||||
menu.button(cat.name, style, () -> visible(index)).row();
|
||||
}else{
|
||||
menu.button(cat.name, cat.icon, style, isize, () -> visible(index)).with(b -> ((Image)b.getChildren().get(1)).setScaling(Scaling.fit)).marginLeft(marg).row();
|
||||
menu.button(cat.name, cat.icon, style, isize, () -> visible(index)).with(b -> ((Image)b.getChildren().get(1)).setScaling(Scaling.fit)).row();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
@ -438,22 +438,19 @@ public class SettingsMenuDialog extends BaseDialog{
|
|||
}
|
||||
|
||||
graphics.checkPref("effects", true);
|
||||
graphics.checkPref("atmosphere", !mobile);
|
||||
graphics.checkPref("destroyedblocks", true);
|
||||
graphics.checkPref("blockstatus", false);
|
||||
graphics.checkPref("playerchat", true);
|
||||
if(!mobile){
|
||||
graphics.checkPref("coreitems", true);
|
||||
}
|
||||
if(!mobile) graphics.checkPref("coreitems", true);
|
||||
graphics.row();
|
||||
graphics.checkPref("minimap", !mobile);
|
||||
graphics.checkPref("smoothcamera", true);
|
||||
graphics.checkPref("position", false);
|
||||
if(!mobile){
|
||||
graphics.checkPref("mouseposition", false);
|
||||
}
|
||||
if(!mobile) graphics.checkPref("mouseposition", false);
|
||||
graphics.checkPref("fps", false);
|
||||
graphics.checkPref("playerindicators", true);
|
||||
graphics.checkPref("indicators", true);
|
||||
graphics.checkPref("atmosphere", !mobile);
|
||||
graphics.checkPref("showweather", true);
|
||||
graphics.checkPref("animatedwater", true);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue