From 07ff2de2a225b09d6e68d2f88b93ebd36bcde523 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 16 May 2022 17:53:09 -0400 Subject: [PATCH] Misc tech tree & block stuff --- core/src/mindustry/content/Blocks.java | 2 +- core/src/mindustry/content/TechTree.java | 2 +- core/src/mindustry/mod/ContentParser.java | 32 ++++++++++++------- .../blocks/payloads/PayloadDeconstructor.java | 2 +- gradle.properties | 2 +- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 50cd687c4c..8225ed1b0d 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -4445,7 +4445,7 @@ public class Blocks{ consumePower(2f); size = 3; //TODO expand this list - filter = Seq.with(Blocks.tungstenWallLarge, Blocks.berylliumWallLarge, Blocks.carbideWallLarge, Blocks.reinforcedLiquidContainer, Blocks.reinforcedContainer, Blocks.beamNode); + filter = Seq.with(Blocks.tungstenWallLarge, Blocks.berylliumWallLarge, Blocks.carbideWallLarge, Blocks.reinforcedSurgeWallLarge, Blocks.reinforcedLiquidContainer, Blocks.reinforcedContainer, Blocks.beamNode); }}; //yes this block is pretty much useless diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index e8a64bc168..aef00856f5 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -141,7 +141,7 @@ public class TechTree{ } public String localizedName(){ - return Core.bundle.get("techtree." + name); + return Core.bundle.get("techtree." + name, name); } public void setupRequirements(ItemStack[] requirements){ diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 9cfdb57a3d..23cd8da414 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -886,7 +886,7 @@ public class ContentParser{ researchName = research.asString(); customRequirements = null; }else{ - researchName = research.getString("parent"); + researchName = research.getString("parent", null); customRequirements = research.has("requirements") ? parser.readValue(ItemStack[].class, research.get("requirements")) : null; } @@ -922,18 +922,28 @@ public class ContentParser{ node.setupRequirements(unlock.researchRequirements()); } - //find parent node. - TechNode parent = TechTree.all.find(t -> t.content.name.equals(researchName) || t.content.name.equals(currentMod.name + "-" + researchName) || t.content.name.equals(SaveVersion.mapFallback(researchName))); - - if(parent == null){ - Log.warn("Content '" + researchName + "' isn't in the tech tree, but '" + unlock.name + "' requires it to be researched."); + if(research.getBoolean("root", false)){ + node.name = research.getString("name", unlock.name); + node.requiresUnlock = research.getBoolean("requiresUnlock", false); + TechTree.roots.add(node); }else{ - //add this node to the parent - if(!parent.children.contains(node)){ - parent.children.add(node); + if(researchName != null){ + //find parent node. + TechNode parent = TechTree.all.find(t -> t.content.name.equals(researchName) || t.content.name.equals(currentMod.name + "-" + researchName) || t.content.name.equals(SaveVersion.mapFallback(researchName))); + + if(parent == null){ + Log.warn("Content '" + researchName + "' isn't in the tech tree, but '" + unlock.name + "' requires it to be researched."); + }else{ + //add this node to the parent + if(!parent.children.contains(node)){ + parent.children.add(node); + } + //reparent the node + node.parent = parent; + } + }else{ + Log.warn(unlock.name + " is not a root node, and does not have a `parent: ` property. Ignoring."); } - //reparent the node - node.parent = parent; } }); } diff --git a/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java b/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java index cd2df6d253..5c334bda56 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java @@ -144,7 +144,7 @@ public class PayloadDeconstructor extends PayloadBlock{ time += edelta(); for(int i = 0; i < reqs.length; i++){ - accum[i] += reqs[i].amount * state.rules.deconstructRefundMultiplier * realShift; + accum[i] += reqs[i].amount * (payload instanceof BuildPayload ? state.rules.buildCostMultiplier : 1f) * realShift; } } diff --git a/gradle.properties b/gradle.properties index 87869f1649..33969d93cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=dfcb21ce56 +archash=ef9d6ac655