Carbide, surge conveyors

This commit is contained in:
Anuken
2021-11-05 16:41:08 -04:00
parent 57ef7c823e
commit 6b3dfa6036
21 changed files with 92 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

View File

@@ -419,3 +419,8 @@
63289=tungsten|item-tungsten-ui 63289=tungsten|item-tungsten-ui
63288=ore-tungsten|block-ore-tungsten-ui 63288=ore-tungsten|block-ore-tungsten-ui
63287=impact-drill|block-impact-drill-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

Binary file not shown.

View File

@@ -1,7 +1,6 @@
package mindustry.content; package mindustry.content;
import arc.graphics.*; import arc.graphics.*;
import arc.math.*;
import arc.struct.*; import arc.struct.*;
import mindustry.*; import mindustry.*;
import mindustry.ctype.*; import mindustry.ctype.*;
@@ -60,6 +59,7 @@ public class Blocks implements ContentList{
//crafting //crafting
siliconSmelter, siliconCrucible, siliconArcFurnace, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, siliconCrucible, siliconArcFurnace, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge, melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge,
carbideCrucible,
cellSynthesisChamber, cellSynthesisChamber,
//sandbox //sandbox
@@ -75,6 +75,7 @@ public class Blocks implements ContentList{
conveyor, titaniumConveyor, plastaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, conveyor, titaniumConveyor, plastaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router,
overflowGate, underflowGate, massDriver, overflowGate, underflowGate, massDriver,
duct, ductRouter, ductBridge, duct, ductRouter, ductBridge,
surgeConveyor,
//liquid //liquid
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidContainer, liquidTank, liquidJunction, bridgeConduit, phaseConduit, 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); 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"){{ cellSynthesisChamber = new LiquidConverter("cell-synthesis-chamber"){{
//TODO booster mechanics? //TODO booster mechanics?
requirements(Category.crafting, with(Items.thorium, 100, Items.phaseFabric, 120, Items.titanium, 150, Items.surgeAlloy, 70)); 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 //special transport blocks
duct = new Duct("duct"){{ duct = new Duct("duct"){{
requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 5)); requirements(Category.distribution, with(Items.graphite, 5));
speed = 4f; speed = 4f;
}}; }};
ductRouter = new DuctRouter("duct-router"){{ ductRouter = new DuctRouter("duct-router"){{
requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 10)); requirements(Category.distribution, with(Items.graphite, 10));
speed = 4f; speed = 4f;
}}; }};
ductBridge = new DuctBridge("duct-bridge"){{ ductBridge = new DuctBridge("duct-bridge"){{
requirements(Category.distribution, BuildVisibility.debugOnly, with(Items.graphite, 20)); requirements(Category.distribution, with(Items.graphite, 20));
speed = 4f; 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 //endregion
//region liquid //region liquid

View File

@@ -111,9 +111,7 @@ public class Items implements ContentList{
cost = 1.2f; cost = 1.2f;
}}; }};
//TODO carbide impl carbide = new Item("carbide", Color.valueOf("89769a")){{
carbide = new Item("carbide", Color.valueOf("768a9a")){{
cost = 1.3f; cost = 1.3f;
}}; }};
} }

View File

