wip
This commit is contained in:
@@ -2185,23 +2185,22 @@ public class Blocks{
|
|||||||
ventCondenser = new AttributeCrafter("vent-condenser"){{
|
ventCondenser = new AttributeCrafter("vent-condenser"){{
|
||||||
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 60));
|
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 60));
|
||||||
attribute = Attribute.vent;
|
attribute = Attribute.vent;
|
||||||
displayEfficiencyScale = 1f / 9f;
|
|
||||||
minEfficiency = 9f - 0.0001f;
|
minEfficiency = 9f - 0.0001f;
|
||||||
|
baseEfficiency = 0f;
|
||||||
displayEfficiency = false;
|
displayEfficiency = false;
|
||||||
craftEffect = Fx.turbinegenerate;
|
craftEffect = Fx.turbinegenerate;
|
||||||
drawer = new DrawMulti(new DrawBlock(), new DrawRegion("-rotator-blur"){{
|
drawer = new DrawMulti(new DrawBlock(), new DrawBlurSpin("-rotator"){{
|
||||||
spinSprite = true;
|
|
||||||
drawPlan = false;
|
|
||||||
rotateSpeed = 6f;
|
rotateSpeed = 6f;
|
||||||
}});
|
}});
|
||||||
drawer.iconOverride = new String[]{"", "-rotator"};
|
|
||||||
ignoreLiquidFullness = true;
|
ignoreLiquidFullness = true;
|
||||||
craftTime = 30f;
|
craftTime = 50f;
|
||||||
size = 3;
|
size = 3;
|
||||||
ambientSound = Sounds.hum;
|
ambientSound = Sounds.hum;
|
||||||
ambientSoundVolume = 0.06f;
|
ambientSoundVolume = 0.06f;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
outputLiquid = new LiquidStack(Liquids.water, 30f / 60f / 9f);
|
continuousLiquidOutput = true;
|
||||||
|
boostScale = 1f / 9f;
|
||||||
|
outputLiquid = new LiquidStack(Liquids.water, 30f / 60f);
|
||||||
consumes.power(0.5f);
|
consumes.power(0.5f);
|
||||||
liquidCapacity = 20f;
|
liquidCapacity = 20f;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class AttributeCrafter extends GenericCrafter{
|
|||||||
public void setBars(){
|
public void setBars(){
|
||||||
super.setBars();
|
super.setBars();
|
||||||
|
|
||||||
|
if(!displayEfficiency) return;
|
||||||
|
|
||||||
bars.add("efficiency", (AttributeCrafterBuild entity) ->
|
bars.add("efficiency", (AttributeCrafterBuild entity) ->
|
||||||
new Bar(() ->
|
new Bar(() ->
|
||||||
Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100 * displayEfficiencyScale)),
|
Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100 * displayEfficiencyScale)),
|
||||||
@@ -45,14 +47,14 @@ public class AttributeCrafter extends GenericCrafter{
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||||
//make sure there's enough efficiency at this location
|
//make sure there's enough efficiency at this location
|
||||||
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > minEfficiency;
|
return baseEfficiency + tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) >= minEfficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
|
||||||
stats.add(Stat.affinities, attribute, boostScale * size * size);
|
stats.add(baseEfficiency <= 0.0001f ? Stat.tiles : Stat.affinities, attribute, floating, boostScale * size * size, !displayEfficiency);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttributeCrafterBuild extends GenericCrafterBuild{
|
public class AttributeCrafterBuild extends GenericCrafterBuild{
|
||||||
|
|||||||
@@ -31,6 +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;
|
||||||
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;
|
||||||
@@ -64,7 +66,7 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(outputLiquids != null){
|
if(outputLiquids != null){
|
||||||
stats.add(Stat.output, StatValues.liquids(craftTime, outputLiquids));
|
stats.add(Stat.output, StatValues.liquids(continuousLiquidOutput ? 1f : craftTime, outputLiquids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +190,16 @@ public class GenericCrafter extends Block{
|
|||||||
if(consValid()){
|
if(consValid()){
|
||||||
|
|
||||||
progress += getProgressIncrease(craftTime);
|
progress += getProgressIncrease(craftTime);
|
||||||
totalProgress += delta() * efficiency();
|
|
||||||
warmup = Mathf.approachDelta(warmup, warmupTarget(), warmupSpeed);
|
warmup = Mathf.approachDelta(warmup, warmupTarget(), warmupSpeed);
|
||||||
|
|
||||||
|
//continuously output based on efficiency
|
||||||
|
if(outputLiquids != null && continuousLiquidOutput){
|
||||||
|
float inc = getProgressIncrease(1f);
|
||||||
|
for(var output : outputLiquids){
|
||||||
|
handleLiquid(this, output.liquid, Math.min(output.amount * inc, liquidCapacity - liquids.get(output.liquid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(Mathf.chanceDelta(updateEffectChance)){
|
if(Mathf.chanceDelta(updateEffectChance)){
|
||||||
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
|
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
|
||||||
}
|
}
|
||||||
@@ -198,6 +207,9 @@ public class GenericCrafter extends Block{
|
|||||||
warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);
|
warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO may look bad, revert to edelta() if so
|
||||||
|
totalProgress += warmup * Time.delta;
|
||||||
|
|
||||||
if(progress >= 1f){
|
if(progress >= 1f){
|
||||||
craft();
|
craft();
|
||||||
}
|
}
|
||||||
@@ -230,7 +242,7 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outputLiquids != null){
|
if(outputLiquids != null && !continuousLiquidOutput){
|
||||||
for(var output : outputLiquids){
|
for(var output : outputLiquids){
|
||||||
handleLiquid(this, output.liquid, output.amount);
|
handleLiquid(this, output.liquid, output.amount);
|
||||||
}
|
}
|
||||||
|
|||||||
39
core/src/mindustry/world/draw/DrawBlurSpin.java
Normal file
39
core/src/mindustry/world/draw/DrawBlurSpin.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package mindustry.world.draw;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
/** Not standalone. */
|
||||||
|
public class DrawBlurSpin extends DrawBlock{
|
||||||
|
public TextureRegion region, blurRegion;
|
||||||
|
public String suffix = "";
|
||||||
|
public float rotateSpeed = 1f, x, y, blurThresh = 0.7f;
|
||||||
|
|
||||||
|
public DrawBlurSpin(String suffix){
|
||||||
|
this.suffix = suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawBlurSpin(){
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBase(Building build){
|
||||||
|
Drawf.spinSprite(build.warmup() > blurThresh ? blurRegion : region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||||
|
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(Block block){
|
||||||
|
region = Core.atlas.find(block.name + suffix);
|
||||||
|
blurRegion = Core.atlas.find(block.name + suffix + "-blur");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,4 +24,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=f65ae0d8f7
|
archash=f8264ffafe
|
||||||
|
|||||||
Reference in New Issue
Block a user