Crash fixes / 2x2 drills
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 261 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 138 KiB |
@@ -19,11 +19,15 @@ public class ProductionBlocks extends BlockList implements ContentList{
|
|||||||
tungstenDrill = new Drill("tungsten-drill"){{
|
tungstenDrill = new Drill("tungsten-drill"){{
|
||||||
tier = 2;
|
tier = 2;
|
||||||
drillTime = 300;
|
drillTime = 300;
|
||||||
|
size = 2;
|
||||||
|
drawMineItem = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
carbideDrill = new Drill("carbide-drill"){{
|
carbideDrill = new Drill("carbide-drill"){{
|
||||||
tier = 3;
|
tier = 3;
|
||||||
drillTime = 240;
|
drillTime = 240;
|
||||||
|
size = 2;
|
||||||
|
drawMineItem = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
laserdrill = new Drill("laser-drill"){{
|
laserdrill = new Drill("laser-drill"){{
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class BuildBlock extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean isSolidFor(Tile tile){
|
public boolean isSolidFor(Tile tile){
|
||||||
BuildEntity entity = tile.entity();
|
BuildEntity entity = tile.entity();
|
||||||
return entity == null || (entity.recipe != null && entity.recipe.result.solid) || entity.previous.solid;
|
return entity == null || (entity.recipe != null && entity.recipe.result.solid) || entity.previous == null || entity.previous.solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ public class Drill extends Block{
|
|||||||
/**Speed at which the drill speeds up.*/
|
/**Speed at which the drill speeds up.*/
|
||||||
protected float warmupSpeed = 0.02f;
|
protected float warmupSpeed = 0.02f;
|
||||||
|
|
||||||
|
/**Whether to draw the item this drill is mining.*/
|
||||||
|
protected boolean drawMineItem = false;
|
||||||
/**Effect played when an item is produced. This is colored.*/
|
/**Effect played when an item is produced. This is colored.*/
|
||||||
protected Effect drillEffect = BlockFx.mine;
|
protected Effect drillEffect = BlockFx.mine;
|
||||||
/**Speed the drill bit rotates at.*/
|
/**Speed the drill bit rotates at.*/
|
||||||
@@ -99,9 +101,9 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
if(!isMultiblock() && isValid(tile)){
|
if(entity.dominantItem != null && drawMineItem){
|
||||||
Draw.color(tile.floor().drops.item.color);
|
Draw.color(entity.dominantItem.color);
|
||||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
|
Draw.rect("blank", tile.drawx(), tile.drawy(), 2f, 2f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,6 +146,7 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
float multiplier = 0f;
|
float multiplier = 0f;
|
||||||
float totalHardness = 0f;
|
float totalHardness = 0f;
|
||||||
|
boolean foundDominant = entity.dominantItem != null;
|
||||||
|
|
||||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||||
if(isValid(other)){
|
if(isValid(other)){
|
||||||
@@ -151,6 +154,13 @@ public class Drill extends Block{
|
|||||||
toAdd.add(drop);
|
toAdd.add(drop);
|
||||||
totalHardness += drop.hardness;
|
totalHardness += drop.hardness;
|
||||||
multiplier += 1f;
|
multiplier += 1f;
|
||||||
|
|
||||||
|
if(!foundDominant){
|
||||||
|
entity.dominantItem = drop;
|
||||||
|
foundDominant = true;
|
||||||
|
}else if(entity.dominantItem != drop){
|
||||||
|
entity.dominantItem = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +236,8 @@ public class Drill extends Block{
|
|||||||
public int index;
|
public int index;
|
||||||
public float warmup;
|
public float warmup;
|
||||||
public float drillTime;
|
public float drillTime;
|
||||||
|
|
||||||
|
public Item dominantItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||