Compare commits

..

7 Commits
v123 ... v123.1

Author SHA1 Message Date
Anuken
3aee9bddd4 Cleanup 2021-01-21 08:54:14 -05:00
Sunny Kim
65f97edbc5 Add search option for mod browser (#4391)
* add search option

* mods.browser.sortdate

* mods.browser

* Update bundle_ko.properties

* oopsie

* clearPartiali

* half of my brain cells failed to boot
2021-01-21 08:51:43 -05:00
Anuken
d393230add . 2021-01-21 08:50:25 -05:00
Anuken
75d2b0fb69 Fixed #4393 / Fixed #4398 2021-01-21 08:48:36 -05:00
Anuken
0cc9b0b0a3 Mod version parse fix 2021-01-20 16:44:04 -05:00
Anuken
9b6c125233 UI.formatAmount for negative numbers 2021-01-20 16:38:46 -05:00
Anuken
1f2b331bf6 Possible Android mod extension fix 2021-01-20 14:48:54 -05:00
13 changed files with 42 additions and 49 deletions

View File

@@ -45,6 +45,8 @@ mod.featured.dialog.title = Mod Browser (WIP)
mods.browser.selected = Selected mod mods.browser.selected = Selected mod
mods.browser.add = Install mods.browser.add = Install
mods.github.open = View mods.github.open = View
mods.browser.sortdate = Sort by recent
mods.browser.sortstars = Sort by stars
schematic = Schematic schematic = Schematic
schematic.add = Save Schematic... schematic.add = Save Schematic...

View File

@@ -45,6 +45,8 @@ mod.featured.dialog.title = 모드 탐색 (WIP)
mods.browser.selected = 선택된 모드 mods.browser.selected = 선택된 모드
mods.browser.add = 모드 설치 mods.browser.add = 모드 설치
mods.github.open = 깃허브 사이트 열기 mods.github.open = 깃허브 사이트 열기
mods.browser.sortdate = 최근 업데이트
mods.browser.sortstars = 추천(스타) 수
schematic = 설계도 schematic = 설계도
schematic.add = 설계도 저장하기 schematic.add = 설계도 저장하기

View File

@@ -182,7 +182,7 @@ public class NetServer implements ApplicationListener{
return; return;
} }
if(Groups.player.contains(player -> player.uuid().equals(packet.uuid) || player.usid().equals(packet.usid) || player.ip().equals(con.address))){ if(Groups.player.contains(player -> player.uuid().equals(packet.uuid) || player.usid().equals(packet.usid))){
con.kick(KickReason.idInUse); con.kick(KickReason.idInUse);
return; return;
} }

View File

