Misc bugfixes

This commit is contained in:
Anuken
2018-11-19 17:56:26 -05:00
parent f31f09d77a
commit 3c37047afb
2 changed files with 17 additions and 11 deletions

View File

@@ -60,7 +60,7 @@ public class Recipe extends UnlockableContent{
public static Array<Recipe> 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;

View File

@@ -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);
};