From 02fad0a9cc2f9c1adb564809cb7e9c60a44baf9d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 3 Mar 2019 10:55:56 -0500 Subject: [PATCH] Consumer fixes / Removed unit factory target tag / Rank tweak --- core/assets/bundles/bundle.properties | 4 ++-- core/src/io/anuke/mindustry/game/Stats.java | 6 +++--- core/src/io/anuke/mindustry/ui/dialogs/GameOverDialog.java | 2 +- .../io/anuke/mindustry/world/blocks/power/PowerGraph.java | 3 ++- .../io/anuke/mindustry/world/blocks/production/Drill.java | 2 +- .../io/anuke/mindustry/world/blocks/units/UnitFactory.java | 2 +- .../io/anuke/mindustry/world/consumers/ConsumeItems.java | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index b20b6e0de4..1015ca19d4 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -788,8 +788,8 @@ block.solar-panel-large.description = Provides much better power supply than a s block.thorium-reactor.description = Generates huge amounts of power from highly radioactive thorium. Requires constant cooling. Will explode violently if insufficient amounts of coolant are supplied. Power output depends on fullness, with base power generated at half capacity. block.rtg-generator.description = A radioisotope thermoelectric generator which does not require cooling but provides less power than a thorium reactor. block.unloader.description = Unloads items from a container, vault or core onto a conveyor or directly into an adjacent block. The type of item to be unloaded can be changed by tapping on the unloader. -block.container.description = Stores a small amount of items of each type. Adjacent containers, vaults and cores will be treated as a single storage unit. An[LIGHT_GRAY] unloader[] can be used to retrieve items from the container. -block.vault.description = Stores a large amount of items of each type. Adjacent containers, vaults and cores will be treated as a single storage unit. An[LIGHT_GRAY] unloader[] can be used to retrieve items from the vault. +block.container.description = Stores a small amount of items of each type. An[LIGHT_GRAY] unloader[] can be used to retrieve items from the container. +block.vault.description = Stores a large amount of items of each type. An[LIGHT_GRAY] unloader[] can be used to retrieve items from the vault. block.mechanical-drill.description = A cheap drill. When placed on appropriate tiles, outputs items at a slow pace indefinitely. block.pneumatic-drill.description = An improved drill which is faster and able to process harder materials by making use of air pressure. block.laser-drill.description = Allows drilling even faster through laser technology, but requires power. Additionally, radioactive thorium can be retrieved with this drill. diff --git a/core/src/io/anuke/mindustry/game/Stats.java b/core/src/io/anuke/mindustry/game/Stats.java index d324cd6c83..ceb10738eb 100644 --- a/core/src/io/anuke/mindustry/game/Stats.java +++ b/core/src/io/anuke/mindustry/game/Stats.java @@ -25,7 +25,7 @@ public class Stats{ /**Friendly buildings destroyed.*/ public int buildingsDestroyed; - public RankResult calculateRank(Zone zone, Rules rules, boolean launched){ + public RankResult calculateRank(Zone zone, boolean launched){ float score = 0; //each new launch period adds onto the rank 1.5 'points' @@ -35,14 +35,14 @@ public class Stats{ int capacity = zone.loadout.core().itemCapacity; - //weigh used fractions of + //weigh used fractions float frac = 0f; Array obtainable = Array.with(zone.resources).select(i -> i.type == ItemType.material); for(Item item : obtainable){ frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size; } - score += frac*3f; + score += frac*2.4f; if(!launched){ score *= 0.5f; diff --git a/core/src/io/anuke/mindustry/ui/dialogs/GameOverDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/GameOverDialog.java index ef09686e07..f20e225fe2 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/GameOverDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/GameOverDialog.java @@ -70,7 +70,7 @@ public class GameOverDialog extends FloatingDialog{ } if(world.isZone()){ - RankResult result = state.stats.calculateRank(world.getZone(), state.rules, state.launched); + RankResult result = state.stats.calculateRank(world.getZone(), state.launched); cont.add(Core.bundle.format("stat.rank", result.rank + result.modifier)); cont.row(); } 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 173947f4b0..e56ec91cff 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -122,7 +122,8 @@ public class PowerGraph{ } public void distributePower(float needed, float produced){ - if(Mathf.isEqual(needed, 0f)){ return; } + //distribute even if not needed. this is because some might be requiring power but not requesting it; it updates consumers + //if(Mathf.isEqual(needed, 0f)) return; float coverage = Math.min(1, produced / needed); for(Tile consumer : consumers){ diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java index 3bd9bb259e..572eb8d48f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java @@ -85,7 +85,7 @@ public class Drill extends Block{ bars.add("drillspeed", e -> { DrillEntity entity = (DrillEntity)e; - return new Bar(() -> Core.bundle.format("blocks.outputspeed", Strings.toFixed(entity.lastDrillSpeed * 60, 2)), () -> Pal.ammo, () -> entity.warmup); + return new Bar(() -> Core.bundle.format("blocks.outputspeed", Strings.toFixed(entity.lastDrillSpeed * 60 * entity.timeScale, 2)), () -> Pal.ammo, () -> entity.warmup); }); } diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index 8aacd1d88f..da0c8cffe6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -51,7 +51,7 @@ public class UnitFactory extends Block{ hasPower = true; hasItems = true; solid = false; - flags = EnumSet.of(BlockFlag.producer, BlockFlag.target); + flags = EnumSet.of(BlockFlag.producer); consumes.require(ConsumeItems.class); } diff --git a/core/src/io/anuke/mindustry/world/consumers/ConsumeItems.java b/core/src/io/anuke/mindustry/world/consumers/ConsumeItems.java index e0d9f61006..517e29956d 100644 --- a/core/src/io/anuke/mindustry/world/consumers/ConsumeItems.java +++ b/core/src/io/anuke/mindustry/world/consumers/ConsumeItems.java @@ -26,7 +26,7 @@ public class ConsumeItems extends Consume{ @Override public void build(Tile tile, Table table){ for(ItemStack stack : items){ - table.add(new ReqImage(new ItemImage(stack.item.icon(Icon.large), stack.amount), () -> valid(tile.block(), tile.entity))).size(8*4).padRight(5); + table.add(new ReqImage(new ItemImage(stack.item.icon(Icon.large), stack.amount), () -> tile.entity != null && tile.entity.items != null && tile.entity.items.has(stack.item, stack.amount))).size(8*4).padRight(5); } }