I bet this will break shit somewhere (#11292)

This commit is contained in:
EggleEgg 2025-12-18 00:32:53 +01:00 committed by GitHub
parent 8d734d70cd
commit 425b154e3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -70,8 +70,8 @@ public class Block extends UnlockableContent implements Senseable{
public boolean separateItemCapacity = false;
/** maximum items this block can carry (usually, this is per-type of item) */
public int itemCapacity = 10;
/** maximum total liquids this block can carry if hasLiquids = true */
public float liquidCapacity = 10f;
/** maximum total liquids this block can carry if hasLiquids = true. Default value is 10, scales with max liquid consumption in ConsumeLiquid */
public float liquidCapacity = -1f;
/** higher numbers increase liquid output speed; TODO remove and replace with better liquids system */
public float liquidPressure = 1f;
/** If true, this block outputs to its facing direction, when applicable.
@ -1327,6 +1327,17 @@ public class Block extends UnlockableContent implements Senseable{
lightClipSize = Math.max(lightClipSize, size * 30f * 2f);
}
// some blocks dont have hasLiquids but have liquid consumers/liquid capacity
if(liquidCapacity < 0){
float consumeAmount = 1f;
for(var cons : consumeBuilder){
if(cons instanceof ConsumeLiquid liq){
consumeAmount = Math.max(consumeAmount, liq.amount * 60f);
}
}
liquidCapacity = Mathf.round(10f * consumeAmount);
}
if(emitLight){
lightClipSize = Math.max(lightClipSize, lightRadius * 2f);
}

View file

@ -79,7 +79,6 @@ public class Drill extends Block{
solid = true;
group = BlockGroup.drills;
hasLiquids = true;
liquidCapacity = 5f;
hasItems = true;
ambientSound = Sounds.loopDrill;
ambientSoundVolume = 0.019f;