diff --git a/core/src/io/anuke/mindustry/ctype/UnlockableContent.java b/core/src/io/anuke/mindustry/ctype/UnlockableContent.java index bc43a75d97..9c33b09fb6 100644 --- a/core/src/io/anuke/mindustry/ctype/UnlockableContent.java +++ b/core/src/io/anuke/mindustry/ctype/UnlockableContent.java @@ -67,6 +67,11 @@ public abstract class UnlockableContent extends MappableContent{ return Vars.data.isUnlocked(this); } + /** @return whether this content is unlocked, or the player is in a custom game. */ + public final boolean unlockedCur(){ + return Vars.data.isUnlocked(this) || !Vars.world.isZone(); + } + public final boolean locked(){ return !unlocked(); } diff --git a/core/src/io/anuke/mindustry/game/Schematics.java b/core/src/io/anuke/mindustry/game/Schematics.java index 9d1c0f00e1..77e9345a27 100644 --- a/core/src/io/anuke/mindustry/game/Schematics.java +++ b/core/src/io/anuke/mindustry/game/Schematics.java @@ -228,7 +228,7 @@ public class Schematics implements Loadable{ /** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */ public Array toRequests(Schematic schem, int x, int y){ return schem.tiles.map(t -> new BuildRequest(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block).original(t.x, t.y, schem.width, schem.height).configure(t.config)) - .removeAll(s -> !s.block.isVisible() || (!s.block.unlocked() && world.isZone())); + .removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur()); } /** Adds a schematic to the list, also copying it into the files.*/ diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 14e72520b4..b76a5dbb34 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -13,8 +13,8 @@ import io.anuke.arc.math.geom.*; import io.anuke.arc.scene.*; import io.anuke.arc.scene.event.*; import io.anuke.arc.scene.ui.layout.*; -import io.anuke.arc.util.*; import io.anuke.arc.util.ArcAnnotate.*; +import io.anuke.arc.util.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.effect.*; @@ -527,7 +527,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ lineRequests.add(req); }); - lineRequests.each(req -> req.block = req.block.getReplacement(req, lineRequests)); + lineRequests.each(req -> { + Block replace = req.block.getReplacement(req, lineRequests); + if(replace.unlockedCur()){ + req.block = replace; + } + }); } protected void updateLine(int x1, int y1){