From 0509c285760ee95a1129287e2a123ed2e2955aec Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 12 Oct 2019 18:39:08 -0400 Subject: [PATCH] Fixed bizzare single type generator initialization --- core/src/io/anuke/mindustry/content/Blocks.java | 3 ++- core/src/io/anuke/mindustry/mod/ContentParser.java | 7 +++++-- .../mindustry/world/blocks/power/ItemLiquidGenerator.java | 5 +++-- .../mindustry/world/blocks/power/SingleTypeGenerator.java | 5 +---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 0fa8f44e5c..4a48bca509 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1083,11 +1083,12 @@ public class Blocks implements ContentList{ size = 2; }}; - differentialGenerator = new SingleTypeGenerator(true, false, "differential-generator"){{ + differentialGenerator = new SingleTypeGenerator("differential-generator"){{ requirements(Category.power, ItemStack.with(Items.copper, 70, Items.titanium, 50, Items.lead, 100, Items.silicon, 65, Items.metaglass, 50)); powerProduction = 16f; itemDuration = 120f; hasLiquids = true; + hasItems = true; size = 3; consumes.item(Items.pyratite).optional(true, false); diff --git a/core/src/io/anuke/mindustry/mod/ContentParser.java b/core/src/io/anuke/mindustry/mod/ContentParser.java index 56b6448301..0e1c729b60 100644 --- a/core/src/io/anuke/mindustry/mod/ContentParser.java +++ b/core/src/io/anuke/mindustry/mod/ContentParser.java @@ -289,9 +289,12 @@ public class ContentParser{ } currentMod = mod; + boolean exists = Vars.content.getByName(type, name) != null; Content c = parsers.get(type).parse(mod.name, name, value); - c.sourceFile = file; - c.mod = mod; + if(!exists){ + c.sourceFile = file; + c.mod = mod; + } checkNulls(c); return c; } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java index 0c4830e439..5af8ba1e9c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java @@ -7,6 +7,7 @@ import io.anuke.arc.math.*; import io.anuke.arc.util.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; +import io.anuke.mindustry.entities.Effects.*; import io.anuke.mindustry.entities.type.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.*; @@ -28,8 +29,8 @@ public class ItemLiquidGenerator extends PowerGenerator{ /** Maximum liquid used per frame. */ protected float maxLiquidGenerate = 0.4f; - protected Effects.Effect generateEffect = Fx.generatespark; - protected Effects.Effect explodeEffect = Fx.generatespark; + protected Effect generateEffect = Fx.generatespark; + protected Effect explodeEffect = Fx.generatespark; protected Color heatColor = Color.valueOf("ff9b59"); protected TextureRegion topRegion, liquidRegion; protected boolean randomlyExplode = true; diff --git a/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java index 12f5a629b2..231533fc8c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java @@ -5,12 +5,9 @@ import io.anuke.mindustry.type.Liquid; public class SingleTypeGenerator extends ItemLiquidGenerator{ - public SingleTypeGenerator(boolean hasItems, boolean hasLiquids, String name){ - super(hasItems, hasLiquids, name); - } - public SingleTypeGenerator(String name){ super(name); + defaults = true; } @Override