Misc cleanup
This commit is contained in:
@@ -103,6 +103,28 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the flammability of the Used for fire calculations.
|
||||
* Takes flammability of floor liquid into account.
|
||||
*/
|
||||
public float getFlammability(){
|
||||
if(!block.hasItems){
|
||||
if(floor.liquidDrop != null && !block.solid){
|
||||
return floor.liquidDrop.flammability;
|
||||
}
|
||||
return 0;
|
||||
}else if(build != null){
|
||||
float result = build.items.sum((item, amount) -> item.flammability * amount);
|
||||
|
||||
if(block.hasLiquids){
|
||||
result += build.liquids.sum((liquid, amount) -> liquid.flammability * amount / 3f);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Convenience method that returns the building of this tile with a cast.
|
||||
* Method name is shortened to prevent conflict. */
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Reference in New Issue
Block a user