diff --git a/core/src/mindustry/ctype/UnlockableContent.java b/core/src/mindustry/ctype/UnlockableContent.java index b557bbaf89..c45f076061 100644 --- a/core/src/mindustry/ctype/UnlockableContent.java +++ b/core/src/mindustry/ctype/UnlockableContent.java @@ -149,9 +149,17 @@ public abstract class UnlockableContent extends MappableContent{ } } + public boolean unlockedNowHost(){ + if(!state.isCampaign()) return true; + return net != null && net.client() ? + alwaysUnlocked || state.rules.researched.contains(name) : + unlocked || alwaysUnlocked; + } + public boolean unlocked(){ - if(net != null && net.client()) return alwaysUnlocked || state.rules.researched.contains(name); - return unlocked || alwaysUnlocked; + return net != null && net.client() ? + alwaysUnlocked || unlocked || state.rules.researched.contains(name) : + unlocked || alwaysUnlocked; } /** Locks this content again. */ diff --git a/core/src/mindustry/world/blocks/ConstructBlock.java b/core/src/mindustry/world/blocks/ConstructBlock.java index 63f66a9afa..9113a840a1 100644 --- a/core/src/mindustry/world/blocks/ConstructBlock.java +++ b/core/src/mindustry/world/blocks/ConstructBlock.java @@ -302,7 +302,7 @@ public class ConstructBlock extends Block{ int accumulated = (int)(accumulator[i]); //get amount if(clampedAmount > 0 && accumulated > 0){ //if it's positive, add it to the core - if(core != null && requirements[i].item.unlockedNow()){ //only accept items that are unlocked + if(core != null && requirements[i].item.unlockedNowHost()){ //only accept items that are unlocked int accepting = Math.min(accumulated, core.storageCapacity - core.items.get(requirements[i].item)); //transfer items directly, as this is not production. core.items.add(requirements[i].item, accepting); diff --git a/core/src/mindustry/world/blocks/units/Reconstructor.java b/core/src/mindustry/world/blocks/units/Reconstructor.java index b8ee614f50..0d84db2fb5 100644 --- a/core/src/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/mindustry/world/blocks/units/Reconstructor.java @@ -126,7 +126,7 @@ public class Reconstructor extends UnitBlock{ var upgrade = upgrade(pay.unit.type); if(upgrade != null){ - if(!upgrade.unlockedNow()){ + if(!upgrade.unlockedNowHost()){ //flash "not researched" pay.showOverlay(Icon.tree); } @@ -137,7 +137,7 @@ public class Reconstructor extends UnitBlock{ } } - return upgrade != null && upgrade.unlockedNow() && !upgrade.isBanned(); + return upgrade != null && upgrade.unlockedNowHost() && !upgrade.isBanned(); } @Override @@ -232,7 +232,7 @@ public class Reconstructor extends UnitBlock{ if(payload == null) return null; UnitType t = upgrade(payload.unit.type); - return t != null && t.unlockedNow() ? t : null; + return t != null && t.unlockedNowHost() ? t : null; } public boolean constructing(){ @@ -241,7 +241,7 @@ public class Reconstructor extends UnitBlock{ public boolean hasUpgrade(UnitType type){ UnitType t = upgrade(type); - return t != null && t.unlockedNow() && !type.isBanned(); + return t != null && t.unlockedNowHost() && !type.isBanned(); } public UnitType upgrade(UnitType type){