Chained block inventory scaling
This commit is contained in:
@@ -385,10 +385,11 @@ public class Block extends BaseBlock {
|
||||
tempColor.set(Palette.darkFlame);
|
||||
|
||||
if(hasItems){
|
||||
float scaling = inventoryScaling(tile);
|
||||
for(Item item : content.items()){
|
||||
int amount = tile.entity.items.get(item);
|
||||
explosiveness += item.explosiveness * amount;
|
||||
flammability += item.flammability * amount;
|
||||
explosiveness += item.explosiveness * amount * scaling;
|
||||
flammability += item.flammability * amount * scaling;
|
||||
|
||||
if(item.flammability * amount > 0.5){
|
||||
units++;
|
||||
@@ -414,7 +415,7 @@ public class Block extends BaseBlock {
|
||||
float splash = Mathf.clamp(amount / 4f, 0f, 10f);
|
||||
|
||||
for(int i = 0; i < Mathf.clamp(amount / 5, 0, 30); i++){
|
||||
Timers.run(i / 2, () -> {
|
||||
Timers.run(i / 2f, () -> {
|
||||
Tile other = world.tile(tile.x + Mathf.range(size / 2), tile.y + Mathf.range(size / 2));
|
||||
if(other != null){
|
||||
Puddle.deposit(other, liquid, splash);
|
||||
@@ -430,6 +431,11 @@ public class Block extends BaseBlock {
|
||||
}
|
||||
}
|
||||
|
||||
/**Returns scaled # of inventories in this block.*/
|
||||
public float inventoryScaling(Tile tile){
|
||||
return 1f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the flammability of the tile. Used for fire calculations.
|
||||
* Takes flammability of floor liquid into account.
|
||||
|
||||
@@ -89,6 +89,12 @@ public abstract class StorageBlock extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float inventoryScaling(Tile tile){
|
||||
StorageEntity entity = tile.entity();
|
||||
return 1f / entity.graph.getTiles().size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity newEntity(){
|
||||
return new StorageEntity();
|
||||
|
||||
Reference in New Issue
Block a user