Serpulo transport stuff + qol (#10706)

* death penalty, instant

* idk if to leave to exactly 11/s or 12/s

* yass display changes

* broke

* hhh

* a

* welp, good enough

* ok fixed

* totally not stealing from foos. Yup

* revert dump

* a
This commit is contained in:
EggleEgg
2025-04-26 16:58:13 +02:00
committed by GitHub
parent ec6740c8da
commit 2d8e99339b
7 changed files with 68 additions and 5 deletions

View File

@@ -1937,7 +1937,7 @@ public class Blocks{
}}; }};
junction = new Junction("junction"){{ junction = new Junction("junction"){{
requirements(Category.distribution, with(Items.copper, 2)); requirements(Category.distribution, with(Items.copper, 3));
speed = 26; speed = 26;
capacity = 6; capacity = 6;
health = 30; health = 30;
@@ -1956,6 +1956,7 @@ public class Blocks{
phaseConveyor = new ItemBridge("phase-conveyor"){{ phaseConveyor = new ItemBridge("phase-conveyor"){{
requirements(Category.distribution, with(Items.phaseFabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10)); requirements(Category.distribution, with(Items.phaseFabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10));
range = 12; range = 12;
transportTime = 2f;
arrowPeriod = 0.9f; arrowPeriod = 0.9f;
arrowTimeScl = 2.75f; arrowTimeScl = 2.75f;
hasPower = true; hasPower = true;

View File

@@ -55,7 +55,7 @@ public class Renderer implements ApplicationListener{
//currently landing core, null if there are no cores or it has finished landing. //currently landing core, null if there are no cores or it has finished landing.
private @Nullable LaunchAnimator launchAnimator; private @Nullable LaunchAnimator launchAnimator;
private Color clearColor = new Color(0f, 0f, 0f, 1f); private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float public float
//target camera scale that is lerp-ed to //target camera scale that is lerp-ed to
targetscale = Scl.scl(4), targetscale = Scl.scl(4),
//current actual camera scale //current actual camera scale

View File

@@ -32,6 +32,7 @@ import mindustry.input.Placement.*;
import mindustry.net.Administration.*; import mindustry.net.Administration.*;
import mindustry.net.*; import mindustry.net.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*;
import mindustry.ui.fragments.*; import mindustry.ui.fragments.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.ConstructBlock.*; import mindustry.world.blocks.ConstructBlock.*;
@@ -1539,6 +1540,28 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Lines.rect(result.x, result.y - 1, result.x2 - result.x, result.y2 - result.y); Lines.rect(result.x, result.y - 1, result.x2 - result.x, result.y2 - result.y);
Draw.color(col2); Draw.color(col2);
Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y); Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y);
Font font = Fonts.outline;
font.setColor(col2);
var ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false);
var z = Draw.z();
Draw.z(Layer.endPixeled);
font.getData().setScale(1 / renderer.camerascale);
var snapToCursor = Core.settings.getBool("selectionsizeoncursor");
var textOffset = Core.settings.getInt("selectionsizeoncursoroffset", 5);
int width = (int)((result.x2 - result.x) / 8);
int height = (int)((result.y2 - result.y) / 8);
int area = width * height;
// FINISHME: When not snapping to cursor, perhaps it would be best to choose the corner closest to the cursor that's at least a block away?
font.draw(width + "x" + height + " (" + area + ")",
snapToCursor ? input.mouseWorldX() + textOffset * (4 / renderer.camerascale) : result.x2,
snapToCursor ? input.mouseWorldY() - textOffset * (4 / renderer.camerascale) : result.y
);
font.setColor(Color.white);
font.getData().setScale(1);
font.setUseIntegerPositions(ints);
Draw.z(z);
} }
protected void flushSelectPlans(Seq<BuildPlan> plans){ protected void flushSelectPlans(Seq<BuildPlan> plans){

View File

@@ -4,12 +4,14 @@ import arc.util.io.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.meta.*;
public class BufferedItemBridge extends ItemBridge{ public class BufferedItemBridge extends ItemBridge{
public final int timerAccept = timers++; public final int timerAccept = timers++;
public float speed = 40f; public float speed = 40f;
public int bufferCapacity = 50; public int bufferCapacity = 50;
public float displayedSpeed = 11f;
public BufferedItemBridge(String name){ public BufferedItemBridge(String name){
super(name); super(name);
@@ -18,6 +20,15 @@ public class BufferedItemBridge extends ItemBridge{
canOverdrive = true; canOverdrive = true;
} }
@Override
public void setStats(){
super.setStats();
//Hard to calculate, fps and overdive reliant. Movement speed taken from testing
stats.add(Stat.itemsMoved, displayedSpeed, StatUnit.itemsSecond);
}
public class BufferedItemBridgeBuild extends ItemBridgeBuild{ public class BufferedItemBridgeBuild extends ItemBridgeBuild{
ItemBuffer buffer = new ItemBuffer(bufferCapacity); ItemBuffer buffer = new ItemBuffer(bufferCapacity);
@@ -40,12 +51,14 @@ public class BufferedItemBridge extends ItemBridge{
dump(); dump();
} }
@Override @Override
public void write(Writes write){ public void write(Writes write){
super.write(write); super.write(write);
buffer.write(write); buffer.write(write);
} }
@Override @Override
public void read(Reads read, byte revision){ public void read(Reads read, byte revision){
super.read(read, revision); super.read(read, revision);

View File

@@ -2,6 +2,8 @@ package mindustry.world.blocks.distribution;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.meta.*;
public class DuctBridge extends DirectionBridge{ public class DuctBridge extends DirectionBridge{
public float speed = 5f; public float speed = 5f;
@@ -15,6 +17,12 @@ public class DuctBridge extends DirectionBridge{
isDuct = true; isDuct = true;
} }
@Override
public void setStats(){
super.setStats();
stats.add(Stat.itemsMoved, 60f / speed, StatUnit.itemsSecond);
}
public class DuctBridgeBuild extends DirectionBridgeBuild{ public class DuctBridgeBuild extends DirectionBridgeBuild{
public float progress = 0f; public float progress = 0f;

View File

@@ -26,7 +26,7 @@ public class ItemBridge extends Block{
public final int timerCheckMoved = timers ++; public final int timerCheckMoved = timers ++;
public int range; public int range;
public float transportTime = 2f; public float transportTime;
public @Load("@-end") TextureRegion endRegion; public @Load("@-end") TextureRegion endRegion;
public @Load("@-bridge") TextureRegion bridgeRegion; public @Load("@-bridge") TextureRegion bridgeRegion;
public @Load("@-arrow") TextureRegion arrowRegion; public @Load("@-arrow") TextureRegion arrowRegion;
@@ -65,6 +65,14 @@ public class ItemBridge extends Block{
config(Integer.class, (ItemBridgeBuild tile, Integer i) -> tile.link = i); config(Integer.class, (ItemBridgeBuild tile, Integer i) -> tile.link = i);
} }
@Override
public void setStats() {
super.setStats();
if(transportTime != 0f){
stats.add(Stat.itemsMoved, 60f / transportTime, StatUnit.itemsSecond);
}
}
@Override @Override
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){ public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
otherReq = null; otherReq = null;

View File

@@ -12,6 +12,7 @@ import static mindustry.Vars.*;
public class Junction extends Block{ public class Junction extends Block{
public float speed = 26; //frames taken to go through this junction public float speed = 26; //frames taken to go through this junction
public int capacity = 6; public int capacity = 6;
public float displayedSpeed = 13f;
public Junction(String name){ public Junction(String name){
super(name); super(name);
@@ -24,6 +25,15 @@ public class Junction extends Block{
noUpdateDisabled = true; noUpdateDisabled = true;
} }
@Override
public void setStats(){
super.setStats();
//(60f / speed * capacity) returns 13.84 which is not the actual value (non linear, depends on fps)
stats.add(Stat.itemsMoved, displayedSpeed, StatUnit.itemsSecond);
stats.add(Stat.itemCapacity, capacity, StatUnit.items);
}
@Override @Override
public boolean outputsItems(){ public boolean outputsItems(){
return true; return true;