fix issue where items were accepted by a belt from opposite travel direction

This commit is contained in:
2026-07-14 20:15:39 +02:00
parent 4b149d97a7
commit af8a2224c0
5 changed files with 249 additions and 80 deletions

View File

@@ -74,8 +74,10 @@ public:
// port.direction = direction items flow on that tile
//
// tryPutItem: place item onto tile.
// Returns false if the tile is not a belt/splitter, or tile full.
// fromDir: travel direction of the item (used for splitter animation).
// Returns false if the tile is not a belt/splitter/tunnel entry, tile full,
// or the item would enter through the tile's output edge (REQ-MAT-ACCEPT-DIR).
// fromDir: travel direction of the item (used for splitter animation and for
// the output-edge check).
bool tryPutItem(QPoint tile, Item item, Rotation fromDir = Rotation::West);
// tryTakeItem: remove and return the leading item from port.tile.
@@ -117,6 +119,12 @@ private:
static std::pair<int, int> key(QPoint tile);
static QPoint adjacentTile(QPoint tile, Rotation dir);
static Rotation oppositeRotation(Rotation dir);
// True if an item travelling in travelDir would enter the transport tile at
// `tile` through one of that tile's output edges (and must therefore be
// refused). Returns false if no transport tile occupies `tile`.
bool entersThroughOutputEdge(QPoint tile, Rotation travelDir) const;
// Returns the world-space centre of a slot given tile origin and progress.
static QPointF slotWorldPos(QPoint tile, Rotation dir, double progress);