Skip to content

[core] Introduce Transaction base, ItemUseTransaction.#9929

Merged
Xaver-DaRed merged 1 commit into
LandSandBoat:basefrom
sruon:item_use_tx
May 4, 2026
Merged

[core] Introduce Transaction base, ItemUseTransaction.#9929
Xaver-DaRed merged 1 commit into
LandSandBoat:basefrom
sruon:item_use_tx

Conversation

@sruon
Copy link
Copy Markdown
Contributor

@sruon sruon commented May 4, 2026

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

Transaction base

  • Expects subclass to implement commit / rollback mechanisms. What that means exactly is left to the subclass.
  • TXs can only go from Open to Committed or RolledBack
  • Expects subclasses to release items on uncommitted destroyed TX - else crashes very loudly on purpose

Only ItemAccess can flip an item in and out of a transaction. Only Transaction can access these functions on ItemAccess.
There will be more checks added in next PRs to ensure you cannot create duplicate transactions etc.

ItemUseTransaction

  • Subclass handling the marking and tracking of items as they get used across many ticks.
    • Not much to it, it's the least interesting type of transaction but it serves to show the concept.

There's a little bit of an edge case because ItemState cannot represent an item as both Equipped and InTransaction as it is - I'll revisit that later as there is still the ITEM_LOCKED backstop in place.

Steps to test these changes

Some tests included + ran through a manual checklist.

@Xaver-DaRed Xaver-DaRed merged commit d77a734 into LandSandBoat:base May 4, 2026
10 checks passed
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.

2 participants