The on-going consumer disaster
This commit is contained in:
BIN
core/assets-raw/sprites/units/locus-cell.png
Normal file
BIN
core/assets-raw/sprites/units/locus-cell.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
BIN
core/assets-raw/sprites/units/locus-weapon-cell.png
Normal file
BIN
core/assets-raw/sprites/units/locus-weapon-cell.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 559 B |
Binary file not shown.
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 1.3 KiB |
@@ -545,3 +545,5 @@
|
|||||||
63158=fabricator|block-fabricator-ui
|
63158=fabricator|block-fabricator-ui
|
||||||
63157=stell|unit-stell-ui
|
63157=stell|unit-stell-ui
|
||||||
63156=ore-beryllium|block-ore-beryllium-ui
|
63156=ore-beryllium|block-ore-beryllium-ui
|
||||||
|
63155=locus|unit-locus-ui
|
||||||
|
63154=avert|unit-avert-ui
|
||||||
|
|||||||
Binary file not shown.
@@ -996,10 +996,9 @@ public class Blocks{
|
|||||||
consumeItems(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
|
consumeItems(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cryofluidMixer = new LiquidConverter("cryofluid-mixer"){{
|
cryofluidMixer = new GenericCrafter("cryofluid-mixer"){{
|
||||||
requirements(Category.crafting, with(Items.lead, 65, Items.silicon, 40, Items.titanium, 60));
|
requirements(Category.crafting, with(Items.lead, 65, Items.silicon, 40, Items.titanium, 60));
|
||||||
outputLiquid = new LiquidStack(Liquids.cryofluid, 0.2f);
|
outputLiquid = new LiquidStack(Liquids.cryofluid, 12f / 60f);
|
||||||
craftTime = 120f;
|
|
||||||
size = 2;
|
size = 2;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
@@ -1012,7 +1011,7 @@ public class Blocks{
|
|||||||
|
|
||||||
consumePower(1f);
|
consumePower(1f);
|
||||||
consumeItem(Items.titanium);
|
consumeItem(Items.titanium);
|
||||||
consumeLiquid(Liquids.water, 0.2f);
|
consumeLiquid(Liquids.water, 12f / 60f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
pyratiteMixer = new GenericCrafter("pyratite-mixer"){{
|
pyratiteMixer = new GenericCrafter("pyratite-mixer"){{
|
||||||
@@ -1043,8 +1042,8 @@ public class Blocks{
|
|||||||
melter = new GenericCrafter("melter"){{
|
melter = new GenericCrafter("melter"){{
|
||||||
requirements(Category.crafting, with(Items.copper, 30, Items.lead, 35, Items.graphite, 45));
|
requirements(Category.crafting, with(Items.copper, 30, Items.lead, 35, Items.graphite, 45));
|
||||||
health = 200;
|
health = 200;
|
||||||
outputLiquid = new LiquidStack(Liquids.slag, 2f);
|
outputLiquid = new LiquidStack(Liquids.slag, 12f / 60f);
|
||||||
craftTime = 10f;
|
craftTime = 1f;
|
||||||
hasLiquids = hasPower = true;
|
hasLiquids = hasPower = true;
|
||||||
drawer = new DrawLiquid(){{
|
drawer = new DrawLiquid(){{
|
||||||
liquidDrawn = Liquids.slag;
|
liquidDrawn = Liquids.slag;
|
||||||
@@ -1091,8 +1090,7 @@ public class Blocks{
|
|||||||
sporePress = new GenericCrafter("spore-press"){{
|
sporePress = new GenericCrafter("spore-press"){{
|
||||||
requirements(Category.crafting, with(Items.lead, 35, Items.silicon, 30));
|
requirements(Category.crafting, with(Items.lead, 35, Items.silicon, 30));
|
||||||
liquidCapacity = 60f;
|
liquidCapacity = 60f;
|
||||||
craftTime = 20f;
|
outputLiquid = new LiquidStack(Liquids.oil, 18f / 60f);
|
||||||
outputLiquid = new LiquidStack(Liquids.oil, 6f);
|
|
||||||
size = 2;
|
size = 2;
|
||||||
health = 320;
|
health = 320;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
@@ -1177,7 +1175,6 @@ public class Blocks{
|
|||||||
|
|
||||||
drawer.iconOverride = new String[]{"-bottom", ""};
|
drawer.iconOverride = new String[]{"-bottom", ""};
|
||||||
regionRotated1 = 3;
|
regionRotated1 = 3;
|
||||||
continuousLiquidOutput = true;
|
|
||||||
outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60);
|
outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60);
|
||||||
liquidOutputDirections = new int[]{1, 3};
|
liquidOutputDirections = new int[]{1, 3};
|
||||||
}};
|
}};
|
||||||
@@ -1185,7 +1182,6 @@ public class Blocks{
|
|||||||
atmosphericConcentrator = new HeatCrafter("atmospheric-concentrator"){{
|
atmosphericConcentrator = new HeatCrafter("atmospheric-concentrator"){{
|
||||||
requirements(Category.crafting, with(Items.oxide, 60, Items.beryllium, 180, Items.silicon, 150));
|
requirements(Category.crafting, with(Items.oxide, 60, Items.beryllium, 180, Items.silicon, 150));
|
||||||
size = 3;
|
size = 3;
|
||||||
continuousLiquidOutput = true;
|
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
|
|
||||||
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.nitrogen, 4.1f), new DrawBlock(), new DrawHeatInput(),
|
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.nitrogen, 4.1f), new DrawBlock(), new DrawHeatInput(),
|
||||||
@@ -1318,7 +1314,6 @@ public class Blocks{
|
|||||||
|
|
||||||
craftTime = 60f * 2f;
|
craftTime = 60f * 2f;
|
||||||
|
|
||||||
continuousLiquidOutput = true;
|
|
||||||
outputLiquid = new LiquidStack(Liquids.gallium, 1f / 60f);
|
outputLiquid = new LiquidStack(Liquids.gallium, 1f / 60f);
|
||||||
outputItem = new ItemStack(Items.scrap, 1);
|
outputItem = new ItemStack(Items.scrap, 1);
|
||||||
}};
|
}};
|
||||||
@@ -1385,8 +1380,7 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
|
|
||||||
liquidCapacity = 40f;
|
liquidCapacity = 40f;
|
||||||
outputLiquid = new LiquidStack(Liquids.cyanogen, 3f);
|
outputLiquid = new LiquidStack(Liquids.cyanogen, 3f / 60f);
|
||||||
craftTime = 60f * 1f;
|
|
||||||
|
|
||||||
consumeLiquids(LiquidStack.with(Liquids.hydrogen, 3f / 60f, Liquids.nitrogen, 2f / 60f));
|
consumeLiquids(LiquidStack.with(Liquids.hydrogen, 3f / 60f, Liquids.nitrogen, 2f / 60f));
|
||||||
consumeItem(Items.graphite);
|
consumeItem(Items.graphite);
|
||||||
@@ -2185,13 +2179,18 @@ public class Blocks{
|
|||||||
scaledHealth = 130;
|
scaledHealth = 130;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
combustionGenerator = new BurnerGenerator("combustion-generator"){{
|
combustionGenerator = new ConsumeGenerator("combustion-generator"){{
|
||||||
requirements(Category.power, with(Items.copper, 25, Items.lead, 15));
|
requirements(Category.power, with(Items.copper, 25, Items.lead, 15));
|
||||||
powerProduction = 1f;
|
powerProduction = 1f;
|
||||||
itemDuration = 120f;
|
itemDuration = 120f;
|
||||||
|
|
||||||
ambientSound = Sounds.smelter;
|
ambientSound = Sounds.smelter;
|
||||||
ambientSoundVolume = 0.03f;
|
ambientSoundVolume = 0.03f;
|
||||||
|
|
||||||
|
consume(new ConsumeItemFlammable());
|
||||||
|
consume(new ConsumeItemExplode());
|
||||||
|
|
||||||
|
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
thermalGenerator = new ThermalGenerator("thermal-generator"){{
|
thermalGenerator = new ThermalGenerator("thermal-generator"){{
|
||||||
@@ -2205,7 +2204,7 @@ public class Blocks{
|
|||||||
ambientSoundVolume = 0.06f;
|
ambientSoundVolume = 0.06f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
steamGenerator = new BurnerGenerator("steam-generator"){{
|
steamGenerator = new ConsumeGenerator("steam-generator"){{
|
||||||
requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30));
|
requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30));
|
||||||
powerProduction = 5.5f;
|
powerProduction = 5.5f;
|
||||||
itemDuration = 90f;
|
itemDuration = 90f;
|
||||||
@@ -2216,6 +2215,11 @@ public class Blocks{
|
|||||||
|
|
||||||
ambientSound = Sounds.smelter;
|
ambientSound = Sounds.smelter;
|
||||||
ambientSoundVolume = 0.06f;
|
ambientSoundVolume = 0.06f;
|
||||||
|
|
||||||
|
consume(new ConsumeItemFlammable());
|
||||||
|
consume(new ConsumeItemExplode());
|
||||||
|
|
||||||
|
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion(), new DrawTurbines());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
differentialGenerator = new ConsumeGenerator("differential-generator"){{
|
differentialGenerator = new ConsumeGenerator("differential-generator"){{
|
||||||
@@ -2234,11 +2238,15 @@ public class Blocks{
|
|||||||
consumeLiquid(Liquids.cryofluid, 0.1f);
|
consumeLiquid(Liquids.cryofluid, 0.1f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
rtgGenerator = new DecayGenerator("rtg-generator"){{
|
rtgGenerator = new ConsumeGenerator("rtg-generator"){{
|
||||||
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phaseFabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phaseFabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
||||||
size = 2;
|
size = 2;
|
||||||
powerProduction = 4.5f;
|
powerProduction = 4.5f;
|
||||||
itemDuration = 60 * 14f;
|
itemDuration = 60 * 14f;
|
||||||
|
envEnabled = Env.any;
|
||||||
|
|
||||||
|
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
|
||||||
|
consume(new ConsumeItemRadioactive());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
solarPanel = new SolarGenerator("solar-panel"){{
|
solarPanel = new SolarGenerator("solar-panel"){{
|
||||||
@@ -2260,8 +2268,10 @@ public class Blocks{
|
|||||||
health = 700;
|
health = 700;
|
||||||
itemDuration = 360f;
|
itemDuration = 360f;
|
||||||
powerProduction = 15f;
|
powerProduction = 15f;
|
||||||
consumeItem(Items.thorium);
|
|
||||||
heating = 0.02f;
|
heating = 0.02f;
|
||||||
|
|
||||||
|
consumeItem(Items.thorium);
|
||||||
|
//TODO how to non update
|
||||||
consumeLiquid(Liquids.cryofluid, heating / coolantPower).update(false);
|
consumeLiquid(Liquids.cryofluid, heating / coolantPower).update(false);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -2479,7 +2489,6 @@ public class Blocks{
|
|||||||
ambientSound = Sounds.hum;
|
ambientSound = Sounds.hum;
|
||||||
ambientSoundVolume = 0.06f;
|
ambientSoundVolume = 0.06f;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
continuousLiquidOutput = true;
|
|
||||||
boostScale = 1f / 9f;
|
boostScale = 1f / 9f;
|
||||||
outputLiquid = new LiquidStack(Liquids.water, 30f / 60f);
|
outputLiquid = new LiquidStack(Liquids.water, 30f / 60f);
|
||||||
consumePower(0.5f);
|
consumePower(0.5f);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class UnitTypes{
|
|||||||
public static @EntityDef({Unitc.class, BuildingTetherc.class, Payloadc.class}) UnitType manifold, assemblyDrone, effectDrone;
|
public static @EntityDef({Unitc.class, BuildingTetherc.class, Payloadc.class}) UnitType manifold, assemblyDrone, effectDrone;
|
||||||
|
|
||||||
//tank
|
//tank
|
||||||
public static @EntityDef({Unitc.class, Tankc.class}) UnitType stell, vanquish, conquer;
|
public static @EntityDef({Unitc.class, Tankc.class}) UnitType stell, locus, vanquish, conquer;
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
@@ -2457,6 +2457,47 @@ public class UnitTypes{
|
|||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
locus = new TankUnitType("locus"){{
|
||||||
|
hitSize = 18f;
|
||||||
|
treadPullOffset = 5;
|
||||||
|
speed = 0.7f;
|
||||||
|
rotateSpeed = 3f;
|
||||||
|
health = 800;
|
||||||
|
armor = 7f;
|
||||||
|
areaDamage = 8f;
|
||||||
|
treadRects = new Rect[]{new Rect(17, 10, 19, 76)};
|
||||||
|
researchCostMultiplier = 0f;
|
||||||
|
|
||||||
|
weapons.add(new Weapon("locus-weapon"){{
|
||||||
|
layerOffset = 0.0001f;
|
||||||
|
reload = 70f;
|
||||||
|
shootY = 8f;
|
||||||
|
recoil = 1f;
|
||||||
|
rotate = true;
|
||||||
|
rotateSpeed = 1.4f;
|
||||||
|
mirror = false;
|
||||||
|
x = 0f;
|
||||||
|
y = 0f;
|
||||||
|
heatColor = Color.valueOf("f9350f");
|
||||||
|
cooldownTime = 30f;
|
||||||
|
|
||||||
|
bullet = new BasicBulletType(5f, 50){{
|
||||||
|
sprite = "missile-large";
|
||||||
|
smokeEffect = Fx.shootBigSmoke;
|
||||||
|
shootEffect = Fx.shootBigColor;
|
||||||
|
width = 5f;
|
||||||
|
height = 7f;
|
||||||
|
lifetime = 40f;
|
||||||
|
hitSize = 4f;
|
||||||
|
hitColor = backColor = trailColor = Color.valueOf("feb380");
|
||||||
|
frontColor = Color.white;
|
||||||
|
trailWidth = 1.7f;
|
||||||
|
trailLength = 5;
|
||||||
|
despawnEffect = hitEffect = Fx.hitBulletColor;
|
||||||
|
}};
|
||||||
|
}});
|
||||||
|
}};
|
||||||
|
|
||||||
vanquish = new TankUnitType("vanquish"){{
|
vanquish = new TankUnitType("vanquish"){{
|
||||||
hitSize = 28f;
|
hitSize = 28f;
|
||||||
treadPullOffset = 4;
|
treadPullOffset = 4;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
public transient float healSuppressionTime = -1f;
|
public transient float healSuppressionTime = -1f;
|
||||||
public transient float lastHealTime = -120f * 10f;
|
public transient float lastHealTime = -120f * 10f;
|
||||||
|
|
||||||
private transient boolean consValid, consOptionalValid;
|
private transient boolean consValid;
|
||||||
private transient float timeScale = 1f, timeScaleDuration;
|
private transient float timeScale = 1f, timeScaleDuration;
|
||||||
private transient float dumpAccum;
|
private transient float dumpAccum;
|
||||||
|
|
||||||
@@ -460,10 +460,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
return consValid && enabled && shouldConsume();
|
return consValid && enabled && shouldConsume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean consOptionalValid(){
|
|
||||||
return consValid() && consOptionalValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void consume(){
|
public void consume(){
|
||||||
for(Consume cons : block.consumers){
|
for(Consume cons : block.consumers){
|
||||||
cons.trigger(self());
|
cons.trigger(self());
|
||||||
@@ -1621,18 +1617,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
public void updateConsumption(){
|
public void updateConsumption(){
|
||||||
//everything is valid when cheating
|
//everything is valid when cheating
|
||||||
if(cheating()){
|
if(cheating()){
|
||||||
consValid = consOptionalValid = true;
|
consValid = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean prevValid = consValid();
|
boolean prevValid = consValid();
|
||||||
consValid = true;
|
consValid = true;
|
||||||
consOptionalValid = true;
|
|
||||||
boolean docons = shouldConsume() && productionValid();
|
boolean docons = shouldConsume() && productionValid();
|
||||||
|
|
||||||
for(Consume cons : block.consumers){
|
for(Consume cons : block.nonOptionalConsumers){
|
||||||
if(cons.optional) continue;
|
|
||||||
|
|
||||||
if(docons && cons.update && prevValid && cons.valid(self())){
|
if(docons && cons.update && prevValid && cons.valid(self())){
|
||||||
cons.update(self());
|
cons.update(self());
|
||||||
}
|
}
|
||||||
@@ -1644,8 +1637,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
if(docons && cons.update && prevValid && cons.valid(self())){
|
if(docons && cons.update && prevValid && cons.valid(self())){
|
||||||
cons.update(self());
|
cons.update(self());
|
||||||
}
|
}
|
||||||
|
|
||||||
consOptionalValid &= cons.valid(self());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -297,17 +297,12 @@ public class ClassMap{
|
|||||||
classes.put("BatteryBuild", mindustry.world.blocks.power.Battery.BatteryBuild.class);
|
classes.put("BatteryBuild", mindustry.world.blocks.power.Battery.BatteryBuild.class);
|
||||||
classes.put("BeamNode", mindustry.world.blocks.power.BeamNode.class);
|
classes.put("BeamNode", mindustry.world.blocks.power.BeamNode.class);
|
||||||
classes.put("BeamNodeBuild", mindustry.world.blocks.power.BeamNode.BeamNodeBuild.class);
|
classes.put("BeamNodeBuild", mindustry.world.blocks.power.BeamNode.BeamNodeBuild.class);
|
||||||
classes.put("BurnerGenerator", mindustry.world.blocks.power.BurnerGenerator.class);
|
|
||||||
classes.put("BurnerGeneratorBuild", mindustry.world.blocks.power.BurnerGenerator.BurnerGeneratorBuild.class);
|
|
||||||
classes.put("ConditionalConsumePower", ConsumePowerCondition.class);
|
classes.put("ConditionalConsumePower", ConsumePowerCondition.class);
|
||||||
classes.put("ConsumeGenerator", mindustry.world.blocks.power.ConsumeGenerator.class);
|
classes.put("ConsumeGenerator", mindustry.world.blocks.power.ConsumeGenerator.class);
|
||||||
classes.put("ConsumeGeneratorBuild", mindustry.world.blocks.power.ConsumeGenerator.ConsumeGeneratorBuild.class);
|
classes.put("ConsumeGeneratorBuild", mindustry.world.blocks.power.ConsumeGenerator.ConsumeGeneratorBuild.class);
|
||||||
classes.put("DecayGenerator", mindustry.world.blocks.power.DecayGenerator.class);
|
|
||||||
classes.put("DynamicConsumePower", ConsumePowerDynamic.class);
|
classes.put("DynamicConsumePower", ConsumePowerDynamic.class);
|
||||||
classes.put("ImpactReactor", mindustry.world.blocks.power.ImpactReactor.class);
|
classes.put("ImpactReactor", mindustry.world.blocks.power.ImpactReactor.class);
|
||||||
classes.put("ImpactReactorBuild", mindustry.world.blocks.power.ImpactReactor.ImpactReactorBuild.class);
|
classes.put("ImpactReactorBuild", mindustry.world.blocks.power.ImpactReactor.ImpactReactorBuild.class);
|
||||||
classes.put("ItemLiquidGenerator", mindustry.world.blocks.power.ItemLiquidGenerator.class);
|
|
||||||
classes.put("ItemLiquidGeneratorBuild", mindustry.world.blocks.power.ItemLiquidGenerator.ItemLiquidGeneratorBuild.class);
|
|
||||||
classes.put("LightBlock", mindustry.world.blocks.power.LightBlock.class);
|
classes.put("LightBlock", mindustry.world.blocks.power.LightBlock.class);
|
||||||
classes.put("LightBuild", mindustry.world.blocks.power.LightBlock.LightBuild.class);
|
classes.put("LightBuild", mindustry.world.blocks.power.LightBlock.LightBuild.class);
|
||||||
classes.put("LongPowerNode", mindustry.world.blocks.power.LongPowerNode.class);
|
classes.put("LongPowerNode", mindustry.world.blocks.power.LongPowerNode.class);
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ public class Weapon implements Cloneable{
|
|||||||
public TextureRegion region;
|
public TextureRegion region;
|
||||||
/** heat region, must be same size as region (optional) */
|
/** heat region, must be same size as region (optional) */
|
||||||
public TextureRegion heatRegion;
|
public TextureRegion heatRegion;
|
||||||
|
/** cell region, must be same size as region (optional) */
|
||||||
|
public TextureRegion cellRegion;
|
||||||
/** outline region to display if top is false */
|
/** outline region to display if top is false */
|
||||||
public TextureRegion outlineRegion;
|
public TextureRegion outlineRegion;
|
||||||
/** heat region tint */
|
/** heat region tint */
|
||||||
@@ -209,6 +211,12 @@ public class Weapon implements Cloneable{
|
|||||||
|
|
||||||
Draw.rect(region, wx, wy, weaponRotation);
|
Draw.rect(region, wx, wy, weaponRotation);
|
||||||
|
|
||||||
|
if(cellRegion.found()){
|
||||||
|
Draw.color(unit.type.cellColor(unit));
|
||||||
|
Draw.rect(cellRegion, wx, wy, weaponRotation);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
if(heatRegion.found() && mount.heat > 0){
|
if(heatRegion.found() && mount.heat > 0){
|
||||||
Draw.color(heatColor, mount.heat);
|
Draw.color(heatColor, mount.heat);
|
||||||
Draw.blend(Blending.additive);
|
Draw.blend(Blending.additive);
|
||||||
@@ -475,6 +483,7 @@ public class Weapon implements Cloneable{
|
|||||||
public void load(){
|
public void load(){
|
||||||
region = Core.atlas.find(name);
|
region = Core.atlas.find(name);
|
||||||
heatRegion = Core.atlas.find(name + "-heat");
|
heatRegion = Core.atlas.find(name + "-heat");
|
||||||
|
cellRegion = Core.atlas.find(name + "-cell");
|
||||||
outlineRegion = Core.atlas.find(name + "-outline");
|
outlineRegion = Core.atlas.find(name + "-outline");
|
||||||
|
|
||||||
//TODO outlinedRegions
|
//TODO outlinedRegions
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
/** Consumption filters. */
|
/** Consumption filters. */
|
||||||
public boolean[] itemFilter, liquidFilter;
|
public boolean[] itemFilter, liquidFilter;
|
||||||
/** Array of consumers used by this block. Only populated after init(). */
|
/** Array of consumers used by this block. Only populated after init(). */
|
||||||
public Consume[] consumers = {}, optionalConsumers = {};
|
public Consume[] consumers = {}, optionalConsumers = {}, nonOptionalConsumers = {};
|
||||||
/** Set to true if this block has any consumers in its array. */
|
/** Set to true if this block has any consumers in its array. */
|
||||||
public boolean hasConsumers;
|
public boolean hasConsumers;
|
||||||
/** The single power consumer, if applicable. */
|
/** The single power consumer, if applicable. */
|
||||||
@@ -1090,7 +1090,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
buildCost *= buildCostMultiplier;
|
buildCost *= buildCostMultiplier;
|
||||||
|
|
||||||
consumers = consumeBuilder.toArray(Consume.class);
|
consumers = consumeBuilder.toArray(Consume.class);
|
||||||
optionalConsumers = consumeBuilder.filter(consume -> consume.optional).toArray(Consume.class);
|
optionalConsumers = consumeBuilder.select(consume -> consume.optional).toArray(Consume.class);
|
||||||
|
nonOptionalConsumers = consumeBuilder.select(consume -> !consume.optional).toArray(Consume.class);
|
||||||
hasConsumers = consumers.length > 0;
|
hasConsumers = consumers.length > 0;
|
||||||
itemFilter = new boolean[content.items().size];
|
itemFilter = new boolean[content.items().size];
|
||||||
liquidFilter = new boolean[content.liquids().size];
|
liquidFilter = new boolean[content.liquids().size];
|
||||||
|
|||||||
@@ -187,13 +187,13 @@ public class RegenProjector extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
drawer.drawBase(this);
|
drawer.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
drawer.drawLights(this);
|
drawer.drawLight(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class BaseTurret extends Block{
|
|||||||
public void init(){
|
public void init(){
|
||||||
//just makes things a little more convenient
|
//just makes things a little more convenient
|
||||||
if(coolant != null){
|
if(coolant != null){
|
||||||
|
//TODO coolant fix
|
||||||
coolant.update = false;
|
coolant.update = false;
|
||||||
coolant.booster = true;
|
coolant.booster = true;
|
||||||
coolant.optional = true;
|
coolant.optional = true;
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ public class Turret extends ReloadTurret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
draw.drawBase(this);
|
draw.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ public class HeatConductor extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
drawer.drawBase(this);
|
drawer.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
drawer.drawLights(this);
|
drawer.drawLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package mindustry.world.blocks.power;
|
|
||||||
|
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.world.draw.*;
|
|
||||||
|
|
||||||
//TODO deprecate this whole class?
|
|
||||||
public class BurnerGenerator extends ItemLiquidGenerator{
|
|
||||||
|
|
||||||
public BurnerGenerator(String name){
|
|
||||||
super(true, false, name);
|
|
||||||
|
|
||||||
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion(), new DrawTurbines());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getLiquidEfficiency(Liquid liquid){
|
|
||||||
return liquid.flammability;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getItemEfficiency(Item item){
|
|
||||||
return item.flammability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BurnerGeneratorBuild extends ItemLiquidGeneratorBuild{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,7 @@ import mindustry.content.*;
|
|||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.consumers.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,6 +23,9 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
public @Nullable LiquidStack liquidOutput;
|
public @Nullable LiquidStack liquidOutput;
|
||||||
|
|
||||||
|
public @Nullable ConsumeItemFilter filterItem;
|
||||||
|
public @Nullable ConsumeLiquidFilter filterLiquid;
|
||||||
|
|
||||||
public ConsumeGenerator(String name){
|
public ConsumeGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
@@ -37,10 +41,15 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
filterItem = findConsumer(c -> c instanceof ConsumeItemFilter);
|
||||||
|
filterLiquid = findConsumer(c -> c instanceof ConsumeLiquidFilter);
|
||||||
|
|
||||||
if(liquidOutput != null){
|
if(liquidOutput != null){
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO hardcoded
|
||||||
emitLight = true;
|
emitLight = true;
|
||||||
lightRadius = 65f * size;
|
lightRadius = 65f * size;
|
||||||
super.init();
|
super.init();
|
||||||
@@ -61,6 +70,7 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
public class ConsumeGeneratorBuild extends GeneratorBuild{
|
public class ConsumeGeneratorBuild extends GeneratorBuild{
|
||||||
public float warmup, totalTime;
|
public float warmup, totalTime;
|
||||||
|
public float itemMultiplier = 1f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
@@ -68,7 +78,17 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
warmup = Mathf.lerpDelta(warmup, enabled && valid ? 1f : 0f, 0.05f);
|
warmup = Mathf.lerpDelta(warmup, enabled && valid ? 1f : 0f, 0.05f);
|
||||||
|
|
||||||
productionEfficiency = valid ? 1f : 0f;
|
float multiplier = 1f;
|
||||||
|
if(valid){
|
||||||
|
if(filterItem != null && filterItem.getConsumed(this) != null){
|
||||||
|
itemMultiplier = filterItem.getEfficiency(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//efficiency is added together
|
||||||
|
multiplier *= itemMultiplier + (filterLiquid == null ? 0f : filterLiquid.getEfficiency(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
productionEfficiency = (valid ? 1f : 0f) * multiplier;
|
||||||
totalTime += warmup * Time.delta;
|
totalTime += warmup * Time.delta;
|
||||||
|
|
||||||
//randomly produce the effect
|
//randomly produce the effect
|
||||||
@@ -93,10 +113,6 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getEfficiencyMultiplier(){
|
|
||||||
return 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean consumeTriggerValid(){
|
public boolean consumeTriggerValid(){
|
||||||
return generateTime > 0;
|
return generateTime > 0;
|
||||||
@@ -114,7 +130,9 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
//TODO
|
//???
|
||||||
|
drawer.drawLight(this);
|
||||||
|
//TODO hard coded
|
||||||
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * warmup);
|
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * warmup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package mindustry.world.blocks.power;
|
|
||||||
|
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.world.meta.*;
|
|
||||||
|
|
||||||
public class DecayGenerator extends ItemLiquidGenerator{
|
|
||||||
|
|
||||||
public DecayGenerator(String name){
|
|
||||||
super(true, false, name);
|
|
||||||
hasItems = true;
|
|
||||||
hasLiquids = false;
|
|
||||||
envEnabled = Env.any;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getItemEfficiency(Item item){
|
|
||||||
return item.radioactivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
package mindustry.world.blocks.power;
|
|
||||||
|
|
||||||
import arc.func.*;
|
|
||||||
import arc.graphics.*;
|
|
||||||
import arc.math.*;
|
|
||||||
import arc.util.*;
|
|
||||||
import mindustry.content.*;
|
|
||||||
import mindustry.entities.*;
|
|
||||||
import mindustry.graphics.*;
|
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.world.consumers.*;
|
|
||||||
import mindustry.world.draw.*;
|
|
||||||
import mindustry.world.meta.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Power generation block which can use items, liquids or both as input sources for power production.
|
|
||||||
* Liquids will take priority over items.
|
|
||||||
*/
|
|
||||||
//TODO remove
|
|
||||||
@Deprecated
|
|
||||||
public class ItemLiquidGenerator extends PowerGenerator{
|
|
||||||
public float minItemEfficiency = 0.2f;
|
|
||||||
/** The time in number of ticks during which a single item will produce power. */
|
|
||||||
public float itemDuration = 70f;
|
|
||||||
|
|
||||||
/** Minimum liquid efficiency for a generator to accept it. */
|
|
||||||
public float minLiquidEfficiency = 0.2f;
|
|
||||||
/** Maximum liquid used per frame. */
|
|
||||||
public float maxLiquidGenerate = 0.4f;
|
|
||||||
|
|
||||||
public Effect generateEffect = Fx.generatespark;
|
|
||||||
public float generateEffectRnd = 3f;
|
|
||||||
public Effect explodeEffect = Fx.generatespark;
|
|
||||||
public boolean randomlyExplode = true;
|
|
||||||
public boolean defaults = false;
|
|
||||||
|
|
||||||
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
|
||||||
this(name);
|
|
||||||
this.hasItems = hasItems;
|
|
||||||
this.hasLiquids = hasLiquids;
|
|
||||||
setDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemLiquidGenerator(String name){
|
|
||||||
super(name);
|
|
||||||
|
|
||||||
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setDefaults(){
|
|
||||||
if(hasItems){
|
|
||||||
consume(new ConsumeItemFilter(item -> getItemEfficiency(item) >= minItemEfficiency)).update(false).optional(true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasLiquids){
|
|
||||||
consume(new ConsumeLiquidFilter(liquid -> getLiquidEfficiency(liquid) >= minLiquidEfficiency, maxLiquidGenerate)).update(false).optional(true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaults = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(){
|
|
||||||
emitLight = true;
|
|
||||||
lightRadius = 65f * size;
|
|
||||||
if(!defaults){
|
|
||||||
setDefaults();
|
|
||||||
}
|
|
||||||
super.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStats(){
|
|
||||||
super.setStats();
|
|
||||||
|
|
||||||
if(hasItems){
|
|
||||||
stats.add(Stat.productionTime, itemDuration / 60f, StatUnit.seconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float getItemEfficiency(Item item){
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float getLiquidEfficiency(Liquid liquid){
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ItemLiquidGeneratorBuild extends GeneratorBuild{
|
|
||||||
protected Boolf<Liquid> liquidFilter = other -> liquids.get(other) >= 0.001f && getLiquidEfficiency(other) >= minLiquidEfficiency;
|
|
||||||
|
|
||||||
public float explosiveness, heat, totalTime;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean productionValid(){
|
|
||||||
return generateTime > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTile(){
|
|
||||||
//Note: Do not use this delta when calculating the amount of power or the power efficiency, but use it for resource consumption if necessary.
|
|
||||||
//Power amount is delta'd by PowerGraph class already.
|
|
||||||
float calculationDelta = delta();
|
|
||||||
boolean cons = consValid();
|
|
||||||
|
|
||||||
heat = Mathf.lerpDelta(heat, generateTime >= 0.001f && enabled && cons ? 1f : 0f, 0.05f);
|
|
||||||
|
|
||||||
if(!cons){
|
|
||||||
productionEfficiency = 0.0f;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Liquid liquid = hasLiquids ? content.liquids().find(liquidFilter) : null;
|
|
||||||
totalTime += heat * Time.delta;
|
|
||||||
|
|
||||||
//liquid takes priority over solids
|
|
||||||
//TODO several issues with this! - it does not work correctly, consumption should not be handled here, why am I re-implementing consumes
|
|
||||||
//TODO what an awful class
|
|
||||||
if(hasLiquids && liquid != null && liquids.get(liquid) >= 0.001f){
|
|
||||||
float baseLiquidEfficiency = getLiquidEfficiency(liquid);
|
|
||||||
float maximumPossible = maxLiquidGenerate * calculationDelta;
|
|
||||||
float used = Math.min(liquids.get(liquid) * calculationDelta, maximumPossible);
|
|
||||||
|
|
||||||
liquids.remove(liquid, used);
|
|
||||||
productionEfficiency = baseLiquidEfficiency * used / maximumPossible;
|
|
||||||
|
|
||||||
//TODO this aggressively spams the generate effect why would anyone want this why is this here
|
|
||||||
if(used > 0.001f && (generateTime -= delta()) <= 0f){
|
|
||||||
generateEffect.at(x + Mathf.range(generateEffectRnd), y + Mathf.range(generateEffectRnd));
|
|
||||||
generateTime = 1f;
|
|
||||||
}
|
|
||||||
}else if(hasItems){
|
|
||||||
// No liquids accepted or none supplied, try using items if accepted
|
|
||||||
if(generateTime <= 0f && items.total() > 0){
|
|
||||||
generateEffect.at(x + Mathf.range(generateEffectRnd), y + Mathf.range(generateEffectRnd));
|
|
||||||
Item item = items.take();
|
|
||||||
productionEfficiency = getItemEfficiency(item);
|
|
||||||
explosiveness = item.explosiveness;
|
|
||||||
generateTime = 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(generateTime > 0f){
|
|
||||||
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
|
||||||
|
|
||||||
if(randomlyExplode && state.rules.reactorExplosions && Mathf.chance(delta() * 0.06 * Mathf.clamp(explosiveness - 0.5f))){
|
|
||||||
//this block is run last so that in the event of a block destruction, no code relies on the block type
|
|
||||||
damage(Mathf.random(11f));
|
|
||||||
explodeEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
productionEfficiency = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float warmup(){
|
|
||||||
return heat;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float totalProgress(){
|
|
||||||
return totalTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawLight(){
|
|
||||||
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * heat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -73,13 +73,13 @@ public class PowerGenerator extends PowerDistributor{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
drawer.drawBase(this);
|
drawer.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
drawer.drawLights(this);
|
drawer.drawLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public class GenericCrafter extends Block{
|
|||||||
/** if true, crafters with multiple liquid outputs will dump excess when there's still space for at least one liquid type */
|
/** if true, crafters with multiple liquid outputs will dump excess when there's still space for at least one liquid type */
|
||||||
public boolean dumpExtraLiquid = true;
|
public boolean dumpExtraLiquid = true;
|
||||||
public boolean ignoreLiquidFullness = false;
|
public boolean ignoreLiquidFullness = false;
|
||||||
/** if true, liquid will be outputted continuously regardless of craft time */
|
|
||||||
public boolean continuousLiquidOutput = false;
|
//TODO should be seconds?
|
||||||
public float craftTime = 80;
|
public float craftTime = 80;
|
||||||
public Effect craftEffect = Fx.none;
|
public Effect craftEffect = Fx.none;
|
||||||
public Effect updateEffect = Fx.none;
|
public Effect updateEffect = Fx.none;
|
||||||
@@ -66,7 +66,7 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(outputLiquids != null){
|
if(outputLiquids != null){
|
||||||
stats.add(Stat.output, StatValues.liquids(continuousLiquidOutput ? 1f : craftTime, outputLiquids));
|
stats.add(Stat.output, StatValues.liquids(1f, outputLiquids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,13 +145,13 @@ public class GenericCrafter extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
drawer.drawBase(this);
|
drawer.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
drawer.drawLights(this);
|
drawer.drawLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -193,7 +193,7 @@ public class GenericCrafter extends Block{
|
|||||||
warmup = Mathf.approachDelta(warmup, warmupTarget(), warmupSpeed);
|
warmup = Mathf.approachDelta(warmup, warmupTarget(), warmupSpeed);
|
||||||
|
|
||||||
//continuously output based on efficiency
|
//continuously output based on efficiency
|
||||||
if(outputLiquids != null && continuousLiquidOutput){
|
if(outputLiquids != null){
|
||||||
float inc = getProgressIncrease(1f);
|
float inc = getProgressIncrease(1f);
|
||||||
for(var output : outputLiquids){
|
for(var output : outputLiquids){
|
||||||
handleLiquid(this, output.liquid, Math.min(output.amount * inc, liquidCapacity - liquids.get(output.liquid)));
|
handleLiquid(this, output.liquid, Math.min(output.amount * inc, liquidCapacity - liquids.get(output.liquid)));
|
||||||
@@ -242,12 +242,6 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outputLiquids != null && !continuousLiquidOutput){
|
|
||||||
for(var output : outputLiquids){
|
|
||||||
handleLiquid(this, output.liquid, output.amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
craftEffect.at(x, y);
|
craftEffect.at(x, y);
|
||||||
progress %= 1f;
|
progress %= 1f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
package mindustry.world.blocks.production;
|
|
||||||
|
|
||||||
import arc.math.*;
|
|
||||||
import arc.util.*;
|
|
||||||
import mindustry.world.consumers.*;
|
|
||||||
import mindustry.world.meta.*;
|
|
||||||
|
|
||||||
public class LiquidConverter extends GenericCrafter{
|
|
||||||
protected @Nullable ConsumeLiquid consumer;
|
|
||||||
|
|
||||||
public LiquidConverter(String name){
|
|
||||||
super(name);
|
|
||||||
hasLiquids = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean outputsItems(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(){
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
consumer = findConsumer(b -> b instanceof ConsumeLiquid);
|
|
||||||
if(consumer == null) throw new RuntimeException("LiquidConverters must have a ConsumeLiquid.");
|
|
||||||
consumer.update = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStats(){
|
|
||||||
super.setStats();
|
|
||||||
stats.remove(Stat.output);
|
|
||||||
stats.add(Stat.output, outputLiquid.liquid, outputLiquid.amount * 60f, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LiquidConverterBuild extends GenericCrafterBuild{
|
|
||||||
@Override
|
|
||||||
public void drawLight(){
|
|
||||||
if(hasLiquids && drawLiquidLight && outputLiquid.liquid.lightColor.a > 0.001f){
|
|
||||||
drawLiquidLight(outputLiquid.liquid, liquids.get(outputLiquid.liquid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTile(){
|
|
||||||
if(consValid()){
|
|
||||||
if(Mathf.chanceDelta(updateEffectChance)){
|
|
||||||
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);
|
|
||||||
float use = Math.min(consumer.amount * edelta(), liquidCapacity - liquids.get(outputLiquid.liquid));
|
|
||||||
float ratio = outputLiquid.amount / consumer.amount;
|
|
||||||
|
|
||||||
liquids.remove(consumer.liquid, Math.min(use, liquids.get(consumer.liquid)));
|
|
||||||
|
|
||||||
progress += use / consumer.amount;
|
|
||||||
liquids.add(outputLiquid.liquid, use * ratio);
|
|
||||||
if(progress >= craftTime){
|
|
||||||
consume();
|
|
||||||
progress %= craftTime;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//warmup is still 1 even if not consuming
|
|
||||||
warmup = Mathf.lerp(warmup, canConsume() ? 1f : 0f, 0.02f);
|
|
||||||
}
|
|
||||||
|
|
||||||
dumpLiquid(outputLiquid.liquid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -110,13 +110,13 @@ public class Pump extends LiquidBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
draw.drawBase(this);
|
draw.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
draw.drawLights(this);
|
draw.drawLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import mindustry.world.meta.*;
|
|||||||
|
|
||||||
/** An abstract class that defines a type of resource that a block can consume. */
|
/** An abstract class that defines a type of resource that a block can consume. */
|
||||||
public abstract class Consume{
|
public abstract class Consume{
|
||||||
|
|
||||||
|
//TODO maybe remove these and make it an interface if possible?
|
||||||
/** If true, this consumer will not influence consumer validity. */
|
/** If true, this consumer will not influence consumer validity. */
|
||||||
public boolean optional;
|
public boolean optional;
|
||||||
/** If true, this consumer will be displayed as a boost input. */
|
/** If true, this consumer will be displayed as a boost input. */
|
||||||
public boolean booster;
|
public boolean booster;
|
||||||
//TODO bad. I don't like it.
|
//TODO bad. I don't like it.
|
||||||
|
@Deprecated
|
||||||
public boolean update = true;
|
public boolean update = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +34,7 @@ public abstract class Consume{
|
|||||||
return optional(true, true);
|
return optional(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Consume update(boolean update){
|
public Consume update(boolean update){
|
||||||
this.update = update;
|
this.update = update;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
21
core/src/mindustry/world/consumers/ConsumeItemCharged.java
Normal file
21
core/src/mindustry/world/consumers/ConsumeItemCharged.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
/** For mods. I don't use this (yet). */
|
||||||
|
public class ConsumeItemCharged extends ConsumeItemFilter{
|
||||||
|
|
||||||
|
public ConsumeItemCharged(float minCharge){
|
||||||
|
super(item -> item.charge >= minCharge);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeItemCharged(){
|
||||||
|
this(0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
var item = getConsumed(build);
|
||||||
|
return item == null ? 0f : item.charge;
|
||||||
|
}
|
||||||
|
}
|
||||||
64
core/src/mindustry/world/consumers/ConsumeItemExplode.java
Normal file
64
core/src/mindustry/world/consumers/ConsumeItemExplode.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.scene.ui.layout.*;
|
||||||
|
import mindustry.*;
|
||||||
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
|
/** Causes a block to explode when explosive items are moved into it. */
|
||||||
|
public class ConsumeItemExplode extends ConsumeItemFilter{
|
||||||
|
public float damage = 4f;
|
||||||
|
public float threshold, baseChance = 0.06f;
|
||||||
|
public Effect explodeEffect = Fx.generatespark;
|
||||||
|
|
||||||
|
public ConsumeItemExplode(float threshold){
|
||||||
|
super(item -> item.explosiveness >= threshold);
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeItemExplode(){
|
||||||
|
this(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Building build){
|
||||||
|
var item = getConsumed(build);
|
||||||
|
|
||||||
|
if(item != null){
|
||||||
|
if(Vars.state.rules.reactorExplosions && Mathf.chance(build.delta() * baseChance * Mathf.clamp(item.explosiveness - threshold))){
|
||||||
|
build.damage(damage);
|
||||||
|
explodeEffect.at(build.x + Mathf.range(build.block.size * tilesize / 2f), build.y + Mathf.range(build.block.size * tilesize / 2f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//as this consumer doesn't actually consume anything, all methods below are empty
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(Building build, Table table){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trigger(Building build){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Stats stats){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(Block block){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean valid(Building build){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,11 @@ public class ConsumeItemFilter extends Consume{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return efficiency multiplier based on current item to be consumed; overridden in subclasses. Returns 0 if not valid in subclasses. */
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable Item getConsumed(Building build){
|
public @Nullable Item getConsumed(Building build){
|
||||||
for(int i = 0; i < content.items().size; i++){
|
for(int i = 0; i < content.items().size; i++){
|
||||||
Item item = content.item(i);
|
Item item = content.item(i);
|
||||||
|
|||||||
20
core/src/mindustry/world/consumers/ConsumeItemFlammable.java
Normal file
20
core/src/mindustry/world/consumers/ConsumeItemFlammable.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
public class ConsumeItemFlammable extends ConsumeItemFilter{
|
||||||
|
|
||||||
|
public ConsumeItemFlammable(float minFlammability){
|
||||||
|
super(item -> item.flammability >= minFlammability);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeItemFlammable(){
|
||||||
|
this(0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
var item = getConsumed(build);
|
||||||
|
return item == null ? 0f : item.flammability;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
public class ConsumeItemRadioactive extends ConsumeItemFilter{
|
||||||
|
|
||||||
|
public ConsumeItemRadioactive(float minRadioactivity){
|
||||||
|
super(item -> item.radioactivity >= minRadioactivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeItemRadioactive(){
|
||||||
|
this(0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
var item = getConsumed(build);
|
||||||
|
return item == null ? 0f : item.radioactivity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,11 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{
|
|||||||
var liq = getConsumed(build);
|
var liq = getConsumed(build);
|
||||||
return liq != null && build.liquids.get(liq) >= use(build);
|
return liq != null && build.liquids.get(liq) >= use(build);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return efficiency multiplier based on current item to be consumed; overridden in subclasses. Returns 0 if not valid in subclasses. */
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable Liquid getConsumed(Building build){
|
public @Nullable Liquid getConsumed(Building build){
|
||||||
float u = use(build);
|
float u = use(build);
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
public class ConsumeLiquidFlammable extends ConsumeLiquidFilter{
|
||||||
|
|
||||||
|
public ConsumeLiquidFlammable(float minFlammability, float amount){
|
||||||
|
super(item -> item.flammability >= minFlammability, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeLiquidFlammable(float amount){
|
||||||
|
this(0.2f, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency(Building build){
|
||||||
|
var item = getConsumed(build);
|
||||||
|
return item == null ? 0f : item.flammability;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public class DrawAnimation extends DrawBlock{
|
|||||||
public TextureRegion liquid, top;
|
public TextureRegion liquid, top;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
Draw.rect(
|
Draw.rect(
|
||||||
sine ?
|
sine ?
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class DrawArcSmelter extends DrawBlock{
|
|||||||
public Blending blending = Blending.additive;
|
public Blending blending = Blending.additive;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(drawBottom) Draw.rect(bottom, build.x, build.y);
|
if(drawBottom) Draw.rect(bottom, build.x, build.y);
|
||||||
|
|
||||||
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ public class DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Draws the block itself. */
|
/** Draws the block itself. */
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y, build.drawrot());
|
Draw.rect(build.block.region, build.x, build.y, build.drawrot());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Draws any extra light for the block. */
|
/** Draws any extra light for the block. */
|
||||||
public void drawLights(Building build){
|
public void drawLight(Building build){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class DrawBlurSpin extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Drawf.spinSprite(build.warmup() > blurThresh ? blurRegion : region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed);
|
Drawf.spinSprite(build.warmup() > blurThresh ? blurRegion : region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class DrawBubbles extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(build.warmup() <= 0.001f) return;
|
if(build.warmup() <= 0.001f) return;
|
||||||
|
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DrawCells extends DrawBlock{
|
|||||||
public float range = 4f, recurrence = 6f, radius = 3f, lifetime = 60f;
|
public float range = 4f, recurrence = 6f, radius = 3f, lifetime = 60f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
|
|
||||||
Draw.rect(bottom, build.x, build.y);
|
Draw.rect(bottom, build.x, build.y);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class DrawCircles extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(build.warmup() <= 0.001f) return;
|
if(build.warmup() <= 0.001f) return;
|
||||||
|
|
||||||
Draw.color(color, build.warmup() * color.a);
|
Draw.color(color, build.warmup() * color.a);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class DrawCrucibleFlame extends DrawPartial{
|
|||||||
public Interp particleInterp = new PowIn(1.5f);
|
public Interp particleInterp = new PowIn(1.5f);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
|
|
||||||
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
||||||
Lines.stroke(circleStroke * build.warmup());
|
Lines.stroke(circleStroke * build.warmup());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class DrawCultivator extends DrawBlock{
|
|||||||
public TextureRegion top;
|
public TextureRegion top;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
|
|
||||||
Drawf.liquid(middle, build.x, build.y, build.warmup(), plantColor);
|
Drawf.liquid(middle, build.x, build.y, build.warmup(), plantColor);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class DrawGlow extends DrawBlock{
|
|||||||
public TextureRegion top;
|
public TextureRegion top;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
Draw.alpha(Mathf.absin(build.totalProgress(), glowScale, glowAmount) * build.warmup());
|
Draw.alpha(Mathf.absin(build.totalProgress(), glowScale, glowAmount) * build.warmup());
|
||||||
Draw.rect(top, build.x, build.y);
|
Draw.rect(top, build.x, build.y);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class DrawGlowRegion extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(build.warmup() <= 0.001f) return;
|
if(build.warmup() <= 0.001f) return;
|
||||||
|
|
||||||
float z = Draw.z();
|
float z = Draw.z();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class DrawHeatInput extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
|
|
||||||
Draw.z(Layer.blockAdditive);
|
Draw.z(Layer.blockAdditive);
|
||||||
if(build instanceof HeatConsumer hc){
|
if(build instanceof HeatConsumer hc){
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class DrawHeatOutput extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
|
if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
|
||||||
|
|
||||||
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
|
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class DrawHeatRegion extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
|
|
||||||
Draw.z(Layer.blockAdditive);
|
Draw.z(Layer.blockAdditive);
|
||||||
if(build instanceof HeatCrafterBuild hc && hc.heat > 0){
|
if(build instanceof HeatCrafterBuild hc && hc.heat > 0){
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class DrawLiquid extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
GenericCrafter type = (GenericCrafter)build.block;
|
GenericCrafter type = (GenericCrafter)build.block;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class DrawLiquidOutputs extends DrawBlock{
|
|||||||
public TextureRegion[][] liquidOutputRegions;
|
public TextureRegion[][] liquidOutputRegions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
GenericCrafter crafter = (GenericCrafter)build.block;
|
GenericCrafter crafter = (GenericCrafter)build.block;
|
||||||
if(crafter.outputLiquids == null) return;
|
if(crafter.outputLiquids == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class DrawLiquidRegion extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(!build.block.hasLiquids) return;
|
if(!build.block.hasLiquids) return;
|
||||||
|
|
||||||
Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
|
Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class DrawLiquidTile extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
|
Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
|
||||||
LiquidBlock.drawTiledFrames(build.block.size, build.x, build.y, padding, drawn, build.liquids.get(drawn) / build.block.liquidCapacity * alpha);
|
LiquidBlock.drawTiledFrames(build.block.size, build.x, build.y, padding, drawn, build.liquids.get(drawn) / build.block.liquidCapacity * alpha);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class DrawMixer extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
GenericCrafter crafter = (GenericCrafter)build.block;
|
GenericCrafter crafter = (GenericCrafter)build.block;
|
||||||
float rotation = build.block.rotate ? build.rotdeg() : 0;
|
float rotation = build.block.rotate ? build.rotdeg() : 0;
|
||||||
Draw.rect(bottom, build.x, build.y, rotation);
|
Draw.rect(bottom, build.x, build.y, rotation);
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ public class DrawMulti extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
for(var draw : drawers){
|
for(var draw : drawers){
|
||||||
draw.drawBase(build);
|
draw.draw(build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,9 +46,9 @@ public class DrawMulti extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLights(Building build){
|
public void drawLight(Building build){
|
||||||
for(var draw : drawers){
|
for(var draw : drawers){
|
||||||
draw.drawLights(build);
|
draw.drawLight(build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class DrawMultiWeave extends DrawBlock{
|
|||||||
public float pulse = 0.3f, pulseScl = 10f;
|
public float pulse = 0.3f, pulseScl = 10f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed);
|
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed);
|
||||||
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
|
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class DrawParticles extends DrawBlock{
|
|||||||
public Blending blending = Blending.normal;
|
public Blending blending = Blending.normal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
|
|
||||||
if(build.warmup() > 0f){
|
if(build.warmup() > 0f){
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class DrawPistons extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
for(int i = 0; i < sides; i++){
|
for(int i = 0; i < sides; i++){
|
||||||
float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset;
|
float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset;
|
||||||
float angle = i * 360f / sides;
|
float angle = i * 360f / sides;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class DrawPulseShape extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
float pz = Draw.z();
|
float pz = Draw.z();
|
||||||
if(layer > 0) Draw.z(layer);
|
if(layer > 0) Draw.z(layer);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class DrawPump extends DrawBlock{
|
|||||||
public TextureRegion liquid;
|
public TextureRegion liquid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
|
|
||||||
if(!(build instanceof PumpBuild pump) || pump.liquidDrop == null) return;
|
if(!(build instanceof PumpBuild pump) || pump.liquidDrop == null) return;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class DrawRegion extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
float z = Draw.z();
|
float z = Draw.z();
|
||||||
if(layer > 0) Draw.z(layer);
|
if(layer > 0) Draw.z(layer);
|
||||||
if(spinSprite){
|
if(spinSprite){
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class DrawRotator extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(build.block.region, build.x, build.y);
|
||||||
if(drawSpinSprite){
|
if(drawSpinSprite){
|
||||||
Drawf.spinSprite(rotator, build.x, build.y, build.totalProgress() * spinSpeed);
|
Drawf.spinSprite(rotator, build.x, build.y, build.totalProgress() * spinSpeed);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class DrawShape extends DrawPartial{
|
|||||||
public boolean useWarmupRadius = false;
|
public boolean useWarmupRadius = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
float pz = Draw.z();
|
float pz = Draw.z();
|
||||||
if(layer > 0) Draw.z(layer);
|
if(layer > 0) Draw.z(layer);
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class DrawSideRegion extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
|
if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
|
||||||
|
|
||||||
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
|
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class DrawSmelter extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(build.block.region, build.x, build.y, build.block.rotate ? build.rotdeg() : 0);
|
Draw.rect(build.block.region, build.x, build.y, build.block.rotate ? build.rotdeg() : 0);
|
||||||
|
|
||||||
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
if(build.warmup() > 0f && flameColor.a > 0.001f){
|
||||||
@@ -54,7 +54,7 @@ public class DrawSmelter extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLights(Building build){
|
public void drawLight(Building build){
|
||||||
Drawf.light(build.team, build.x, build.y, (lightRadius + Mathf.absin(lightSinScl, lightSinMag)) * build.warmup() * build.block.size, flameColor, lightAlpha);
|
Drawf.light(build.team, build.x, build.y, (lightRadius + Mathf.absin(lightSinScl, lightSinMag)) * build.warmup() * build.block.size, flameColor, lightAlpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class DrawSpikes extends DrawPartial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(build.warmup() <= 0.001f) return;
|
if(build.warmup() <= 0.001f) return;
|
||||||
|
|
||||||
Draw.color(color, build.warmup() * color.a);
|
Draw.color(color, build.warmup() * color.a);
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ public class DrawTurbines extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
if(!turbines[0].found()) return;
|
|
||||||
|
|
||||||
float totalTime = build.totalProgress();
|
float totalTime = build.totalProgress();
|
||||||
Draw.rect(turbines[0], build.x, build.y, totalTime * turbineSpeed);
|
Draw.rect(turbines[0], build.x, build.y, totalTime * turbineSpeed);
|
||||||
Draw.rect(turbines[1], build.x, build.y, -totalTime * turbineSpeed);
|
Draw.rect(turbines[1], build.x, build.y, -totalTime * turbineSpeed);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class DrawTurret extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Turret turret = (Turret)build.block;
|
Turret turret = (Turret)build.block;
|
||||||
TurretBuild tb = (TurretBuild)build;
|
TurretBuild tb = (TurretBuild)build;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class DrawWarmupRegion extends DrawBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
Draw.alpha(build.warmup() * (1f - sinMag) + Mathf.absin(Time.time, sinScl, sinMag) * build.warmup());
|
Draw.alpha(build.warmup() * (1f - sinMag) + Mathf.absin(Time.time, sinScl, sinMag) * build.warmup());
|
||||||
Draw.rect(region, build.x, build.y);
|
Draw.rect(region, build.x, build.y);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class DrawWeave extends DrawBlock{
|
|||||||
public TextureRegion weave, bottom;
|
public TextureRegion weave, bottom;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void draw(Building build){
|
||||||
Draw.rect(bottom, build.x, build.y);
|
Draw.rect(bottom, build.x, build.y);
|
||||||
Draw.rect(weave, build.x, build.y, build.totalProgress());
|
Draw.rect(weave, build.x, build.y, build.totalProgress());
|
||||||
|
|
||||||
|
|||||||
@@ -8,52 +8,47 @@ import mindustry.game.*;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.power.*;
|
import mindustry.world.blocks.power.*;
|
||||||
import mindustry.world.blocks.power.ItemLiquidGenerator.*;
|
import mindustry.world.blocks.power.ConsumeGenerator.*;
|
||||||
|
import mindustry.world.consumers.*;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
import static org.junit.jupiter.api.DynamicTest.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class tests generators which can process items, liquids or both.
|
* This class tests generators which can process items, liquids or both.
|
||||||
* All tests are run with a fixed delta of 0.5 so delta considerations can be tested as well.
|
* All tests are run with a fixed delta of 0.5 so delta considerations can be tested as well.
|
||||||
* Additionally, each PowerGraph::update() call will have its own thread frame, i.e. the method will never be called twice within the same frame.
|
* Any expected power amount (produced, consumed, buffered) should be affected by fakeDelta but status should not!
|
||||||
* Both of these constraints are handled by FakeThreadHandler within PowerTestFixture.
|
|
||||||
* Any expected power amount (produced, consumed, buffered) should be affected by FakeThreadHandler.fakeDelta but status should not!
|
|
||||||
*/
|
*/
|
||||||
public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
public class ConsumeGeneratorTests extends PowerTestFixture{
|
||||||
private ItemLiquidGenerator generator;
|
private ConsumeGenerator generator;
|
||||||
private Tile tile;
|
private Tile tile;
|
||||||
private ItemLiquidGeneratorBuild entity;
|
private ConsumeGeneratorBuild build;
|
||||||
private final float fakeItemDuration = 60f; //ticks
|
private final float fakeItemDuration = 60f; //ticks
|
||||||
private final float maximumLiquidUsage = 0.5f;
|
private final float maximumLiquidUsage = 0.5f;
|
||||||
|
|
||||||
public void createGenerator(InputType inputType){
|
public void createGenerator(InputType inputType){
|
||||||
Vars.state = new GameState();
|
Vars.state = new GameState();
|
||||||
Vars.state.rules = new Rules();
|
Vars.state.rules = new Rules();
|
||||||
generator = new ItemLiquidGenerator(inputType != InputType.liquids, inputType != InputType.items, "fakegen" + System.nanoTime()){
|
generator = new ConsumeGenerator("fakegen" + System.nanoTime()){{
|
||||||
{
|
powerProduction = 0.1f;
|
||||||
powerProduction = 0.1f;
|
itemDuration = fakeItemDuration;
|
||||||
itemDuration = fakeItemDuration;
|
buildType = ConsumeGeneratorBuild::new;
|
||||||
maxLiquidGenerate = maximumLiquidUsage;
|
|
||||||
buildType = ItemLiquidGeneratorBuild::new;
|
if(inputType != InputType.liquids){
|
||||||
|
consume(new ConsumeItemFlammable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if(inputType != InputType.items){
|
||||||
public float getItemEfficiency(Item item){
|
consume(new ConsumeLiquidFlammable(maximumLiquidUsage));
|
||||||
return item.flammability;
|
|
||||||
}
|
}
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
generator.init();
|
||||||
public float getLiquidEfficiency(Liquid liquid){
|
|
||||||
return liquid.flammability;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tile = createFakeTile(0, 0, generator);
|
tile = createFakeTile(0, 0, generator);
|
||||||
entity = (ItemLiquidGeneratorBuild)tile.build;
|
build = (ConsumeGeneratorBuild)tile.build;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tests the consumption and efficiency when being supplied with liquids. */
|
/** Tests the consumption and efficiency when being supplied with liquids. */
|
||||||
@@ -86,16 +81,16 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
final float expectedRemainingLiquidAmount = Math.max(0.0f, availableLiquidAmount - expectedConsumptionPerTick * Time.delta);
|
final float expectedRemainingLiquidAmount = Math.max(0.0f, availableLiquidAmount - expectedConsumptionPerTick * Time.delta);
|
||||||
|
|
||||||
createGenerator(inputType);
|
createGenerator(inputType);
|
||||||
assertTrue(entity.acceptLiquid(null, liquid), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
assertTrue(build.acceptLiquid(null, liquid), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||||
|
|
||||||
entity.liquids.add(liquid, availableLiquidAmount);
|
build.liquids.add(liquid, availableLiquidAmount);
|
||||||
entity.updateConsumption();
|
build.updateConsumption();
|
||||||
|
|
||||||
// Perform an update on the generator once - This should use up any resource up to the maximum liquid usage
|
// Perform an update on the generator once - This should use up any resource up to the maximum liquid usage
|
||||||
entity.updateTile();
|
build.updateTile();
|
||||||
|
|
||||||
assertEquals(expectedRemainingLiquidAmount, entity.liquids.get(liquid), inputType + " | " + parameterDescription + ": Remaining liquid amount mismatch.");
|
assertEquals(expectedRemainingLiquidAmount, build.liquids.get(liquid), inputType + " | " + parameterDescription + ": Remaining liquid amount mismatch.");
|
||||||
assertEquals(expectedEfficiency, entity.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
assertEquals(expectedEfficiency, build.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tests the consumption and efficiency when being supplied with items. */
|
/** Tests the consumption and efficiency when being supplied with items. */
|
||||||
@@ -114,7 +109,6 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
tests.add(dynamicTest("02", () -> simulateItemConsumption(inputType, Items.coal, 1, "Sufficient coal provided")));
|
tests.add(dynamicTest("02", () -> simulateItemConsumption(inputType, Items.coal, 1, "Sufficient coal provided")));
|
||||||
tests.add(dynamicTest("03", () -> simulateItemConsumption(inputType, Items.coal, 10, "Excess coal provided")));
|
tests.add(dynamicTest("03", () -> simulateItemConsumption(inputType, Items.coal, 10, "Excess coal provided")));
|
||||||
tests.add(dynamicTest("04", () -> simulateItemConsumption(inputType, Items.blastCompound, 1, "Blast compound provided")));
|
tests.add(dynamicTest("04", () -> simulateItemConsumption(inputType, Items.blastCompound, 1, "Blast compound provided")));
|
||||||
//dynamicTest("03", () -> simulateItemConsumption(inputType, Items.plastanium, 1, "Plastanium provided")), // Not accepted by generator due to low flammability
|
|
||||||
tests.add(dynamicTest("05", () -> simulateItemConsumption(inputType, Items.sporePod, 1, "Biomatter provided")));
|
tests.add(dynamicTest("05", () -> simulateItemConsumption(inputType, Items.sporePod, 1, "Biomatter provided")));
|
||||||
tests.add(dynamicTest("06", () -> simulateItemConsumption(inputType, Items.pyratite, 1, "Pyratite provided")));
|
tests.add(dynamicTest("06", () -> simulateItemConsumption(inputType, Items.pyratite, 1, "Pyratite provided")));
|
||||||
}
|
}
|
||||||
@@ -124,27 +118,22 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void simulateItemConsumption(InputType inputType, Item item, int amount, String parameterDescription){
|
void simulateItemConsumption(InputType inputType, Item item, int amount, String parameterDescription){
|
||||||
final float expectedEfficiency = amount > 0 ? item.flammability : 0f;
|
float expectedEfficiency = amount > 0 ? item.flammability : 0f;
|
||||||
final float expectedRemainingItemAmount = Math.max(0, amount - 1);
|
int expectedRemainingItemAmount = Math.max(0, amount - 1);
|
||||||
|
|
||||||
createGenerator(inputType);
|
createGenerator(inputType);
|
||||||
assertTrue(entity.acceptItem(null, item), inputType + " | " + parameterDescription + ": Items which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
assertTrue(build.acceptItem(null, item), inputType + " | " + parameterDescription + ": Items which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||||
|
|
||||||
if(amount > 0){
|
if(amount > 0){
|
||||||
entity.items.add(item, amount);
|
build.items.add(item, amount);
|
||||||
}
|
}
|
||||||
entity.updateConsumption();
|
|
||||||
|
|
||||||
// Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not.
|
// Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not.
|
||||||
try{
|
build.update();
|
||||||
entity.updateTile();
|
|
||||||
|
assertEquals(expectedRemainingItemAmount, build.items.get(item), inputType + " | " + parameterDescription + ": Remaining item amount mismatch.");
|
||||||
|
assertEquals(expectedEfficiency, build.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
||||||
|
|
||||||
assertEquals(expectedRemainingItemAmount, entity.items.get(item), inputType + " | " + parameterDescription + ": Remaining item amount mismatch.");
|
|
||||||
assertEquals(expectedEfficiency, entity.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
|
||||||
}catch(NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
//hacky, but sometimes tests fail here and I'm not going to bother testing it
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Makes sure the efficiency stays equal during the item duration. */
|
/** Makes sure the efficiency stays equal during the item duration. */
|
||||||
@@ -163,19 +152,18 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
createGenerator(inputType);
|
createGenerator(inputType);
|
||||||
|
|
||||||
// Burn a single coal and test for the duration
|
// Burn a single coal and test for the duration
|
||||||
entity.items.add(Items.coal, 1);
|
build.items.add(Items.coal, 1);
|
||||||
entity.updateConsumption();
|
build.update();
|
||||||
entity.updateTile();
|
|
||||||
|
|
||||||
float expectedEfficiency = entity.productionEfficiency;
|
float expectedEfficiency = build.productionEfficiency;
|
||||||
|
|
||||||
float currentDuration = 0.0f;
|
float currentDuration = 0.0f;
|
||||||
while((currentDuration += Time.delta) <= fakeItemDuration){
|
while((currentDuration += Time.delta) <= fakeItemDuration){
|
||||||
entity.updateTile();
|
build.update();
|
||||||
assertEquals(expectedEfficiency, entity.productionEfficiency, "Duration: " + currentDuration);
|
assertEquals(expectedEfficiency, build.productionEfficiency, "Duration: " + currentDuration);
|
||||||
}
|
}
|
||||||
entity.updateTile();
|
build.update();
|
||||||
assertEquals(0.0f, entity.productionEfficiency, "Duration: " + currentDuration);
|
assertEquals(0.0f, build.productionEfficiency, "Duration: " + currentDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum InputType{
|
enum InputType{
|
||||||
@@ -642,6 +642,12 @@ public class Generators{
|
|||||||
Pixmap wepReg = weapon.top ? outline.get(reg) : reg;
|
Pixmap wepReg = weapon.top ? outline.get(reg) : reg;
|
||||||
|
|
||||||
drawWeapon.get(weapon, wepReg);
|
drawWeapon.get(weapon, wepReg);
|
||||||
|
|
||||||
|
if(weapon.cellRegion.found()){
|
||||||
|
Pixmap weaponCell = get(weapon.cellRegion);
|
||||||
|
weaponCell.replace(in -> in == 0xffffffff ? 0xffa664ff : in == 0xdcc6c6ff || in == 0xdcc5c5ff ? 0xd06b53ff : 0);
|
||||||
|
drawWeapon.get(weapon, weaponCell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO I can save a LOT of space by not creating a full icon.
|
//TODO I can save a LOT of space by not creating a full icon.
|
||||||
|
|||||||
Reference in New Issue
Block a user