Skip to content

feat: add unique id to entity that is serialized#430

Merged
LordMidas merged 11 commits into
developmentfrom
feat-unique-id-for-entities
Mar 30, 2025
Merged

feat: add unique id to entity that is serialized#430
LordMidas merged 11 commits into
developmentfrom
feat-unique-id-for-entities

Conversation

@LordMidas

@LordMidas LordMidas commented Sep 28, 2024

Copy link
Copy Markdown
Member

Vanilla has a getID() for entities but that ID is changed on every game load. This PR adds a Unique ID to every entity that is preserved across game save/load. This can be useful for a number of things.

@TaroEld

TaroEld commented Sep 28, 2024

Copy link
Copy Markdown
Member

Don't entities already have IDs?
actor.getID() certainly is used a lot.

@LordMidas

Copy link
Copy Markdown
Member Author

Don't entities already have IDs? actor.getID() certainly is used a lot.

They are not persistent and are changed upon every game load.

So it automatically gets ser/deserialized during entity ser/de and is properly set during deser instead of after it - because flags are the first thing to get deserialized.
- Entities without UID not getting assigned one after loading MSU in existing campaign.
- Explicitly give the UID a null value during deserialization of the game.
@LordMidas LordMidas force-pushed the feat-unique-id-for-entities branch from 906c117 to 61a1fb5 Compare March 4, 2025 20:31
Comment thread msu/hooks/entity/tactical/entity.nut Outdated
Comment thread msu/utils/utils.nut
@TaroEld TaroEld self-requested a review March 11, 2025 19:32
@LordMidas LordMidas merged commit 19025a9 into development Mar 30, 2025
@LordMidas LordMidas deleted the feat-unique-id-for-entities branch March 30, 2025 21:29
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.

3 participants