diff --git a/core/assets-raw/sprites/blocks/distribution/ducts/duct-top-0.png b/core/assets-raw/sprites/blocks/distribution/ducts/duct-top-0.png index 04cd2abceb..eae68cbeaf 100644 Binary files a/core/assets-raw/sprites/blocks/distribution/ducts/duct-top-0.png and b/core/assets-raw/sprites/blocks/distribution/ducts/duct-top-0.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-glow-0.png b/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-glow-0.png new file mode 100644 index 0000000000..469de30742 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-glow-0.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-top-0.png b/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-top-0.png new file mode 100644 index 0000000000..fa16df4cef Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/ducts/surge-duct-top-0.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-0.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-0.png new file mode 100644 index 0000000000..7217e22c18 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-0.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-1.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-1.png new file mode 100644 index 0000000000..ef69e2600b Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-1.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-2.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-2.png new file mode 100644 index 0000000000..3c1afe07dc Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-2.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-edge.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-edge.png new file mode 100644 index 0000000000..8144b95cbe Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-edge.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-glow.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-glow.png new file mode 100644 index 0000000000..469de30742 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-glow.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-stack.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-stack.png new file mode 100644 index 0000000000..fa549cc0c5 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor-stack.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor.png b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor.png new file mode 100644 index 0000000000..10a38a7a83 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/stack-conveyors/surge-conveyor.png differ diff --git a/core/assets-raw/sprites/items/item-carbide.png b/core/assets-raw/sprites/items/item-carbide.png new file mode 100644 index 0000000000..20d65e08bd Binary files /dev/null and b/core/assets-raw/sprites/items/item-carbide.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index a2ea6fb873..dc3f50f422 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -419,3 +419,8 @@ 63289=tungsten|item-tungsten-ui 63288=ore-tungsten|block-ore-tungsten-ui 63287=impact-drill|block-impact-drill-ui +63286=carbide|item-carbide-ui +63285=evoke|unit-evoke-ui +63284=carbide-crucible|block-carbide-crucible-ui +63283=surge-duct|block-surge-duct-ui +63282=surge-conveyor|block-surge-conveyor-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index b80d250d08..4f09d2749f 100644 Binary files a/core/assets/logicids.dat and b/core/assets/logicids.dat differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 54013dcb68..7348863fb4 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1,7 +1,6 @@ package mindustry.content; import arc.graphics.*; -import arc.math.*; import arc.struct.*; import mindustry.*; import mindustry.ctype.*; @@ -60,6 +59,7 @@ public class Blocks implements ContentList{ //crafting siliconSmelter, siliconCrucible, siliconArcFurnace, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge, + carbideCrucible, cellSynthesisChamber, //sandbox @@ -75,6 +75,7 @@ public class Blocks implements ContentList{ conveyor, titaniumConveyor, plastaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, underflowGate, massDriver, duct, ductRouter, ductBridge, + surgeConveyor, //liquid mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidContainer, liquidTank, liquidJunction, bridgeConduit, phaseConduit, @@ -939,6 +940,22 @@ public class Blocks implements ContentList{ consumes.power(0.50f); }}; + carbideCrucible = new GenericCrafter("carbide-crucible"){{ + requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30)); + craftEffect = Fx.smeltsmoke; + outputItem = new ItemStack(Items.carbide, 1); + craftTime = 30f; + size = 2; + hasPower = hasItems = true; + drawer = new DrawSmelter(Color.valueOf("ffc099")); + ambientSound = Sounds.smelter; + ambientSoundVolume = 0.07f; + + //TODO use heat! + consumes.items(with(Items.tungsten, 1, Items.graphite, 2)); + consumes.power(2f); + }}; + cellSynthesisChamber = new LiquidConverter("cell-synthesis-chamber"){{ //TODO booster mechanics? requirements(Category.crafting, with(Items.thorium, 100, Items.phaseFabric, 120, Items.titanium, 150, Items.surgeAlloy, 70)); @@ -1277,20 +1294,35 @@ public class Blocks implements ContentList{ //special transport blocks duct = new Duct("duct"){{ - requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 5)); + requirements(Category.distribution, with(Items.graphite, 5)); speed = 4f; }}; ductRouter = new DuctRouter("duct-router"){{ - requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 10)); + requirements(Category.distribution, with(Items.graphite, 10)); speed = 4f; }}; ductBridge = new DuctBridge("duct-bridge"){{ - requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 20)); + requirements(Category.distribution, with(Items.graphite, 20)); speed = 4f; }}; + surgeConveyor = new StackConveyor("surge-conveyor"){{ + requirements(Category.distribution, with(Items.surgeAlloy, 3, Items.graphite, 5)); + health = 90; + //TODO different base speed/item capacity? + speed = 5f / 60f; + itemCapacity = 10; + + outputRouter = false; + hasPower = true; + consumesPower = true; + conductivePower = true; + baseEfficiency = 1f; + consumes.power(1f / 60f); + }}; + //endregion //region liquid diff --git a/core/src/mindustry/content/Items.java b/core/src/mindustry/content/Items.java index 4e09984dbf..5c3d285f20 100644 --- a/core/src/mindustry/content/Items.java +++ b/core/src/mindustry/content/Items.java @@ -111,9 +111,7 @@ public class Items implements ContentList{ cost = 1.2f; }}; - //TODO carbide impl - - carbide = new Item("carbide", Color.valueOf("768a9a")){{ + carbide = new Item("carbide", Color.valueOf("89769a")){{ cost = 1.3f; }}; } diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 99a891ab48..6774862c35 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -845,7 +845,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, for(Building other : proximity){ if(other != null && other.power != null && other.team == team - && !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower) + && !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower && !block.conductivePower && !other.block.conductivePower) && conductsTo(other) && other.conductsTo(self()) && !power.links.contains(other.pos())){ out.add(other); } diff --git a/core/src/mindustry/graphics/Layer.java b/core/src/mindustry/graphics/Layer.java index cf465dc300..59d4808945 100644 --- a/core/src/mindustry/graphics/Layer.java +++ b/core/src/mindustry/graphics/Layer.java @@ -26,6 +26,9 @@ public class Layer{ //base block layer - most blocks go here block = 30, + //informal layer used for additive blending overlay, grouped together to reduce draw calls + blockAdditive = 31, + //things drawn over blocks (intermediate layer) blockOver = 35, diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index f75d256bef..86cf53f335 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -47,6 +47,7 @@ public class Block extends UnlockableContent{ public boolean outputsLiquid = false; public boolean consumesPower = true; public boolean outputsPower = false; + public boolean conductivePower = false; public boolean outputsPayload = false; public boolean acceptsPayload = false; public boolean acceptsItems = false; diff --git a/core/src/mindustry/world/blocks/Autotiler.java b/core/src/mindustry/world/blocks/Autotiler.java index 3c5c1cb503..03e0b7e01a 100644 --- a/core/src/mindustry/world/blocks/Autotiler.java +++ b/core/src/mindustry/world/blocks/Autotiler.java @@ -189,7 +189,8 @@ public interface Autotiler{ default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) || ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && - Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); + Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || + (otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); } /** @return whether this other block is *not* looking at this one. */ diff --git a/core/src/mindustry/world/blocks/distribution/StackConveyor.java b/core/src/mindustry/world/blocks/distribution/StackConveyor.java index fa7d2427e3..cce5470752 100644 --- a/core/src/mindustry/world/blocks/distribution/StackConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/StackConveyor.java @@ -1,5 +1,6 @@ package mindustry.world.blocks.distribution; +import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; import arc.struct.*; @@ -25,9 +26,15 @@ public class StackConveyor extends Block implements Autotiler{ public @Load(value = "@-#", length = 3) TextureRegion[] regions; public @Load("@-edge") TextureRegion edgeRegion; public @Load("@-stack") TextureRegion stackRegion; + /** requires power to work properly */ + public @Load(value = "@-glow") TextureRegion glowRegion; + public float glowAlpha = 1f; + public Color glowColor = Pal.redLight; + + public float baseEfficiency = 1f; public float speed = 0f; - public boolean splitOut = true; + public boolean outputRouter = true; /** (minimum) amount of loading docks needed to fill a line. */ public float recharge = 2f; public Effect loadEffect = Fx.plasticburn; @@ -61,7 +68,7 @@ public class StackConveyor extends Block implements Autotiler{ int state = b.state; if(state == stateLoad){ //standard conveyor mode return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock); - }else if(state == stateUnload){ //router mode + }else if(state == stateUnload && !outputRouter){ //router mode return otherblock.acceptsItems && (!otherblock.noSideBlend || lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock)) && (notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) || @@ -105,6 +112,7 @@ public class StackConveyor extends Block implements Autotiler{ public int link = -1; public float cooldown; public Item lastItem; + public float glow; boolean proxUpdating = false; @@ -124,6 +132,17 @@ public class StackConveyor extends Block implements Autotiler{ Tile from = world.tile(link); + //TODO do not draw for certain configurations? + if(glowRegion.found() && glow > 0f){ + Draw.z(Layer.blockAdditive); + Draw.color(glowColor, glowAlpha * glow); + Draw.blend(Blending.additive); + Draw.rect(glowRegion, x, y, rotation * 90); + Draw.blend(); + Draw.color(); + Draw.z(Layer.block - 0.1f); + } + if(link == -1 || from == null || lastItem == null) return; int fromRot = from.build == null ? rotation : from.build.rotation; @@ -139,6 +158,10 @@ public class StackConveyor extends Block implements Autotiler{ if((fromRot%4) == 3 && (rotation%4) == 0) a = -1 * 90; if((fromRot%4) == 0 && (rotation%4) == 3) a = 4 * 90; + if(glowRegion.found()){ + Draw.z(Layer.blockAdditive + 0.01f); + } + //stack Draw.rect(stackRegion, Tmp.v1.x, Tmp.v1.y, Mathf.lerp(a, b, Interp.smooth.apply(1f - Mathf.clamp(cooldown * 2, 0f, 1f)))); @@ -169,13 +192,14 @@ public class StackConveyor extends Block implements Autotiler{ int[] bits = buildBlending(tile, rotation, null, true); if(bits[0] == 0 && blends(tile, rotation, 0) && !blends(tile, rotation, 2)) state = stateLoad; // a 0 that faces into a conveyor with none behind it - if(bits[0] == 0 && !blends(tile, rotation, 0) && blends(tile, rotation, 2)) state = stateUnload; // a 0 that faces into none with a conveyor behind it + if(outputRouter && bits[0] == 0 && !blends(tile, rotation, 0) && blends(tile, rotation, 2)) state = stateUnload; // a 0 that faces into none with a conveyor behind it + if(!outputRouter && !(front() instanceof StackConveyorBuild)) state = stateUnload; // a 0 that faces into none with a conveyor behind it if(!headless){ blendprox = 0; for(int i = 0; i < 4; i++){ - if(blends(tile, rotation, i)){ + if(blends(tile, rotation, i) && (state != stateUnload || outputRouter || i == 0 || nearby(Mathf.mod(rotation - i, 4)) instanceof StackConveyorBuild)){ blendprox |= (1 << i); } } @@ -210,7 +234,7 @@ public class StackConveyor extends Block implements Autotiler{ @Override public float efficiency(){ - return 1f; + return baseEfficiency + (power == null ? 0f : power.status); } @Override @@ -229,12 +253,21 @@ public class StackConveyor extends Block implements Autotiler{ lastItem = items.first(); } + if(power != null) glow = Mathf.lerpDelta(glow, power.status, 0.6f); + //do not continue if disabled, will still allow one to be reeled in to prevent visual stacking if(!enabled) return; if(state == stateUnload){ //unload - while(lastItem != null && (!splitOut ? moveForward(lastItem) : dump(lastItem))){ - if(items.empty()) poofOut(); + while(lastItem != null && (!outputRouter ? moveForward(lastItem) : dump(lastItem))){ + if(!outputRouter){ + items.remove(lastItem, 1); + } + + if(items.empty()){ + poofOut(); + lastItem = null; + } } }else{ //transfer if(state != stateLoad || (items.total() >= getMaximumAccepted(lastItem))){ diff --git a/core/src/mindustry/world/blocks/production/BurstDrill.java b/core/src/mindustry/world/blocks/production/BurstDrill.java index 86c12320bc..1e13ef29df 100644 --- a/core/src/mindustry/world/blocks/production/BurstDrill.java +++ b/core/src/mindustry/world/blocks/production/BurstDrill.java @@ -7,6 +7,7 @@ import arc.util.*; import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.entities.*; +import mindustry.graphics.*; public class BurstDrill extends Drill{ public float shake = 2f; @@ -104,8 +105,6 @@ public class BurstDrill extends Drill{ Draw.color(); } - float z = Draw.z(); - float fract = smoothProgress; int arrows = 3; Draw.color(arrowColor); @@ -116,13 +115,13 @@ public class BurstDrill extends Drill{ Tmp.v1.trns(i * 90 + 45, j * arrowSpacing); //TODO maybe just use arrow alpha and that drawn on the base? - Draw.z(z); + Draw.z(Layer.block); Draw.color(baseArrowColor, arrowColor, a); Draw.rect(arrowRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90); Draw.color(arrowColor); - Draw.z(z + 0.001f); + Draw.z(Layer.blockAdditive); Draw.blend(Blending.additive); Draw.alpha(Mathf.pow(a, 10f)); Draw.rect(arrowBlurRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90);