Bugfixes / Power capacity sensor
This commit is contained in:
@@ -1177,6 +1177,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
if(sensor == LSensor.powerNetIn && power != null) return power.graph.getPowerProduced();
|
||||
if(sensor == LSensor.powerNetOut && power != null) return power.graph.getPowerNeeded();
|
||||
if(sensor == LSensor.powerNetStored && power != null) return power.graph.getLastPowerStored();
|
||||
if(sensor == LSensor.powerNetCapacity && power != null) return power.graph.getBatteryCapacity();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class LAssembler{
|
||||
String[] lines = data.split("[;\n]+");
|
||||
for(String line : lines){
|
||||
//comments
|
||||
//if(line.startsWith("#")) continue;
|
||||
if(line.startsWith("#")) continue;
|
||||
|
||||
String[] tokens = line.split(" ");
|
||||
LStatement st = LogicIO.read(tokens);
|
||||
|
||||
@@ -5,6 +5,7 @@ public enum LSensor{
|
||||
totalLiquids,
|
||||
totalPower,
|
||||
powerNetStored,
|
||||
powerNetCapacity,
|
||||
powerNetIn,
|
||||
powerNetOut,
|
||||
health,
|
||||
|
||||
@@ -24,11 +24,12 @@ public abstract class LStatement{
|
||||
public abstract LCategory category();
|
||||
public abstract LInstruction build(LAssembler builder);
|
||||
|
||||
//TODO doesn't work with modded stuff
|
||||
public LStatement copy(){
|
||||
StringBuilder build = new StringBuilder();
|
||||
write(build);
|
||||
return LogicIO.read(build.toString().split(" "));
|
||||
String[] split = build.toString().split(" ");
|
||||
LStatement result = LogicIO.read(split);
|
||||
return result == null && LAssembler.customParsers.containsKey(split[0]) ? LAssembler.customParsers.get(split[0]).get(split) : result;
|
||||
}
|
||||
|
||||
//protected methods are only for internal UI layout utilities
|
||||
|
||||
Reference in New Issue
Block a user