saves: create new item objects #337

Open
opened 2026-10-24 09:45:54 +02:00 by jqueuniet · 0 comments
Owner

Allow constructing new item objects. The library and CLI only move, copy, clear and read existing ones today.

Scope

  • Allocate a record in the matching per-type array, assign a free object ID, set type, subtype and fields.
  • Update the per-type record counts in the dungeon state header (n_records) and anything else the engine relies on to find the record.
  • Refuse fields that don't persist through re-encode (per docs/formats/save-object-editability.md).
  • Place the new item in an inventory slot or a container, reusing the existing operations.
  • Expose through dm2-wasm; optionally dm2 save inventory --create.

Acceptance

  • A created item survives save → rebuild → re-read with all persistent fields intact.
  • The game loads the edited save and shows the item (manual check on DOS, noted in the PR).
  • Running out of record capacity is an error.

Blocked by the inventory-operations and container issues.

Allow constructing new item objects. The library and CLI only move, copy, clear and read existing ones today. ## Scope - Allocate a record in the matching per-type array, assign a free object ID, set type, subtype and fields. - Update the per-type record counts in the dungeon state header (`n_records`) and anything else the engine relies on to find the record. - Refuse fields that don't persist through re-encode (per `docs/formats/save-object-editability.md`). - Place the new item in an inventory slot or a container, reusing the existing operations. - Expose through `dm2-wasm`; optionally `dm2 save inventory --create`. ## Acceptance - A created item survives save → rebuild → re-read with all persistent fields intact. - The game loads the edited save and shows the item (manual check on DOS, noted in the PR). - Running out of record capacity is an error. Blocked by the inventory-operations and container issues.
jqueuniet added this to the dm2-tools project 2026-10-24 09:49:02 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools#337
No description provided.