Small deconstructor
This commit is contained in:
@@ -3244,7 +3244,6 @@ public class Blocks{
|
||||
consumes.power(6f);
|
||||
}};
|
||||
|
||||
if(false)
|
||||
smallDeconstructor = new PayloadDeconstructor("small-deconstructor"){{
|
||||
requirements(Category.units, with(Items.thorium, 80, Items.silicon, 80, Items.graphite, 80));
|
||||
itemCapacity = 100;
|
||||
|
||||
@@ -43,10 +43,14 @@ public class ErekirTechTree{
|
||||
});
|
||||
});
|
||||
|
||||
node(deconstructor, () -> {
|
||||
node(smallDeconstructor, () -> {
|
||||
node(largeConstructor, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(deconstructor, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -196,12 +196,12 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
}else if(!nearWall(x, y)){
|
||||
|
||||
if(noise(x + 150, y + x*2 + 100, 4, 0.8f, 60f, 1f) > 0.76f/* && floor == Blocks.yellowStone*/){
|
||||
if(noise(x + 150, y + x*2 + 100, 4, 0.8f, 60f, 1f) > 0.75f/* && floor == Blocks.yellowStone*/){
|
||||
ore = Blocks.oreTungsten;
|
||||
}
|
||||
|
||||
//TODO design ore generation so it doesn't overlap
|
||||
if(noise(x + 999, y + 600, 4, 0.63f, 50f, 1f) < 0.22f/* && floor == Blocks.yellowStone*/){
|
||||
if(noise(x + 999, y + 600, 4, 0.63f, 50f, 1f) < 0.21f/* && floor == Blocks.yellowStone*/){
|
||||
ore = Blocks.oreThorium;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public class PlacementFragment extends Fragment{
|
||||
}
|
||||
|
||||
boolean unlocked(Block block){
|
||||
return block.unlockedNow() && block.placeablePlayer && (state.rules.hiddenBuildItems.isEmpty() || !Structs.contains(block.requirements, i -> state.rules.hiddenBuildItems.contains(i.item)));
|
||||
return block.unlockedNow() && block.placeablePlayer && block.environmentBuildable();
|
||||
}
|
||||
|
||||
boolean hasInfoBox(){
|
||||
|
||||
@@ -781,6 +781,10 @@ public class Block extends UnlockableContent{
|
||||
return buildVisibility != BuildVisibility.hidden && buildVisibility != BuildVisibility.debugOnly;
|
||||
}
|
||||
|
||||
public boolean environmentBuildable(){
|
||||
return (state.rules.hiddenBuildItems.isEmpty() || !Structs.contains(requirements, i -> state.rules.hiddenBuildItems.contains(i.item)));
|
||||
}
|
||||
|
||||
public boolean isStatic(){
|
||||
return cacheLayer == CacheLayer.walls;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import mindustry.content.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
@@ -136,6 +137,12 @@ public abstract class BlockProducer extends PayloadBlock{
|
||||
Draw.rect(topRegion, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return progress;
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Constructor extends BlockProducer{
|
||||
}
|
||||
|
||||
public boolean canProduce(Block b){
|
||||
return b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b);
|
||||
return b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b) && b.environmentBuildable();
|
||||
}
|
||||
|
||||
public class ConstructorBuild extends BlockProducerBuild{
|
||||
|
||||
@@ -7,6 +7,7 @@ import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -189,6 +190,12 @@ public class PayloadDeconstructor extends PayloadBlock{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return progress;
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(){
|
||||
return deconstructing != null && enabled;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PayloadSource extends PayloadBlock{
|
||||
}
|
||||
|
||||
public boolean canProduce(Block b){
|
||||
return b.isVisible() && b.size < size && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b);
|
||||
return b.isVisible() && b.size < size && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b) && b.environmentBuildable();
|
||||
}
|
||||
|
||||
public boolean canProduce(UnitType t){
|
||||
|
||||
Reference in New Issue
Block a user