Closes Anuken/Mindustry-Suggestions/issues/4780 (dumping neoplasm from tanks)
This commit is contained in:
@@ -154,6 +154,8 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
public boolean updateInUnits = true;
|
||||
/** if true, this block updates in payloads in units regardless of the experimental game rule */
|
||||
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. */
|
||||
public boolean useColor = true;
|
||||
/** item that drops from this block, used for drills */
|
||||
|
||||
@@ -47,7 +47,10 @@ public class Build{
|
||||
Block sub = ConstructBlock.get(previous.size);
|
||||
|
||||
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);
|
||||
var build = (ConstructBuild)tile.build;
|
||||
|
||||
@@ -5,6 +5,7 @@ import arc.math.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.logic.*;
|
||||
@@ -140,6 +141,16 @@ public class PayloadDeconstructor extends PayloadBlock{
|
||||
float shift = edelta() * deconstructSpeed / deconstructing.buildTime();
|
||||
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;
|
||||
time += edelta();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user