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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 68 additions and 5 deletions

View file

@ -1937,7 +1937,7 @@ public class Blocks{
}};
junction = new Junction("junction"){{
requirements(Category.distribution, with(Items.copper, 2));
requirements(Category.distribution, with(Items.copper, 3));
speed = 26;
capacity = 6;
health = 30;
@ -1956,6 +1956,7 @@ public class Blocks{
phaseConveyor = new ItemBridge("phase-conveyor"){{
requirements(Category.distribution, with(Items.phaseFabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10));
range = 12;
transportTime = 2f;
arrowPeriod = 0.9f;
arrowTimeScl = 2.75f;
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.
private @Nullable LaunchAnimator launchAnimator;
private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float
public float
//target camera scale that is lerp-ed to
targetscale = Scl.scl(4),
//current actual camera scale

View file

@ -32,6 +32,7 @@ import mindustry.input.Placement.*;
import mindustry.net.Administration.*;
import mindustry.net.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.ui.fragments.*;
import mindustry.world.*;
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);
Draw.color(col2);
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){

View file

@ -4,12 +4,14 @@ import arc.util.io.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.meta.*;
public class BufferedItemBridge extends ItemBridge{
public final int timerAccept = timers++;
public float speed = 40f;
public int bufferCapacity = 50;
public float displayedSpeed = 11f;
public BufferedItemBridge(String name){
super(name);
@ -17,6 +19,15 @@ public class BufferedItemBridge extends ItemBridge{
hasItems = 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{
ItemBuffer buffer = new ItemBuffer(bufferCapacity);
@ -40,16 +51,18 @@ public class BufferedItemBridge extends ItemBridge{
dump();
}
@Override
public void write(Writes write){
super.write(write);
buffer.write(write);
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
buffer.read(read);
}
}
}
}

View file

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

View file

@ -26,7 +26,7 @@ public class ItemBridge extends Block{
public final int timerCheckMoved = timers ++;
public int range;
public float transportTime = 2f;
public float transportTime;
public @Load("@-end") TextureRegion endRegion;
public @Load("@-bridge") TextureRegion bridgeRegion;
public @Load("@-arrow") TextureRegion arrowRegion;
@ -65,6 +65,14 @@ public class ItemBridge extends Block{
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
public void drawPlanConfigTop(BuildPlan plan, Eachable<BuildPlan> list){
otherReq = null;
@ -518,4 +526,4 @@ public class ItemBridge extends Block{
}
}
}
}
}

View file

@ -12,6 +12,7 @@ import static mindustry.Vars.*;
public class Junction extends Block{
public float speed = 26; //frames taken to go through this junction
public int capacity = 6;
public float displayedSpeed = 13f;
public Junction(String name){
super(name);
@ -24,6 +25,15 @@ public class Junction extends Block{
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
public boolean outputsItems(){
return true;