Display incompatible mods in browser / Shoot alternate mirror fix

This commit is contained in:
Anuken
2025-04-04 16:51:23 -04:00
parent d601a96838
commit dd0982dc93
3 changed files with 18 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package mindustry.entities.pattern;
import arc.math.*;
import arc.util.*;
public class ShootAlternate extends ShootPattern{
@@ -9,6 +10,8 @@ public class ShootAlternate extends ShootPattern{
public float spread = 5f;
/** offset of barrel to start on */
public int barrelOffset = 0;
/** If true, the shoot order is flipped. */
public boolean mirror = false;
public ShootAlternate(float spread){
this.spread = spread;
@@ -17,11 +20,16 @@ public class ShootAlternate extends ShootPattern{
public ShootAlternate(){
}
@Override
public void flip(){
mirror = !mirror;
}
@Override
public void shoot(int totalShots, BulletHandler handler, @Nullable Runnable barrelIncrementer){
for(int i = 0; i < shots; i++){
float index = ((totalShots + i + barrelOffset) % barrels) - (barrels-1)/2f;
handler.shoot(index * spread, 0, 0f, firstShotDelay + shotDelay * i);
handler.shoot(index * spread * -Mathf.sign(mirror), 0, 0f, firstShotDelay + shotDelay * i);
if(barrelIncrementer != null) barrelIncrementer.run();
}
}

View File

@@ -488,8 +488,6 @@ public class ModsDialog extends BaseDialog{
for(ModListing mod : listings){
if(((mod.hasJava || mod.hasScripts) && Vars.ios) ||
(!Strings.matches(searchtxt, mod.name) && !Strings.matches(searchtxt, mod.repo))
//hack, I'm basically testing if 135.10 >= modVersion, which is equivalent to modVersion >= 136
|| (Version.isAtLeast(135, 10, mod.minGameVersion))
) continue;
float s = 64f;
@@ -538,13 +536,16 @@ public class ModsDialog extends BaseDialog{
}
}).size(s).pad(4f * 2f);
con.add(
String infoText =
"[accent]" + mod.name.replace("\n", "") +
(installed.contains(mod.repo) ? "\n[lightgray]" + Core.bundle.get("mod.installed") : "") +
"\n[lightgray]\uE809 " + mod.stars +
(Version.isAtLeast(mod.minGameVersion) ? "" :
"\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion)))
.width(358f).wrap().grow().pad(4f, 2f, 4f, 6f).top().left().labelAlign(Align.topLeft);
(!Version.isAtLeast(mod.minGameVersion) ? "\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion) :
((mod.hasJava && Strings.parseDouble(mod.minGameVersion, 0) < minJavaModGameVersion) ? "\n" + Core.bundle.get("mod.incompatiblemod") : ""));
con.add(infoText).width(358f).wrap().grow().pad(4f, 2f, 4f, 6f).top().left().labelAlign(Align.topLeft);
}, Styles.flatBordert, () -> {
var sel = new BaseDialog(mod.name);
@@ -569,6 +570,7 @@ public class ModsDialog extends BaseDialog{
sel.buttons.button("@mods.github.open", Icon.link, () -> {
Core.app.openURI("https://github.com/" + mod.repo);
});
sel.buttons.button("@mods.browser.view-releases", Icon.zoom, () -> {
BaseDialog load = new BaseDialog("");
load.cont.add("[accent]Fetching Releases...");