mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-21 01:37:13 +07:00
Test fixes / Building module presence saving
This commit is contained in:
parent
29f8ebddb9
commit
4567ee9a13
@ -1446,7 +1446,7 @@ item.blast-compound.description = Used in bombs and explosive ammunition.
|
||||
item.pyratite.description = Used in incendiary weapons and combustion-fueled generators.
|
||||
|
||||
liquid.water.description = Used for cooling machines and waste processing.
|
||||
liquid.slag.description = Refined in separators into constituent metals, or sprayed at enemies as a weapon.
|
||||
liquid.slag.description = Refined in separators into constituent metals. Consumed in liquid turrets as ammunition.
|
||||
liquid.oil.description = Used in advanced material production and as incendiary ammunition.
|
||||
liquid.cryofluid.description = Used as coolant in reactors, turrets and factories.
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30));
|
||||
craftEffect = Fx.none;
|
||||
outputItem = new ItemStack(Items.carbide, 1);
|
||||
craftTime = 60f * 4f;
|
||||
craftTime = 60f * 3f;
|
||||
size = 3;
|
||||
itemCapacity = 20;
|
||||
hasPower = hasItems = true;
|
||||
@ -1044,15 +1044,25 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
//TODO implement
|
||||
//TODO "crucible" is getting old
|
||||
//TODO should have a useful turret ammo byproduct?
|
||||
//original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
|
||||
if(false)
|
||||
surgeCrucible = new GenericCrafter("surge-crucible"){{
|
||||
//needs:
|
||||
//liquid lead???
|
||||
//slag (a lot of it)
|
||||
//silicon
|
||||
//heat
|
||||
surgeCrucible = new HeatCrafter("surge-crucible"){{
|
||||
size = 3;
|
||||
|
||||
itemCapacity = 20;
|
||||
heatRequirement = 5f;
|
||||
craftTime = 60f * 2.5f;
|
||||
|
||||
ambientSound = Sounds.smelter;
|
||||
ambientSoundVolume = 0.07f;
|
||||
|
||||
consumes.item(Items.silicon, 3);
|
||||
//TODO must consume from 2 pumps, 1, or 1.5?
|
||||
//TODO consume hydrogen/ozone?
|
||||
consumes.liquid(Liquids.slag, 2f * 80f / 60f);
|
||||
consumes.power(2f); //TODO necessary?
|
||||
}};
|
||||
|
||||
//TODO needs to be completely redone from the ground up
|
||||
@ -1534,7 +1544,7 @@ public class Blocks implements ContentList{
|
||||
//TODO CUSTOM DRAW ANIMATION - pistons - repurpose DrawBlock?
|
||||
consumes.liquid(Liquids.hydrogen, 1.5f / 60f);
|
||||
|
||||
pumpAmount = 0.4f;
|
||||
pumpAmount = 80f / 60f / 4f;
|
||||
liquidCapacity = 40f;
|
||||
size = 2;
|
||||
}};
|
||||
|
@ -40,7 +40,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
//air
|
||||
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra,
|
||||
evoke; //elicit, incite?
|
||||
evoke;
|
||||
|
||||
//air, legacy
|
||||
public static @EntityDef(value = {Unitc.class}, legacy = true) UnitType mono;
|
||||
@ -50,7 +50,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
//air + payload
|
||||
public static @EntityDef({Unitc.class, Payloadc.class}) UnitType mega,
|
||||
incite;
|
||||
incite, emanate;
|
||||
|
||||
//air + payload, legacy
|
||||
public static @EntityDef(value = {Unitc.class, Payloadc.class}, legacy = true) UnitType quad;
|
||||
@ -2526,6 +2526,8 @@ public class UnitTypes implements ContentList{
|
||||
}});
|
||||
}};
|
||||
|
||||
//TODO emanate (+ better names)
|
||||
|
||||
//endregion
|
||||
//region internal
|
||||
|
||||
|
@ -152,8 +152,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
write.f(health);
|
||||
write.b(rotation | 0b10000000);
|
||||
write.b(team.id);
|
||||
write.b(1); //version
|
||||
write.b(2); //version
|
||||
write.b(enabled ? 1 : 0);
|
||||
//write presence of items/power/liquids/cons, so removing/adding them does not corrupt future saves.
|
||||
write.b(moduleBitmask());
|
||||
if(items != null) items.write(write);
|
||||
if(power != null) power.write(write);
|
||||
if(liquids != null) liquids.write(write);
|
||||
@ -167,23 +169,35 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
team = Team.get(read.b());
|
||||
|
||||
rotation = rot & 0b01111111;
|
||||
|
||||
int moduleBits = moduleBitmask();
|
||||
boolean legacy = true;
|
||||
|
||||
if((rot & 0b10000000) != 0){
|
||||
byte ver = read.b(); //version of entity save
|
||||
if(ver == 1){
|
||||
if(ver >= 1){
|
||||
byte on = read.b();
|
||||
this.enabled = on == 1;
|
||||
if(!this.enabled){
|
||||
enabledControlTime = timeToUncontrol;
|
||||
}
|
||||
}
|
||||
|
||||
//get which modules should actually be read; this was added in version 2
|
||||
if(ver >= 2){
|
||||
moduleBits = read.b();
|
||||
}
|
||||
legacy = false;
|
||||
}
|
||||
|
||||
if(items != null) items.read(read, legacy);
|
||||
if(power != null) power.read(read, legacy);
|
||||
if(liquids != null) liquids.read(read, legacy);
|
||||
if(cons != null) cons.read(read, legacy);
|
||||
if((moduleBits & 1) != 0) (items == null ? new ItemModule() : items).read(read, legacy);
|
||||
if((moduleBits & 2) != 0) (power == null ? new PowerModule() : power).read(read, legacy);
|
||||
if((moduleBits & 4) != 0) (liquids == null ? new LiquidModule() : liquids).read(read, legacy);
|
||||
if((moduleBits & 8) != 0) (cons == null ? new ConsumeModule(self()) : cons).read(read, legacy);
|
||||
}
|
||||
|
||||
public int moduleBitmask(){
|
||||
return (items != null ? 1 : 0) | (power != null ? 2 : 0) | (liquids != null ? 4 : 0) | (cons != null ? 8 : 0);
|
||||
}
|
||||
|
||||
public void writeAll(Writes write){
|
||||
|
@ -79,6 +79,10 @@ public abstract class SaveFileReader{
|
||||
protected int lastRegionLength;
|
||||
protected @Nullable CounterInputStream currCounter;
|
||||
|
||||
public static String mapFallback(String name){
|
||||
return fallback.get(name, name);
|
||||
}
|
||||
|
||||
public void region(String name, DataInput stream, CounterInputStream counter, IORunner<DataInput> cons) throws IOException{
|
||||
counter.resetCount();
|
||||
this.currCounter = counter;
|
||||
|
@ -28,6 +28,7 @@ import mindustry.game.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.io.*;
|
||||
import mindustry.mod.Mods.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.ammo.*;
|
||||
@ -759,7 +760,7 @@ public class ContentParser{
|
||||
}
|
||||
|
||||
//find parent node.
|
||||
TechNode parent = TechTree.all.find(t -> t.content.name.equals(researchName) || t.content.name.equals(currentMod.name + "-" + researchName));
|
||||
TechNode parent = TechTree.all.find(t -> t.content.name.equals(researchName) || t.content.name.equals(currentMod.name + "-" + researchName) || t.content.name.equals(SaveVersion.mapFallback(researchName)));
|
||||
|
||||
if(parent == null){
|
||||
Log.warn("Content '" + researchName + "' isn't in the tech tree, but '" + unlock.name + "' requires it to be researched.");
|
||||
|
@ -39,7 +39,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
public DrawBlock drawer = new DrawBlock();
|
||||
/** If set, the icon is overridden to be these strings, in order. Each string is a suffix. */
|
||||
public String[] iconOverride = null;
|
||||
public @Nullable String[] iconOverride = null;
|
||||
|
||||
public GenericCrafter(String name){
|
||||
super(name);
|
||||
|
@ -62,6 +62,10 @@ public class Consumers{
|
||||
return add(new ConsumeLiquid(liquid, amount));
|
||||
}
|
||||
|
||||
public ConsumeLiquids liquids(LiquidStack... stacks){
|
||||
return add(new ConsumeLiquids(stacks));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consumer which directly uses power without buffering it.
|
||||
* @param powerPerTick The amount of power which is required each tick for 100% efficiency.
|
||||
|
Loading…
Reference in New Issue
Block a user