diff --git a/core/assets/ui/square.fnt b/core/assets/ui/square.fnt index 7a74b6069e..032f5b7854 100644 --- a/core/assets/ui/square.fnt +++ b/core/assets/ui/square.fnt @@ -5,7 +5,7 @@ page id=1 file="square2.png" page id=2 file="square3.png" chars count=11449 char id=13 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=0 page=0 chnl=0 -char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=0 +char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=8 page=0 chnl=0 char id=33 x=2039 y=147 width=7 height=23 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 char id=34 x=147 y=2032 width=15 height=11 xoffset=-1 yoffset=4 xadvance=16 page=0 chnl=0 char id=36 x=7 y=0 width=23 height=31 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=0 diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index dca67baded..f289742c2f 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -26,10 +26,7 @@ import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.ucore.core.*; import io.anuke.ucore.entities.EntityQuery; import io.anuke.ucore.modules.Module; -import io.anuke.ucore.util.Atlas; -import io.anuke.ucore.util.Bundles; -import io.anuke.ucore.util.Strings; -import io.anuke.ucore.util.Timer; +import io.anuke.ucore.util.*; import java.io.IOException; @@ -397,7 +394,7 @@ public class Control extends Module{ } }else{ - if(!state.is(State.paused) || Net.active()){ + if(!state.isPaused()){ Timers.update(); } } diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index ee9433d7d0..fb1feb196d 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -10,6 +10,7 @@ import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Teams; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.world.Tile; @@ -21,7 +22,6 @@ import io.anuke.ucore.entities.EntityQuery; import io.anuke.ucore.modules.Module; import static io.anuke.mindustry.Vars.*; -import io.anuke.mindustry.gen.Call; /** * Logic module. @@ -159,16 +159,13 @@ public class Logic extends Module{ if(!state.is(State.menu)){ - if(!state.is(State.paused) || Net.active()){ - Timers.update(); - } - if(!Net.client() && !world.isInvalidMap()){ updateSectors(); checkGameOver(); } - if(!state.is(State.paused) || Net.active()){ + if(!state.isPaused()){ + Timers.update(); if(!state.mode.disableWaveTimer && !state.mode.disableWaves){ state.wavetime -= Timers.delta(); diff --git a/core/src/io/anuke/mindustry/ui/ItemImage.java b/core/src/io/anuke/mindustry/ui/ItemImage.java index b07b3dba1c..aa1a370efd 100644 --- a/core/src/io/anuke/mindustry/ui/ItemImage.java +++ b/core/src/io/anuke/mindustry/ui/ItemImage.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.ui; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureRegion; import io.anuke.mindustry.type.ItemStack; +import io.anuke.ucore.core.Core; import io.anuke.ucore.function.Supplier; import io.anuke.ucore.scene.ui.Image; import io.anuke.ucore.scene.ui.layout.Stack; @@ -14,7 +15,7 @@ public class ItemImage extends Stack{ public ItemImage(TextureRegion region, Supplier text){ Table t = new Table().left().bottom(); - t.label(text).color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f)); + t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2).get().setFontScale(Unit.dp.scl(0.5f)); t.row(); t.label(text).get().setFontScale(Unit.dp.scl(0.5f)); @@ -25,7 +26,7 @@ public class ItemImage extends Stack{ public ItemImage(ItemStack stack){ Table t = new Table().left().bottom(); - t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f)); + t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2).get().setFontScale(Unit.dp.scl(0.5f)); t.row(); t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f)); diff --git a/core/src/io/anuke/mindustry/world/BaseBlock.java b/core/src/io/anuke/mindustry/world/BaseBlock.java index 9561bf9449..6cc2c79119 100644 --- a/core/src/io/anuke/mindustry/world/BaseBlock.java +++ b/core/src/io/anuke/mindustry/world/BaseBlock.java @@ -40,9 +40,7 @@ public abstract class BaseBlock extends MappableContent{ return true; } - /** - * Returns the amount of items this block can accept. - */ + /**Returns the amount of items this block can accept.*/ public int acceptStack(Item item, int amount, Tile tile, Unit source){ if(acceptItem(item, tile, tile) && hasItems && (source == null || source.getTeam() == tile.getTeam())){ return Math.min(getMaximumAccepted(tile, item), amount); @@ -52,12 +50,10 @@ public abstract class BaseBlock extends MappableContent{ } public int getMaximumAccepted(Tile tile, Item item){ - return itemCapacity - (tile.entity.items.total() - tile.entity.items.get(item)); + return itemCapacity; } - /** - * Remove a stack from this inventory, and return the amount removed. - */ + /**Remove a stack from this inventory, and return the amount removed.*/ public int removeStack(Tile tile, Item item, int amount){ tile.entity.noSleep(); tile.entity.items.remove(item, amount); @@ -88,7 +84,8 @@ public abstract class BaseBlock extends MappableContent{ } public boolean acceptItem(Item item, Tile tile, Tile source){ - return tile.entity != null && consumes.has(ConsumeItem.class) && consumes.item() == item && tile.entity.items.get(item) < getMaximumAccepted(tile, item); + return tile.entity != null && consumes.has(ConsumeItem.class) && consumes.item() == item && + tile.entity.items.get(item) < getMaximumAccepted(tile, item); } public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){ diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java index 41ddb64976..2723d2835d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java @@ -89,7 +89,7 @@ public class ForceProjector extends Block { entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, (float)entity.items.get(consumes.item()) / itemCapacity, 0.1f); - if(!entity.broken && entity.timer.get(timerUse, phaseUseTime) && entity.items.total() > 0){ + if(entity.cons.valid() && !entity.broken && entity.timer.get(timerUse, phaseUseTime) && entity.items.total() > 0){ entity.items.remove(consumes.item(), 1); } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java index c8951d62c9..cae33e9b66 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java @@ -61,7 +61,7 @@ public class MendProjector extends Block{ entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, (float)entity.items.get(consumes.item()) / itemCapacity, 0.1f); - if(entity.timer.get(timerUse, useTime) && entity.items.total() > 0){ + if(entity.cons.valid() && entity.timer.get(timerUse, useTime) && entity.items.total() > 0){ entity.items.remove(consumes.item(), 1); } diff --git a/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java b/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java index 0b25ea2782..1f6948f785 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java @@ -172,7 +172,7 @@ public class PowerSmelter extends PowerBlock{ @Override public int getMaximumAccepted(Tile tile, Item item){ - return itemCapacity - tile.entity.items.get(item); + return itemCapacity; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java index 37b412a012..49042d4180 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java @@ -154,7 +154,7 @@ public class Smelter extends Block{ @Override public int getMaximumAccepted(Tile tile, Item item){ - return itemCapacity - tile.entity.items.get(item); + return itemCapacity; } @Override