Merge branches '6.0' and 'master' of https://github.com/Anuken/Mindustry into 6.0

# Conflicts:
#	core/assets/bundles/bundle_uk_UA.properties
#	core/src/mindustry/core/NetClient.java
#	core/src/mindustry/ui/fragments/PlayerListFragment.java
#	core/src/mindustry/world/blocks/power/ImpactReactor.java
#	gradle.properties
This commit is contained in:
Anuken
2020-04-11 10:37:52 -04:00
55 changed files with 2898 additions and 1198 deletions

View File

@@ -95,6 +95,7 @@ public class NetClient implements ApplicationListener{
logic.reset();
platform.updateRPC();
player.name(Core.settings.getString("name"));
player.color().set(Core.settings.getInt("color-0"));
if(quiet) return;

View File

@@ -336,7 +336,7 @@ public class UI implements ApplicationListener, Loadable{
new Dialog(""){{
getCell(cont).growX();
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
}}.show();
}
@@ -375,7 +375,7 @@ public class UI implements ApplicationListener, Loadable{
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.parseException(exc, true)).color(Color.lightGray).left()), true);
cont.addButton("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
cont.addButton("$ok", this::hide).size(100, 50).fillX().left();
cont.addButton("$ok", this::hide).size(110, 50).fillX().left();
cont.row();
cont.add(col).colspan(2).pad(2);
}}.show();
@@ -423,14 +423,14 @@ public class UI implements ApplicationListener, Loadable{
cont.row();
cont.add(text).width(400f).wrap().get().setAlignment(align, align);
cont.row();
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
}}.show();
}
public void showInfoText(String titleText, String text){
new Dialog(titleText){{
cont.margin(15).add(text).width(400f).wrap().left().get().setAlignment(Align.left, Align.left);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
}}.show();
}
@@ -439,7 +439,7 @@ public class UI implements ApplicationListener, Loadable{
cont.margin(10).add(text);
titleTable.row();
titleTable.addImage().color(Pal.accent).height(3f).growX().pad(2f);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
}}.show();
}

View File

@@ -122,7 +122,7 @@ public class Scripts implements Disposable{
if(matched.find()){
LoadedMod required = Vars.mods.locateMod(matched.group(1));
String script = matched.group(2);
if(required == null || root.equals(required.root.child("scripts"))){ // Mod not found, or already using a mod
if(required == null){ // Mod not found, treat it as a folder
Fi dir = root.child(matched.group(1));
if(!dir.exists()) return null; // Mod and folder not found
return loadSource(script, dir, validator);

View File

@@ -19,6 +19,7 @@ public class PlayerListFragment extends Fragment{
private boolean visible = false;
private Table content = new Table().marginRight(13f).marginLeft(13f);
private Interval timer = new Interval();
private TextField sField;
@Override
public void build(Group parent){
@@ -41,6 +42,13 @@ public class PlayerListFragment extends Fragment{
cont.table(Tex.buttonTrans, pane -> {
pane.label(() -> Core.bundle.format(Groups.player.size() == 1 ? "players.single" : "players", Groups.player.size()));
pane.row();
sField = pane.addField(null, text -> {
rebuild();
}).grow().pad(8).get();
sField.setMaxLength(maxNameLength);
sField.setMessageText(Core.bundle.format("players.search"));
pane.row();
pane.pane(content).grow().get().setScrollingDisabled(true, false);
pane.row();
@@ -69,6 +77,7 @@ public class PlayerListFragment extends Fragment{
NetConnection connection = user.con();
if(connection == null && net.server() && !user.isLocal()) return;
if(sField.getText().length() > 0 && !user.name().toLowerCase().contains(sField.getText().toLowerCase()) && !Strings.stripColors(user.name.toLowerCase()).contains(sField.getText().toLowerCase())) return;
Table button = new Table();
button.left();
@@ -104,9 +113,9 @@ public class PlayerListFragment extends Fragment{
t.defaults().size(bs);
t.addImageButton(Icon.hammer, Styles.clearPartiali,
() -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban)));
() -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban)));
t.addImageButton(Icon.cancel, Styles.clearPartiali,
() -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick)));
() -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick)));
t.row();
@@ -120,11 +129,10 @@ public class PlayerListFragment extends Fragment{
}else{
ui.showConfirm("$confirm", "$confirmadmin", () -> netServer.admins.adminPlayer(id, user.usid()));
}
})
.update(b -> b.setChecked(user.admin()))
.disabled(b -> net.client())
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
.checked(user.admin());
}).update(b -> b.setChecked(user.admin()))
.disabled(b -> net.client())
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
.checked(user.admin());
t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
@@ -133,7 +141,7 @@ public class PlayerListFragment extends Fragment{
button.add().growY();
button.addImageButton(Icon.hammer, Styles.clearPartiali,
() -> ui.showConfirm("$confirm", "$confirmvotekick", () -> Call.sendChatMessage("/votekick " + user.name()))).size(h);
() -> ui.showConfirm("$confirm", "$confirmvotekick", () -> Call.sendChatMessage("/votekick " + user.name()))).size(h);
}
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
@@ -142,6 +150,10 @@ public class PlayerListFragment extends Fragment{
content.row();
});
if(sField.getText().length() > 0 && !Groups.player.contains(user -> user.name.toLowerCase().contains(sField.getText().toLowerCase()))) {
content.add(Core.bundle.format("players.notfound")).padBottom(6).width(350f).maxHeight(h + 14);
}
content.marginBottom(5);
}
@@ -149,6 +161,9 @@ public class PlayerListFragment extends Fragment{
visible = !visible;
if(visible){
rebuild();
}else{
Core.scene.setKeyboardFocus(null);
sField.clearText();
}
}

View File

@@ -89,7 +89,7 @@ public class Build{
}
if(type.isMultiblock()){
if(type.canReplace(tile.block()) && tile.block().size == type.size && type.canPlaceOn(tile) && tile.interactable(team)){
if((type.canReplace(tile.block()) || (tile.block instanceof BuildBlock && tile.<BuildEntity>ent().cblock == type)) && tile.block().size == type.size && type.canPlaceOn(tile) && tile.interactable(team)){
return true;
}
@@ -119,7 +119,7 @@ public class Build{
&& contactsGround(tile.x, tile.y, type)
&& (!tile.floor().isDeep() || type.floating)
&& tile.floor().placeableOn
&& ((type.canReplace(tile.block())
&& (((type.canReplace(tile.block()) || (tile.block instanceof BuildBlock && tile.<BuildEntity>ent().cblock == type))
&& !(type == tile.block() && rotation == tile.rotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
&& tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile);
}

View File

@@ -100,8 +100,8 @@ public class ImpactReactor extends PowerGenerator{
public void draw(){
Draw.rect(reg(bottomRegion), x, y);
for(int i = 0; i < plasmas; i++){
float r = 29f + Mathf.absin(Time.time(), 2f + i * 1f, 5f - i * 0.5f);
for(int i = 0; i < plasmas; i++){
float r = size * tilesize - 3f + Mathf.absin(Time.time(), 2f + i * 1f, 5f - i * 0.5f);
Draw.color(plasma1, plasma2, (float)i / plasmas);
Draw.alpha((0.3f + Mathf.absin(Time.time(), 2f + i * 2f, 0.3f + i * 0.05f)) * warmup);