Test fixes / Building module presence saving
This commit is contained in:
@@ -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.
|
item.pyratite.description = Used in incendiary weapons and combustion-fueled generators.
|
||||||
|
|
||||||
liquid.water.description = Used for cooling machines and waste processing.
|
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.oil.description = Used in advanced material production and as incendiary ammunition.
|
||||||
liquid.cryofluid.description = Used as coolant in reactors, turrets and factories.
|
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));
|
requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30));
|
||||||
craftEffect = Fx.none;
|
craftEffect = Fx.none;
|
||||||
outputItem = new ItemStack(Items.carbide, 1);
|
outputItem = new ItemStack(Items.carbide, 1);
|
||||||
craftTime = 60f * 4f;
|
craftTime = 60f * 3f;
|
||||||
size = 3;
|
size = 3;
|
||||||
itemCapacity = 20;
|
itemCapacity = 20;
|
||||||
hasPower = hasItems = true;
|
hasPower = hasItems = true;
|
||||||
@@ -1044,15 +1044,25 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO implement
|
//TODO implement
|
||||||
|
//TODO "crucible" is getting old
|
||||||
//TODO should have a useful turret ammo byproduct?
|
//TODO should have a useful turret ammo byproduct?
|
||||||
//original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
|
//original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
|
||||||
if(false)
|
if(false)
|
||||||
surgeCrucible = new GenericCrafter("surge-crucible"){{
|
surgeCrucible = new HeatCrafter("surge-crucible"){{
|
||||||
//needs:
|
size = 3;
|
||||||
//liquid lead???
|
|
||||||
//slag (a lot of it)
|
itemCapacity = 20;
|
||||||
//silicon
|
heatRequirement = 5f;
|
||||||
//heat
|
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
|
//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?
|
//TODO CUSTOM DRAW ANIMATION - pistons - repurpose DrawBlock?
|
||||||
consumes.liquid(Liquids.hydrogen, 1.5f / 60f);
|
consumes.liquid(Liquids.hydrogen, 1.5f / 60f);
|
||||||
|
|
||||||
pumpAmount = 0.4f;
|
pumpAmount = 80f / 60f / 4f;
|
||||||
liquidCapacity = 40f;
|
liquidCapacity = 40f;
|
||||||
size = 2;
|
size = 2;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
//air
|
//air
|
||||||
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra,
|
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra,
|
||||||
evoke; //elicit, incite?
|
evoke;
|
||||||
|
|
||||||
//air, legacy
|
//air, legacy
|
||||||
public static @EntityDef(value = {Unitc.class}, legacy = true) UnitType mono;
|
public static @EntityDef(value = {Unitc.class}, legacy = true) UnitType mono;
|
||||||
@@ -50,7 +50,7 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
//air + payload
|
//air + payload
|
||||||
public static @EntityDef({Unitc.class, Payloadc.class}) UnitType mega,
|
public static @EntityDef({Unitc.class, Payloadc.class}) UnitType mega,
|
||||||
incite;
|
incite, emanate;
|
||||||
|
|
||||||
//air + payload, legacy
|
//air + payload, legacy
|
||||||
public static @EntityDef(value = {Unitc.class, Payloadc.class}, legacy = true) UnitType quad;
|
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
|
//endregion
|
||||||
//region internal
|
//region internal
|
||||||
|
|
||||||
|
|||||||
@@ -152,8 +152,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
write.f(health);
|
write.f(health);
|
||||||
write.b(rotation | 0b10000000);
|
write.b(rotation | 0b10000000);
|
||||||
write.b(team.id);
|
write.b(team.id);
|
||||||
write.b(1); //version
|
write.b(2); //version
|
||||||
write.b(enabled ? 1 : 0);
|
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(items != null) items.write(write);
|
||||||
if(power != null) power.write(write);
|
if(power != null) power.write(write);
|
||||||
if(liquids != null) liquids.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());
|
team = Team.get(read.b());
|
||||||
|
|
||||||
rotation = rot & 0b01111111;
|
rotation = rot & 0b01111111;
|
||||||
|
|
||||||
|
int moduleBits = moduleBitmask();
|
||||||
boolean legacy = true;
|
boolean legacy = true;
|
||||||
|
|
||||||
if((rot & 0b10000000) != 0){
|
if((rot & 0b10000000) != 0){
|
||||||
byte ver = read.b(); //version of entity save
|
byte ver = read.b(); //version of entity save
|
||||||
if(ver == 1){
|
if(ver >= 1){
|
||||||
byte on = read.b();
|
byte on = read.b();
|
||||||
this.enabled = on == 1;
|
this.enabled = on == 1;
|
||||||
if(!this.enabled){
|
if(!this.enabled){
|
||||||
enabledControlTime = timeToUncontrol;
|
enabledControlTime = timeToUncontrol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get which modules should actually be read; this was added in version 2
|
||||||
|
if(ver >= 2){
|
||||||
|
moduleBits = read.b();
|
||||||
|
}
|
||||||
legacy = false;
|
legacy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(items != null) items.read(read, legacy);
|
if((moduleBits & 1) != 0) (items == null ? new ItemModule() : items).read(read, legacy);
|
||||||
if(power != null) power.read(read, legacy);
|
if((moduleBits & 2) != 0) (power == null ? new PowerModule() : power).read(read, legacy);
|
||||||
if(liquids != null) liquids.read(read, legacy);
|
if((moduleBits & 4) != 0) (liquids == null ? new LiquidModule() : liquids).read(read, legacy);
|
||||||
if(cons != null) cons.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){
|
public void writeAll(Writes write){
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ public abstract class SaveFileReader{
|
|||||||
protected int lastRegionLength;
|
protected int lastRegionLength;
|
||||||
protected @Nullable CounterInputStream currCounter;
|
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{
|
public void region(String name, DataInput stream, CounterInputStream counter, IORunner<DataInput> cons) throws IOException{
|
||||||
counter.resetCount();
|
counter.resetCount();
|
||||||
this.currCounter = counter;
|
this.currCounter = counter;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import mindustry.game.*;
|
|||||||
import mindustry.game.Objectives.*;
|
import mindustry.game.Objectives.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.io.*;
|
||||||
import mindustry.mod.Mods.*;
|
import mindustry.mod.Mods.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.type.ammo.*;
|
import mindustry.type.ammo.*;
|
||||||
@@ -759,7 +760,7 @@ public class ContentParser{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//find parent node.
|
//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){
|
if(parent == null){
|
||||||
Log.warn("Content '" + researchName + "' isn't in the tech tree, but '" + unlock.name + "' requires it to be researched.");
|
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();
|
public DrawBlock drawer = new DrawBlock();
|
||||||
/** If set, the icon is overridden to be these strings, in order. Each string is a suffix. */
|
/** 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){
|
public GenericCrafter(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ public class Consumers{
|
|||||||
return add(new ConsumeLiquid(liquid, amount));
|
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.
|
* Creates a consumer which directly uses power without buffering it.
|
||||||
* @param powerPerTick The amount of power which is required each tick for 100% efficiency.
|
* @param powerPerTick The amount of power which is required each tick for 100% efficiency.
|
||||||
|
|||||||
Reference in New Issue
Block a user