Closes Anuken/Mindustry-Suggestions/issues/4780 (dumping neoplasm from tanks)
This commit is contained in:
@@ -54,7 +54,7 @@ public class Liquids{
|
|||||||
capPuddles = false;
|
capPuddles = false;
|
||||||
spreadTarget = Liquids.water;
|
spreadTarget = Liquids.water;
|
||||||
moveThroughBlocks = true;
|
moveThroughBlocks = true;
|
||||||
incinerable = true;
|
incinerable = false;
|
||||||
blockReactive = false;
|
blockReactive = false;
|
||||||
canStayOn.addAll(water, oil, cryofluid);
|
canStayOn.addAll(water, oil, cryofluid);
|
||||||
|
|
||||||
|
|||||||
@@ -1344,6 +1344,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
return block.itemCapacity;
|
return block.itemCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Called when a block begins (not finishes!) deconstruction. The building is still present at this point. */
|
||||||
|
public void onDeconstructed(@Nullable Unit builder){
|
||||||
|
//deposit non-incinerable liquid on ground
|
||||||
|
if(liquids != null && liquids.currentAmount() > 0 && (!liquids.current().incinerable || block.deconstructDropAllLiquid)){
|
||||||
|
float perCell = liquids.currentAmount() / (block.size * block.size) * 2f;
|
||||||
|
tile.getLinkedTiles(other -> Puddles.deposit(other, liquids.current(), perCell));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Called when the block is destroyed. The tile is still intact at this stage. */
|
/** Called when the block is destroyed. The tile is still intact at this stage. */
|
||||||
public void onDestroyed(){
|
public void onDestroyed(){
|
||||||
float explosiveness = block.baseExplosiveness;
|
float explosiveness = block.baseExplosiveness;
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public boolean updateInUnits = true;
|
public boolean updateInUnits = true;
|
||||||
/** if true, this block updates in payloads in units regardless of the experimental game rule */
|
/** if true, this block updates in payloads in units regardless of the experimental game rule */
|
||||||
public boolean alwaysUpdateInUnits = false;
|
public boolean alwaysUpdateInUnits = false;
|
||||||
|
/** if false, only incinerable liquids are dropped when deconstructing; otherwise, all liquids are dropped. */
|
||||||
|
public boolean deconstructDropAllLiquid = false;
|
||||||
/** Whether to use this block's color in the minimap. Only used for overlays. */
|
/** Whether to use this block's color in the minimap. Only used for overlays. */
|
||||||
public boolean useColor = true;
|
public boolean useColor = true;
|
||||||
/** item that drops from this block, used for drills */
|
/** item that drops from this block, used for drills */
|
||||||
|
|||||||
@@ -47,7 +47,10 @@ public class Build{
|
|||||||
Block sub = ConstructBlock.get(previous.size);
|
Block sub = ConstructBlock.get(previous.size);
|
||||||
|
|
||||||
Seq<Building> prevBuild = new Seq<>(1);
|
Seq<Building> prevBuild = new Seq<>(1);
|
||||||
if(tile.build != null) prevBuild.add(tile.build);
|
if(tile.build != null){
|
||||||
|
prevBuild.add(tile.build);
|
||||||
|
tile.build.onDeconstructed(unit);
|
||||||
|
}
|
||||||
|
|
||||||
tile.setBlock(sub, team, rotation);
|
tile.setBlock(sub, team, rotation);
|
||||||
var build = (ConstructBuild)tile.build;
|
var build = (ConstructBuild)tile.build;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import arc.math.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.logic.*;
|
import mindustry.logic.*;
|
||||||
@@ -140,6 +141,16 @@ public class PayloadDeconstructor extends PayloadBlock{
|
|||||||
float shift = edelta() * deconstructSpeed / deconstructing.buildTime();
|
float shift = edelta() * deconstructSpeed / deconstructing.buildTime();
|
||||||
float realShift = Math.min(shift, 1f - progress);
|
float realShift = Math.min(shift, 1f - progress);
|
||||||
|
|
||||||
|
//if began deconstruction...
|
||||||
|
if(progress == 0f && shift > 0f && deconstructing instanceof BuildPayload pay){
|
||||||
|
var build = pay.build;
|
||||||
|
//dump liquid on floor (does not respect block configuration with respect to dumping liquids on floor)
|
||||||
|
if(build.liquids != null && build.liquids.currentAmount() > 0){
|
||||||
|
float perCell = build.liquids.currentAmount() / (block.size * block.size) * 2f;
|
||||||
|
tile.getLinkedTiles(other -> Puddles.deposit(other, build.liquids.current(), perCell));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
progress += shift;
|
progress += shift;
|
||||||
time += edelta();
|
time += edelta();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user