@@ -845,7 +845,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
for(Building other : proximity){ for(Building other : proximity){
if(other != null && other.power != null if(other != null && other.power != null
&& other.team == team && 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())){ && conductsTo(other) && other.conductsTo(self()) && !power.links.contains(other.pos())){
out.add(other); out.add(other);
} }

View File

@@ -26,6 +26,9 @@ public class Layer{
//base block layer - most blocks go here //base block layer - most blocks go here
block = 30, block = 30,
//informal layer used for additive blending overlay, grouped together to reduce draw calls
blockAdditive = 31,
//things drawn over blocks (intermediate layer) //things drawn over blocks (intermediate layer)
blockOver = 35, blockOver = 35,

View File

@@ -47,6 +47,7 @@ public class Block extends UnlockableContent{
public boolean outputsLiquid = false; public boolean outputsLiquid = false;
public boolean consumesPower = true; public boolean consumesPower = true;
public boolean outputsPower = false; public boolean outputsPower = false;
public boolean conductivePower = false;
public boolean outputsPayload = false; public boolean outputsPayload = false;
public boolean acceptsPayload = false; public boolean acceptsPayload = false;
public boolean acceptsItems = false; public boolean acceptsItems = false;

View File

@@ -189,7 +189,8 @@ public interface Autotiler{
default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ 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) 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 && || ((!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. */ /** @return whether this other block is *not* looking at this one. */

View File

@@ -1,5 +1,6 @@
package mindustry.world.blocks.distribution; package mindustry.world.blocks.distribution;
import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
@@ -25,9 +26,15 @@ public class StackConveyor extends Block implements Autotiler{
public @Load(value = "@-#", length = 3) TextureRegion[] regions; public @Load(value = "@-#", length = 3) TextureRegion[] regions;
public @Load("@-edge") TextureRegion edgeRegion; public @Load("@-edge") TextureRegion edgeRegion;
public @Load("@-stack") TextureRegion stackRegion; 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 float speed = 0f;
public boolean splitOut = true; public boolean outputRouter = true;
/** (minimum) amount of loading docks needed to fill a line. */ /** (minimum) amount of loading docks needed to fill a line. */
public float recharge = 2f; public float recharge = 2f;
public Effect loadEffect = Fx.plasticburn; public Effect loadEffect = Fx.plasticburn;
@@ -61,7 +68,7 @@ public class StackConveyor extends Block implements Autotiler{
int state = b.state; int state = b.state;
if(state == stateLoad){ //standard conveyor mode if(state == stateLoad){ //standard conveyor mode
return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock); 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 && return otherblock.acceptsItems &&
(!otherblock.noSideBlend || lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock)) && (!otherblock.noSideBlend || lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock)) &&
(notLookingAt(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 int link = -1;
public float cooldown; public float cooldown;
public Item lastItem; public Item lastItem;
public float glow;
boolean proxUpdating = false; boolean proxUpdating = false;
@@ -124,6 +132,17 @@ public class StackConveyor extends Block implements Autotiler{
Tile from = world.tile(link); 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; if(link == -1 || from == null || lastItem == null) return;
int fromRot = from.build == null ? rotation : from.build.rotation; 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) == 3 && (rotation%4) == 0) a = -1 * 90;
if((fromRot%4) == 0 && (rotation%4) == 3) a = 4 * 90; if((fromRot%4) == 0 && (rotation%4) == 3) a = 4 * 90;
if(glowRegion.found()){
Draw.z(Layer.blockAdditive + 0.01f);
}
//stack //stack
Draw.rect(stackRegion, Tmp.v1.x, Tmp.v1.y, Mathf.lerp(a, b, Interp.smooth.apply(1f - Mathf.clamp(cooldown * 2, 0f, 1f)))); 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); 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 = 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){ if(!headless){
blendprox = 0; blendprox = 0;
for(int i = 0; i < 4; i++){ 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); blendprox |= (1 << i);
} }
} }
@@ -210,7 +234,7 @@ public class StackConveyor extends Block implements Autotiler{
@Override @Override
public float efficiency(){ public float efficiency(){
return 1f; return baseEfficiency + (power == null ? 0f : power.status);
} }
@Override @Override
@@ -229,12 +253,21 @@ public class StackConveyor extends Block implements Autotiler{
lastItem = items.first(); 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 //do not continue if disabled, will still allow one to be reeled in to prevent visual stacking
if(!enabled) return; if(!enabled) return;
if(state == stateUnload){ //unload if(state == stateUnload){ //unload
while(lastItem != null && (!splitOut ? moveForward(lastItem) : dump(lastItem))){ while(lastItem != null && (!outputRouter ? moveForward(lastItem) : dump(lastItem))){
if(items.empty()) poofOut(); if(!outputRouter){
items.remove(lastItem, 1);
}
if(items.empty()){
poofOut();
lastItem = null;
}
} }
}else{ //transfer }else{ //transfer
if(state != stateLoad || (items.total() >= getMaximumAccepted(lastItem))){ if(state != stateLoad || (items.total() >= getMaximumAccepted(lastItem))){

View File

@@ -7,6 +7,7 @@ import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.graphics.*;
public class BurstDrill extends Drill{ public class BurstDrill extends Drill{
public float shake = 2f; public float shake = 2f;
@@ -104,8 +105,6 @@ public class BurstDrill extends Drill{
Draw.color(); Draw.color();
} }
float z = Draw.z();
float fract = smoothProgress; float fract = smoothProgress;
int arrows = 3; int arrows = 3;
Draw.color(arrowColor); Draw.color(arrowColor);
@@ -116,13 +115,13 @@ public class BurstDrill extends Drill{
Tmp.v1.trns(i * 90 + 45, j * arrowSpacing); Tmp.v1.trns(i * 90 + 45, j * arrowSpacing);
//TODO maybe just use arrow alpha and that drawn on the base? //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.color(baseArrowColor, arrowColor, a);
Draw.rect(arrowRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90); Draw.rect(arrowRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90);
Draw.color(arrowColor); Draw.color(arrowColor);
Draw.z(z + 0.001f); Draw.z(Layer.blockAdditive);
Draw.blend(Blending.additive); Draw.blend(Blending.additive);
Draw.alpha(Mathf.pow(a, 10f)); Draw.alpha(Mathf.pow(a, 10f));
Draw.rect(arrowBlurRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90); Draw.rect(arrowBlurRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90);