Core containers/vaults no longer explode violently

This commit is contained in:
Anuken
2021-07-18 12:12:04 -04:00
parent 974d3498c1
commit 89942416ac
2 changed files with 12 additions and 1 deletions

View File

@@ -1018,6 +1018,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
/** @return the cap for item amount calculations, used when this block explodes. */
public int explosionItemCap(){
return block.itemCapacity;
}
/** Called when the block is destroyed. The tile is still intact at this stage. */
public void onDestroyed(){
float explosiveness = block.baseExplosiveness;
@@ -1026,7 +1031,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(block.hasItems){
for(Item item : content.items()){
int amount = items.get(item);
int amount = Math.min(items.get(item), explosionItemCap());
explosiveness += item.explosiveness * amount;
flammability += item.flammability * amount;
power += item.charge * amount * 100f;

View File

@@ -83,6 +83,12 @@ public class StorageBlock extends Block{
return itemCapacity;
}
@Override
public int explosionItemCap(){
//when linked to a core, containers/vaults are made significantly less explosive.
return linkedCore != null ? Math.min(itemCapacity/60, 6) : itemCapacity;
}
@Override
public void drawSelect(){
if(linkedCore != null){