From 77530b7be3ce87de91a64d21ea85cad28c918f97 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 3 Nov 2017 22:32:48 -0400 Subject: [PATCH] Added more replacement for turrets/conveyors/junctions/routers --- .../anuke/mindustry/world/blocks/types/defense/Turret.java | 5 +++++ .../mindustry/world/blocks/types/distribution/Conveyor.java | 3 ++- .../mindustry/world/blocks/types/distribution/Junction.java | 5 +++++ .../mindustry/world/blocks/types/distribution/Router.java | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java index b4e1031746..9c730c6fb0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java @@ -43,6 +43,11 @@ public class Turret extends Block{ solid = true; } + @Override + public boolean canReplace(Block other){ + return other instanceof Turret; + } + @Override public void draw(Tile tile){ Vector2 offset = getPlaceOffset(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java index d51d043ce2..f13cf8c6d8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java @@ -27,8 +27,9 @@ public class Conveyor extends Block{ update = true; } + @Override public boolean canReplace(Block other){ - return other instanceof Conveyor; + return other instanceof Conveyor || other instanceof Router || other instanceof Junction; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java index 5ac79878cc..c1450b3ed6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java @@ -13,6 +13,11 @@ public class Junction extends Block{ solid = true; } + @Override + public boolean canReplace(Block other){ + return other instanceof Conveyor || other instanceof Router; + } + @Override public void handleItem(Tile tile, Item item, Tile source){ int dir = source.relativeTo(tile.x, tile.y); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java index d95f4c8445..d35f57630d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java @@ -19,6 +19,11 @@ public class Router extends Block{ solid = true; } + @Override + public boolean canReplace(Block other){ + return other instanceof Junction || other instanceof Conveyor; + } + @Override public void update(Tile tile){ if(Timers.get(tile, 2) && tile.entity.totalItems() > 0){