Remote unlock tweaks

This commit is contained in:
Anuken
2021-08-18 17:52:02 -04:00
parent ba48373bbc
commit a94735c5a5
3 changed files with 15 additions and 7 deletions

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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){