QcHopperQueue Struct
Which Signal Hoppers to look at when (decision E-344): those awake for the next hopper step, those waiting for a tick (their cooldown ends, an unloaded neighbour may have loaded) and the containers whose contents changed. More...
| Header: | #include <server/signal/QcHopperQueue.h> |
Public Functions
| void | clear() |
| void | forgetChunk(QcChunkPos chunk) |
| QSet<QcBlockPos> | takeDue(quint64 now) |
| void | wake(QcBlockPos pos) |
| void | wakeAt(QcBlockPos pos, quint64 tick) |
Public Variables
| QSet<QcBlockPos> | awake |
| int | cooldownTicks |
| std::map<quint64, QList<QcBlockPos>> | timers |
| QSet<QcBlockPos> | touched |
Detailed Description
A hopper that finds nothing to do sleeps and costs nothing until something around it changes: a block next to it, the contents of a container next to it, an item moving into its pickup area. The cooldown itself belongs to the hopper's container (QcBlockEntities::Container).
Member Function Documentation
void QcHopperQueue::clear()
Forgets every hopper and container.
void QcHopperQueue::forgetChunk(QcChunkPos chunk)
Forgets the hoppers and containers inside chunk.
QSet<QcBlockPos> QcHopperQueue::takeDue(quint64 now)
Returns the awake hoppers and those whose timer is due at now and takes them out.
void QcHopperQueue::wake(QcBlockPos pos)
Looks at the hopper at pos in the next step.
void QcHopperQueue::wakeAt(QcBlockPos pos, quint64 tick)
Looks at the hopper at pos at tick (not before).
Member Variable Documentation
QSet<QcBlockPos> QcHopperQueue::awake
Hoppers to look at in the next step.
int QcHopperQueue::cooldownTicks
Ticks after a transfer before the hopper moves the next item (QcServerLimits::hopperCooldownTicks, set by QcServerState; the reference's 8).
std::map<quint64, QList<QcBlockPos>> QcHopperQueue::timers
Hoppers to look at by the tick of their timer.
QSet<QcBlockPos> QcHopperQueue::touched
Containers whose contents changed (QcServerState::noteContents): the hoppers next to them wake.