WIP pressure turbine
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
core/assets-raw/sprites/blocks/power/pressure-turbine.png
Normal file
BIN
core/assets-raw/sprites/blocks/power/pressure-turbine.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -410,3 +410,4 @@
|
|||||||
63298=core-bastion|block-core-bastion-ui
|
63298=core-bastion|block-core-bastion-ui
|
||||||
63297=plasma-bore|block-plasma-bore-ui
|
63297=plasma-bore|block-plasma-bore-ui
|
||||||
63296=steam-vent|block-steam-vent-ui
|
63296=steam-vent|block-steam-vent-ui
|
||||||
|
63295=pressure-turbine|block-pressure-turbine-ui
|
||||||
|
|||||||
Binary file not shown.
@@ -77,6 +77,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
//power
|
//power
|
||||||
combustionGenerator, thermalGenerator, steamGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
|
combustionGenerator, thermalGenerator, steamGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
|
||||||
|
pressureTurbine,
|
||||||
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
|
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
|
||||||
|
|
||||||
//production
|
//production
|
||||||
@@ -336,6 +337,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
steamVent = new SteamVent("steam-vent"){{
|
steamVent = new SteamVent("steam-vent"){{
|
||||||
parent = blendGroup = rhyolite;
|
parent = blendGroup = rhyolite;
|
||||||
|
attributes.set(Attribute.vent, 1f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
regolith = new Floor("regolith"){{
|
regolith = new Floor("regolith"){{
|
||||||
@@ -1490,6 +1492,26 @@ public class Blocks implements ContentList{
|
|||||||
consumes.liquid(Liquids.cryofluid, 0.25f);
|
consumes.liquid(Liquids.cryofluid, 0.25f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
//TODO work on sprite, green bits?
|
||||||
|
pressureTurbine = new ThermalGenerator("pressure-turbine"){{
|
||||||
|
requirements(Category.power, with(Items.graphite, 35, Items.lead, 50, Items.beryllium, 25));
|
||||||
|
attribute = Attribute.vent;
|
||||||
|
displayEfficiencyScale = 1f / 9f;
|
||||||
|
minEfficiency = 9f - 0.0001f;
|
||||||
|
powerProduction = 1f;
|
||||||
|
displayEfficiency = false;
|
||||||
|
generateEffect = Fx.turbinegenerate;
|
||||||
|
effectChance = 0.04f;
|
||||||
|
size = 3;
|
||||||
|
ambientSound = Sounds.hum;
|
||||||
|
ambientSoundVolume = 0.06f;
|
||||||
|
spinSpeed = 0.6f;
|
||||||
|
spinners = true;
|
||||||
|
hasLiquids = true;
|
||||||
|
liquidOutput = new LiquidStack(Liquids.water, 5f / 60f / 9f);
|
||||||
|
liquidCapacity = 20f;
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion power
|
//endregion power
|
||||||
//region production
|
//region production
|
||||||
|
|
||||||
|
|||||||
@@ -1632,6 +1632,17 @@ public class Fx{
|
|||||||
}
|
}
|
||||||
}).layer(Layer.bullet - 1f),
|
}).layer(Layer.bullet - 1f),
|
||||||
|
|
||||||
|
turbinegenerate = new Effect(100, e -> {
|
||||||
|
color(Pal.vent);
|
||||||
|
alpha(e.fslope() * 0.8f);
|
||||||
|
|
||||||
|
rand.setSeed(e.id);
|
||||||
|
for(int i = 0; i < 3; i++){
|
||||||
|
v.trns(rand.random(360f), rand.random(e.finpow() * 14f)).add(e.x, e.y);
|
||||||
|
Fill.circle(v.x, v.y, rand.random(1.4f, 3.4f));
|
||||||
|
}
|
||||||
|
}).layer(Layer.bullet - 1f),
|
||||||
|
|
||||||
generatespark = new Effect(18, e -> {
|
generatespark = new Effect(18, e -> {
|
||||||
randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
||||||
float len = e.fout() * 4f;
|
float len = e.fout() * 4f;
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ public interface Autotiler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slices a texture region depending on the SliceMode paramater
|
|
||||||
*
|
|
||||||
* @param input The TextureRegion to be sliced
|
* @param input The TextureRegion to be sliced
|
||||||
* @param mode The SliceMode to be applied
|
* @param mode The SliceMode to be applied
|
||||||
* @return The sliced texture
|
* @return The sliced texture
|
||||||
@@ -40,12 +38,7 @@ public interface Autotiler{
|
|||||||
return mode == SliceMode.none ? input : mode == SliceMode.bottom ? botHalf(input) : topHalf(input);
|
return mode == SliceMode.none ? input : mode == SliceMode.bottom ? botHalf(input) : topHalf(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @return The top half of the input */
|
||||||
* Get the top half of a texture
|
|
||||||
*
|
|
||||||
* @param input The TextureRegion to slice
|
|
||||||
* @return The top half of the texture
|
|
||||||
*/
|
|
||||||
default TextureRegion topHalf(TextureRegion input){
|
default TextureRegion topHalf(TextureRegion input){
|
||||||
TextureRegion region = Tmp.tr1;
|
TextureRegion region = Tmp.tr1;
|
||||||
region.set(input);
|
region.set(input);
|
||||||
@@ -53,12 +46,7 @@ public interface Autotiler{
|
|||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @return The bottom half of the input */
|
||||||
* Get the buttom half of a texture
|
|
||||||
*
|
|
||||||
* @param input The TextureRegion to slice
|
|
||||||
* @return The buttom half of the texture
|
|
||||||
*/
|
|
||||||
default TextureRegion botHalf(TextureRegion input){
|
default TextureRegion botHalf(TextureRegion input){
|
||||||
TextureRegion region = Tmp.tr1;
|
TextureRegion region = Tmp.tr1;
|
||||||
region.set(input);
|
region.set(input);
|
||||||
|
|||||||
@@ -2,25 +2,42 @@ package mindustry.world.blocks.power;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class ThermalGenerator extends PowerGenerator{
|
public class ThermalGenerator extends PowerGenerator{
|
||||||
public Effect generateEffect = Fx.none;
|
public Effect generateEffect = Fx.none;
|
||||||
public float effectChance = 0.05f;
|
public float effectChance = 0.05f;
|
||||||
|
public float minEfficiency = 0f;
|
||||||
|
public float spinSpeed = 1f;
|
||||||
|
public float displayEfficiencyScale = 1f;
|
||||||
|
public boolean spinners = false;
|
||||||
|
public boolean displayEfficiency = true;
|
||||||
|
public @Nullable LiquidStack liquidOutput;
|
||||||
public Attribute attribute = Attribute.heat;
|
public Attribute attribute = Attribute.heat;
|
||||||
|
|
||||||
|
public @Load("@-rotator") TextureRegion rotatorRegion;
|
||||||
|
public @Load("@-rotator-blur") TextureRegion blurRegion;
|
||||||
|
|
||||||
public ThermalGenerator(String name){
|
public ThermalGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
if(liquidOutput != null){
|
||||||
|
outputsLiquid = true;
|
||||||
|
hasLiquids = true;
|
||||||
|
}
|
||||||
super.init();
|
super.init();
|
||||||
//proper light clipping
|
//proper light clipping
|
||||||
clipSize = Math.max(clipSize, 45f * size * 2f * 2f);
|
clipSize = Math.max(clipSize, 45f * size * 2f * 2f);
|
||||||
@@ -30,24 +47,32 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
|
||||||
stats.add(Stat.tiles, attribute, floating, size * size, false);
|
stats.add(Stat.tiles, attribute, floating, size * size * displayEfficiencyScale, !displayEfficiency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
super.drawPlace(x, y, rotation, valid);
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
|
if(displayEfficiency){
|
||||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(attribute, x, y) * 100, 1), x, y, valid);
|
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(attribute, x, y) * 100, 1), x, y, valid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||||
//make sure there's heat at this location
|
//make sure there's heat at this location
|
||||||
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > 0.01f;
|
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > minEfficiency;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] icons(){
|
||||||
|
return spinners ? new TextureRegion[]{region, rotatorRegion} : super.makeIconRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThermalGeneratorBuild extends GeneratorBuild{
|
public class ThermalGeneratorBuild extends GeneratorBuild{
|
||||||
public float sum;
|
public float sum;
|
||||||
|
public float spinRotation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
@@ -56,6 +81,23 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
if(productionEfficiency > 0.1f && Mathf.chanceDelta(effectChance)){
|
if(productionEfficiency > 0.1f && Mathf.chanceDelta(effectChance)){
|
||||||
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
|
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spinRotation += productionEfficiency * spinSpeed;
|
||||||
|
|
||||||
|
if(liquidOutput != null){
|
||||||
|
float added = Math.min(productionEfficiency * delta() * liquidOutput.amount, liquidCapacity - liquids.get(liquidOutput.liquid));
|
||||||
|
liquids.add(liquidOutput.liquid, added);
|
||||||
|
dumpLiquid(liquidOutput.liquid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(){
|
||||||
|
super.draw();
|
||||||
|
|
||||||
|
if(spinners){
|
||||||
|
Drawf.spinSprite(blurRegion.found() ? blurRegion : rotatorRegion, x, y, spinRotation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ public class Attribute{
|
|||||||
/** Light coverage. Negative values decrease solar panel efficiency. */
|
/** Light coverage. Negative values decrease solar panel efficiency. */
|
||||||
light = add("light"),
|
light = add("light"),
|
||||||
/** Silicate content. Used for sand extraction. */
|
/** Silicate content. Used for sand extraction. */
|
||||||
silicate = add("silicate");
|
silicate = add("silicate"),
|
||||||
|
/** Used for erekir vents only. */
|
||||||
|
vent = add("vent");
|
||||||
|
|
||||||
public final int id;
|
public final int id;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def transformColors = { List<List<String>> list ->
|
|||||||
|
|
||||||
//TODO implementing this in gradle is a bad idea
|
//TODO implementing this in gradle is a bad idea
|
||||||
//d4816b
|
//d4816b
|
||||||
transformColors([["bf92f9", "8a73c6", "665c9f"], ["6e7080", "989aa4", "b0bac0"], ["bc5452", "ea8878", "feb380"],
|
transformColors([["4a4b53", "6e7080", "989aa4"], ["3a5651", "3a8f64", "92dd7e"], ["bf92f9", "8a73c6", "665c9f"], /*["6e7080", "989aa4", "b0bac0"],*/ ["bc5452", "ea8878", "feb380"],
|
||||||
["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"],
|
["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"],
|
||||||
["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"],
|
["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"],
|
||||||
["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"]])
|
["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"]])
|
||||||
|
|||||||
Reference in New Issue
Block a user