Preserve a carried remainder when refilling a farm station
Section titled “Preserve a carried remainder when refilling a farm station”- Status: current.
- Engine: ue6-main
61e2877e, Linux x86_64, Epic clang 23.1.5. - Context: Standalone UE6 BPVerse actor interactions with native C++ inventory and station stock.
- Prerequisites: Game-instance subsystem bridge, one held item, a station with a capacity, and a refill interaction.
Symptom
Section titled “Symptom”A four-portion scoop fills a station from six to eight. If the bridge consumes the carried actor after every successful pour, the other two portions disappear. Farm stock also needs to represent a chick’s half portion when that same station next receives a refill.
Smallest example / reproduction
Section titled “Smallest example / reproduction”With a station capacity of eight and six already stocked, pick up a four-portion scoop and interact with the station. Try pouring again at the full station. Drop the scoop, pick it up, then pour it at a station with two free places. Check for a two-portion transfer on both successful pours and for the same item in hand after the first one.
Solution
Section titled “Solution”Use the existing Verse interaction to check the carried kind and call the native subsystem. In the native operation:
- Check that the carry kind matches the station.
- Ask the station to add the quantity held. Return the accepted quantity, clamped to the station’s free space.
- Subtract that quantity from the held item. Destroy the item when the remaining quantity reaches zero.
- Keep both quantities numeric with fractional support. When a chick eats, deduct the actual half portion and use it to scale the needs gain.
In Coop Zero, the native transaction is in UCoopGameSubsystem::AddPortions. ACoopStation::AddPortions updates the station’s stock and fill mesh. UCoopCarryComponent::PourPortions updates the existing carried actor.
Why it works
Section titled “Why it works”The station and held item move by the same signed amount during a synchronous bridge call. A full station returns zero and leaves the held item alone. Sharing the same numeric representation across stocking, carrying and consuming lets a free half-portion of capacity be refilled without rounding away food or water.
Verified
Section titled “Verified”- Evidence level: runs in packaged build.
- How: Run the Step 08 proof commands in Coop Zero’s
REPORT.md. The scripted interaction logsFEEDER_REFILLED feeder=8 added=2,POUR_REMAINDER item=scoop portions=2andCARRY_PICKED_UP item=scoop portions=2. The same run logs chick meals withration=0.5. - Date / by: 2026-11-25, Coop Zero Step 08.
Limits and assumptions
Section titled “Limits and assumptions”The packaged fixtures drove the normal interaction handlers from the Development console. The tests cover the single-player farm. The shared jar and stock mutations have no network transport in this slice, and physical controller input awaits owner review.