Small deconstructor

This commit is contained in:
Anuken
2021-12-06 14:30:54 -05:00
parent c4dc6511fd
commit 26692a3199
14 changed files with 30 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -475,3 +475,4 @@
63231=regen-projector|block-regen-projector-ui 63231=regen-projector|block-regen-projector-ui
63230=titan|block-titan-ui 63230=titan|block-titan-ui
63229=horde|block-horde-ui 63229=horde|block-horde-ui
63228=small-deconstructor|block-small-deconstructor-ui

Binary file not shown.

View File

@@ -3244,7 +3244,6 @@ public class Blocks{
consumes.power(6f); consumes.power(6f);
}}; }};
if(false)
smallDeconstructor = new PayloadDeconstructor("small-deconstructor"){{ smallDeconstructor = new PayloadDeconstructor("small-deconstructor"){{
requirements(Category.units, with(Items.thorium, 80, Items.silicon, 80, Items.graphite, 80)); requirements(Category.units, with(Items.thorium, 80, Items.silicon, 80, Items.graphite, 80));
itemCapacity = 100; itemCapacity = 100;

View File

@@ -43,10 +43,14 @@ public class ErekirTechTree{
}); });
}); });
node(deconstructor, () -> { node(smallDeconstructor, () -> {
node(largeConstructor, () -> { node(largeConstructor, () -> {
}); });
node(deconstructor, () -> {
});
}); });
}); });
}); });

View File

@@ -196,12 +196,12 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
} }
}else if(!nearWall(x, y)){ }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; ore = Blocks.oreTungsten;
} }
//TODO design ore generation so it doesn't overlap //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; ore = Blocks.oreThorium;
} }
} }

View File

@@ -445,7 +445,7 @@ public class PlacementFragment extends Fragment{
} }
boolean unlocked(Block block){ 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(){ boolean hasInfoBox(){

View File

@@ -781,6 +781,10 @@ public class Block extends UnlockableContent{
return buildVisibility != BuildVisibility.hidden && buildVisibility != BuildVisibility.debugOnly; 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(){ public boolean isStatic(){
return cacheLayer == CacheLayer.walls; return cacheLayer == CacheLayer.walls;
} }

View File

@@ -9,6 +9,7 @@ import mindustry.content.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
@@ -136,6 +137,12 @@ public abstract class BlockProducer extends PayloadBlock{
Draw.rect(topRegion, x, y); Draw.rect(topRegion, x, y);
} }
@Override
public double sense(LAccess sensor){
if(sensor == LAccess.progress) return progress;
return super.sense(sensor);
}
@Override @Override
public void write(Writes write){ public void write(Writes write){
super.write(write); super.write(write);

View File

@@ -43,7 +43,7 @@ public class Constructor extends BlockProducer{
} }
public boolean canProduce(Block b){ 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{ public class ConstructorBuild extends BlockProducerBuild{

View File

@@ -7,6 +7,7 @@ import arc.util.io.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.ui.*; import mindustry.ui.*;
import static mindustry.Vars.*; 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 @Override
public boolean shouldConsume(){ public boolean shouldConsume(){
return deconstructing != null && enabled; return deconstructing != null && enabled;

View File

@@ -71,7 +71,7 @@ public class PayloadSource extends PayloadBlock{
} }
public boolean canProduce(Block b){ 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){ public boolean canProduce(UnitType t){

View File

@@ -45,7 +45,7 @@ def transformColors = { List<List<String>> list ->
//TODO implementing this in gradle is a bad idea //TODO implementing this in gradle is a bad idea
//d4816b //d4816b
transformColors([["4a4b53", "6e7080", "989aa4"], ["3a5651", "3a8f64", "92dd7e"], ["bf92f9", "8a73c6", "665c9f"], /*["6e7080", "989aa4", "b0bac0"],*/ ["bc5452", "ea8878", "feb380"], transformColors([/*["4a4b53", "6e7080", "989aa4"],*/ ["3a5651", "3a8f64", "92dd7e"], ["bf92f9", "8a73c6", "665c9f"], ["6e7080", "989aa4", "b0bac0"], ["bc5452", "ea8878", "feb380"],
["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"], ["d57c65", "e3ae6f", "f7e97e"], ["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"], ["d57c65", "e3ae6f", "f7e97e"],
["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"], ["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"],
["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"], ["4c5878", "768a9a", "a0b0c8"], ["62ae7f", "62ae7f", "84f491"]]) ["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"], ["4c5878", "768a9a", "a0b0c8"], ["62ae7f", "62ae7f", "84f491"]])