Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Refactor LD to use StringName item IDs instead of ints - #301

Open
Koopa1018 wants to merge 5 commits into
masterfrom
refactor-ld-item-list
Open

Refactor LD to use StringName item IDs instead of ints#301
Koopa1018 wants to merge 5 commits into
masterfrom
refactor-ld-item-list

Conversation

@Koopa1018

@Koopa1018 Koopa1018 commented Jul 19, 2024

Copy link
Copy Markdown
Collaborator

Description of changes

Exactly what it says on the tin. Also, comment and cleanup (I had left some functions literally marked "does nothing" because I couldn't tell what they output--even though I knew commenting them out broke the code--so now that I've figured it out, I've gone back and clarified).

Issue(s)

Meant to facilitate using human-readable item IDs when we switch to JSON level serialization.

Future work

items.xml.tres still uses ints for its IDs. The ints are stored as strings, so it still works, but it's far from human-readable yet.

Finally figured out how and why data is being written from functions which seemingly return nothing: they are being given arrays and dictionaries, which are always stored and passed by reference--then saving *inner dictionaries" by reference, and writing the original passed arrays through the reference.

With this new knowledge, I can comment about what's going on in the code so future readers aren't confused (hopefully), and also finally document the format of the item properties dictionaries!
All these fns use the same sequence of operations, and if they can rely on by-reference semantics, so can I ;)
...and also properties' "increment" property, since I apparently missed documenting its default value.
...now that I finally understand what it does.
To facilitate using human-readable IDs in JSON-serialized level files.

Not too hard a change either. Just following the errors fixed everything up--no huge logic changes or anything. Didn't even have to touch most uses of these dictionaries! Surprisingly, the item list is even ordered the same.

On that note: I haven't actually changed any item IDs yet. Lucky they're already strings.)

(Accidentally got into fixing a few crashes in exit-playtest mode. Still crashes, but further along.) (Still not worth getting it totally working though.)
@Koopa1018 Koopa1018 added refactor Edits to the underlying code level designer labels Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

level designer refactor Edits to the underlying code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant