From 3c37047afb2623bee7bc52e44150639acdb7c801 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Nov 2018 17:56:26 -0500 Subject: [PATCH] Misc bugfixes --- core/src/io/anuke/mindustry/type/Recipe.java | 3 +-- .../ui/fragments/PlacementFragment.java | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/core/src/io/anuke/mindustry/type/Recipe.java b/core/src/io/anuke/mindustry/type/Recipe.java index 2b5d02fb57..daa84726e7 100644 --- a/core/src/io/anuke/mindustry/type/Recipe.java +++ b/core/src/io/anuke/mindustry/type/Recipe.java @@ -60,7 +60,7 @@ public class Recipe extends UnlockableContent{ public static Array getByCategory(Category category){ returnArray.clear(); for(Recipe recipe : content.recipes()){ - if(recipe.category == category && !recipe.isHidden()){ + if(recipe.category == category && recipe.visibility.shown() && (recipe.mode == state.mode || recipe.mode == null)){ returnArray.add(recipe); } } @@ -91,7 +91,6 @@ public class Recipe extends UnlockableContent{ return this; } - @Override public boolean alwaysUnlocked(){ return alwaysUnlocked; diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index 7ac10844df..299caf0744 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Interpolation; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.TileEntity; +import io.anuke.mindustry.game.EventType.WorldLoadGraphicsEvent; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.type.Category; @@ -13,6 +14,7 @@ import io.anuke.mindustry.ui.ImageStack; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.OreBlock; +import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Graphics; import io.anuke.ucore.scene.Group; import io.anuke.ucore.scene.actions.Actions; @@ -34,6 +36,14 @@ public class PlacementFragment extends Fragment{ Table blockTable, toggler; boolean shown = true; + public PlacementFragment(){ + Events.on(WorldLoadGraphicsEvent.class, event -> { + Group group = toggler.getParent(); + toggler.remove(); + build(group); + }); + } + @Override public void build(Group parent){ parent.fill(full -> { @@ -84,16 +94,13 @@ public class PlacementFragment extends Fragment{ } }); - if(!mobile){ - button.hovered(() -> hovered = recipe.result); - button.exited(() -> { - if(hovered == recipe.result){ - hovered = null; - } - }); - } + button.hovered(() -> hovered = recipe.result); + button.exited(() -> { + if(hovered == recipe.result){ + hovered = null; + } + }); } - blockTable.act(0f); };