Bugfixes / Power capacity sensor

This commit is contained in:
Anuken
2020-08-09 20:18:47 -04:00
parent 15572cdd7a
commit f00510a508
14 changed files with 6 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 KiB

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -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.powerNetIn && power != null) return power.graph.getPowerProduced();
if(sensor == LSensor.powerNetOut && power != null) return power.graph.getPowerNeeded(); if(sensor == LSensor.powerNetOut && power != null) return power.graph.getPowerNeeded();
if(sensor == LSensor.powerNetStored && power != null) return power.graph.getLastPowerStored(); if(sensor == LSensor.powerNetStored && power != null) return power.graph.getLastPowerStored();
if(sensor == LSensor.powerNetCapacity && power != null) return power.graph.getBatteryCapacity();
return 0; return 0;
} }

View File

@@ -68,7 +68,7 @@ public class LAssembler{
String[] lines = data.split("[;\n]+"); String[] lines = data.split("[;\n]+");
for(String line : lines){ for(String line : lines){
//comments //comments
//if(line.startsWith("#")) continue; if(line.startsWith("#")) continue;
String[] tokens = line.split(" "); String[] tokens = line.split(" ");
LStatement st = LogicIO.read(tokens); LStatement st = LogicIO.read(tokens);

View File

@@ -5,6 +5,7 @@ public enum LSensor{
totalLiquids, totalLiquids,
totalPower, totalPower,
powerNetStored, powerNetStored,
powerNetCapacity,
powerNetIn, powerNetIn,
powerNetOut, powerNetOut,
health, health,

View File

@@ -24,11 +24,12 @@ public abstract class LStatement{
public abstract LCategory category(); public abstract LCategory category();
public abstract LInstruction build(LAssembler builder); public abstract LInstruction build(LAssembler builder);
//TODO doesn't work with modded stuff
public LStatement copy(){ public LStatement copy(){
StringBuilder build = new StringBuilder(); StringBuilder build = new StringBuilder();
write(build); 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 //protected methods are only for internal UI layout utilities