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 mindustry.content.*;
import mindustry.ctype.*;
import mindustry.game.EventType.*;
import mindustry.entities.bullet.*;
import mindustry.game.EventType.*;
import mindustry.io.*;
import mindustry.mod.Mods.*;
import mindustry.type.*;
import mindustry.world.*;
@@ -211,10 +212,16 @@ public class ContentLoader{
}
public <T extends MappableContent> T getByName(ContentType type, String name){
if(contentNameMap[type.ordinal()] == null){
return null;
var map = contentNameMap[type.ordinal()];
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){

View File

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

View File

@@ -59,6 +59,13 @@ public abstract class SaveFileReader{
"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 DataOutputStream dataBytes = new DataOutputStream(byteOutput);
protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream();

View File

@@ -80,6 +80,8 @@ public class ContentParser{
if(data.isString()){
StatusEffect result = locate(ContentType.status, data.asString());
if(result != null) return result;
result = (StatusEffect)fieldOpt(StatusEffects.class, data);
if(result != null) return result;
throw new IllegalArgumentException("Unknown status effect: '" + data.asString() + "'");
}
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){
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){

View File

@@ -8,11 +8,11 @@ import mindustry.world.meta.*;
/** Consumer class for blocks which consume power while being connected to a power graph. */
public class ConsumePower extends Consume{
/** 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. */
public final float capacity;
public float capacity;
/** True if the module can store power. */
public final boolean buffered;
public boolean buffered;
public ConsumePower(float usage, float capacity, boolean buffered){
this.usage = usage;