Fixed unit pads hiding in PvP / Fixed recipes not deselecting in menu
This commit is contained in:
@@ -3,9 +3,9 @@ package io.anuke.mindustry.content;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.blocks.*;
|
import io.anuke.mindustry.content.blocks.*;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.GameMode;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.type.Recipe;
|
||||||
|
|
||||||
import static io.anuke.mindustry.type.Category.*;
|
import static io.anuke.mindustry.type.Category.*;
|
||||||
|
|
||||||
@@ -145,14 +145,14 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(units, UnitBlocks.dronePad, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
|
new Recipe(units, UnitBlocks.dronePad, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
|
||||||
new Recipe(units, UnitBlocks.fabricatorPad, new ItemStack(Items.densealloy, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
|
new Recipe(units, UnitBlocks.fabricatorPad, new ItemStack(Items.densealloy, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.daggerPad, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70)).setMode(GameMode.noWaves);
|
new Recipe(units, UnitBlocks.daggerPad, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70)).setPad();
|
||||||
new Recipe(units, UnitBlocks.titanPad, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90)).setMode(GameMode.noWaves);
|
new Recipe(units, UnitBlocks.titanPad, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90)).setPad();
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.interceptorPad, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90)).setMode(GameMode.noWaves);
|
new Recipe(units, UnitBlocks.interceptorPad, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90)).setPad();
|
||||||
new Recipe(units, UnitBlocks.monsoonPad, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220)).setMode(GameMode.noWaves);
|
new Recipe(units, UnitBlocks.monsoonPad, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220)).setPad();
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
|
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
|
||||||
new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200)).setMode(GameMode.noWaves);
|
new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200)).setPad();
|
||||||
|
|
||||||
//LIQUIDS
|
//LIQUIDS
|
||||||
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1)).setDependencies(CraftingBlocks.smelter);
|
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1)).setDependencies(CraftingBlocks.smelter);
|
||||||
@@ -176,43 +176,6 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(units, DebugBlocks.powerInfinite).setDebug();
|
new Recipe(units, DebugBlocks.powerInfinite).setDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init(Object... objects){
|
|
||||||
Category cat = null;
|
|
||||||
Block block = null;
|
|
||||||
ItemStack stack = null;
|
|
||||||
Array<ItemStack> arr = new Array<>();
|
|
||||||
for(Object object : objects){
|
|
||||||
if(object instanceof Category){
|
|
||||||
if(stack != null) throw new RuntimeException("Finish defining stack before beginning category");
|
|
||||||
if(block != null){
|
|
||||||
new Recipe(cat, block, arr.toArray(ItemStack.class));
|
|
||||||
block = null;
|
|
||||||
stack = null;
|
|
||||||
arr.clear();
|
|
||||||
}
|
|
||||||
cat = (Category) object;
|
|
||||||
}else if(object instanceof Block){
|
|
||||||
if(cat == null) throw new RuntimeException("Finish defining category before beginning blocks");
|
|
||||||
if(block != null){
|
|
||||||
new Recipe(cat, block, arr.toArray(ItemStack.class));
|
|
||||||
stack = null;
|
|
||||||
arr.clear();
|
|
||||||
}
|
|
||||||
block = (Block) object;
|
|
||||||
arr.clear();
|
|
||||||
}else if(object instanceof Item){
|
|
||||||
if(block == null) throw new RuntimeException("Finish defining block before defining item");
|
|
||||||
if(stack != null) throw new RuntimeException("Finish defining stack before defining another stack");
|
|
||||||
stack = new ItemStack((Item) object, 1);
|
|
||||||
}else if(object instanceof Integer){
|
|
||||||
if(stack == null) throw new RuntimeException("Finish defining item before defining item amount");
|
|
||||||
stack.amount = (Integer) object;
|
|
||||||
arr.add(stack);
|
|
||||||
stack = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Array<? extends Content> getAll(){
|
public Array<? extends Content> getAll(){
|
||||||
return Recipe.all();
|
return Recipe.all();
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ public enum GameMode{
|
|||||||
disableWaves = true;
|
disableWaves = true;
|
||||||
hidden = true;
|
hidden = true;
|
||||||
autoSpawn = true;
|
autoSpawn = true;
|
||||||
|
showPads = true;
|
||||||
}},
|
}},
|
||||||
pvp{{
|
pvp{{
|
||||||
|
showPads = true;
|
||||||
disableWaves = true;
|
disableWaves = true;
|
||||||
isPvp = true;
|
isPvp = true;
|
||||||
hidden = true;
|
hidden = true;
|
||||||
@@ -24,7 +26,7 @@ public enum GameMode{
|
|||||||
respawnTime = 60 * 10;
|
respawnTime = 60 * 10;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
public boolean infiniteResources, disableWaveTimer, disableWaves, hidden, autoSpawn, isPvp;
|
public boolean infiniteResources, disableWaveTimer, disableWaves, hidden, autoSpawn, isPvp, showPads;
|
||||||
public float enemyCoreBuildRadius = 400f;
|
public float enemyCoreBuildRadius = 400f;
|
||||||
public float enemyCoreShieldRadius = 140f;
|
public float enemyCoreShieldRadius = 140f;
|
||||||
public float respawnTime = 60 * 4;
|
public float respawnTime = 60 * 4;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.utils.ObjectMap;
|
|||||||
import com.badlogic.gdx.utils.OrderedMap;
|
import com.badlogic.gdx.utils.OrderedMap;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.GameMode;
|
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.ui.ContentDisplay;
|
import io.anuke.mindustry.ui.ContentDisplay;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
@@ -35,7 +34,7 @@ public class Recipe implements UnlockableContent{
|
|||||||
|
|
||||||
public boolean desktopOnly = false, debugOnly = false;
|
public boolean desktopOnly = false, debugOnly = false;
|
||||||
//the only gamemode in which the recipe shows up
|
//the only gamemode in which the recipe shows up
|
||||||
public GameMode targetMode;
|
public boolean isPad;
|
||||||
|
|
||||||
private Block[] dependencies;
|
private Block[] dependencies;
|
||||||
private Recipe[] recipeDependencies;
|
private Recipe[] recipeDependencies;
|
||||||
@@ -104,8 +103,8 @@ public class Recipe implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Recipe setMode(GameMode mode){
|
public Recipe setPad(){
|
||||||
this.targetMode = mode;
|
this.isPad = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ public class BlocksFragment extends Fragment{
|
|||||||
descTable = new Table("button");
|
descTable = new Table("button");
|
||||||
descTable.visible(() -> (hoverRecipe != null || input.recipe != null) && shown); //make sure it's visible when necessary
|
descTable.visible(() -> (hoverRecipe != null || input.recipe != null) && shown); //make sure it's visible when necessary
|
||||||
descTable.update(() -> {
|
descTable.update(() -> {
|
||||||
|
if(state.is(State.menu)){
|
||||||
|
descTable.clear();
|
||||||
|
control.input(0).recipe = null;
|
||||||
|
}
|
||||||
// note: This is required because there is no direct connection between input.recipe and the description ui.
|
// note: This is required because there is no direct connection between input.recipe and the description ui.
|
||||||
// If input.recipe gets set to null, a proper cleanup of the ui elements is required.
|
// If input.recipe gets set to null, a proper cleanup of the ui elements is required.
|
||||||
boolean anyRecipeShown = input.recipe != null || hoverRecipe != null;
|
boolean anyRecipeShown = input.recipe != null || hoverRecipe != null;
|
||||||
@@ -167,7 +171,7 @@ public class BlocksFragment extends Fragment{
|
|||||||
|
|
||||||
//add actual recipes
|
//add actual recipes
|
||||||
for(Recipe r : recipes){
|
for(Recipe r : recipes){
|
||||||
if((r.debugOnly && !debug) || (r.desktopOnly && mobile) || (r.targetMode != null && r.targetMode != state.mode)) continue;
|
if((r.debugOnly && !debug) || (r.desktopOnly && mobile) || (r.isPad && !state.mode.showPads)) continue;
|
||||||
|
|
||||||
ImageButton image = new ImageButton(new TextureRegion(), "select");
|
ImageButton image = new ImageButton(new TextureRegion(), "select");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user