Fixed HeatCrafter Consumes Less Liquid (#7288)

This commit is contained in:
BlackDeluxeCat 2022-08-09 02:24:45 +08:00 committed by GitHub
parent fae3360dfc
commit 0802941cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -1685,6 +1685,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
/** Calculate your own efficiency multiplier. */
public float efficiencyScale(){
return 1f;
}
public void updateConsumption(){
//everything is valid when cheating
if(!block.hasConsumers || cheating()){

View File

@ -72,6 +72,7 @@ public class HeatCrafter extends GenericCrafter{
potentialEfficiency *= efficiencyScale();
}
@Override
public float efficiencyScale(){
float over = Math.max(heat - heatRequirement, 0f);
return Math.min(Mathf.clamp(heat / heatRequirement) + over / heatRequirement * overheatScale, maxEfficiency);

View File

@ -40,7 +40,7 @@ public class ConsumeLiquid extends ConsumeLiquidBase{
@Override
public float efficiency(Building build){
float ed = build.edelta();
float ed = build.edelta() * build.efficiencyScale();
if(ed <= 0.00000001f) return 0f;
//there can be more liquid than necessary, so cap at 1
return Math.min(build.liquids.get(liquid) / (amount * ed), 1f);