Crash fixes / Mod browser >=136 filter

This commit is contained in:
Anuken 2022-07-17 10:27:27 -04:00
parent c4d5126ac2
commit ebf9e82146
5 changed files with 6 additions and 16 deletions

Binary file not shown.

View File

@ -144,7 +144,7 @@ public class BlockIndexer{
process(tile); process(tile);
var drop = tile.drop(); var drop = tile.drop();
if(drop != null){ if(drop != null && ores != null){
int qx = tile.x / quadrantSize; int qx = tile.x / quadrantSize;
int qy = tile.y / quadrantSize; int qy = tile.y / quadrantSize;

View File

@ -168,18 +168,6 @@ public class Logic implements ApplicationListener{
} }
}); });
//send out items to each client
Events.on(TurnEvent.class, e -> {
if(net.server() && state.isCampaign()){
int[] out = new int[content.items().size];
state.getSector().info.production.each((item, stat) -> {
out[item.id] = Math.max(0, (int)(stat.mean * turnDuration / 60));
});
Call.sectorProduced(out);
}
});
//listen to core changes; if all cores have been destroyed, set to derelict. //listen to core changes; if all cores have been destroyed, set to derelict.
Events.on(CoreChangeEvent.class, e -> Core.app.post(() -> { Events.on(CoreChangeEvent.class, e -> Core.app.post(() -> {
if(state.rules.cleanupDeadTeams && state.rules.pvp && !e.core.isAdded() && e.core.team != Team.derelict && e.core.team.cores().isEmpty()){ if(state.rules.cleanupDeadTeams && state.rules.pvp && !e.core.isAdded() && e.core.team != Team.derelict && e.core.team.cores().isEmpty()){
@ -397,7 +385,9 @@ public class Logic implements ApplicationListener{
//called when the remote server runs a turn and produces something //called when the remote server runs a turn and produces something
@Remote @Remote
public static void sectorProduced(int[] amounts){ public static void sectorProduced(int[] amounts){
if(!state.isCampaign()) return; //TODO currently disabled.
if(!state.isCampaign() || true) return;
Planet planet = state.rules.sector.planet; Planet planet = state.rules.sector.planet;
boolean any = false; boolean any = false;

View File

@ -658,7 +658,7 @@ public class MobileInput extends InputHandler implements GestureListener{
payloadTarget = null; payloadTarget = null;
//control a unit/block detected on first tap of double-tap //control a unit/block detected on first tap of double-tap
if(unitTapped != null && state.rules.possessionAllowed){ if(unitTapped != null && state.rules.possessionAllowed && unitTapped.isAI() && unitTapped.team == player.team() && !unitTapped.dead && unitTapped.type.playerControllable){
Call.unitControl(player, unitTapped); Call.unitControl(player, unitTapped);
recentRespawnTimer = 1f; recentRespawnTimer = 1f;
}else if(buildingTapped != null && state.rules.possessionAllowed){ }else if(buildingTapped != null && state.rules.possessionAllowed){

View File

@ -430,7 +430,7 @@ public class ModsDialog extends BaseDialog{
if(((mod.hasJava || mod.hasScripts) && Vars.ios) || if(((mod.hasJava || mod.hasScripts) && Vars.ios) ||
(!Strings.matches(searchtxt, mod.name) && !Strings.matches(searchtxt, mod.repo)) (!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 //hack, I'm basically testing if 135.10 >= modVersion, which is equivalent to modVersion >= 136
//|| (Version.isAtLeast(135, 10, mod.minGameVersion)) || (Version.isAtLeast(135, 10, mod.minGameVersion))
) continue; ) continue;
float s = 64f; float s = 64f;