hortiloaders 1.0.3.0 bug fix (#6233)
* hortiloaders 1.0.3.0 bug fix it didnt unload from StackConveyors/Storage when they had the same loadfactor as the factory * unloader fix, using fields
This commit is contained in:
@@ -265,6 +265,8 @@ public class Block extends UnlockableContent{
|
|||||||
public boolean quickRotate = true;
|
public boolean quickRotate = true;
|
||||||
/** Main subclass. Non-anonymous. */
|
/** Main subclass. Non-anonymous. */
|
||||||
public @Nullable Class<?> subclass;
|
public @Nullable Class<?> subclass;
|
||||||
|
/** Determines if this block gets a higher unloader priority. */
|
||||||
|
public boolean highUnloadPriority = false;
|
||||||
|
|
||||||
public float selectScroll; //scroll position for certain blocks
|
public float selectScroll; //scroll position for certain blocks
|
||||||
public Prov<Building> buildType = null; //initialized later
|
public Prov<Building> buildType = null; //initialized later
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
hasItems = true;
|
hasItems = true;
|
||||||
itemCapacity = 10;
|
itemCapacity = 10;
|
||||||
conveyorPlacement = true;
|
conveyorPlacement = true;
|
||||||
|
highUnloadPriority = true;
|
||||||
|
|
||||||
ambientSound = Sounds.conveyor;
|
ambientSound = Sounds.conveyor;
|
||||||
ambientSoundVolume = 0.004f;
|
ambientSoundVolume = 0.004f;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class StorageBlock extends Block{
|
|||||||
flags = EnumSet.of(BlockFlag.storage);
|
flags = EnumSet.of(BlockFlag.storage);
|
||||||
allowResupply = true;
|
allowResupply = true;
|
||||||
envEnabled = Env.any;
|
envEnabled = Env.any;
|
||||||
|
highUnloadPriority = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import mindustry.gen.*;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.blocks.distribution.*;
|
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -139,7 +138,7 @@ public class Unloader extends Block{
|
|||||||
|
|
||||||
//sort so it gives full priority to blocks that can give but not receive (stackConveyors and Storage), and then by load
|
//sort so it gives full priority to blocks that can give but not receive (stackConveyors and Storage), and then by load
|
||||||
possibleBlocks.sort(Structs.comps(
|
possibleBlocks.sort(Structs.comps(
|
||||||
Structs.comparingBool(e -> e.building.block instanceof StorageBlock || e.building.block instanceof StackConveyor),
|
Structs.comparingBool(e -> e.building.block.highUnloadPriority),
|
||||||
Structs.comparingFloat(e -> e.loadFactor)
|
Structs.comparingFloat(e -> e.loadFactor)
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -163,7 +162,7 @@ public class Unloader extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//trade the items
|
//trade the items
|
||||||
if(dumpingFrom != null && dumpingTo != null && dumpingFrom.loadFactor != dumpingTo.loadFactor){
|
if(dumpingFrom != null && dumpingTo != null && (dumpingFrom.loadFactor != dumpingTo.loadFactor || dumpingFrom.building.block.highUnloadPriority)){
|
||||||
dumpingTo.building.handleItem(this, item);
|
dumpingTo.building.handleItem(this, item);
|
||||||
dumpingFrom.building.removeStack(item, 1);
|
dumpingFrom.building.removeStack(item, 1);
|
||||||
any = true;
|
any = true;
|
||||||
@@ -232,4 +231,4 @@ public class Unloader extends Block{
|
|||||||
sortItem = id == -1 ? null : content.items().get(id);
|
sortItem = id == -1 ? null : content.items().get(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user