mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 04:37:31 +07:00
Cleanup stack conveyor code (#1946)
- removes now obsolete adhoc boosteffect listing - clarrify comments a bit more - monospace align some code - retexture to avoid shadow conflict
This commit is contained in:

committed by
GitHub

parent
d50092e9a2
commit
a226cd390c
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
@ -52,7 +52,6 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
//have to add a custom calculated speed, since the actual movement speed is apparently not linear
|
||||
stats.add(BlockStat.itemsMoved, displayedSpeed, StatUnit.itemsSecond);
|
||||
stats.add(BlockStat.boostEffect, "$blocks.itemsmoved");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +58,6 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.itemsMoved, speed * 60, StatUnit.perSecond);
|
||||
stats.add(BlockStat.boostEffect, "$blocks.itemcapacity");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,11 +128,11 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
Tmp.v2.set(tile);
|
||||
Tmp.v1.interpolate(Tmp.v2, 1f - cooldown, Interpolation.linear);
|
||||
|
||||
//fixme
|
||||
//rotation
|
||||
float a = (from.rotation()%4) * 90;
|
||||
float b = (tile.rotation()%4) * 90;
|
||||
if((from.rotation()%4) == 3 && (tile.rotation()%4) == 0) a = -1 * 90;
|
||||
if((from.rotation()%4) == 0 && (tile.rotation()%4) == 3) a = 4 * 90;
|
||||
if((from.rotation()%4) == 0 && (tile.rotation()%4) == 3) a = 4 * 90;
|
||||
|
||||
//stack
|
||||
Draw.rect(stackRegion, Tmp.v1.x, Tmp.v1.y, Mathf.lerp(a, b, Interpolation.smooth.apply(1f - Mathf.clamp(cooldown * 2, 0f, 1f))));
|
||||
@ -151,7 +150,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
state = stateMove;
|
||||
|
||||
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
||||
if(bits[0] == 0 && blends(tile, tile.rotation(), 0) && !blends(tile, tile.rotation(), 2)) state = stateLoad; // a 0 that faces into a conveyor with none behind it
|
||||
if(bits[0] == 0 && blends(tile, tile.rotation(), 0) && !blends(tile, tile.rotation(), 2)) state = stateLoad; // a 0 that faces into a conveyor with none behind it
|
||||
if(bits[0] == 0 && !blends(tile, tile.rotation(), 0) && blends(tile, tile.rotation(), 2)) state = stateUnload; // a 0 that faces into none with a conveyor behind it
|
||||
|
||||
blendprox = 0;
|
||||
@ -195,7 +194,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
if(e.link == -1){
|
||||
e.items.addAll(items);
|
||||
e.link = tile.pos();
|
||||
// ▲ new | old ▼
|
||||
// ▲ to | from ▼
|
||||
link = -1;
|
||||
items.clear();
|
||||
|
||||
@ -252,7 +251,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
return !((state != stateLoad) // not a loading dock
|
||||
|| (items.total() > 0 && !items.has(item)) // incompatible items
|
||||
|| (items.total() >= getMaximumAccepted(item)) // filled to capacity
|
||||
|| (tile.front() == source));
|
||||
|| (tile.front() == source));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user