Minor bugfixes & compatibility fixes

This commit is contained in:
Anuken
2021-09-07 17:57:03 -04:00
parent 5641b4901c
commit 5e13f71fde
7 changed files with 28 additions and 9 deletions

View File

@@ -8,8 +8,9 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.EventType.*;
import mindustry.entities.bullet.*; import mindustry.entities.bullet.*;
import mindustry.game.EventType.*;
import mindustry.io.*;
import mindustry.mod.Mods.*; import mindustry.mod.Mods.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
@@ -211,10 +212,16 @@ public class ContentLoader{
} }
public <T extends MappableContent> T getByName(ContentType type, String name){ public <T extends MappableContent> T getByName(ContentType type, String name){
if(contentNameMap[type.ordinal()] == null){ var map = contentNameMap[type.ordinal()];
return null;
if(map == null) return null;
//load fallbacks
if(type == ContentType.block){
name = SaveVersion.modContentNameMap.get(name, name);
} }
return (T)contentNameMap[type.ordinal()].get(name);
return (T)map.get(name);
} }
public <T extends Content> T getByID(ContentType type, int id){ public <T extends Content> T getByID(ContentType type, int id){

View File

@@ -504,6 +504,8 @@ public class Renderer implements ApplicationListener{
public void showLaunch(CoreBlock coreType){ public void showLaunch(CoreBlock coreType){
Vars.ui.hudfrag.showLaunch(); Vars.ui.hudfrag.showLaunch();
Vars.control.input.frag.config.hideConfig();
Vars.control.input.frag.inv.hide();
launchCoreType = coreType; launchCoreType = coreType;
launching = true; launching = true;
landCore = player.team().core(); landCore = player.team().core();

View File

@@ -59,6 +59,13 @@ public abstract class SaveFileReader{
"cryofluidmixer", "cryofluid-mixer" "cryofluidmixer", "cryofluid-mixer"
); );
public static final ObjectMap<String, String> modContentNameMap = ObjectMap.of(
"craters", "crater-stone",
"deepwater", "deep-water",
"water", "shallow-water",
"slag", "molten-slag"
);
protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream(); protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream();
protected final DataOutputStream dataBytes = new DataOutputStream(byteOutput); protected final DataOutputStream dataBytes = new DataOutputStream(byteOutput);
protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream(); protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream();

View File

@@ -80,6 +80,8 @@ public class ContentParser{
if(data.isString()){ if(data.isString()){
StatusEffect result = locate(ContentType.status, data.asString()); StatusEffect result = locate(ContentType.status, data.asString());
if(result != null) return result; if(result != null) return result;
result = (StatusEffect)fieldOpt(StatusEffects.class, data);
if(result != null) return result;
throw new IllegalArgumentException("Unknown status effect: '" + data.asString() + "'"); throw new IllegalArgumentException("Unknown status effect: '" + data.asString() + "'");
} }
StatusEffect effect = new StatusEffect(currentMod.name + "-" + data.getString("name")); StatusEffect effect = new StatusEffect(currentMod.name + "-" + data.getString("name"));

View File

@@ -845,7 +845,8 @@ public class Block extends UnlockableContent{
} }
if(!outputsPower && consumes.hasPower() && consumes.getPower().buffered){ if(!outputsPower && consumes.hasPower() && consumes.getPower().buffered){
throw new IllegalArgumentException("Consumer using buffered power: " + name); Log.warn("Consumer using buffered power: @. Disabling buffered power.", name);
consumes.getPower().buffered = false;
} }
if(buildVisibility == BuildVisibility.sandboxOnly){ if(buildVisibility == BuildVisibility.sandboxOnly){

View File

@@ -8,11 +8,11 @@ import mindustry.world.meta.*;
/** Consumer class for blocks which consume power while being connected to a power graph. */ /** Consumer class for blocks which consume power while being connected to a power graph. */
public class ConsumePower extends Consume{ public class ConsumePower extends Consume{
/** The maximum amount of power which can be processed per tick. This might influence efficiency or load a buffer. */ /** The maximum amount of power which can be processed per tick. This might influence efficiency or load a buffer. */
public final float usage; public float usage;
/** The maximum power capacity in power units. */ /** The maximum power capacity in power units. */
public final float capacity; public float capacity;
/** True if the module can store power. */ /** True if the module can store power. */
public final boolean buffered; public boolean buffered;
public ConsumePower(float usage, float capacity, boolean buffered){ public ConsumePower(float usage, float capacity, boolean buffered){
this.usage = usage; this.usage = usage;

View File

@@ -11,4 +11,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
http.socketTimeout=80000 http.socketTimeout=80000
http.connectionTimeout=80000 http.connectionTimeout=80000
archash=98c420de77661889ab0330a956d50721f27f33d9 archash=d78dce000f67845a757dca905de9209ad57106a9