Animate items emerging from building output ports
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "BuildingId.h"
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
#include "BeltSlot.h"
|
||||
#include "Item.h"
|
||||
#include "ItemType.h"
|
||||
#include "Port.h"
|
||||
@@ -75,6 +76,26 @@ struct Building
|
||||
OutputBuffer outputBuffer;
|
||||
std::optional<Production> production;
|
||||
|
||||
// Items currently emerging from each output port on its virtual output belt
|
||||
// (REQ-MAT-OUTPUT-EMERGE); one lane per output port, parallel to outputPorts.
|
||||
// Each lane holds slots at progress [0.5, 1.0], front (highest progress) first.
|
||||
// An emerging item still counts as residing in the output buffer until it hands
|
||||
// off onto a real belt at progress 1.0.
|
||||
std::vector<std::vector<BeltItemSlot>> emergingItems;
|
||||
|
||||
// Total items held on the output side: buffered plus still-emerging. The
|
||||
// output-buffer capacity rule (REQ-MAT-OUTPUT-BUFFER) counts emerging items,
|
||||
// since they have not yet left the building.
|
||||
int outputItemCount() const
|
||||
{
|
||||
int count = static_cast<int>(outputBuffer.items.size());
|
||||
for (const std::vector<BeltItemSlot>& lane : emergingItems)
|
||||
{
|
||||
count += static_cast<int>(lane.size());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Pre-computed from surface mask at placement; in absolute world coordinates.
|
||||
std::vector<QPoint> bodyCells;
|
||||
std::vector<Port> outputPorts;
|
||||
|
||||
Reference in New Issue
Block a user