Resolved #0202 - The question of cable power usage.

Cables no longer use power.
Each channel on a block now consumes 1 / 128 AE/t
This commit is contained in:
AlgorithmX2
2014-03-17 22:58:58 -05:00
parent b226b5bb49
commit a475a3e91f
6 changed files with 51 additions and 19 deletions
+10 -1
View File
@@ -21,9 +21,11 @@ import appeng.api.networking.energy.IEnergyGridProvider;
import appeng.api.networking.energy.IEnergyWatcher;
import appeng.api.networking.energy.IEnergyWatcherHost;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPostCacheConstruction;
import appeng.api.networking.events.MENetworkPowerIdleChange;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.events.MENetworkPowerStorage;
import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.networking.storage.IStackWatcherHost;
import appeng.me.GridNode;
import appeng.me.energy.EnergyThreshold;
@@ -108,11 +110,18 @@ public class EnergyGridCache implements IEnergyGrid
Set<IEnergyGridProvider> gproviders = new LinkedHashSet();
final IGrid myGrid;
PathGridCache pgc;
public EnergyGridCache(IGrid g) {
myGrid = g;
}
@MENetworkEventSubscribe
public void postInit(MENetworkPostCacheConstruction pcc)
{
pgc = myGrid.getCache( IPathingGrid.class );
}
@MENetworkEventSubscribe
public void EnergyNodeChanges(MENetworkPowerIdleChange ev)
{
@@ -491,7 +500,7 @@ public class EnergyGridCache implements IEnergyGrid
@Override
public double getIdlePowerUsage()
{
return drainPerTick;
return drainPerTick + pgc.channelPowerUsage;
}
@Override
+8 -1
View File
@@ -52,6 +52,9 @@ public class PathGridCache implements IPathingGrid
private HashSet<IPathItem> semiOpen = new HashSet();
private HashSet<IPathItem> closedList = new HashSet();
public int channelsByBlocks = 0;
public double channelPowerUsage = 0.0;
public PathGridCache(IGrid g) {
myGrid = g;
}
@@ -82,6 +85,8 @@ public class PathGridCache implements IPathingGrid
int nodes = myGrid.getNodes().size();
ticksUntilReady = 20 + (nodes / 10);
channelsByBlocks = nodes * used;
channelPowerUsage = (double) channelsByBlocks / 128.0;
myGrid.getPivot().beginVisition( new AdHocChannelUpdater( used ) );
}
@@ -111,7 +116,7 @@ public class PathGridCache implements IPathingGrid
closedList.add( gc );
open.add( gc );
gc.setControllerRoute( (GridNode) node, true );
active.add( new PathSegment( open, semiOpen, closedList ) );
active.add( new PathSegment( this, open, semiOpen, closedList ) );
}
}
}
@@ -145,6 +150,7 @@ public class PathGridCache implements IPathingGrid
}
booting = false;
channelPowerUsage = (double) channelsByBlocks / 128.0;
myGrid.postEvent( new MENetworkBootingStatusChange() );
}
}
@@ -181,6 +187,7 @@ public class PathGridCache implements IPathingGrid
// clean up...
active.clear();
channelsByBlocks = 0;
updateNetwork = true;
}
+7 -1
View File
@@ -9,6 +9,7 @@ import java.util.Set;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridMultiblock;
import appeng.api.networking.IGridNode;
import appeng.me.cache.PathGridCache;
public class PathSegment
{
@@ -22,10 +23,13 @@ public class PathSegment
};
public PathSegment(List open, Set semiopen, Set closed) {
PathGridCache pgc;
public PathSegment(PathGridCache myPGC, List open, Set semiopen, Set closed) {
this.open = open;
this.semiopen = semiopen;
this.closed = closed;
pgc = myPGC;
isDead = false;
}
@@ -101,6 +105,7 @@ public class PathSegment
pi = start;
while (pi != null)
{
pgc.channelsByBlocks++;
pi.incrementChannelCount( 1 );
pi = pi.getControllerRoute();
}
@@ -122,6 +127,7 @@ public class PathSegment
pi = start;
while (pi != null)
{
pgc.channelsByBlocks++;
pi.incrementChannelCount( 1 );
pi = pi.getControllerRoute();
}