Testing a 'iOS compatible' flag for script mods

This commit is contained in:
Anuken
2025-12-18 17:27:32 -05:00
parent 6a13f2ef08
commit 8e7eeb2573
7 changed files with 21 additions and 4 deletions

View File

@@ -729,7 +729,7 @@ public class NetServer implements ApplicationListener{
long elapsed = Math.min(Time.timeSinceMillis(con.lastReceivedClientTime), 1500); long elapsed = Math.min(Time.timeSinceMillis(con.lastReceivedClientTime), 1500);
float maxSpeed = unit.speed(); float maxSpeed = unit.speed();
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.2f; float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
//ignore the position if the player thinks they're dead, or the unit is wrong //ignore the position if the player thinks they're dead, or the unit is wrong
boolean ignorePosition = dead || unit.id != unitID; boolean ignorePosition = dead || unit.id != unitID;

View File

@@ -636,6 +636,12 @@ public class BulletType extends Content implements Cloneable{
if(trailLength > 0 && b.trail != null && b.trail.size() > 0){ if(trailLength > 0 && b.trail != null && b.trail.size() > 0){
Fx.trailFade.at(b.x, b.y, trailWidth, trailColor, b.trail.copy()); Fx.trailFade.at(b.x, b.y, trailWidth, trailColor, b.trail.copy());
} }
//if the bullet never created any frags and is removed (probably by hitting something), it needs to spawn those
//TODO: disabled for now as this makes vanquish significantly more powerful
if(b.frags == 0 && !fragOnHit && fragBullet != null){
// createFrags(b, b.x, b.y);
}
} }
public float buildingDamage(Bullet b){ public float buildingDamage(Bullet b){

View File

@@ -274,7 +274,7 @@ public class Waves{
{nova, pulsar, quasar, vela, corvus}, {nova, pulsar, quasar, vela, corvus},
{crawler, atrax, spiroct, arkyid, toxopid}, {crawler, atrax, spiroct, arkyid, toxopid},
{risso, minke, bryde, sei, omura}, {risso, minke, bryde, sei, omura},
{risso, oxynoe, cyerce, aegires, navanax}, //retusa intentionally left out as it cannot damage the core properly {retusa, oxynoe, cyerce, aegires, navanax},
{flare, horizon, zenith, rand.chance(0.5) ? quad : antumbra, rand.chance(0.1) ? quad : eclipse} {flare, horizon, zenith, rand.chance(0.5) ? quad : antumbra, rand.chance(0.1) ? quad : eclipse}
}; };

View File

@@ -3,7 +3,7 @@ package mindustry.mod;
/** Mod listing as a data class. */ /** Mod listing as a data class. */
public class ModListing{ public class ModListing{
public String repo, name, internalName, subtitle, author, lastUpdated, description, minGameVersion; public String repo, name, internalName, subtitle, author, lastUpdated, description, minGameVersion;
public boolean hasScripts, hasJava; public boolean hasScripts, hasJava, iosCompatible;
public String[] contentTypes = {}; public String[] contentTypes = {};
public int stars; public int stars;

View File

@@ -1419,6 +1419,8 @@ public class Mods implements Loadable{
public boolean hidden; public boolean hidden;
/** If true, this mod should be loaded as a Java class mod. This is technically optional, but highly recommended. */ /** If true, this mod should be loaded as a Java class mod. This is technically optional, but highly recommended. */
public boolean java; public boolean java;
/** If true, this script mod is compatible with iOS. Only set this to true if you don't use extend()/JavaAdapter. */
public boolean iosCompatible;
/** To rescale textures with a different size. Represents the size in pixels of the sprite of a 1x1 block. */ /** To rescale textures with a different size. Represents the size in pixels of the sprite of a 1x1 block. */
public float texturescale = 1.0f; public float texturescale = 1.0f;
/** If true, bleeding is skipped and no content icons are generated. */ /** If true, bleeding is skipped and no content icons are generated. */

View File

@@ -486,7 +486,7 @@ public class ModsDialog extends BaseDialog{
} }
for(ModListing mod : listings){ for(ModListing mod : listings){
if(((mod.hasJava || mod.hasScripts) && Vars.ios) || if(((mod.hasJava || mod.hasScripts && !mod.iosCompatible) && Vars.ios) ||
(!Strings.matches(searchtxt, mod.name) && !Strings.matches(searchtxt, mod.repo)) (!Strings.matches(searchtxt, mod.name) && !Strings.matches(searchtxt, mod.repo))
) continue; ) continue;

View File

@@ -18,6 +18,7 @@ import org.robovm.apple.coregraphics.*;
import org.robovm.apple.foundation.*; import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.*; import org.robovm.apple.uikit.*;
import org.robovm.objc.block.*; import org.robovm.objc.block.*;
import rhino.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@@ -137,6 +138,14 @@ public class IOSLauncher extends IOSApplication.Delegate{
UIApplication.getSharedApplication().getKeyWindow().getRootViewController().presentViewController(cont, true, () -> {}); UIApplication.getSharedApplication().getKeyWindow().getRootViewController().presentViewController(cont, true, () -> {});
} }
@Override
public Context getScriptContext(){
Context context = Context.getCurrentContext();
if(context == null) context = Context.enter();
context.setOptimizationLevel(-1);
return context;
}
@Override @Override
public void shareFile(Fi file){ public void shareFile(Fi file){
try{ try{