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:
@@ -103,7 +103,7 @@ public class Blocks{
|
||||
overflowGate, underflowGate, massDriver,
|
||||
|
||||
//transport - alternate
|
||||
duct, armoredDuct, ductRouter, overflowDuct, ductBridge, ductUnloader,
|
||||
duct, armoredDuct, ductRouter, overflowDuct, underflowDuct, ductBridge, ductUnloader,
|
||||
surgeConveyor, surgeRouter,
|
||||
|
||||
unitCargoLoader, unitCargoUnloadPoint,
|
||||
@@ -1991,6 +1991,15 @@ public class Blocks{
|
||||
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"){{
|
||||
requirements(Category.distribution, with(Items.beryllium, 20));
|
||||
health = 90;
|
||||
@@ -5316,4 +5325,4 @@ public class Blocks{
|
||||
|
||||
//endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class ErekirTechTree{
|
||||
});
|
||||
|
||||
node(overflowDuct, Seq.with(new OnSector(two)), () -> {
|
||||
node(underflowDuct);
|
||||
node(reinforcedContainer, () -> {
|
||||
node(ductUnloader, () -> {
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package mindustry.mod;
|
||||
|
||||
import arc.struct.*;
|
||||
import mindustry.world.blocks.distribution.OverflowDuct.*;
|
||||
|
||||
/** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ClassMap{
|
||||
@@ -226,7 +228,7 @@ public class ClassMap{
|
||||
classes.put("DriverState", mindustry.world.blocks.distribution.MassDriver.DriverState.class);
|
||||
classes.put("MassDriverBuild", mindustry.world.blocks.distribution.MassDriver.MassDriverBuild.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("OverflowGateBuild", mindustry.world.blocks.distribution.OverflowGate.OverflowGateBuild.class);
|
||||
classes.put("Router", mindustry.world.blocks.distribution.Router.class);
|
||||
|
||||
@@ -13,6 +13,7 @@ import mindustry.world.meta.*;
|
||||
|
||||
public class OverflowDuct extends Block{
|
||||
public float speed = 5f;
|
||||
public boolean invert = false;
|
||||
|
||||
public @Load(value = "@-top") TextureRegion topRegion;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class OverflowDuct extends Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
public class DuctRouterBuild extends Building{
|
||||
public class OverflowDuctBuild extends Building{
|
||||
public float progress;
|
||||
public @Nullable Item current;
|
||||
|
||||
@@ -95,11 +96,27 @@ public class OverflowDuct extends Block{
|
||||
public Building target(){
|
||||
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();
|
||||
if(front != null && front.team == team && front.acceptItem(this, current)){
|
||||
return front;
|
||||
}
|
||||
|
||||
if(invert) return null;
|
||||
|
||||
for(int i = -1; i <= 1; i++){
|
||||
int dir = Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4);
|
||||
if(dir == rotation) continue;
|
||||
@@ -108,6 +125,7 @@ public class OverflowDuct extends Block{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user