Overflow duct
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
Binary file not shown.
|
After Width: | Height: | Size: 377 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -447,3 +447,5 @@
|
|||||||
63259=oxidation-chamber|block-oxidation-chamber-ui
|
63259=oxidation-chamber|block-oxidation-chamber-ui
|
||||||
63258=surge-crucible|block-surge-crucible-ui
|
63258=surge-crucible|block-surge-crucible-ui
|
||||||
63257=emanate|unit-emanate-ui
|
63257=emanate|unit-emanate-ui
|
||||||
|
63256=overflow-duct|block-overflow-duct-ui
|
||||||
|
63255=large-plasma-bore|block-large-plasma-bore-ui
|
||||||
|
|||||||
Binary file not shown.
@@ -77,7 +77,7 @@ public class Blocks implements ContentList{
|
|||||||
overflowGate, underflowGate, massDriver,
|
overflowGate, underflowGate, massDriver,
|
||||||
|
|
||||||
//transport - alternate
|
//transport - alternate
|
||||||
duct, ductRouter, ductBridge, ductUnloader,
|
duct, ductRouter, overflowDuct, ductBridge, ductUnloader,
|
||||||
surgeConveyor, surgeRouter,
|
surgeConveyor, surgeRouter,
|
||||||
|
|
||||||
//liquid
|
//liquid
|
||||||
@@ -94,7 +94,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
//production
|
//production
|
||||||
mechanicalDrill, pneumaticDrill, laserDrill, blastDrill, waterExtractor, oilExtractor, cultivator,
|
mechanicalDrill, pneumaticDrill, laserDrill, blastDrill, waterExtractor, oilExtractor, cultivator,
|
||||||
cliffCrusher, plasmaBore, impactDrill,
|
cliffCrusher, plasmaBore, largePlasmaBore, impactDrill,
|
||||||
|
|
||||||
//storage
|
//storage
|
||||||
coreShard, coreFoundation, coreNucleus, vault, container, unloader,
|
coreShard, coreFoundation, coreNucleus, vault, container, unloader,
|
||||||
@@ -1430,6 +1430,11 @@ public class Blocks implements ContentList{
|
|||||||
speed = 4f;
|
speed = 4f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
overflowDuct = new OverflowDuct("overflow-duct"){{
|
||||||
|
requirements(Category.distribution, with(Items.graphite, 10));
|
||||||
|
speed = 4f;
|
||||||
|
}};
|
||||||
|
|
||||||
ductBridge = new DuctBridge("duct-bridge"){{
|
ductBridge = new DuctBridge("duct-bridge"){{
|
||||||
requirements(Category.distribution, with(Items.graphite, 20));
|
requirements(Category.distribution, with(Items.graphite, 20));
|
||||||
speed = 4f;
|
speed = 4f;
|
||||||
@@ -1908,13 +1913,27 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
plasmaBore = new BeamDrill("plasma-bore"){{
|
plasmaBore = new BeamDrill("plasma-bore"){{
|
||||||
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 10, Items.lead, 20));
|
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 10));
|
||||||
consumes.power(0.2f);
|
consumes.power(0.2f);
|
||||||
|
drillTime = 200f;
|
||||||
tier = 4;
|
tier = 4;
|
||||||
size = 2;
|
size = 2;
|
||||||
range = 2;
|
range = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
//TODO awful name
|
||||||
|
largePlasmaBore = new BeamDrill("large-plasma-bore"){{
|
||||||
|
//TODO requirements
|
||||||
|
//TODO require hydrogen? optional for all drills?
|
||||||
|
requirements(Category.production, with(Items.graphite, 30, Items.beryllium, 20, Items.carbide, 30));
|
||||||
|
consumes.power(0.6f);
|
||||||
|
drillTime = 170f;
|
||||||
|
tier = 5;
|
||||||
|
size = 3;
|
||||||
|
range = 6;
|
||||||
|
laserWidth = 0.7f;
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
//region storage
|
//region storage
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ abstract class BlockUnitComp implements Unitc{
|
|||||||
set(tile);
|
set(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(){
|
||||||
|
if(tile == null){
|
||||||
|
throw new RuntimeException("Do not add BlockUnit entities to the game, they will simply crash. Internal use only.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class DuctRouter extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
solid = false;
|
solid = false;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
conveyorPlacement = true;
|
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
itemCapacity = 1;
|
itemCapacity = 1;
|
||||||
noUpdateDisabled = true;
|
noUpdateDisabled = true;
|
||||||
@@ -58,6 +57,11 @@ public class DuctRouter extends Block{
|
|||||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean rotatedOutput(int x, int y){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public class DuctRouterBuild extends Building{
|
public class DuctRouterBuild extends Building{
|
||||||
public @Nullable Item sortItem;
|
public @Nullable Item sortItem;
|
||||||
|
|
||||||
|
|||||||
137
core/src/mindustry/world/blocks/distribution/OverflowDuct.java
Normal file
137
core/src/mindustry/world/blocks/distribution/OverflowDuct.java
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
public class OverflowDuct extends Block{
|
||||||
|
public float speed = 5f;
|
||||||
|
|
||||||
|
public @Load(value = "@-top") TextureRegion topRegion;
|
||||||
|
|
||||||
|
public OverflowDuct(String name){
|
||||||
|
super(name);
|
||||||
|
|
||||||
|
group = BlockGroup.transportation;
|
||||||
|
update = true;
|
||||||
|
solid = false;
|
||||||
|
hasItems = true;
|
||||||
|
conveyorPlacement = true;
|
||||||
|
unloadable = false;
|
||||||
|
itemCapacity = 1;
|
||||||
|
noUpdateDisabled = true;
|
||||||
|
rotate = true;
|
||||||
|
envEnabled = Env.space | Env.terrestrial | Env.underwater;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
super.setStats();
|
||||||
|
|
||||||
|
stats.add(Stat.itemsMoved, 60f / speed, StatUnit.itemsSecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] icons(){
|
||||||
|
return new TextureRegion[]{region, topRegion};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||||
|
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||||
|
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean rotatedOutput(int x, int y){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DuctRouterBuild extends Building{
|
||||||
|
public float progress;
|
||||||
|
public @Nullable Item current;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(){
|
||||||
|
Draw.rect(region, x, y);
|
||||||
|
Draw.rect(topRegion, x, y, rotdeg());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTile(){
|
||||||
|
progress += edelta() / speed * 2f;
|
||||||
|
|
||||||
|
if(current != null){
|
||||||
|
if(progress >= (1f - 1f/speed)){
|
||||||
|
var target = target();
|
||||||
|
if(target != null){
|
||||||
|
target.handleItem(this, current);
|
||||||
|
cdump = (byte)(cdump == 0 ? 2 : 0);
|
||||||
|
items.remove(current, 1);
|
||||||
|
current = null;
|
||||||
|
progress %= (1f - 1f/speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
progress = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(current == null && items.total() > 0){
|
||||||
|
current = items.first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public Building target(){
|
||||||
|
if(current == null) return null;
|
||||||
|
|
||||||
|
Building front = front();
|
||||||
|
if(front != null && front.team == team && front.acceptItem(this, current)){
|
||||||
|
return front;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = -1; i <= 1; i++){
|
||||||
|
int dir = Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4);
|
||||||
|
if(dir == rotation) continue;
|
||||||
|
Building other = nearby(dir);
|
||||||
|
if(other != null && other.team == team && other.acceptItem(this, current)){
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptItem(Building source, Item item){
|
||||||
|
return current == null && items.total() == 0 &&
|
||||||
|
(Edges.getFacingEdge(source.tile(), tile).relativeTo(tile) == rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeStack(Item item, int amount){
|
||||||
|
int removed = super.removeStack(item, amount);
|
||||||
|
if(item == current) current = null;
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleStack(Item item, int amount, Teamc source){
|
||||||
|
super.handleStack(item, amount, source);
|
||||||
|
current = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleItem(Building source, Item item){
|
||||||
|
current = item;
|
||||||
|
progress = -1f;
|
||||||
|
items.add(item, 1);
|
||||||
|
noSleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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=430f9146f3c9c34db1f9ad9a8784e71c322246f2
|
archash=5952043ab3a6de8f254dd038ea7ac4cab1b8a852
|
||||||
|
|||||||
Reference in New Issue
Block a user