From 74233fdc2caeebeab570dd0a1b063a068294b76c Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 20 Feb 2022 13:32:25 -0500 Subject: [PATCH] Erekir parallel tech tree changes --- core/src/mindustry/content/Blocks.java | 1 + .../src/mindustry/content/ErekirTechTree.java | 82 +++++++++++++------ core/src/mindustry/content/Items.java | 1 - core/src/mindustry/content/Liquids.java | 1 - core/src/mindustry/content/UnitTypes.java | 1 + core/src/mindustry/game/EventType.java | 2 +- .../mindustry/ui/dialogs/ResearchDialog.java | 5 +- core/src/mindustry/world/Tile.java | 27 +----- .../world/blocks/sandbox/ItemSource.java | 5 +- 9 files changed, 67 insertions(+), 58 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 13045d34e1..33e31727ad 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -3620,6 +3620,7 @@ public class Blocks{ size = 3; configurable = false; plans.add(new UnitPlan(UnitTypes.stell, 60f * 60f, with(Items.graphite, 20f, Items.silicon, 40f))); + researchCostMultiplier = 1f / 8f; consumePower(2f); }}; diff --git a/core/src/mindustry/content/ErekirTechTree.java b/core/src/mindustry/content/ErekirTechTree.java index 15d4ee9987..78da8a3533 100644 --- a/core/src/mindustry/content/ErekirTechTree.java +++ b/core/src/mindustry/content/ErekirTechTree.java @@ -197,6 +197,12 @@ public class ErekirTechTree{ node(tungstenWallLarge, () -> { }); + + node(carbideWall, () -> { + node(carbideWallLarge, () -> { + + }); + }); }); }); @@ -219,26 +225,32 @@ public class ErekirTechTree{ }); }); - node(tankAssembler, Seq.with(new OnSector(four), new Research(constructor), new Research(atmosphericConcentrator)), () -> { - node(UnitTypes.vanquish, () -> { - node(UnitTypes.conquer, Seq.with(tmpNever), () -> { + node(fabricator, () -> { + node(UnitTypes.stell, Seq.with(new Research(siliconArcFurnace), new Research(plasmaBore), new Research(turbineCondenser)), () -> { - }); }); - node(shipAssembler, Seq.with(new OnSector(five)), () -> { - node(UnitTypes.quell, () -> { - node(UnitTypes.disrupt, Seq.with(tmpNever), () -> { + node(tankAssembler, Seq.with(new OnSector(four), new Research(constructor), new Research(atmosphericConcentrator)), () -> { + node(UnitTypes.vanquish, () -> { + node(UnitTypes.conquer, Seq.with(tmpNever), () -> { }); }); - node(mechAssembler, Seq.with(tmpNever), () -> { - node(UnitTypes.bulwark, () -> { - node(UnitTypes.krepost, Seq.with(tmpNever), () -> { + node(shipAssembler, Seq.with(new OnSector(five)), () -> { + node(UnitTypes.quell, () -> { + node(UnitTypes.disrupt, Seq.with(tmpNever), () -> { }); }); + + node(mechAssembler, Seq.with(tmpNever), () -> { + node(UnitTypes.bulwark, () -> { + node(UnitTypes.krepost, Seq.with(tmpNever), () -> { + + }); + }); + }); }); }); }); @@ -258,26 +270,48 @@ public class ErekirTechTree{ }); nodeProduce(Items.beryllium, () -> { - nodeProduce(Items.oxide, () -> { - nodeProduce(Items.fissileMatter, () -> { - - }); - }); - - nodeProduce(Liquids.ozone, () -> { - nodeProduce(Liquids.hydrogen, () -> { - nodeProduce(Liquids.nitrogen, () -> { - nodeProduce(Liquids.cyanogen, () -> { + nodeProduce(Items.graphite, () -> { + nodeProduce(Items.sand, () -> { + nodeProduce(Items.silicon, () -> { + nodeProduce(Items.oxide, () -> { + nodeProduce(Items.fissileMatter, () -> { + }); }); }); }); - }); - nodeProduce(Items.tungsten, () -> { - nodeProduce(Items.carbide, () -> { - nodeProduce(Liquids.gallium, () -> { + nodeProduce(Liquids.water, () -> { + nodeProduce(Liquids.ozone, () -> { + nodeProduce(Liquids.hydrogen, () -> { + nodeProduce(Liquids.nitrogen, () -> { + nodeProduce(Liquids.cyanogen, () -> { + }); + }); + }); + }); + }); + + nodeProduce(Items.tungsten, () -> { + nodeProduce(Liquids.slag, () -> { + + }); + + nodeProduce(Items.thorium, () -> { + nodeProduce(Items.carbide, () -> { + nodeProduce(Items.surgeAlloy, () -> { + nodeProduce(Items.phaseFabric, () -> { + + }); + }); + + nodeProduce(Liquids.gallium, () -> { + nodeProduce(Items.scrap, () -> { + + }); + }); + }); }); }); }); diff --git a/core/src/mindustry/content/Items.java b/core/src/mindustry/content/Items.java index 7a638ac744..afe6ffcfeb 100644 --- a/core/src/mindustry/content/Items.java +++ b/core/src/mindustry/content/Items.java @@ -35,7 +35,6 @@ public class Items{ }}; sand = new Item("sand", Color.valueOf("f7cba4")){{ - alwaysUnlocked = true; lowPriority = true; }}; diff --git a/core/src/mindustry/content/Liquids.java b/core/src/mindustry/content/Liquids.java index 5a3a338133..ce10382ef9 100644 --- a/core/src/mindustry/content/Liquids.java +++ b/core/src/mindustry/content/Liquids.java @@ -12,7 +12,6 @@ public class Liquids{ water = new Liquid("water", Color.valueOf("596ab8")){{ heatCapacity = 0.4f; - alwaysUnlocked = true; effect = StatusEffects.wet; boilPoint = 0.5f; gasColor = Color.grays(0.9f); diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index bf76252a3d..74a16604d0 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2425,6 +2425,7 @@ public class UnitTypes{ armor = 5f; areaDamage = 5f; treadRects = new Rect[]{new Rect(12, 7, 14, 51)}; + researchCostMultiplier = 0f; weapons.add(new Weapon("stell-weapon"){{ layerOffset = 0.0001f; diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index cf3e2104f9..6537cb7696 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -281,7 +281,7 @@ public class EventType{ /** * Called *after* a tile has changed. * WARNING! This event is special: its instance is reused! Do not cache or use with a timer. - * Do not modify any tiles inside listeners that use this tile. + * Do not modify any tiles inside listener code. * */ public static class TileChangeEvent{ public Tile tile; diff --git a/core/src/mindustry/ui/dialogs/ResearchDialog.java b/core/src/mindustry/ui/dialogs/ResearchDialog.java index 18cbc03e4e..afec0901a0 100644 --- a/core/src/mindustry/ui/dialogs/ResearchDialog.java +++ b/core/src/mindustry/ui/dialogs/ResearchDialog.java @@ -325,16 +325,17 @@ public class ResearchDialog extends BaseDialog{ void checkNodes(TechTreeNode node){ boolean locked = locked(node.node); - if(!locked) node.visible = true; + if(!locked && (node.parent == null || node.parent.visible)) node.visible = true; node.selectable = selectable(node.node); for(TechTreeNode l : node.children){ - l.visible = !locked; + l.visible = !locked && l.parent.visible; checkNodes(l); } itemDisplay.rebuild(items); } + boolean selectable(TechNode node){ return node.content.unlocked() || !node.objectives.contains(i -> !i.complete()); } diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index 28632bf598..e28a2ad931 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -21,8 +21,6 @@ import mindustry.world.blocks.environment.*; import static mindustry.Vars.*; public class Tile implements Position, QuadTreeObject, Displayable{ - private static boolean tileChangeLock = false; - private static boolean tilePreChangeLock = false; private static final TileChangeEvent tileChange = new TileChangeEvent(); private static final TilePreChangeEvent preChange = new TilePreChangeEvent(); private static final ObjectSet tileSet = new ObjectSet<>(); @@ -632,34 +630,13 @@ public class Tile implements Position, QuadTreeObject, Displayable{ protected void fireChanged(){ if(!world.isGenerating()){ - - //A TileChangeEvent may cause other TileChangeEvents to occur, and if that happens, allocate a new instance. - boolean wasLocked = tileChangeLock; - var eventInst = wasLocked ? new TileChangeEvent() : tileChange; - tileChangeLock = true; - - Events.fire(eventInst.set(this)); - - //unlock after it's done - if(!wasLocked){ - tileChangeLock = false; - } + Events.fire(tileChange.set(this)); } } protected void firePreChanged(){ if(!world.isGenerating()){ - - //same as above - boolean wasLocked = tilePreChangeLock; - var eventInst = wasLocked ? new TilePreChangeEvent() : preChange; - tilePreChangeLock = true; - - Events.fire(eventInst.set(this)); - - if(!wasLocked){ - tilePreChangeLock = false; - } + Events.fire(preChange.set(this)); } } diff --git a/core/src/mindustry/world/blocks/sandbox/ItemSource.java b/core/src/mindustry/world/blocks/sandbox/ItemSource.java index 70babad3d3..a8b571c576 100644 --- a/core/src/mindustry/world/blocks/sandbox/ItemSource.java +++ b/core/src/mindustry/world/blocks/sandbox/ItemSource.java @@ -81,10 +81,7 @@ public class ItemSource extends Block{ while(counter >= limit){ items.set(outputItem, 1); - if(dump(outputItem)){ - //for debugging only - produced(outputItem); - } + dump(outputItem); items.set(outputItem, 0); counter -= limit; }