Underflow duct (#6957)

* Underflow Gate

I'm not sure why ClassMap decided to import OverflowDuct instead of using the full path when being generated.

* Better top sprite

Also fix base asymmetry

Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
MEEPofFaith
2022-07-05 15:41:13 -07:00
committed by GitHub
parent 7ddbc40720
commit 45bc4dcb00
8 changed files with 36 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

View File

@@ -2002,6 +2002,7 @@ block.shield-projector.name = Shield Projector
block.large-shield-projector.name = Large Shield Projector block.large-shield-projector.name = Large Shield Projector
block.armored-duct.name = Armored Duct block.armored-duct.name = Armored Duct
block.overflow-duct.name = Overflow Duct block.overflow-duct.name = Overflow Duct
block.underflow-duct.name = Underflow Duct
block.duct-unloader.name = Duct Unloader block.duct-unloader.name = Duct Unloader
block.surge-conveyor.name = Surge Conveyor block.surge-conveyor.name = Surge Conveyor
block.surge-router.name = Surge Router block.surge-router.name = Surge Router
@@ -2080,4 +2081,4 @@ unit.precept.name = Precept
unit.merui.name = Merui unit.merui.name = Merui
unit.anthicus.name = Anthicus unit.anthicus.name = Anthicus
unit.elude.name = Elude unit.elude.name = Elude
unit.obviate.name = Obviate unit.obviate.name = Obviat

View File

@@ -103,7 +103,7 @@ public class Blocks{
overflowGate, underflowGate, massDriver, overflowGate, underflowGate, massDriver,
//transport - alternate //transport - alternate
duct, armoredDuct, ductRouter, overflowDuct, ductBridge, ductUnloader, duct, armoredDuct, ductRouter, overflowDuct, underflowDuct, ductBridge, ductUnloader,
surgeConveyor, surgeRouter, surgeConveyor, surgeRouter,
unitCargoLoader, unitCargoUnloadPoint, unitCargoLoader, unitCargoUnloadPoint,
@@ -1991,6 +1991,15 @@ public class Blocks{
researchCostMultiplier = 1.5f; researchCostMultiplier = 1.5f;
}}; }};
underflowDuct = new OverflowDuct("underflow-duct"){{
requirements(Category.distribution, with(Items.graphite, 8, Items.beryllium, 8));
health = 90;
speed = 4f;
solid = false;
researchCostMultiplier = 1.5f;
invert = true;
}};
ductBridge = new DuctBridge("duct-bridge"){{ ductBridge = new DuctBridge("duct-bridge"){{
requirements(Category.distribution, with(Items.beryllium, 20)); requirements(Category.distribution, with(Items.beryllium, 20));
health = 90; health = 90;

View File

@@ -87,6 +87,7 @@ public class ErekirTechTree{
}); });
node(overflowDuct, Seq.with(new OnSector(two)), () -> { node(overflowDuct, Seq.with(new OnSector(two)), () -> {
node(underflowDuct);
node(reinforcedContainer, () -> { node(reinforcedContainer, () -> {
node(ductUnloader, () -> { node(ductUnloader, () -> {

View File

@@ -1,6 +1,8 @@
package mindustry.mod; package mindustry.mod;
import arc.struct.*; import arc.struct.*;
import mindustry.world.blocks.distribution.OverflowDuct.*;
/** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */ /** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class ClassMap{ public class ClassMap{
@@ -226,7 +228,7 @@ public class ClassMap{
classes.put("DriverState", mindustry.world.blocks.distribution.MassDriver.DriverState.class); classes.put("DriverState", mindustry.world.blocks.distribution.MassDriver.DriverState.class);
classes.put("MassDriverBuild", mindustry.world.blocks.distribution.MassDriver.MassDriverBuild.class); classes.put("MassDriverBuild", mindustry.world.blocks.distribution.MassDriver.MassDriverBuild.class);
classes.put("OverflowDuct", mindustry.world.blocks.distribution.OverflowDuct.class); classes.put("OverflowDuct", mindustry.world.blocks.distribution.OverflowDuct.class);
classes.put("DuctRouterBuild", mindustry.world.blocks.distribution.OverflowDuct.DuctRouterBuild.class); classes.put("DuctRouterBuild", OverflowDuctBuild.class);
classes.put("OverflowGate", mindustry.world.blocks.distribution.OverflowGate.class); classes.put("OverflowGate", mindustry.world.blocks.distribution.OverflowGate.class);
classes.put("OverflowGateBuild", mindustry.world.blocks.distribution.OverflowGate.OverflowGateBuild.class); classes.put("OverflowGateBuild", mindustry.world.blocks.distribution.OverflowGate.OverflowGateBuild.class);
classes.put("Router", mindustry.world.blocks.distribution.Router.class); classes.put("Router", mindustry.world.blocks.distribution.Router.class);

View File

@@ -13,6 +13,7 @@ import mindustry.world.meta.*;
public class OverflowDuct extends Block{ public class OverflowDuct extends Block{
public float speed = 5f; public float speed = 5f;
public boolean invert = false;
public @Load(value = "@-top") TextureRegion topRegion; public @Load(value = "@-top") TextureRegion topRegion;
@@ -57,7 +58,7 @@ public class OverflowDuct extends Block{
return false; return false;
} }
public class DuctRouterBuild extends Building{ public class OverflowDuctBuild extends Building{
public float progress; public float progress;
public @Nullable Item current; public @Nullable Item current;
@@ -95,11 +96,27 @@ public class OverflowDuct extends Block{
public Building target(){ public Building target(){
if(current == null) return null; if(current == null) return null;
if(invert){ //Lots of extra code. Make separate UnderflowDuct class?
Building l = left(), r = right();
boolean lc = l != null && l.team == team && l.acceptItem(this, current),
rc = r != null && r.team == team && r.acceptItem(this, current);
if(lc && !rc){
return l;
}else if(rc && !lc){
return r;
}else if(lc && rc){
return cdump == 0 ? l : r;
}
}
Building front = front(); Building front = front();
if(front != null && front.team == team && front.acceptItem(this, current)){ if(front != null && front.team == team && front.acceptItem(this, current)){
return front; return front;
} }
if(invert) return null;
for(int i = -1; i <= 1; i++){ for(int i = -1; i <= 1; i++){
int dir = Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4); int dir = Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4);
if(dir == rotation) continue; if(dir == rotation) continue;
@@ -108,6 +125,7 @@ public class OverflowDuct extends Block{
return other; return other;
} }
} }
return null; return null;
} }