Config option to make Controller mandatory

This commit is contained in:
tilera Ley 2021-03-28 17:58:25 +02:00
parent 822e2e5e11
commit 97e2388d02
2 changed files with 22 additions and 17 deletions

View File

@ -100,6 +100,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private double WirelessBoosterRangeMultiplier = 1;
private double WirelessBoosterExp = 1.5;
public int ItemTypeLimit = 63;
public boolean NeedController = false;
public AEConfig( final File configFile )
{
@ -160,7 +161,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.colorApplicatorBattery = this.get( "battery", "colorApplicator", this.colorApplicatorBattery ).getInt( this.colorApplicatorBattery );
this.matterCannonBattery = this.get( "battery", "matterCannon", this.matterCannonBattery ).getInt( this.matterCannonBattery );
this.ItemTypeLimit = this.get( "storage", "typeLimit", this.ItemTypeLimit ).getInt( this.ItemTypeLimit );
this.ItemTypeLimit = this.get( "tileraedition", "typeLimit", this.ItemTypeLimit ).getInt( this.ItemTypeLimit );
this.NeedController = this.get("tileraedition", "needController", this.NeedController).getBoolean( this.NeedController );
this.clientSync();

View File

@ -94,23 +94,26 @@ public class PathGridCache implements IPathingGrid
this.myGrid.getPivot().beginVisit( new AdHocChannelUpdater( used ) );
}
else if( this.controllerState == ControllerState.NO_CONTROLLER )
{
final int requiredChannels = this.calculateRequiredChannels();
int used = requiredChannels;
if( requiredChannels > 8 )
{
used = 0;
else if( this.controllerState == ControllerState.NO_CONTROLLER ) {
if (AEConfig.instance.NeedController) {
this.ticksUntilReady = 20;
this.myGrid.getPivot().beginVisit( new AdHocChannelUpdater( 0 ) );
} else {
final int requiredChannels = this.calculateRequiredChannels();
int used = requiredChannels;
if (requiredChannels > 8) {
used = 0;
}
final int nodes = this.myGrid.getNodes().size();
this.setChannelsInUse(used);
this.ticksUntilReady = 20 + Math.max(0, nodes / 100 - 20);
this.setChannelsByBlocks(nodes * used);
this.setChannelPowerUsage(this.getChannelsByBlocks() / 128.0);
this.myGrid.getPivot().beginVisit(new AdHocChannelUpdater(used));
}
final int nodes = this.myGrid.getNodes().size();
this.setChannelsInUse( used );
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
this.setChannelsByBlocks( nodes * used );
this.setChannelPowerUsage( this.getChannelsByBlocks() / 128.0 );
this.myGrid.getPivot().beginVisit( new AdHocChannelUpdater( used ) );
}
else if( this.controllerState == ControllerState.CONTROLLER_CONFLICT )
{