Misc. cleanup

This commit is contained in:
Anuken
2019-01-20 15:21:46 -05:00
parent 46dfa064d0
commit cbdce79d7d
6 changed files with 63 additions and 30 deletions
+54 -27
View File
@@ -4,6 +4,7 @@ import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.CacheLayer; import io.anuke.mindustry.graphics.CacheLayer;
import io.anuke.mindustry.type.Category;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -25,6 +26,7 @@ import io.anuke.mindustry.world.blocks.units.RepairPoint;
import io.anuke.mindustry.world.blocks.units.UnitFactory; import io.anuke.mindustry.world.blocks.units.UnitFactory;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.state;
public class Blocks implements ContentList{ public class Blocks implements ContentList{
public static Block public static Block
@@ -360,11 +362,26 @@ public class Blocks implements ContentList{
//endregion //endregion
//region sandbox //region sandbox
powerVoid = new PowerVoid("power-void"); powerVoid = new PowerVoid("power-void"){{
powerSource = new PowerSource("power-source"); requirements(Category.power, () -> state.rules.infiniteResources, ItemStack.with());
itemSource = new ItemSource("item-source"); alwaysUnlocked = true;
itemVoid = new ItemVoid("item-void"); }};
liquidSource = new LiquidSource("liquid-source"); powerSource = new PowerSource("power-source"){{
requirements(Category.power, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
itemSource = new ItemSource("item-source"){{
requirements(Category.distribution, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
itemVoid = new ItemVoid("item-void"){{
requirements(Category.distribution, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
liquidSource = new LiquidSource("liquid-source"){{
requirements(Category.liquid, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
//endregion //endregion
//region defense //region defense
@@ -458,16 +475,19 @@ public class Blocks implements ContentList{
conveyor = new Conveyor("conveyor"){{ conveyor = new Conveyor("conveyor"){{
health = 45; health = 45;
speed = 0.03f; speed = 0.03f;
requirements(Category.distribution, ItemStack.with(Items.copper, 1), true);
}}; }};
titaniumConveyor = new Conveyor("titanium-conveyor"){{ titaniumConveyor = new Conveyor("titanium-conveyor"){{
health = 65; health = 65;
speed = 0.07f; speed = 0.07f;
requirements(Category.distribution, ItemStack.with(Items.copper, 2, Items.titanium, 1));
}}; }};
junction = new Junction("junction"){{ junction = new Junction("junction"){{
speed = 26; speed = 26;
capacity = 32; capacity = 32;
requirements(Category.distribution, ItemStack.with(Items.copper, 2));
}}; }};
itemBridge = new BufferedItemBridge("bridge-conveyor"){{ itemBridge = new BufferedItemBridge("bridge-conveyor"){{
@@ -482,9 +502,13 @@ public class Blocks implements ContentList{
consumes.power(0.03f, 1.0f); consumes.power(0.03f, 1.0f);
}}; }};
sorter = new Sorter("sorter"); sorter = new Sorter("sorter"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 5, Items.titanium, 4));
}};
router = new Router("router"); router = new Router("router"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 6));
}};
distributor = new Router("distributor"){{ distributor = new Router("distributor"){{
size = 2; size = 2;
@@ -560,6 +584,28 @@ public class Blocks implements ContentList{
//endregion //endregion
//region power //region power
powerNode = new PowerNode("power-node"){{
maxNodes = 4;
laserRange = 6;
requirements(Category.power, ItemStack.with(Items.copper, 2, Items.lead, 6));
}};
powerNodeLarge = new PowerNode("power-node-large"){{
size = 2;
maxNodes = 6;
laserRange = 9.5f;
requirements(Category.power, ItemStack.with(Items.silicon, 6, Items.lead, 20, Items.titanium, 6));
}};
battery = new Battery("battery"){{
consumes.powerBuffered(320f, 1f);
}};
batteryLarge = new Battery("battery-large"){{
size = 3;
consumes.powerBuffered(2000f, 1f);
}};
combustionGenerator = new BurnerGenerator("combustion-generator"){{ combustionGenerator = new BurnerGenerator("combustion-generator"){{
powerProduction = 0.09f; powerProduction = 0.09f;
itemDuration = 40f; itemDuration = 40f;
@@ -604,26 +650,6 @@ public class Blocks implements ContentList{
size = 4; size = 4;
health = 600; health = 600;
}}; }};
battery = new Battery("battery"){{
consumes.powerBuffered(320f, 1f);
}};
batteryLarge = new Battery("battery-large"){{
size = 3;
consumes.powerBuffered(2000f, 1f);
}};
powerNode = new PowerNode("power-node"){{
maxNodes = 4;
laserRange = 6;
}};
powerNodeLarge = new PowerNode("power-node-large"){{
size = 2;
maxNodes = 6;
laserRange = 9.5f;
}};
//endregion power //endregion power
//region production //region production
@@ -772,6 +798,7 @@ public class Blocks implements ContentList{
health = 110; health = 110;
inaccuracy = 2f; inaccuracy = 2f;
rotatespeed = 10f; rotatespeed = 10f;
requirements(Category.turret, ItemStack.with(Items.copper, 60), true);
}}; }};
hail = new ArtilleryTurret("hail"){{ hail = new ArtilleryTurret("hail"){{
@@ -77,7 +77,7 @@ public class TechTreeDialog extends FloatingDialog{
if(!locked) node.visible = true; if(!locked) node.visible = true;
for(TreeNode child : node.children){ for(TreeNode child : node.children){
TechTreeNode l = (TechTreeNode)child; TechTreeNode l = (TechTreeNode)child;
l.visible = !locked; l.visible = !locked && l.node.block.isVisible();
checkNodes(l); checkNodes(l);
} }
} }
@@ -33,7 +33,7 @@ public class PlacementFragment extends Fragment{
final int rowWidth = 4; final int rowWidth = 4;
Array<Block> returnArray = new Array<>(); Array<Block> returnArray = new Array<>();
Category currentCategory = Category.turret; Category currentCategory = Category.distribution;
Block hovered, lastDisplay; Block hovered, lastDisplay;
Tile hoverTile; Tile hoverTile;
Table blockTable, toggler, topTable; Table blockTable, toggler, topTable;
@@ -506,6 +506,11 @@ public class Block extends BlockStorage{
return alwaysUnlocked; return alwaysUnlocked;
} }
protected void requirements(Category cat, ItemStack[] stacks, boolean unlocked){
requirements(cat, () -> true, stacks);
this.alwaysUnlocked = unlocked;
}
protected void requirements(Category cat, ItemStack[] stacks){ protected void requirements(Category cat, ItemStack[] stacks){
requirements(cat, () -> true, stacks); requirements(cat, () -> true, stacks);
} }
@@ -150,6 +150,7 @@ public class BuildBlock extends Block{
@Override @Override
public void drawShadow(Tile tile){ public void drawShadow(Tile tile){
//don't //don't
//TODO maybe do
} }
@Override @Override
@@ -136,7 +136,7 @@ public class Drill extends Block{
table.addImage(item.name + "1").size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3); table.addImage(item.name + "1").size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
table.add(item.localizedName()); table.add(item.localizedName());
if(i != list.size - 1){ if(i != list.size - 1){
table.add("/"); table.add("/").padLeft(5).padRight(5);
} }
} }
}); });