mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-05-28 17:06:34 +03:00
Fixed #12091
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user