From e55f6ecd6b0f1d2ea4c69aad932b49965df725cd Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 20 Oct 2018 13:49:58 -0400 Subject: [PATCH] Fixes to power system --- .../io/anuke/mindustry/content/blocks/CraftingBlocks.java | 4 ++++ .../anuke/mindustry/world/blocks/distribution/Router.java | 6 ++++++ .../io/anuke/mindustry/world/blocks/power/PowerGraph.java | 3 ++- .../mindustry/world/blocks/production/PhaseWeaver.java | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java b/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java index a08b971250..f5ab2fa73c 100644 --- a/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java @@ -46,6 +46,7 @@ public class CraftingBlocks extends BlockList implements ContentList{ craftEffect = BlockFx.smeltsmoke; result = Items.silicon; craftTime = 40f; + powerCapacity = 20f; size = 2; hasLiquids = false; flameColor = Color.valueOf("ffef99"); @@ -60,6 +61,7 @@ public class CraftingBlocks extends BlockList implements ContentList{ craftTime = 60f; output = Items.plastanium; itemCapacity = 30; + powerCapacity = 40f; size = 2; health = 320; hasPower = hasLiquids = true; @@ -75,6 +77,7 @@ public class CraftingBlocks extends BlockList implements ContentList{ craftEffect = BlockFx.smeltsmoke; result = Items.phasematter; craftTime = 120f; + powerCapacity = 50f; size = 2; consumes.items(new ItemStack[]{new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10)}); @@ -85,6 +88,7 @@ public class CraftingBlocks extends BlockList implements ContentList{ craftEffect = BlockFx.smeltsmoke; result = Items.surgealloy; craftTime = 75f; + powerCapacity = 60f; size = 2; useFlux = true; diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java index 2bf270c27f..92760c8a1b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java @@ -32,6 +32,12 @@ public class Router extends Block{ @Override public void update(Tile tile){ SplitterEntity entity = tile.entity(); + + if(entity.lastItem == null && entity.items.total() > 0){ + entity.lastItem = entity.items.take(); + entity.items.add(entity.lastItem, 1); + } + if(entity.lastItem != null){ entity.time += 1f/speed * Timers.delta(); Tile target = getTileTarget(tile, entity.lastItem, entity.lastInput, false); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java index cbb38364a1..957d5ee250 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.IntSet; import com.badlogic.gdx.utils.ObjectSet; import com.badlogic.gdx.utils.Queue; import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Timers; import static io.anuke.mindustry.Vars.threads; @@ -55,7 +56,7 @@ public class PowerGraph{ outputs += Math.min(tile.block().powerCapacity - tile.entity.power.amount, toEach) / toEach; } - float finalEach = toEach / outputs; + float finalEach = toEach / outputs * Timers.delta(); float buffer = 0f; if(Float.isNaN(finalEach) || Float.isInfinite(finalEach)){ diff --git a/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java b/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java index 5a7369d1aa..f6758438f8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java @@ -46,6 +46,7 @@ public class PhaseWeaver extends PowerSmelter{ Shaders.build.region = weaveRegion; Shaders.build.progress = progress; Shaders.build.color.set(Palette.accent); + Shaders.build.color.a = entity.heat; Shaders.build.time = -entity.time / 10f; Graphics.shader(Shaders.build, false);