Miniloader

by therax

Compact and UPS-friendly 1x1 loaders. Works with train cargo wagons, circuits, filters, and modded belts from Bob's, Krastorio, FactorioExtended Plus, Space Exploration, and Ultimate Belts.

Content
1 year, 3 months ago
0.15 - 1.1
192K
Logistics

b Orientation is regularly incorrect when placed by construction bots

2 years ago

I keep finding that miniloaders are either the wrong way round (chest side flipped to belt side) or their direction (input or output from chest) is backwards after using copy paste / blue prints / ghost placements, especially against machines or trains rather than chests.

Had a bit of a look in here for this issue, but can't see anything under 1 year old

Seems to be more prevalent when non-personal bots do it.

IS this known? Or is there something screw going on. I can't seem to make it do it when I want to for a screenshot lol

2 years ago

I haven't noticed it happening, but can imagine a couple possible causes. Even better than a screenshot might be a blueprint that has had the problem.

Also have you noticed if it occurs after rotating/flipping the design before placing it?

2 years ago

Nothing specific about rotating flipping. Happened to me a few times today just from ghosts (picking via Q from a placed one). It's not a specific blueprint that pastes wrong, it just seems that construction bots "get it wrong" about 5-10% of the time.

2 years ago
(updated 2 years ago)

Nothing specific about rotating flipping. Happened to me a few times today just from ghosts (picking via Q from a placed one). It's not a specific blueprint that pastes wrong (I don't have ANY blueprints with loaders), it just seems that construction bots "get it wrong" about 5-10% of the time. Copy paste is similar fail rate, but it seems patchy.

2 years ago
(updated 2 years ago)

Ah, nailed one: https://youtu.be/u9k96B7Mp9A

I also have the save file at exactly this point if needed / useful

It makes no difference if I "Q" the wrong one or the "right" one next to it. Placing here seems toALWAYS be backward

2 years ago
(updated 2 years ago)

Somehow keep making extra replies sorry... Edit does not seem to be editing :/

All miniloaders doing it to me at this spot right now... Struggling to place one how I want at all

2 years ago

Looking at the video I was still unable to reproduce that behavior locally, so a save file that consistently reproduces this for you might help.

Have you tried in the mod settings -> map tab deselecting "Snap miniloaders"? I don't think any of that code path would have been triggered in the video you showed so shouldn't make a difference, but might be worth trying.

Also I'm curious if you tried placing the miniloader backward if it would get placed into the desired position or end up still in the same orientation.

2 years ago

Link to save file https://1drv.ms/u/s!AovEDuJOp5pvgeoWXUMIKnXatorszw?e=7YbEyc

I'll let you have a play with that first, let me know if there's other things you'd like me to try.

2 years ago

So the simple workaround actually is to disable snapping, disable mod settings -> map tab -> Snap miniloaders.

The problem arises as a result of the nullius windmills having a hidden entity with a large bounding box which the miniloader then sees and snaps to.

https://postimg.cc/Mv7dGKjs

Another workaround is to place connecting belts (before or after the loaders) since the loaders will preferentially snap to belts over other entities.

A proper fix for most situations might be to have miniloaders snap to the closest entity, or just not snap and keep the placed direction if entities in both directions are found.

2 years ago

The problem arises as a result of the nullius windmills having a hidden entity with a large bounding box which the miniloader then sees and snaps to.

Ahahaha. Nice. Well found.

I have had the issue previously in K2SE, but was definitely getting it more often in nullius. I suspect something similar with the various tricky things in K2SE would be at play, such as a passing cargo rocket or delivery capsule or something.

I guess I have to turn snapping off. I'll mention it to anachrony (nullius) but I doubt anything will change. They'll likely just mention to turn snapping off in their official modpacks that includes miniloaders.

2 years ago

Yeah, I didn't look into Nullius and what it is using the entity for at all but it's probably needed, so there likely isn't much they can do about it on their end.

After thinking about it some more I have a feeling that no matter what we do there are probably always going to be edge cases that go wrong. So I'm leaning more and more toward following the Python zen in this case, "In the face of ambiguity, refuse the temptation to guess". If there are entities in both directions just keep the direction originally placed, that way the player is able to override any problem.

2 years ago

Sent a PR for this at https://github.com/mspielberg/factorio-miniloader/pull/73

Also noticed that it will currently snap to the back of underground belts, where the only even semi-useful direction seems like it would be snapping away from them in that situation.

2 years ago

Nice detective work.

My initial devvy thoughts are to have it look for entities that are actually next to it, working its way outward, but that's assuming it's possible to get an entitly location that's "center" based. Check the 3x3 around, then 5x5, then 7x7 (and maybe make max size check configurable to avoid load). As soon as something positive is hit (and 99% of the time, finding a belt on the first check is the end of it) use that.

2 years ago
(updated 2 years ago)

So the miniloader, when searching for objects to do the snapping to, is asking the engine for entities that are in the tile at either end of it. The engine is returning every entity whose bounding box intersects with those positions. Every entity has both a position and a bounding box. The position is usually, but not always, centered in the bounding box. So it would be trivial to go with the entity whose position (or center) is closer if there is a difference.

That would fix this particular situation and most likely the majority of problems, but would still break when placed next to a larger building with another entity nearby that happens to be closer. The user would then be left once again with no way to fix it except to disable snapping altogether.

2 years ago

Wouldn't a simpler fix be to add a blacklist of entities that the miniloaders won't snap to? This can be updated in the miniloaders mod, or add by other mods through a remote-interface.

2 years ago

A blacklist would be nice to help reduce the number of times an ambiguity occurs, but is orthogonal to deciding what to do when encountering multiple possibilities. It seems like it would also be quite a bit more complex to get implemented, still might be worth doing along with not snapping when eligible entities are found in both directions though.

1 year, 10 months ago

I get wrong direction snap (not sure about the terminology used :D) between a steel chest and a belt that, while it doesn't point away from the loader, it doesn't point to it, which, in my mind, is the only reason to snap the direction towards the chest. But also only sometimes. It's… maddening.

I wish the function wasn't as idiotic as the name "idiot_snap" suggests…

1 year, 9 months ago

That would fix this particular situation and most likely the majority of problems, but would still break when placed next to a larger building with another entity nearby that happens to be closer. The user would then be left once again with no way to fix it except to disable snapping altogether.

Maybe it just needs another keyboard shortcut. [R] works like current, flipping the direction, and [Shift+R] rotates around 90°. So you can get good snapping wherever it works, but the orientation is totally fixable without removing snapping when it's broken.

New response