This commit is contained in:
Anuken
2026-05-18 15:17:31 -04:00
parent a052b8bd30
commit d2dbc5e7d5
3 changed files with 10 additions and 7 deletions

View File

@@ -103,11 +103,12 @@ public class Logic implements ApplicationListener{
if(state.isCampaign()){
//enable building AI on campaign unless the preset disables it
state.rules.coreIncinerates = true;
state.rules.infiniteResources = false;
state.rules.allowEditRules = false;
state.rules.allowEditWorldProcessors = false;
state.rules.worldProcessorPlayerLink = false;
if(state.getPlanet().enemyInfiniteItems){
state.rules.waveTeam.rules().infiniteResources = true;
state.rules.waveTeam.rules().fillItems = true;

View File

@@ -98,6 +98,8 @@ public class Rules{
public boolean logicUnitBuild = true;
/** Whether to allow units to deconstruct blocks with logic. */
public boolean logicUnitDeconstruct = false;
/** If false, world processors can't link to player structures. This is used in the campaign; see issue #12091 */
public boolean worldProcessorPlayerLink = true;
/** If true, world processors can be edited and placed on this map. */
public boolean allowEditWorldProcessors = false;
/** If true, world processors no longer update. Used for testing. */

View File

@@ -182,7 +182,7 @@ public class LogicBlock extends Block{
@Override
public Object pointConfig(Object config, Cons<Point2> transformer){
if(config instanceof byte[] data){
if(config instanceof byte[] data && data.length <= maxCompressedLen){
try(DataInputStream stream = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)))){
//discard version for now
@@ -208,8 +208,8 @@ public class LogicBlock extends Block{
}
return compress(bytes, links);
}catch(IOException e){
Log.err(e);
}catch(IOException ignored){
//error should not be logged
}
}
return config;
@@ -705,7 +705,7 @@ public class LogicBlock extends Block{
}
public boolean validLink(Building other){
return other != null && other.isValid() && (privileged || (!other.block.privileged && other.team == team && other.within(this, range + other.block.size*tilesize/2f))) && !(other instanceof ConstructBuild);
return other != null && other.isValid() && (privileged || (!other.block.privileged && other.team == team && other.within(this, range + other.block.size*tilesize/2f))) && !(privileged && !state.rules.worldProcessorPlayerLink && other.team == state.rules.defaultTeam) && !(other instanceof ConstructBuild);
}
@Override
@@ -728,8 +728,8 @@ public class LogicBlock extends Block{
//this is a hack to allow configuration to work correctly in the editor for privileged processors
if(forceEditor) state.rules.editor = true;
byte[] bytes = compress(code, relativeConnections());
if(bytes.length >= maxCompressedLen){
ui.showErrorMessage(Core.bundle.format("logic.error.toolong ", maxByteLen, bytes.length));
if(bytes.length > maxCompressedLen){
ui.showErrorMessage(Core.bundle.format("logic.error.toolong", maxByteLen, bytes.length));
}else{
configure(bytes);
state.rules.editor = prev;