the refactoring continues
This commit is contained in:
@@ -14,7 +14,6 @@ import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
@@ -588,36 +587,6 @@ public class NetClient implements ApplicationListener{
|
||||
|
||||
void sync(){
|
||||
if(timer.get(0, playerSyncTime)){
|
||||
BuildPlan[] requests = null;
|
||||
if(player.isBuilder()){
|
||||
//limit to 10 to prevent buffer overflows
|
||||
int usedRequests = Math.min(player.unit().plans().size, 10);
|
||||
|
||||
int totalLength = 0;
|
||||
|
||||
//prevent buffer overflow by checking config length
|
||||
for(int i = 0; i < usedRequests; i++){
|
||||
BuildPlan plan = player.unit().plans().get(i);
|
||||
if(plan.config instanceof byte[] b){
|
||||
totalLength += b.length;
|
||||
}
|
||||
|
||||
if(plan.config instanceof String b){
|
||||
totalLength += b.length();
|
||||
}
|
||||
|
||||
if(totalLength > 500){
|
||||
usedRequests = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
requests = new BuildPlan[usedRequests];
|
||||
for(int i = 0; i < usedRequests; i++){
|
||||
requests[i] = player.unit().plans().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
Unit unit = player.dead() ? Nulls.unit : player.unit();
|
||||
int uid = player.dead() ? -1 : unit.id;
|
||||
|
||||
@@ -632,7 +601,7 @@ public class NetClient implements ApplicationListener{
|
||||
unit.vel.x, unit.vel.y,
|
||||
player.unit().mineTile,
|
||||
player.boosting, player.shooting, ui.chatfrag.shown(), control.input.isBuilding,
|
||||
requests,
|
||||
player.isBuilder() ? player.unit().plans : null,
|
||||
Core.camera.position.x, Core.camera.position.y,
|
||||
Core.camera.width, Core.camera.height
|
||||
);
|
||||
|
||||
@@ -14,8 +14,8 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
@@ -628,7 +628,7 @@ public class NetServer implements ApplicationListener{
|
||||
float xVelocity, float yVelocity,
|
||||
Tile mining,
|
||||
boolean boosting, boolean shooting, boolean chatting, boolean building,
|
||||
@Nullable BuildPlan[] requests,
|
||||
@Nullable Queue<BuildPlan> plans,
|
||||
float viewX, float viewY, float viewWidth, float viewHeight
|
||||
){
|
||||
NetConnection con = player.con;
|
||||
@@ -675,8 +675,8 @@ public class NetServer implements ApplicationListener{
|
||||
player.unit().clearBuilding();
|
||||
player.unit().updateBuilding(building);
|
||||
|
||||
if(requests != null){
|
||||
for(BuildPlan req : requests){
|
||||
if(plans != null){
|
||||
for(BuildPlan req : plans){
|
||||
if(req == null) continue;
|
||||
Tile tile = world.tile(req.x, req.y);
|
||||
if(tile == null || (!req.breaking && req.block == null)) continue;
|
||||
@@ -1049,7 +1049,6 @@ public class NetServer implements ApplicationListener{
|
||||
if(Groups.player.size() > 0 && Core.settings.getBool("blocksync") && timer.get(timerBlockSync, blockSyncTime)){
|
||||
writeBlockSnapshots();
|
||||
}
|
||||
|
||||
}catch(IOException e){
|
||||
Log.err(e);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
||||
Draw.reset();
|
||||
Draw.mixcol(Color.white, 0.24f + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
||||
Draw.alpha(alpha);
|
||||
request.block.drawRequestConfigTop(request, plans);
|
||||
request.block.drawPlanConfigTop(request, plans);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
transient boolean wasVisible; //used only by the block renderer when fog is on
|
||||
transient float visualLiquid;
|
||||
|
||||
//TODO save efficiency too!
|
||||
transient boolean consValid;
|
||||
|
||||
@Nullable PowerModule power;
|
||||
@Nullable ItemModule items;
|
||||
@Nullable LiquidModule liquids;
|
||||
@@ -80,7 +83,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
public transient float healSuppressionTime = -1f;
|
||||
public transient float lastHealTime = -120f * 10f;
|
||||
|
||||
private transient boolean consValid;
|
||||
private transient float timeScale = 1f, timeScaleDuration;
|
||||
private transient float dumpAccum;
|
||||
|
||||
@@ -488,7 +490,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return BlockStatus.noOutput;
|
||||
}
|
||||
|
||||
if(!consValid() || !productionValid()){
|
||||
if(!consValid || !productionValid()){
|
||||
return BlockStatus.noInput;
|
||||
}
|
||||
|
||||
@@ -1583,16 +1585,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
|
||||
//TODO remove
|
||||
public float efficiency(){
|
||||
return efficiency;
|
||||
}
|
||||
|
||||
//TODO probably should not have a shouldConsume() check?
|
||||
public boolean consValid(){
|
||||
return consValid && shouldConsume();
|
||||
}
|
||||
//TODO probably should not have a shouldConsume() check? should you even *use* consValid?
|
||||
|
||||
public void consume(){
|
||||
for(Consume cons : block.consumers){
|
||||
@@ -1618,6 +1616,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
/** Base efficiency. If this entity has non-buffered power, returns the power %, otherwise returns 1. */
|
||||
private transient float efficiency = 1f;
|
||||
|
||||
//why?
|
||||
transient float efficiencyMultiplier = 1f;
|
||||
|
||||
//TODO remove?
|
||||
@Deprecated
|
||||
private transient boolean consOptionalValid = false;
|
||||
@@ -1681,9 +1682,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
//TODO test with overdraw, e.g. requesting 20/frame on a block with only 10 capacity
|
||||
//- should lead to 50% efficiency, for example - make sure all blocks have, at minimum, 10x their capacity per frame - should last for a second at least
|
||||
|
||||
public void updateEfficiencyMultiplier(){
|
||||
|
||||
}
|
||||
|
||||
public void updateConsumption(){
|
||||
//everything is valid when cheating
|
||||
if(cheating()){
|
||||
if(cheating() || !block.hasConsumers){
|
||||
consValid = true;
|
||||
consOptionalValid = true;
|
||||
return;
|
||||
@@ -1706,6 +1711,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
|
||||
//assume efficiency is 1 for the calculations below
|
||||
efficiency = 1f;
|
||||
//average
|
||||
|
||||
//first pass: get the minimum efficiency of any consumer
|
||||
for(var cons : nonOptional){
|
||||
@@ -1713,8 +1719,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
//consValid &= cons.valid(self());
|
||||
}
|
||||
|
||||
efficiencyMultiplier = 1f;
|
||||
|
||||
updateEfficiencyMultiplier();
|
||||
|
||||
//efficiency is now this minimum value
|
||||
efficiency = minEfficiency;
|
||||
consValid = efficiency > 0;
|
||||
|
||||
//second pass: update every consumer based on efficiency
|
||||
|
||||
|
||||
@@ -244,20 +244,20 @@ public class Schematics implements Loadable{
|
||||
Draw.rect(Tmp.tr1, buffer.getWidth()/2f, buffer.getHeight()/2f, buffer.getWidth(), -buffer.getHeight());
|
||||
Draw.color();
|
||||
|
||||
Seq<BuildPlan> requests = schematic.tiles.map(t -> new BuildPlan(t.x, t.y, t.rotation, t.block, t.config));
|
||||
Seq<BuildPlan> plans = schematic.tiles.map(t -> new BuildPlan(t.x, t.y, t.rotation, t.block, t.config));
|
||||
|
||||
Draw.flush();
|
||||
//scale each request to fit schematic
|
||||
Draw.trans().scale(resolution / tilesize, resolution / tilesize).translate(tilesize*1.5f, tilesize*1.5f);
|
||||
|
||||
//draw requests
|
||||
requests.each(req -> {
|
||||
plans.each(req -> {
|
||||
req.animScale = 1f;
|
||||
req.worldContext = false;
|
||||
req.block.drawRequestRegion(req, requests);
|
||||
req.block.drawPlanRegion(req, plans);
|
||||
});
|
||||
|
||||
requests.each(req -> req.block.drawRequestConfigTop(req, requests));
|
||||
plans.each(req -> req.block.drawPlanConfigTop(req, plans));
|
||||
|
||||
Draw.flush();
|
||||
Draw.trans().idt();
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SectorInfo{
|
||||
var pads = indexer.getFlagged(state.rules.defaultTeam, BlockFlag.launchPad);
|
||||
|
||||
//disable export when launch pads are disabled, or there aren't any active ones
|
||||
if(pads.size == 0 || !pads.contains(t -> t.consValid())){
|
||||
if(pads.size == 0 || !pads.contains(t -> t.consValid)){
|
||||
export.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -202,10 +202,10 @@ public class DesktopInput extends InputHandler{
|
||||
//draw schematic requests
|
||||
selectRequests.each(req -> {
|
||||
req.animScale = 1f;
|
||||
drawRequest(req);
|
||||
drawPlan(req);
|
||||
});
|
||||
|
||||
selectRequests.each(this::drawOverRequest);
|
||||
selectRequests.each(this::drawOverPlan);
|
||||
|
||||
if(player.isBuilder()){
|
||||
//draw things that may be placed soon
|
||||
@@ -215,23 +215,23 @@ public class DesktopInput extends InputHandler{
|
||||
if(i == lineRequests.size - 1 && req.block.rotate){
|
||||
drawArrow(block, req.x, req.y, req.rotation);
|
||||
}
|
||||
drawRequest(lineRequests.get(i));
|
||||
drawPlan(lineRequests.get(i));
|
||||
}
|
||||
lineRequests.each(this::drawOverRequest);
|
||||
lineRequests.each(this::drawOverPlan);
|
||||
}else if(isPlacing()){
|
||||
if(block.rotate && block.drawArrow){
|
||||
drawArrow(block, cursorX, cursorY, rotation);
|
||||
}
|
||||
Draw.color();
|
||||
boolean valid = validPlace(cursorX, cursorY, block, rotation);
|
||||
drawRequest(cursorX, cursorY, block, rotation);
|
||||
drawPlan(cursorX, cursorY, block, rotation);
|
||||
block.drawPlace(cursorX, cursorY, rotation, valid);
|
||||
|
||||
if(block.saveConfig){
|
||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
||||
brequest.set(cursorX, cursorY, rotation, block);
|
||||
brequest.config = block.lastConfig;
|
||||
block.drawRequestConfig(brequest, allRequests());
|
||||
block.drawPlanConfig(brequest, allRequests());
|
||||
brequest.config = null;
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -952,22 +952,22 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawOverRequest(BuildPlan request){
|
||||
protected void drawOverPlan(BuildPlan request){
|
||||
boolean valid = validPlace(request.x, request.y, request.block, request.rotation);
|
||||
|
||||
Draw.reset();
|
||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
||||
Draw.alpha(1f);
|
||||
request.block.drawRequestConfigTop(request, allSelectLines);
|
||||
request.block.drawPlanConfigTop(request, allSelectLines);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
protected void drawRequest(BuildPlan request){
|
||||
protected void drawPlan(BuildPlan request){
|
||||
request.block.drawPlan(request, allRequests(), validPlace(request.x, request.y, request.block, request.rotation));
|
||||
}
|
||||
|
||||
/** Draws a placement icon for a specific block. */
|
||||
protected void drawRequest(int x, int y, Block block, int rotation){
|
||||
protected void drawPlan(int x, int y, Block block, int rotation){
|
||||
brequest.set(x, y, rotation, block);
|
||||
brequest.animScale = 1f;
|
||||
block.drawPlan(brequest, allRequests(), validPlace(x, y, block, rotation));
|
||||
|
||||
@@ -327,7 +327,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
request.block.drawPlan(request, allRequests(), validPlace(request.x, request.y, request.block, request.rotation) && getRequest(request.x, request.y, request.block.size, null) == null);
|
||||
drawSelected(request.x, request.y, request.block, Pal.accent);
|
||||
}
|
||||
lineRequests.each(this::drawOverRequest);
|
||||
lineRequests.each(this::drawOverPlan);
|
||||
}else if(mode == breaking){
|
||||
drawBreakSelection(lineStartX, lineStartY, tileX, tileY);
|
||||
}
|
||||
@@ -367,9 +367,9 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
drawRequest(request);
|
||||
drawPlan(request);
|
||||
if(!request.breaking){
|
||||
drawOverRequest(request);
|
||||
drawOverPlan(request);
|
||||
}
|
||||
|
||||
//draw last placed request
|
||||
@@ -399,7 +399,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawRequest(BuildPlan request){
|
||||
protected void drawPlan(BuildPlan request){
|
||||
if(request.tile() == null) return;
|
||||
brequest.animScale = request.animScale = Mathf.lerpDelta(request.animScale, 1f, 0.1f);
|
||||
|
||||
|
||||
@@ -310,18 +310,63 @@ public class TypeIO{
|
||||
return content.block(read.s());
|
||||
}
|
||||
|
||||
public static void writeRequest(Writes write, BuildPlan request){
|
||||
write.b(request.breaking ? (byte)1 : 0);
|
||||
write.i(Point2.pack(request.x, request.y));
|
||||
if(!request.breaking){
|
||||
write.s(request.block.id);
|
||||
write.b((byte)request.rotation);
|
||||
write.b(1); //always has config
|
||||
writeObject(write, request.config);
|
||||
/** @return the maximum acceptable amount of plans to send over the network */
|
||||
public static int getMaxPlans(Queue<BuildPlan> plans){
|
||||
//limit to 10 to prevent buffer overflows
|
||||
int usedRequests = Math.min(plans.size, 10);
|
||||
int totalLength = 0;
|
||||
|
||||
//prevent buffer overflow by checking config length
|
||||
for(int i = 0; i < usedRequests; i++){
|
||||
BuildPlan plan = plans.get(i);
|
||||
if(plan.config instanceof byte[] b){
|
||||
totalLength += b.length;
|
||||
}
|
||||
|
||||
if(plan.config instanceof String b){
|
||||
totalLength += b.length();
|
||||
}
|
||||
|
||||
if(totalLength > 500){
|
||||
usedRequests = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return usedRequests;
|
||||
}
|
||||
|
||||
//on the network, plans must be capped by size
|
||||
public static void writePlansQueueNet(Writes write, Queue<BuildPlan> plans){
|
||||
int used = getMaxPlans(plans);
|
||||
|
||||
write.i(used);
|
||||
for(int i = 0; i < used; i++){
|
||||
writePlan(write, plans.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static BuildPlan readRequest(Reads read){
|
||||
public static Queue<BuildPlan> readPlansQueue(Reads read){
|
||||
int used = read.i();
|
||||
var out = new Queue<BuildPlan>();
|
||||
for(int i = 0; i < used; i++){
|
||||
out.add(readPlan(read));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static void writePlan(Writes write, BuildPlan plan){
|
||||
write.b(plan.breaking ? (byte)1 : 0);
|
||||
write.i(Point2.pack(plan.x, plan.y));
|
||||
if(!plan.breaking){
|
||||
write.s(plan.block.id);
|
||||
write.b((byte)plan.rotation);
|
||||
write.b(1); //always has config
|
||||
writeObject(write, plan.config);
|
||||
}
|
||||
}
|
||||
|
||||
public static BuildPlan readPlan(Reads read){
|
||||
BuildPlan currentRequest;
|
||||
|
||||
byte type = read.b();
|
||||
@@ -348,18 +393,18 @@ public class TypeIO{
|
||||
return currentRequest;
|
||||
}
|
||||
|
||||
public static void writeRequests(Writes write, BuildPlan[] requests){
|
||||
if(requests == null){
|
||||
public static void writePlans(Writes write, BuildPlan[] plans){
|
||||
if(plans == null){
|
||||
write.s(-1);
|
||||
return;
|
||||
}
|
||||
write.s((short)requests.length);
|
||||
for(BuildPlan request : requests){
|
||||
writeRequest(write, request);
|
||||
write.s((short)plans.length);
|
||||
for(BuildPlan request : plans){
|
||||
writePlan(write, request);
|
||||
}
|
||||
}
|
||||
|
||||
public static BuildPlan[] readRequests(Reads read){
|
||||
public static BuildPlan[] readPlans(Reads read){
|
||||
short reqamount = read.s();
|
||||
if(reqamount == -1){
|
||||
return null;
|
||||
@@ -367,7 +412,7 @@ public class TypeIO{
|
||||
|
||||
BuildPlan[] reqs = new BuildPlan[reqamount];
|
||||
for(int i = 0; i < reqamount; i++){
|
||||
BuildPlan request = readRequest(read);
|
||||
BuildPlan request = readPlan(read);
|
||||
if(request != null){
|
||||
reqs[i] = request;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public class SectorDamage{
|
||||
}
|
||||
|
||||
//point defense turrets act as flat health right now
|
||||
if(build.block instanceof PointDefenseTurret && build.consValid()){
|
||||
if(build.block instanceof PointDefenseTurret && build.consValid){
|
||||
sumHealth += 150f * build.timeScale();
|
||||
}
|
||||
|
||||
|
||||
@@ -643,18 +643,18 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Draw.alpha(alpha);
|
||||
float prevScale = Draw.scl;
|
||||
Draw.scl *= plan.animScale;
|
||||
drawRequestRegion(plan, list);
|
||||
drawPlanRegion(plan, list);
|
||||
Draw.scl = prevScale;
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawDefaultRequestRegion(plan, list);
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawDefaultPlanRegion(plan, list);
|
||||
}
|
||||
|
||||
/** this is a different method so subclasses can call it even after overriding the base */
|
||||
public void drawDefaultRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
TextureRegion reg = getRequestRegion(plan, list);
|
||||
public void drawDefaultPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
TextureRegion reg = getPlanRegion(plan, list);
|
||||
Draw.rect(reg, plan.drawx(), plan.drawy(), !rotate || !rotateDraw ? 0 : plan.rotation * 90);
|
||||
|
||||
if(plan.worldContext && player != null && teamRegion != null && teamRegion.found()){
|
||||
@@ -663,18 +663,18 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
drawRequestConfig(plan, list);
|
||||
drawPlanConfig(plan, list);
|
||||
}
|
||||
|
||||
public TextureRegion getRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public TextureRegion getPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
return fullIcon;
|
||||
}
|
||||
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
public void drawRequestConfigCenter(BuildPlan plan, Object content, String region, boolean cross){
|
||||
public void drawPlanConfigCenter(BuildPlan plan, Object content, String region, boolean cross){
|
||||
if(content == null){
|
||||
if(cross){
|
||||
Draw.rect("cross", plan.drawx(), plan.drawy());
|
||||
@@ -689,11 +689,11 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawRequestConfigCenter(BuildPlan plan, Object content, String region){
|
||||
drawRequestConfigCenter(plan, content, region, false);
|
||||
public void drawPlanConfigCenter(BuildPlan plan, Object content, String region){
|
||||
drawPlanConfigCenter(plan, content, region, false);
|
||||
}
|
||||
|
||||
public void drawRequestConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Accelerator extends Block{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
heat = Mathf.lerpDelta(heat, consValid() ? 1f : 0f, 0.05f);
|
||||
heat = Mathf.lerpDelta(heat, consValid ? 1f : 0f, 0.05f);
|
||||
statusLerp = Mathf.lerpDelta(statusLerp, power.status, 0.05f);
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ public class Accelerator extends Block{
|
||||
|
||||
@Override
|
||||
public Cursor getCursor(){
|
||||
return !state.isCampaign() || !consValid() ? SystemCursor.arrow : super.getCursor();
|
||||
return !state.isCampaign() || !consValid ? SystemCursor.arrow : super.getCursor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
deselect();
|
||||
|
||||
if(!state.isCampaign() || !consValid()) return;
|
||||
if(!state.isCampaign() || !consValid) return;
|
||||
|
||||
ui.planet.showPlanetLaunch(state.rules.sector, sector -> {
|
||||
//TODO cutscene, etc...
|
||||
|
||||
@@ -126,7 +126,7 @@ public class LaunchPad extends Block{
|
||||
if(!state.isCampaign()) return;
|
||||
|
||||
//increment launchCounter then launch when full and base conditions are met
|
||||
if((launchCounter += edelta()) >= launchTime && consValid() && items.total() >= itemCapacity){
|
||||
if((launchCounter += edelta()) >= launchTime && consValid && items.total() >= itemCapacity){
|
||||
//if there are item requirements, use those.
|
||||
consume();
|
||||
launchSound.at(x, y);
|
||||
|
||||
@@ -241,7 +241,7 @@ public class BuildTurret extends BaseTurret{
|
||||
super.write(write);
|
||||
write.f(rotation);
|
||||
//TODO queue can be very large due to logic?
|
||||
TypeIO.writeRequests(write, unit.plans().toArray(BuildPlan.class));
|
||||
TypeIO.writePlans(write, unit.plans().toArray(BuildPlan.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,7 +250,7 @@ public class BuildTurret extends BaseTurret{
|
||||
rotation = read.f();
|
||||
unit.rotation(rotation);
|
||||
unit.plans().clear();
|
||||
var reqs = TypeIO.readRequests(read);
|
||||
var reqs = TypeIO.readPlans(read);
|
||||
if(reqs != null){
|
||||
for(var req : reqs){
|
||||
unit.plans().add(req);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Door extends Wall{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public TextureRegion getPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
return plan.config == Boolean.TRUE ? openRegion : region;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ForceProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
boolean phaseValid = itemConsumer != null && itemConsumer.valid(this);
|
||||
boolean phaseValid = itemConsumer != null && itemConsumer.efficiency(this) > 0;
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(phaseValid), 0.1f);
|
||||
|
||||
@@ -169,7 +169,7 @@ public class ForceProjector extends Block{
|
||||
|
||||
//TODO I hate this system
|
||||
if(coolantConsumer != null){
|
||||
if(coolantConsumer.valid(this)){
|
||||
if(coolantConsumer.efficiency(this) > 0){
|
||||
coolantConsumer.update(this);
|
||||
scale *= (cooldownLiquid * (1f + (liquids.current().heatCapacity - 0.4f) * 0.9f));
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class MendProjector extends Block{
|
||||
boolean canHeal = !checkSuppression();
|
||||
|
||||
smoothEfficiency = Mathf.lerpDelta(smoothEfficiency, efficiency(), 0.08f);
|
||||
heat = Mathf.lerpDelta(heat, consValid() && canHeal ? 1f : 0f, 0.08f);
|
||||
heat = Mathf.lerpDelta(heat, consValid && canHeal ? 1f : 0f, 0.08f);
|
||||
charge += heat * delta();
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(consOptionalValid()), 0.1f);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class OverdriveProjector extends Block{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
smoothEfficiency = Mathf.lerpDelta(smoothEfficiency, efficiency(), 0.08f);
|
||||
heat = Mathf.lerpDelta(heat, consValid() ? 1f : 0f, 0.08f);
|
||||
heat = Mathf.lerpDelta(heat, consValid ? 1f : 0f, 0.08f);
|
||||
charge += heat * Time.delta;
|
||||
|
||||
if(hasBoost){
|
||||
@@ -112,13 +112,13 @@ public class OverdriveProjector extends Block{
|
||||
indexer.eachBlock(this, realRange, other -> other.block.canOverdrive, other -> other.applyBoost(realBoost(), reload + 1f));
|
||||
}
|
||||
|
||||
if(timer(timerUse, useTime) && efficiency() > 0 && consValid()){
|
||||
if(timer(timerUse, useTime) && efficiency() > 0 && consValid){
|
||||
consume();
|
||||
}
|
||||
}
|
||||
|
||||
public float realBoost(){
|
||||
return consValid() ? (speedBoost + phaseHeat * speedBoostPhase) * efficiency() : 0f;
|
||||
return consValid ? (speedBoost + phaseHeat * speedBoostPhase) * efficiency() : 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public class RegenProjector extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class RegenProjector extends Block{
|
||||
}
|
||||
|
||||
//TODO should warmup depend on didRegen?
|
||||
warmup = Mathf.approachDelta(warmup, consValid() && didRegen ? 1f : 0f, 1f / 70f);
|
||||
warmup = Mathf.approachDelta(warmup, consValid && didRegen ? 1f : 0f, 1f / 70f);
|
||||
totalTime += warmup * Time.delta;
|
||||
didRegen = false;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class RegenProjector extends Block{
|
||||
return;
|
||||
}
|
||||
|
||||
if(consValid()){
|
||||
if(consValid){
|
||||
if(consOptionalValid() && (optionalTimer += Time.delta) >= optionalUseTime){
|
||||
consume();
|
||||
optionalUseTime = 0f;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Thruster extends Wall{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -41,21 +41,18 @@ public class ContinuousLiquidTurret extends ContinuousTurret{
|
||||
public void init(){
|
||||
//TODO display ammoMultiplier.
|
||||
consume(new ConsumeLiquidFilter(i -> ammoTypes.containsKey(i), liquidConsumed){
|
||||
@Override
|
||||
public boolean valid(Building build){
|
||||
return build.liquids.currentAmount() >= use(build);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Stats stats){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float use(Building entity){
|
||||
BulletType type = ammoTypes.get(entity.liquids.current());
|
||||
return Math.min(amount * entity.edelta(), entity.block.liquidCapacity) / (type == null ? 1f : type.ammoMultiplier);
|
||||
}
|
||||
//TODO
|
||||
//@Override
|
||||
//protected float use(Building entity){
|
||||
// BulletType type = ammoTypes.get(entity.liquids.current());
|
||||
// return Math.min(amount * entity.edelta(), entity.block.liquidCapacity) / (type == null ? 1f : type.ammoMultiplier);
|
||||
//}
|
||||
});
|
||||
|
||||
super.init();
|
||||
|
||||
@@ -69,9 +69,9 @@ public class ItemTurret extends Turret{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Building build){
|
||||
public float efficiency(Building build){
|
||||
//valid when there's any ammo in the turret
|
||||
return build instanceof ItemTurretBuild it && !it.ammo.isEmpty();
|
||||
return build instanceof ItemTurretBuild it && !it.ammo.isEmpty() ? 1f : 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,7 +93,7 @@ public class LaserTurret extends PowerTurret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && (consValid() || cheating()) && !charging && shootWarmup >= minWarmup){
|
||||
if(reload <= 0 && (consValid || cheating()) && !charging && shootWarmup >= minWarmup){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
@@ -69,9 +69,9 @@ public class PayloadTurret extends Turret{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Building build){
|
||||
public float efficiency(Building build){
|
||||
//valid when there's any ammo in the turret
|
||||
return build instanceof PayloadTurretBuild it && it.payloads.any();
|
||||
return build instanceof PayloadTurretBuild it && it.payloads.any() ? 1f : 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(plan, list);
|
||||
|
||||
if(bits == null) return;
|
||||
|
||||
@@ -48,13 +48,13 @@ public class DirectionBridge extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(dirRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
otherReq = null;
|
||||
otherDst = range;
|
||||
Point2 d = Geometry.d4(plan.rotation);
|
||||
|
||||
@@ -47,15 +47,15 @@ public class DirectionalUnloader extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
drawRequestConfig(plan, list);
|
||||
drawPlanConfig(plan, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(plan, plan.config, "duct-unloader-center");
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawPlanConfigCenter(plan, plan.config, "duct-unloader-center");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Duct extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(plan, list);
|
||||
|
||||
if(bits == null) return;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DuctRouter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
otherReq = null;
|
||||
list.each(other -> {
|
||||
if(other.block == this && plan != other && plan.config instanceof Point2 p && p.equals(other.x - plan.x, other.y - plan.y)){
|
||||
|
||||
@@ -153,7 +153,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
//skip when there's no power
|
||||
if(!consValid()){
|
||||
if(!consValid){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
protected boolean shooterValid(Building other){
|
||||
return other instanceof MassDriverBuild entity && other.isValid() && other.consValid() && entity.block == block && entity.link == pos() && within(other, range);
|
||||
return other instanceof MassDriverBuild entity && other.isValid() && other.consValid && entity.block == block && entity.link == pos() && within(other, range);
|
||||
}
|
||||
|
||||
protected boolean linkValid(){
|
||||
|
||||
@@ -43,7 +43,7 @@ public class OverflowDuct extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ public class Sorter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(plan, plan.config, "center", true);
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawPlanConfigCenter(plan, plan.config, "center", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,7 +84,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(plan, list);
|
||||
|
||||
if(bits == null) return;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class HeatConductor extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class HeatProducer extends GenericCrafter{
|
||||
super.updateTile();
|
||||
|
||||
//heat approaches target at the same speed regardless of efficiency
|
||||
heat = Mathf.approachDelta(heat, heatOutput * efficiency() * Mathf.num(consValid()), warmupRate * delta());
|
||||
heat = Mathf.approachDelta(heat, heatOutput * efficiency() * Mathf.num(consValid), warmupRate * delta());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,7 +97,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(plan, list);
|
||||
|
||||
if(bits == null) return;
|
||||
|
||||
@@ -484,7 +484,7 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
|
||||
if(enabled && executor.initialized()){
|
||||
accumulator += edelta() * ipt * (consValid() ? 1 : 0);
|
||||
accumulator += edelta() * ipt * (consValid ? 1 : 0);
|
||||
|
||||
if(accumulator > maxInstructionScale * ipt) accumulator = maxInstructionScale * ipt;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class BlockProducer extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
@@ -88,7 +88,7 @@ public abstract class BlockProducer extends PayloadBlock{
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
var recipe = recipe();
|
||||
boolean produce = recipe != null && consValid() && payload == null;
|
||||
boolean produce = recipe != null && consValid && payload == null;
|
||||
|
||||
if(produce){
|
||||
progress += buildSpeed * edelta();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class PayloadLoader extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(inRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(baseRegion, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
@@ -188,7 +188,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
!(
|
||||
current instanceof PayloadDriverBuild entity &&
|
||||
current.isValid() &&
|
||||
entity.consValid() && entity.block == block &&
|
||||
entity.consValid && entity.block == block &&
|
||||
entity.link == pos() && within(current, range)
|
||||
)){
|
||||
waitingShooters.removeFirst();
|
||||
@@ -219,7 +219,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
}
|
||||
|
||||
//skip when there's no power
|
||||
if(!consValid()){
|
||||
if(!consValid){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ public class PayloadRouter extends PayloadConveyor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
super.drawRequestRegion(plan, list);
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
super.drawPlanRegion(plan, list);
|
||||
|
||||
Draw.rect(overRegion, plan.drawx(), plan.drawy());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PayloadSource extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PayloadVoid extends PayloadBlock{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
if(moveInPayload(false) && consValid()){
|
||||
if(moveInPayload(false) && consValid){
|
||||
payload = null;
|
||||
incinerateEffect.at(this);
|
||||
incinerateSound.at(this);
|
||||
|
||||
@@ -70,25 +70,25 @@ public class ConsumeGenerator extends PowerGenerator{
|
||||
|
||||
public class ConsumeGeneratorBuild extends GeneratorBuild{
|
||||
public float warmup, totalTime;
|
||||
public float itemMultiplier = 1f;
|
||||
|
||||
@Override
|
||||
public void updateEfficiencyMultiplier(){
|
||||
if(filterItem != null){
|
||||
float m = filterItem.efficiencyMultiplier(this);
|
||||
if(m > 0) efficiencyMultiplier = m;
|
||||
}else if(filterLiquid != null){
|
||||
float m = filterLiquid.efficiencyMultiplier(this);
|
||||
if(m > 0) efficiencyMultiplier = m;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
boolean valid = consValid();
|
||||
boolean valid = consValid;
|
||||
|
||||
warmup = Mathf.lerpDelta(warmup, enabled && valid ? 1f : 0f, 0.05f);
|
||||
warmup = Mathf.lerpDelta(warmup, valid ? 1f : 0f, 0.05f);
|
||||
|
||||
float multiplier = 1f;
|
||||
if(valid){
|
||||
if(filterItem != null && filterItem.getConsumed(this) != null){
|
||||
itemMultiplier = filterItem.efficiency(this);
|
||||
}
|
||||
|
||||
//efficiency is added together
|
||||
multiplier *= (itemMultiplier + (filterLiquid == null ? 0f : filterLiquid.efficiency(this)));
|
||||
}
|
||||
|
||||
productionEfficiency = (valid ? 1f : 0f) * multiplier;
|
||||
productionEfficiency = efficiency * efficiencyMultiplier;
|
||||
totalTime += warmup * Time.delta;
|
||||
|
||||
//randomly produce the effect
|
||||
@@ -97,7 +97,7 @@ public class ConsumeGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
//take in items periodically
|
||||
if(hasItems && valid && generateTime <= 0f && items.any()){
|
||||
if(hasItems && valid && generateTime <= 0f){
|
||||
consume();
|
||||
consumeEffect.at(x + Mathf.range(generateEffectRange), y + Mathf.range(generateEffectRange));
|
||||
generateTime = 1f;
|
||||
@@ -110,7 +110,7 @@ public class ConsumeGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
//generation time always goes down, but only at the end so consumeTriggerValid doesn't assume fake items
|
||||
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
||||
generateTime -= delta() / itemDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid() && power.status >= 0.99f){
|
||||
if(consValid && power.status >= 0.99f){
|
||||
boolean prevOut = getPowerProduction() <= consPower.requestedPower(this);
|
||||
|
||||
warmup = Mathf.lerpDelta(warmup, 1f, warmupSpeed * timeScale);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PowerDiode extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(fullIcon, plan.drawx(), plan.drawy());
|
||||
Draw.rect(arrow, plan.drawx(), plan.drawy(), !rotate ? 0 : plan.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
if(plan.config instanceof Point2[] ps){
|
||||
setupColor(1f);
|
||||
for(Point2 point : ps){
|
||||
|
||||
@@ -93,7 +93,7 @@ public class BeamDrill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class BeamDrill extends Block{
|
||||
|
||||
if(lasers[0] == null) updateLasers();
|
||||
|
||||
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f);
|
||||
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid), 1f / 60f);
|
||||
lastItem = null;
|
||||
boolean multiple = false;
|
||||
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation), facingAmount = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BurstDrill extends Drill{
|
||||
|
||||
smoothProgress = Mathf.lerpDelta(smoothProgress, progress / (drillTime - 20f), 0.1f);
|
||||
|
||||
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && consValid()){
|
||||
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && consValid){
|
||||
warmup = Mathf.approachDelta(warmup, progress / drillTime, 0.01f);
|
||||
|
||||
float speed = efficiency();
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
if(!plan.worldContext) return;
|
||||
Tile tile = plan.tile();
|
||||
if(tile == null) return;
|
||||
@@ -273,7 +273,7 @@ public class Drill extends Block{
|
||||
|
||||
timeDrilled += warmup * delta();
|
||||
|
||||
if(items.total() < itemCapacity && dominantItems > 0 && consValid()){
|
||||
if(items.total() < itemCapacity && dominantItems > 0 && consValid){
|
||||
|
||||
float speed = 1f;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Fracker extends SolidPump{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid()){
|
||||
if(consValid){
|
||||
if(accumulator >= itemUseTime){
|
||||
consume();
|
||||
accumulator -= itemUseTime;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class GenericCrafter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid()){
|
||||
if(consValid){
|
||||
|
||||
progress += getProgressIncrease(craftTime);
|
||||
warmup = Mathf.approachDelta(warmup, warmupTarget(), warmupSpeed);
|
||||
@@ -282,7 +282,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldAmbientSound(){
|
||||
return consValid();
|
||||
return consValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
heat = Mathf.approachDelta(heat, consValid() && efficiency() > 0.9f ? 1f : 0f, 0.04f);
|
||||
heat = Mathf.approachDelta(heat, consValid && efficiency() > 0.9f ? 1f : 0f, 0.04f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ItemIncinerator extends Block{
|
||||
|
||||
@Override
|
||||
public BlockStatus status(){
|
||||
return consValid() ? BlockStatus.active : BlockStatus.noInput;
|
||||
return consValid ? BlockStatus.active : BlockStatus.noInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +62,7 @@ public class ItemIncinerator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
return consValid();
|
||||
return consValid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class Pump extends LiquidBlock{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid() && liquidDrop != null){
|
||||
if(consValid && liquidDrop != null){
|
||||
float maxPump = Math.min(liquidCapacity - liquids.get(liquidDrop), amount * pumpAmount * edelta());
|
||||
liquids.add(liquidDrop, maxPump);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Separator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldAmbientSound(){
|
||||
return consValid();
|
||||
return consValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,7 +94,7 @@ public class Separator extends Block{
|
||||
public void updateTile(){
|
||||
totalProgress += warmup * delta();
|
||||
|
||||
if(consValid()){
|
||||
if(consValid){
|
||||
progress += getProgressIncrease(craftTime);
|
||||
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);
|
||||
}else{
|
||||
|
||||
@@ -121,7 +121,7 @@ public class SolidPump extends Pump{
|
||||
public void updateTile(){
|
||||
float fraction = Math.max(validTiles + boost + (attribute == null ? 0 : attribute.env()), 0);
|
||||
|
||||
if(consValid() && typeLiquid() < liquidCapacity - 0.001f){
|
||||
if(consValid && typeLiquid() < liquidCapacity - 0.001f){
|
||||
float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency());
|
||||
liquids.add(result, maxPump);
|
||||
lastPump = maxPump / Time.delta;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WallCrafter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class WallCrafter extends Block{
|
||||
|
||||
boolean cons = shouldConsume();
|
||||
|
||||
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 40f);
|
||||
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid), 1f / 40f);
|
||||
float dx = Geometry.d4x(rotation) * 0.5f, dy = Geometry.d4y(rotation) * 0.5f;
|
||||
|
||||
float eff = getEfficiency(tile.x, tile.y, rotation, dest -> {
|
||||
|
||||
@@ -46,8 +46,8 @@ public class ItemSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(plan, plan.config, "center", true);
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawPlanConfigCenter(plan, plan.config, "center", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,8 +46,8 @@ public class LiquidSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(plan, plan.config, "center", true);
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawPlanConfigCenter(plan, plan.config, "center", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,8 +47,8 @@ public class Unloader extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(plan, plan.config, "unloader-center");
|
||||
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawPlanConfigCenter(plan, plan.config, "unloader-center");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Reconstructor extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(inRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
@@ -219,7 +219,7 @@ public class Reconstructor extends UnitBlock{
|
||||
moveOutPayload();
|
||||
}else{ //update progress
|
||||
if(moveInPayload()){
|
||||
if(consValid()){
|
||||
if(consValid){
|
||||
valid = true;
|
||||
progress += edelta() * state.rules.unitBuildSpeed(team);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
boolean healed = false;
|
||||
|
||||
if(target != null && consValid()){
|
||||
if(target != null && consValid){
|
||||
float angle = Angles.angle(x, y, target.x + offset.x, target.y + offset.y);
|
||||
if(Angles.angleDist(angle, rotation) < 30f){
|
||||
healed = true;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class UnitAssembler extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(plan.rotation >= 2 ? sideRegion2 : sideRegion1, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
@@ -261,7 +261,7 @@ public class UnitAssembler extends PayloadBlock{
|
||||
@Override
|
||||
public boolean shouldConsume(){
|
||||
//liquid is only consumed when building is being done
|
||||
return enabled && !wasOccupied && Units.canCreate(team, plan().unit) && consPayload.valid(this);
|
||||
return enabled && !wasOccupied && Units.canCreate(team, plan().unit) && consPayload.efficiency(this) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,7 +375,7 @@ public class UnitAssembler extends PayloadBlock{
|
||||
var plan = plan();
|
||||
|
||||
//check if all requirements are met
|
||||
if(!wasOccupied && consValid() && Units.canCreate(team, plan.unit)){
|
||||
if(!wasOccupied && consValid && Units.canCreate(team, plan.unit)){
|
||||
warmup = Mathf.lerpDelta(warmup, efficiency(), 0.1f);
|
||||
|
||||
if((progress += edelta() * eff / plan.time) >= 1f){
|
||||
@@ -523,7 +523,7 @@ public class UnitAssembler extends PayloadBlock{
|
||||
|
||||
/** @return true if this block is ready to produce units, e.g. requirements met */
|
||||
public boolean ready(){
|
||||
return consValid() && !wasOccupied;
|
||||
return consValid && !wasOccupied;
|
||||
}
|
||||
|
||||
public void yeetPayload(Payload payload){
|
||||
|
||||
@@ -44,7 +44,7 @@ public class UnitAssemblerModule extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(plan.rotation >= 2 ? sideRegion2 : sideRegion1, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
@@ -128,7 +128,7 @@ public class UnitAssemblerModule extends PayloadBlock{
|
||||
findLink();
|
||||
}
|
||||
|
||||
if(moveInPayload() && link != null && link.moduleFits(block, x, y, rotation) && !link.wasOccupied && link.acceptPayload(this, payload) && consValid()){
|
||||
if(moveInPayload() && link != null && link.moduleFits(block, x, y, rotation) && !link.wasOccupied && link.acceptPayload(this, payload) && consValid){
|
||||
link.yeetPayload(payload);
|
||||
payload = null;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class UnitFactory extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(outRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
Draw.rect(topRegion, plan.drawx(), plan.drawy());
|
||||
@@ -244,7 +244,7 @@ public class UnitFactory extends UnitBlock{
|
||||
currentPlan = -1;
|
||||
}
|
||||
|
||||
if(consValid() && currentPlan != -1){
|
||||
if(consValid && currentPlan != -1){
|
||||
time += edelta() * speedScl * Vars.state.rules.unitBuildSpeed(team);
|
||||
progress += edelta() * Vars.state.rules.unitBuildSpeed(team);
|
||||
speedScl = Mathf.lerpDelta(speedScl, 1f, 0.05f);
|
||||
@@ -263,7 +263,7 @@ public class UnitFactory extends UnitBlock{
|
||||
return;
|
||||
}
|
||||
|
||||
if(progress >= plan.time && consValid()){
|
||||
if(progress >= plan.time && consValid){
|
||||
progress %= 1f;
|
||||
|
||||
Unit unit = plan.unit.create(team);
|
||||
|
||||
@@ -13,8 +13,7 @@ public abstract class Consume{
|
||||
public boolean optional;
|
||||
/** If true, this consumer will be displayed as a boost input. */
|
||||
public boolean booster;
|
||||
//TODO bad. I don't like it.
|
||||
@Deprecated
|
||||
/** If false, this consumer will still be checked, but it will need to updated manually. */
|
||||
public boolean update = true;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,6 @@ public abstract class Consume{
|
||||
return optional(true, true);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Consume update(boolean update){
|
||||
this.update = update;
|
||||
return this;
|
||||
@@ -52,11 +50,16 @@ public abstract class Consume{
|
||||
|
||||
public void update(Building build){}
|
||||
|
||||
/** @return efficiency multiplier based on input; overridden in subclasses. Returns 0 if not valid in subclasses. Should return fraction if needs are partially met. */
|
||||
/** @return [0, 1] efficiency multiplier based on input. Returns 0 if not valid in subclasses. Should return fraction if needs are partially met. */
|
||||
public float efficiency(Building build){
|
||||
return 1f;
|
||||
}
|
||||
|
||||
/** @return multiplier for efficiency - this can be above 1. Will not influence a building's base efficiency value. */
|
||||
public float efficiencyMultiplier(Building build){
|
||||
return 1f;
|
||||
}
|
||||
|
||||
public void display(Stats stats){}
|
||||
|
||||
//TODO this should use efficiency instead - remove or deprecate
|
||||
|
||||
@@ -14,7 +14,8 @@ public class ConsumeItemCharged extends ConsumeItemFilter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiency(Building build){
|
||||
public float efficiencyMultiplier(Building build){
|
||||
if(build.consumeTriggerValid()) return 1f;
|
||||
var item = getConsumed(build);
|
||||
return item == null ? 0f : item.charge;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ public class ConsumeItemFlammable extends ConsumeItemFilter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiency(Building build){
|
||||
public float efficiencyMultiplier(Building build){
|
||||
//TODO ugh
|
||||
if(build.consumeTriggerValid()) return 1f;
|
||||
var item = getConsumed(build);
|
||||
return item == null ? 0f : item.flammability;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ public class ConsumeItemRadioactive extends ConsumeItemFilter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiency(Building build){
|
||||
public float efficiencyMultiplier(Building build){
|
||||
if(build.consumeTriggerValid()) return 1f;
|
||||
var item = getConsumed(build);
|
||||
return item == null ? 0f : item.radioactivity;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,7 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{
|
||||
|
||||
@Override
|
||||
public void update(Building build){
|
||||
Liquid liq = getConsumed(build);
|
||||
build.liquids.remove(liq, amount * build.edelta());
|
||||
build.liquids.remove(getConsumed(build), amount * build.edelta());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,8 @@ public class ConsumeLiquidFlammable extends ConsumeLiquidFilter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiency(Building build){
|
||||
var item = getConsumed(build);
|
||||
return item == null ? 0f : item.flammability * super.efficiency(build);
|
||||
public float efficiencyMultiplier(Building build){
|
||||
var liq = getConsumed(build);
|
||||
return liq == null ? 0f : liq.flammability;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ConsumeLiquids extends Consume{
|
||||
int i = 0;
|
||||
for(var stack : liquids){
|
||||
c.add(new ReqImage(stack.liquid.uiIcon,
|
||||
() -> build.liquids.get(stack.liquid) >= stack.amount * build.delta())).size(Vars.iconMed).padRight(8);
|
||||
() -> build.liquids.get(stack.liquid) > 0)).size(Vars.iconMed).padRight(8);
|
||||
if(++i % 4 == 0) c.row();
|
||||
}
|
||||
}).left();
|
||||
@@ -44,13 +44,12 @@ public class ConsumeLiquids extends Consume{
|
||||
@Override
|
||||
public void update(Building build){
|
||||
for(var stack : liquids){
|
||||
build.liquids.remove(stack.liquid, Math.min(use(stack.amount, build), build.liquids.get(stack.liquid)));
|
||||
build.liquids.remove(stack.liquid, stack.amount * build.edelta());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiency(Building build){
|
||||
//TODO delta or edelta
|
||||
float min = 1f, delta = build.edelta();
|
||||
for(var stack : liquids){
|
||||
min = Math.min(build.liquids.get(stack.liquid) / (stack.amount * delta), min);
|
||||
@@ -63,7 +62,4 @@ public class ConsumeLiquids extends Consume{
|
||||
stats.add(booster ? Stat.booster : Stat.input, StatValues.liquids(1f, true, liquids));
|
||||
}
|
||||
|
||||
protected float use(float amount, Building build){
|
||||
return Math.min(amount * build.edelta(), build.block.liquidCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DrawBlock{
|
||||
|
||||
/** Draws the planned version of this block. */
|
||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
block.drawDefaultRequestRegion(plan, list);
|
||||
block.drawDefaultPlanRegion(plan, list);
|
||||
}
|
||||
|
||||
/** Load any relevant texture regions. */
|
||||
|
||||
@@ -25,6 +25,9 @@ public class ItemModule extends BlockModule{
|
||||
protected int total;
|
||||
protected int takeRotation;
|
||||
|
||||
/** A value >0 in an index array indicates that a corresponding item is currently being consumed. 1 indicates an entire item. */
|
||||
public float[] itemConsumption = new float[items.length];
|
||||
|
||||
private @Nullable WindowedMean[] flow;
|
||||
|
||||
public ItemModule copy(){
|
||||
|
||||
Reference in New Issue
Block a user