Payload router
|
After Width: | Height: | Size: 129 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 513 B |
BIN
core/assets-raw/sprites/blocks/distribution/payload-router.png
Normal file
|
After Width: | Height: | Size: 307 B |
@@ -237,3 +237,4 @@
|
||||
63507=block-unloader|block-block-unloader-medium
|
||||
63506=core-silo|block-core-silo-medium
|
||||
63505=data-processor|block-data-processor-medium
|
||||
63504=payload-router|block-payload-router-medium
|
||||
|
||||
|
Before Width: | Height: | Size: 740 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 824 KiB After Width: | Height: | Size: 829 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 273 KiB |
|
Before Width: | Height: | Size: 887 KiB After Width: | Height: | Size: 897 KiB |
@@ -1,6 +1,5 @@
|
||||
package mindustry.ai.types;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.ai.Pathfinder.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -60,7 +59,7 @@ public class GroundAI extends AIController{
|
||||
|
||||
if(tile == targetTile) return;
|
||||
|
||||
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.type().speed * Time.delta()));
|
||||
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.type().speed));
|
||||
}
|
||||
|
||||
protected void moveAwayFromCore(){
|
||||
@@ -88,6 +87,6 @@ public class GroundAI extends AIController{
|
||||
|
||||
if(tile == targetTile || core == null || unit.within(core, 120f)) return;
|
||||
|
||||
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.type().speed * Time.delta()));
|
||||
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.type().speed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
//transport
|
||||
conveyor, titaniumConveyor, plastaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router,
|
||||
overflowGate, underflowGate, massDriver, massConveyor,
|
||||
overflowGate, underflowGate, massDriver, payloadConveyor, payloadRouter,
|
||||
|
||||
//liquid
|
||||
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
|
||||
@@ -990,7 +990,11 @@ public class Blocks implements ContentList{
|
||||
consumes.power(1.75f);
|
||||
}};
|
||||
|
||||
massConveyor = new PayloadConveyor("mass-conveyor"){{
|
||||
payloadConveyor = new PayloadConveyor("mass-conveyor"){{
|
||||
requirements(Category.distribution, ItemStack.with(Items.copper, 1));
|
||||
}};
|
||||
|
||||
payloadRouter = new PayloadRouter("payload-router"){{
|
||||
requirements(Category.distribution, ItemStack.with(Items.copper, 1));
|
||||
}};
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public class Block extends UnlockableContent{
|
||||
public boolean consumesPower = true;
|
||||
public boolean outputsPower = false;
|
||||
public boolean outputsPayload = false;
|
||||
public boolean outputFacing = true;
|
||||
public boolean acceptsItems = false;
|
||||
|
||||
public int itemCapacity = 10;
|
||||
|
||||
@@ -95,20 +95,30 @@ public class PayloadConveyor extends Block{
|
||||
//move forward.
|
||||
next.handlePayload(this, item);
|
||||
item = null;
|
||||
moved();
|
||||
}
|
||||
}else if(!blocked){
|
||||
//dump item forward
|
||||
if(item.dump()){
|
||||
item = null;
|
||||
moved();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void moved(){
|
||||
|
||||
}
|
||||
|
||||
public void drawBottom(){
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
drawBottom();
|
||||
|
||||
float dst = 0.8f;
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package mindustry.world.blocks.distribution;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class PayloadRouter extends PayloadConveyor{
|
||||
public @Load("@-over") TextureRegion overRegion;
|
||||
|
||||
public PayloadRouter(String name){
|
||||
super(name);
|
||||
|
||||
outputsPayload = true;
|
||||
outputFacing = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
super.drawRequestRegion(req, list);
|
||||
|
||||
Draw.rect(overRegion, req.drawx(), req.drawy());
|
||||
}
|
||||
|
||||
public class PayloadRouterEntity extends PayloadConveyorEntity{
|
||||
|
||||
@Override
|
||||
public void moved(){
|
||||
int rotations = 0;
|
||||
do{
|
||||
tile.rotation((tile.rotation() + 1) % 4);
|
||||
onProximityUpdate();
|
||||
}while((blocked || next == null) && ++rotations < 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
Draw.z(Layer.block);
|
||||
|
||||
Draw.rect(overRegion, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.world.blocks.payloads;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -32,6 +33,8 @@ public class UnitPayload implements Payload{
|
||||
//no client dumping
|
||||
if(Vars.net.client()) return true;
|
||||
|
||||
//prevents stacking
|
||||
unit.vel().add(Mathf.range(0.5f), Mathf.range(0.5f));
|
||||
unit.add();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -28,7 +28,8 @@ public class PayloadAcceptor extends Block{
|
||||
accept.block().size == size &&
|
||||
accept.block().outputsPayload &&
|
||||
//block must either be facing this one, or not be rotating
|
||||
((accept.tileX() + Geometry.d4(accept.rotation()).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation()).y * size == tile.tileY()) || !accept.block().rotate);
|
||||
((accept.tileX() + Geometry.d4(accept.rotation()).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation()).y * size == tile.tileY())
|
||||
|| !accept.block().rotate || (accept.block().rotate && !accept.block().outputFacing));
|
||||
}
|
||||
|
||||
public class PayloadAcceptorEntity<T extends Payload> extends TileEntity{
|
||||
|
||||