Misc. bugfixes
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<CharSequence> 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));
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user