Merge pull request #2324 from DeltaNedas/water
deep water is 2x better to pump
This commit is contained in:
@@ -138,6 +138,7 @@ public class Blocks implements ContentList{
|
|||||||
speedMultiplier = 0.2f;
|
speedMultiplier = 0.2f;
|
||||||
variants = 0;
|
variants = 0;
|
||||||
liquidDrop = Liquids.water;
|
liquidDrop = Liquids.water;
|
||||||
|
liquidMultiplier = 2f;
|
||||||
isLiquid = true;
|
isLiquid = true;
|
||||||
status = StatusEffects.wet;
|
status = StatusEffects.wet;
|
||||||
statusDuration = 120f;
|
statusDuration = 120f;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public class Floor extends Block{
|
|||||||
public float statusDuration = 60f;
|
public float statusDuration = 60f;
|
||||||
/** liquids that drop from this block, used for pumps */
|
/** liquids that drop from this block, used for pumps */
|
||||||
public @Nullable Liquid liquidDrop = null;
|
public @Nullable Liquid liquidDrop = null;
|
||||||
|
/** Multiplier for pumped liquids, used for deep water. */
|
||||||
|
public float liquidMultiplier = 1f;
|
||||||
/** item that drops from this block, used for drills */
|
/** item that drops from this block, used for drills */
|
||||||
public @Nullable Item itemDrop = null;
|
public @Nullable Item itemDrop = null;
|
||||||
/** whether this block can be drowned in */
|
/** whether this block can be drowned in */
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ public class Pump extends LiquidBlock{
|
|||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
|
|
||||||
float tiles = 0f;
|
float amount = 0f;
|
||||||
Liquid liquidDrop = null;
|
Liquid liquidDrop = null;
|
||||||
|
|
||||||
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
|
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
|
||||||
if(canPump(other)){
|
if(canPump(other)){
|
||||||
liquidDrop = other.floor().liquidDrop;
|
liquidDrop = other.floor().liquidDrop;
|
||||||
tiles++;
|
amount += other.floor().liquidMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(liquidDrop != null){
|
if(liquidDrop != null){
|
||||||
float width = drawPlaceText(Core.bundle.formatFloat("bar.pumpspeed", tiles * pumpAmount * 60f, 0), x, y, valid);
|
float width = drawPlaceText(Core.bundle.formatFloat("bar.pumpspeed", amount * pumpAmount * 60f, 0), x, y, valid);
|
||||||
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5;
|
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5;
|
||||||
Draw.mixcol(Color.darkGray, 1f);
|
Draw.mixcol(Color.darkGray, 1f);
|
||||||
Draw.rect(liquidDrop.icon(Cicon.small), dx, dy - 1);
|
Draw.rect(liquidDrop.icon(Cicon.small), dx, dy - 1);
|
||||||
@@ -80,8 +80,8 @@ public class Pump extends LiquidBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class PumpEntity extends LiquidBlockEntity{
|
public class PumpEntity extends LiquidBlockEntity{
|
||||||
float tiles = 0f;
|
public float amount = 0f;
|
||||||
Liquid liquidDrop = null;
|
public Liquid liquidDrop = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
@@ -97,18 +97,18 @@ public class Pump extends LiquidBlock{
|
|||||||
public void onProximityUpdate(){
|
public void onProximityUpdate(){
|
||||||
super.onProximityUpdate();
|
super.onProximityUpdate();
|
||||||
|
|
||||||
tiles = 0f;
|
amount = 0f;
|
||||||
liquidDrop = null;
|
liquidDrop = null;
|
||||||
|
|
||||||
if(isMultiblock()){
|
if(isMultiblock()){
|
||||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||||
if(canPump(other)){
|
if(canPump(other)){
|
||||||
liquidDrop = other.floor().liquidDrop;
|
liquidDrop = other.floor().liquidDrop;
|
||||||
tiles++;
|
amount += other.floor().liquidMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
tiles = 1f;
|
amount = tile.floor().liquidMultiplier;
|
||||||
liquidDrop = tile.floor().liquidDrop;
|
liquidDrop = tile.floor().liquidDrop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ public class Pump extends LiquidBlock{
|
|||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
if(consValid() && liquidDrop != null){
|
if(consValid() && liquidDrop != null){
|
||||||
float maxPump = Math.min(liquidCapacity - liquids.total(), tiles * pumpAmount * edelta());
|
float maxPump = Math.min(liquidCapacity - liquids.total(), amount * pumpAmount * edelta());
|
||||||
liquids.add(liquidDrop, maxPump);
|
liquids.add(liquidDrop, maxPump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user