Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Koopa1018
Copy link
Collaborator

@Koopa1018 Koopa1018 commented Jul 19, 2024

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level designer refactor Edits to the underlying code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant