From 85a668c202264772785369336b8e43ca1194b96a Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Thu, 24 Dec 2020 15:47:43 +0100 Subject: [PATCH 1/3] Prevent visual plastanium conveyor glitch when disabled (#4101) --- .../world/blocks/distribution/StackConveyor.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/world/blocks/distribution/StackConveyor.java b/core/src/mindustry/world/blocks/distribution/StackConveyor.java index 4b30d7e82b..ed7fefd2c8 100644 --- a/core/src/mindustry/world/blocks/distribution/StackConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/StackConveyor.java @@ -179,14 +179,18 @@ public class StackConveyor extends Block implements Autotiler{ } } + @Override + public float efficiency(){ + return 1f; + } + @Override public void updateTile(){ // reel in crater if(cooldown > 0f) cooldown = Mathf.clamp(cooldown - speed * edelta(), 0f, recharge); - if(link == -1){ - return; - } + // indicates empty state + if(link == -1) return; // crater needs to be centered if(cooldown > 0f) return; @@ -196,6 +200,9 @@ public class StackConveyor extends Block implements Autotiler{ lastItem = items.first(); } + // do not continue if disabled, will still allow one to be reeled in to prevent visual stacking + if(!enabled) return; + if(state == stateUnload){ //unload while(lastItem != null && (!splitOut ? moveForward(lastItem) : dump(lastItem))){ if(items.empty()) poofOut(); From 9397bd57c4fbdd40156b127ea90f455f99f72b63 Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Thu, 24 Dec 2020 16:33:40 +0100 Subject: [PATCH 2/3] Prevents plastanium conveyor unload exploit (#4098) * Prevent unloaders from unloading plast loading dock * Use overridable boolean method unloadable instead * unloadable -> canUnload --- core/src/mindustry/entities/comp/BuildingComp.java | 4 ++++ .../mindustry/world/blocks/distribution/StackConveyor.java | 5 +++++ core/src/mindustry/world/blocks/storage/Unloader.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 142e89573a..9c4ca480f5 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -384,6 +384,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, //endregion //region handler methods + public boolean canUnload(){ + return block.unloadable; + } + /** Called when an unloader takes an item. */ public void itemTaken(Item item){ diff --git a/core/src/mindustry/world/blocks/distribution/StackConveyor.java b/core/src/mindustry/world/blocks/distribution/StackConveyor.java index ed7fefd2c8..7deba52711 100644 --- a/core/src/mindustry/world/blocks/distribution/StackConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/StackConveyor.java @@ -179,6 +179,11 @@ public class StackConveyor extends Block implements Autotiler{ } } + @Override + public boolean canUnload(){ + return state != stateLoad; + } + @Override public float efficiency(){ return 1f; diff --git a/core/src/mindustry/world/blocks/storage/Unloader.java b/core/src/mindustry/world/blocks/storage/Unloader.java index 47b7c71088..e040153828 100644 --- a/core/src/mindustry/world/blocks/storage/Unloader.java +++ b/core/src/mindustry/world/blocks/storage/Unloader.java @@ -61,7 +61,7 @@ public class Unloader extends Block{ int pos = (offset + i) % proximity.size; var other = proximity.get(pos); - if(other.interactable(team) && other.block.unloadable && other.block.hasItems + if(other.interactable(team) && other.block.unloadable && other.canUnload() && other.block.hasItems && ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){ //make sure the item can't be dumped back into this block dumpingTo = other; From 4a71564d034f2a39ac5272254345b94982b1dbb0 Mon Sep 17 00:00:00 2001 From: younggam <61054554+younggam@users.noreply.github.com> Date: Fri, 25 Dec 2020 00:36:55 +0900 Subject: [PATCH 3/3] mod version check fix (#4100) * Update Version.java * Update contributors --- core/assets/contributors | 1 + core/src/mindustry/core/Version.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/assets/contributors b/core/assets/contributors index 85449e6c45..6ba2c30b20 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -109,3 +109,4 @@ VolasYouKnow Quick-Korx Ángel Rodríguez Aguilera Catchears +younggam diff --git a/core/src/mindustry/core/Version.java b/core/src/mindustry/core/Version.java index 220e75536e..f5b3d2fd6b 100644 --- a/core/src/mindustry/core/Version.java +++ b/core/src/mindustry/core/Version.java @@ -53,7 +53,7 @@ public class Version{ int dot = str.indexOf('.'); if(dot != -1){ int major = Strings.parseInt(str.substring(0, dot), 0), minor = Strings.parseInt(str.substring(dot + 1), 0); - return build >= major && revision >= minor; + return build > major || (build == major && revision >= minor); }else{ return build >= Strings.parseInt(str, 0); }