@@ -526,16 +526,15 @@ public class UI implements ApplicationListener, Loadable{
dialog.show(); dialog.show();
} }
//TODO move?
public static String formatAmount(int number){ public static String formatAmount(int number){
if(number >= 1_000_000_000){ int mag = Math.abs(number);
if(mag >= 1_000_000_000){
return Strings.fixed(number / 1_000_000_000f, 1) + "[gray]" + Core.bundle.get("unit.billions") + "[]"; return Strings.fixed(number / 1_000_000_000f, 1) + "[gray]" + Core.bundle.get("unit.billions") + "[]";
}else if(number >= 1_000_000){ }else if(mag >= 1_000_000){
return Strings.fixed(number / 1_000_000f, 1) + "[gray]" + Core.bundle.get("unit.millions") + "[]"; return Strings.fixed(number / 1_000_000f, 1) + "[gray]" + Core.bundle.get("unit.millions") + "[]";
}else if(number >= 10_000){ }else if(mag >= 10_000){
return number / 1000 + "[gray]" + Core.bundle.get("unit.thousands") + "[]"; return number / 1000 + "[gray]" + Core.bundle.get("unit.thousands") + "[]";
}else if(number >= 1000){ }else if(mag >= 1000){
return Strings.fixed(number / 1000f, 1) + "[gray]" + Core.bundle.get("unit.thousands") + "[]"; return Strings.fixed(number / 1000f, 1) + "[gray]" + Core.bundle.get("unit.thousands") + "[]";
}else{ }else{
return number + ""; return number + "";

View File

@@ -31,7 +31,6 @@ public enum Gamemode{
rules.buildCostMultiplier = 1f; rules.buildCostMultiplier = 1f;
rules.buildSpeedMultiplier = 1f; rules.buildSpeedMultiplier = 1f;
rules.unitBuildSpeedMultiplier = 2f; rules.unitBuildSpeedMultiplier = 2f;
rules.unitHealthMultiplier = 3f;
rules.attackMode = true; rules.attackMode = true;
}, map -> map.teams.size > 1), }, map -> map.teams.size > 1),
editor(true, rules -> { editor(true, rules -> {

View File

@@ -46,8 +46,6 @@ public class Rules{
public boolean unitAmmo = false; public boolean unitAmmo = false;
/** How fast unit pads build units. */ /** How fast unit pads build units. */
public float unitBuildSpeedMultiplier = 1f; public float unitBuildSpeedMultiplier = 1f;
/** How much health units start with. */
public float unitHealthMultiplier = 1f;
/** How much damage any other units deal. */ /** How much damage any other units deal. */
public float unitDamageMultiplier = 1f; public float unitDamageMultiplier = 1f;
/** How much health blocks start with. */ /** How much health blocks start with. */

View File

@@ -72,7 +72,7 @@ public class Mods implements Loadable{
/** Imports an external mod file.*/ /** Imports an external mod file.*/
public void importMod(Fi file) throws IOException{ public void importMod(Fi file) throws IOException{
Fi dest = modDirectory.child(file.name()); Fi dest = modDirectory.child(file.name() + (file.extension().isEmpty() ? ".zip" : ""));
if(dest.exists()){ if(dest.exists()){
throw new IOException("A file with the same name already exists in the mod folder!"); throw new IOException("A file with the same name already exists in the mod folder!");
} }
@@ -720,11 +720,7 @@ public class Mods implements Loadable{
public boolean isSupported(){ public boolean isSupported(){
if(isOutdated()) return false; if(isOutdated()) return false;
int major = getMinMajor(), minor = getMinMinor(); return Version.isAtLeast(meta.minGameVersion);
if(Version.build <= 0) return true;
return Version.build >= major && Version.revision >= minor;
} }
/** @return whether this mod is outdated, e.g. not compatible with v6. */ /** @return whether this mod is outdated, e.g. not compatible with v6. */
@@ -734,33 +730,9 @@ public class Mods implements Loadable{
} }
public int getMinMajor(){ public int getMinMajor(){
int major = 0;
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion; String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
int dot = ver.indexOf(".");
if(ver.contains(".")){ return dot != -1 ? Strings.parseInt(ver.substring(0, dot), 0) : Strings.parseInt(ver, 0);
String[] split = ver.split("\\.");
if(split.length == 2){
major = Strings.parseInt(split[0], 0);
}
}else{
major = Strings.parseInt(ver, 0);
}
return major;
}
public int getMinMinor(){
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
if(ver.contains(".")){
String[] split = ver.split("\\.");
if(split.length == 2){
return Strings.parseInt(split[1], 0);
}
}
return 0;
} }
@Override @Override

View File

@@ -161,7 +161,6 @@ public class CustomRulesDialog extends BaseDialog{
title("@rules.title.unit"); title("@rules.title.unit");
check("@rules.unitammo", b -> rules.unitAmmo = b, () -> rules.unitAmmo); check("@rules.unitammo", b -> rules.unitAmmo = b, () -> rules.unitAmmo);
number("@rules.unithealthmultiplier", f -> rules.unitHealthMultiplier = f, () -> rules.unitHealthMultiplier);
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier); number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0.001f, 50f); number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0.001f, 50f);

View File

@@ -8,6 +8,7 @@ import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.input.*; import arc.input.*;
import arc.scene.style.*; import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*; import arc.scene.ui.TextButton.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
@@ -31,6 +32,7 @@ import static mindustry.Vars.*;
public class ModsDialog extends BaseDialog{ public class ModsDialog extends BaseDialog{
private String searchtxt = ""; private String searchtxt = "";
private @Nullable Seq<ModListing> modList; private @Nullable Seq<ModListing> modList;
private boolean orderDate = true;
public ModsDialog(){ public ModsDialog(){
super("@mods"); super("@mods");
@@ -176,6 +178,11 @@ public class ModsDialog extends BaseDialog{
searchtxt = res; searchtxt = res;
rebuildBrowser[0].run(); rebuildBrowser[0].run();
}).growX().get(); }).growX().get();
table.button(Icon.list, Styles.clearPartiali, 32f, () -> {
orderDate = !orderDate;
rebuildBrowser[0].run();
}).update(b -> b.getStyle().imageUp = (orderDate ? Icon.list : Icon.star)).size(40f).get()
.addListener(new Tooltip(tip -> tip.label(() -> orderDate ? "@mods.browser.sortdate" : "@mods.browser.sortstars").left()));
}).fillX().padBottom(4); }).fillX().padBottom(4);
browser.cont.row(); browser.cont.row();
@@ -186,9 +193,15 @@ public class ModsDialog extends BaseDialog{
tablebrow.clear(); tablebrow.clear();
tablebrow.add("@loading"); tablebrow.add("@loading");
getModList(listings -> { getModList(rlistings -> {
tablebrow.clear(); tablebrow.clear();
Seq<ModListing> listings = rlistings;
if(!orderDate){
listings = rlistings.copy();
listings.sortComparing(m1 -> -m1.stars);
}
for(ModListing mod : listings){ for(ModListing mod : listings){
if(mod.hasJava || !searchtxt.isEmpty() && !mod.repo.toLowerCase().contains(searchtxt.toLowerCase()) || (Vars.ios && mod.hasScripts)) continue; if(mod.hasJava || !searchtxt.isEmpty() && !mod.repo.toLowerCase().contains(searchtxt.toLowerCase()) || (Vars.ios && mod.hasScripts)) continue;
@@ -221,13 +234,13 @@ public class ModsDialog extends BaseDialog{
sel.keyDown(KeyCode.escape, sel::hide); sel.keyDown(KeyCode.escape, sel::hide);
sel.keyDown(KeyCode.back, sel::hide); sel.keyDown(KeyCode.back, sel::hide);
sel.show(); sel.show();
}).width(480f).growX().left().fillY(); }).width(460f).growX().left().fillY();
tablebrow.row(); tablebrow.row();
} }
}); });
}; };
rebuildBrowser[0].run(); rebuildBrowser[0].run();
}); }).get().setScrollingDisabled(true, false);
browser.addCloseButton(); browser.addCloseButton();
browser.show(); browser.show();
}).margin(12f); }).margin(12f);

