Skip to content

Commit

Permalink
Implements #40 in new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
JojoFR1 committed May 17, 2024
1 parent 2cfd410 commit 29b9b2e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/src/multicraft/MultiCrafter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@
import mindustry.ui.ItemImage;
import mindustry.world.Block;
import mindustry.world.blocks.heat.*;
import mindustry.world.blocks.heat.HeatConductor.*;
import mindustry.world.blocks.power.*;
import mindustry.world.consumers.*;
import mindustry.world.draw.DrawBlock;
import mindustry.world.draw.DrawDefault;
import mindustry.world.meta.*;

import multicraft.ui.*;

import java.util.*;

import static mindustry.Vars.tilesize;

public class MultiCrafter extends Block {
Expand Down Expand Up @@ -186,6 +182,7 @@ public class MultiCrafterBuild extends Building implements HeatBlock, HeatConsum
* Serialized
*/
public float craftingTime;
public float totalProgress;
/**
* Serialized
*/
Expand Down Expand Up @@ -267,6 +264,7 @@ public void updateTile() {
if (wasVisible && Mathf.chanceDelta(updateEffectChance))
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
} else warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);
totalProgress += warmup * Time.delta;

if (craftTimeNeed <= 0f) {
if (efficiency > 0f)
Expand Down Expand Up @@ -504,6 +502,11 @@ public float progress() {
return Mathf.clamp(cur.craftTime > 0f ? craftingTime / cur.craftTime : 1f);
}

@Override
public float totalProgress() {
return totalProgress;
}

@Override
public void display(Table table) {
super.display(table);
Expand Down

0 comments on commit 29b9b2e

Please sign in to comment.