Fix block status of repair point and battery (#4187)
* Fix block status of repair point and battery * Update Battery.java * Update RepairPoint.java
This commit is contained in:
committed by
GitHub
parent
b672434e83
commit
b79a6f6b32
@@ -358,6 +358,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return power != null && (block.consumes.has(ConsumeType.power) && !block.consumes.getPower().buffered) ? power.status : 1f;
|
||||
}
|
||||
|
||||
public BlockStatus status(){
|
||||
return cons.status();
|
||||
}
|
||||
|
||||
/** Call when nothing is happening to the entity. This increments the internal sleep timer. */
|
||||
public void sleep(){
|
||||
sleepTime += Time.delta;
|
||||
@@ -812,7 +816,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
Draw.z(Layer.power + 1);
|
||||
Draw.color(Pal.gray);
|
||||
Fill.square(brcx, brcy, 2.5f, 45);
|
||||
Draw.color(cons.status().color);
|
||||
Draw.color(status().color);
|
||||
Fill.square(brcx, brcy, 1.5f, 45);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@@ -42,5 +42,12 @@ public class Battery extends PowerDistributor{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStatus status(){
|
||||
if(Mathf.equal(power.status, 0f, 0.01f)) return BlockStatus.noInput;
|
||||
if(Mathf.equal(power.status, 1f, 0.01f)) return BlockStatus.active;
|
||||
return BlockStatus.noOutput;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,5 +118,10 @@ public class RepairPoint extends Block{
|
||||
public boolean shouldConsume(){
|
||||
return target != null && enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStatus status(){
|
||||
return Mathf.equal(efficiency(), 0f, 0.01f) ? BlockStatus.noInput : cons.status();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user