View File

@@ -111,7 +111,7 @@ public class Turret extends ReloadTurret{
super.setStats(); super.setStats();
stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees); stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees);
stats.add(Stat.reload, 60f / reloadTime * (alternate ? 1 : shots), StatUnit.none); stats.add(Stat.reload, 60f / (reloadTime + 1) * (alternate ? 1 : shots), StatUnit.none);
stats.add(Stat.targetsAir, targetAir); stats.add(Stat.targetsAir, targetAir);
stats.add(Stat.targetsGround, targetGround); stats.add(Stat.targetsGround, targetGround);
if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot); if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot);

View File

@@ -224,7 +224,7 @@ public class PowerGraph{
lastPowerNeeded = powerNeeded; lastPowerNeeded = powerNeeded;
lastPowerProduced = powerProduced; lastPowerProduced = powerProduced;
lastScaledPowerIn = powerProduced / Time.delta; lastScaledPowerIn = (powerProduced + energyDelta) / Time.delta;
lastScaledPowerOut = powerNeeded / Time.delta; lastScaledPowerOut = powerNeeded / Time.delta;
lastCapacity = getTotalBatteryCapacity(); lastCapacity = getTotalBatteryCapacity();
lastPowerStored = getBatteryStored(); lastPowerStored = getBatteryStored();

View File

@@ -226,7 +226,7 @@ public class PowerNode extends PowerBlock{
for(Point2 point : (Point2[])req.config){ for(Point2 point : (Point2[])req.config){
otherReq = null; otherReq = null;
list.each(other -> { list.each(other -> {
if((other.x == req.x + point.x && other.y == req.y + point.y) && other != req){ if((other.x == req.x + point.x && other.y == req.y + point.y) && other != req && other.block != null && other.block.hasPower){
otherReq = other; otherReq = other;
} }
}); });

View File

@@ -0,0 +1,9 @@
[This is a truncated changelog, see Github for full notes]
As 6.0 is more or less stable now, updates have slowed down significantly. This is likely to be one of the last notable releases before 7.0.
- Fixed same-line logic comments not parsing
- Fixed mass driver rotating before payload is received
- Fixed bullets dealing splash damage twice upon collision - splash damage of certain bullets has been increased to compensate