Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Apr 1, 2023
2 parents e81cd5b + c30cbc0 commit d2f2189
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 19 deletions.
2 changes: 1 addition & 1 deletion SERVERLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ For example, if your server address is `example.com:6000`, you would add a comma
"address": "example.com:6000"
}
```
> Note that Mindustry also support SRV records. This allows you to use a subdomain for your server address instead of specifying the port. For example, if you want to use `play.example.com` instead of `example.com:6000`, in the dns settings of your domain, add an SRV record with `_mindustry` as the service, `tcp` as the protocol, `play` as the target and `6000` as the port. You can also setup fallback servers by modifing the weight or priority of the record.
> Note that Mindustry also support SRV records. This allows you to use a subdomain for your server address instead of specifying the port. For example, if you want to use `play.example.com` instead of `example.com:6000`, in the dns settings of your domain, add an SRV record with `_mindustry` as the service, `tcp` as the protocol, `play` as the target and `6000` as the port. You can also setup fallback servers by modifying the weight or priority of the record. Although SRV records are very convenient, keep in mind they are slower than regular addresses. Avoid using them in the server list, but rather as an easy way to share your server address.

Then, press the *'submit pull request'* button and I'll take a look at your server. If I have any issues with it, I'll let you know in the PR comments.
1 change: 1 addition & 0 deletions core/assets/contributors
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,4 @@ BlackDeluxeCat
zenonet
AyuKo-o
JojoFR1
Xasmedy
50 changes: 41 additions & 9 deletions core/src/mindustry/core/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public class UI implements ApplicationListener, Loadable{
public FullTextDialog fullText;
public CampaignCompleteDialog campaignComplete;

public IntMap<Dialog> followUpMenus;

public Cursor drillCursor, unloadCursor, targetCursor;

private @Nullable Element lastAnnouncement;
Expand Down Expand Up @@ -202,6 +204,7 @@ public void init(){
logic = new LogicDialog();
fullText = new FullTextDialog();
campaignComplete = new CampaignCompleteDialog();
followUpMenus = new IntMap<>();

Group group = Core.scene.root;

Expand Down Expand Up @@ -591,9 +594,8 @@ public void showOkText(String title, String text, Runnable confirmed){
dialog.show();
}

/** Shows a menu that fires a callback when an option is selected. If nothing is selected, -1 is returned. */
public void showMenu(String title, String message, String[][] options, Intc callback){
new Dialog(title){{
public Dialog newMenuDialog(String title, String message, String[][] options, Intc buttonListener, Runnable closeOnBack){
return new Dialog(title){{
setFillParent(true);
removeChild(titleTable);
cont.add(titleTable).width(400f);
Expand All @@ -617,16 +619,46 @@ public void showMenu(String title, String message, String[][] options, Intc call

String optionName = optionsRow[i];
int finalOption = option;
buttonRow.button(optionName, () -> {
callback.get(finalOption);
hide();
}).size(i == optionsRow.length - 1 ? lastWidth : width, 50).pad(4);
buttonRow.button(optionName, () -> buttonListener.get(finalOption))
.size(i == optionsRow.length - 1 ? lastWidth : width, 50).pad(4);
option++;
}
}
}).growX();
closeOnBack(() -> callback.get(-1));
}}.show();
closeOnBack(closeOnBack);
}};
}

/** Shows a menu that fires a callback when an option is selected. If nothing is selected, -1 is returned. */
public void showMenu(String title, String message, String[][] options, Intc callback){
newMenuDialog(title, message, options, option -> {
callback.get(option);
hide();
}, () -> callback.get(-1)).show();
}

/** Shows a menu that hides when another followUp-menu is shown or when nothing is selected.
* @see UI#showMenu(String, String, String[][], Intc) */
public void showFollowUpMenu(int menuId, String title, String message, String[][] options, Intc callback) {

Dialog dialog = newMenuDialog(title, message, options, callback, () -> {
followUpMenus.remove(menuId);
callback.get(-1);
});

Dialog oldDialog = followUpMenus.remove(menuId);
if(oldDialog != null){
dialog.show(Core.scene, null);
oldDialog.hide(null);
}else{
dialog.show();
}
followUpMenus.put(menuId, dialog);
}

public void hideFollowUpMenu(int menuId) {
if(!followUpMenus.containsKey(menuId)) return;
followUpMenus.remove(menuId).hide();
}

/** Formats time with hours:minutes:seconds. */
Expand Down
13 changes: 13 additions & 0 deletions core/src/mindustry/ui/Menus.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public static void menu(int menuId, String title, String message, String[][] opt
ui.showMenu(title, message, options, (option) -> Call.menuChoose(player, menuId, option));
}

@Remote(variants = Variant.both)
public static void followUpMenu(int menuId, String title, String message, String[][] options){
if(title == null) title = "";
if(options == null) options = new String[0][0];

ui.showFollowUpMenu(menuId, title, message, options, (option) -> Call.menuChoose(player, menuId, option));
}

@Remote(variants = Variant.both)
public static void hideFollowUpMenu(int menuId) {
ui.hideFollowUpMenu(menuId);
}

@Remote(targets = Loc.both, called = Loc.both)
public static void menuChoose(@Nullable Player player, int menuId, int option){
if(player != null){
Expand Down
13 changes: 12 additions & 1 deletion core/src/mindustry/world/blocks/distribution/Duct.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class Duct extends Block implements Autotiler{
public @Load(value = "@-top-#", length = 5) TextureRegion[] topRegions;
public @Load(value = "@-bottom-#", length = 5, fallback = "duct-bottom-#") TextureRegion[] botRegions;

public @Nullable Block bridgeReplacement;

public Duct(String name){
super(name);

Expand All @@ -56,6 +58,13 @@ public void setStats(){
stats.add(Stat.itemsMoved, 60f / speed, StatUnit.itemsSecond);
}

@Override
public void init(){
super.init();

if(bridgeReplacement == null || !(bridgeReplacement instanceof DuctBridge)) bridgeReplacement = Blocks.ductBridge;
}

@Override
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
int[] bits = getTiling(plan, list);
Expand Down Expand Up @@ -96,7 +105,9 @@ public TextureRegion[] icons(){

@Override
public void handlePlacementLine(Seq<BuildPlan> plans){
Placement.calculateBridges(plans, (DuctBridge)Blocks.ductBridge, false, b -> b instanceof Duct || b instanceof StackConveyor || b instanceof Conveyor);
if(bridgeReplacement == null) return;

Placement.calculateBridges(plans, (DuctBridge)bridgeReplacement, false, b -> b instanceof Duct || b instanceof StackConveyor || b instanceof Conveyor);
}

public class DuctBuild extends Building{
Expand Down
12 changes: 4 additions & 8 deletions servers_v7.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"name": "ECAN",
"address": ["mindustry.ecansol.com:6597", "mindustry.ecansol.com:6499", "mindustry.ecansol.com:6599"]
},
{
"name": "Mindustry Español",
"address": ["mes.xpdustry.fr"]
},
{
"name": "SMoke of Anarchy",
"address": ["smokeofanarchy.ru", "backup.smokeofanarchy.ru"]
Expand Down Expand Up @@ -53,7 +49,7 @@
},
{
"name": "Omega Hub",
"address": ["n1.mindustry.me:6608", "n7.mindustry.me:6567", "n7.mindustry.me:6570", "n1.mindustry.me:6568", "n1.mindustry.me:6671", "n1.mindustry.me:6570", "n1.mindustry.me:6573", "n1.mindustry.me:6610", "n1.mindustry.me:6567", "n1.mindustry.me:6599", "n1.mindustry.me:6774", "n1.mindustry.me:6571", "n1.mindustry.me:6589"]
"address": ["n1.mindustry.me:6608", "n7.mindustry.me:6767", "n7.mindustry.me:6768", "n1.mindustry.me:6568", "n1.mindustry.me:6671", "n1.mindustry.me:6570", "n1.mindustry.me:6573", "n1.mindustry.me:6610", "n1.mindustry.me:6567", "n1.mindustry.me:6599", "n1.mindustry.me:6774", "n1.mindustry.me:6571", "n1.mindustry.me:6589"]
},
{
"name": "KMWStudios",
Expand Down Expand Up @@ -85,11 +81,11 @@
},
{
"name": "Xpdustry",
"address": ["lobby.md.xpdustry.fr", "survival.md.xpdustry.fr", "router.md.xpdustry.fr", "pvp.md.xpdustry.fr", "sandbox.md.xpdustry.fr", "attack.md.xpdustry.fr", "event.md.xpdustry.fr"]
"address": ["37.187.73.180", "37.187.73.180:7000", "37.187.73.180:7001", "37.187.73.180:7002", "37.187.73.180:7003", "37.187.73.180:7004", "37.187.73.180:7005"]
},
{
"name": "LatamDustry",
"address": ["n1.xpdustry.fr:7003", "n1.xpdustry.fr:7004", "n1.xpdustry.fr:7005", "n1.xpdustry.fr:7006", "n1.xpdustry.fr:7007", "uk-prem-01.optik.host:5894"]
"address": ["uk-prem-01.optik.host:5894"]
},
{
"name": "Pandorum",
Expand Down Expand Up @@ -174,6 +170,6 @@
},
{
"name": "Exploding Cowards",
"address": ["193.31.31.165:25778"]
"address": ["193.31.31.165:25778", "193.31.31.165:25790"]
}
]

0 comments on commit d2f2189

Please sign in to comment.