Skip to content

Preserve Fresh ages when objects leave storage - #42

Open
user01010111 wants to merge 1 commit into
rittermod:mainfrom
user01010111:agent/preserve-object-storage-age
Open

Preserve Fresh ages when objects leave storage#42
user01010111 wants to merge 1 commit into
rittermod:mainfrom
user01010111:agent/preserve-object-storage-age

Conversation

@user01010111

Copy link
Copy Markdown

When a bale or pallet left object storage, Fresh searched for a newly registered container and waited up to two seconds. If registration took longer, the saved batches were discarded and the object started again at age zero. Searching globally could also associate the batches with the wrong object when several objects were being unloaded.

This change uses the object-storage spawn callback to keep the transfer tied to the exact spawned object.

The saved batches are now:

  • copied before spawning begins;
  • attached to the spawned object returned by the game;
  • claimed immediately if its Fresh container is already registered, or during registration if it is not;
  • removed from the stored source only after the destination has claimed them.

If spawning fails or the callback does not arrive, the source batches remain available instead of being discarded.

The old polling helpers and two-second timeout have been removed.

Checks completed:

  • Lua syntax validation;
  • callback before and after container registration;
  • asynchronous spawn callback handling;
  • missing callback and spawn-error handling;
  • modDesc.xml validation against the FS25 1.21 schema.

@user01010111
user01010111 marked this pull request as ready for review July 29, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant