Page 1 of 1

[2.0.58] mod-data prototypes are immutable after initial definition

Posted: Mon Jun 23, 2025 7:32 pm
by PyroGamer666
I've written a new branch of "Muluna, Moon of Nauvis" to test the new mod-data prototype, but I've found that unlike other prototypes, mod-data objects are immutable after their initial definition, which limits their usefulness and breaks from conventions of other prototypes.

https://github.com/nicholasgower/planet ... ta-testing

The code I've added in this branch should do the following:

1. (data stage) Define mod-data instance "Planetslib-rocket-part-recipe", containing a list with one entry.
2. (data stage) Add an entry to the list for the key "muluna".
3. (data-final-fixes stage) For every planet with their name not in the list, add data to the list with the planet's name as the key.

In 2.0.58, only step 1 functions as expected, resulting in the following data:
06-23-2025, 12-20-18.png
06-23-2025, 12-20-18.png (266.39 KiB) Viewed 209 times
I expect that like other prototypes, it is possible to edit new instances of mod-data, both within the same mod and in other mods.

To reproduce this error, clone the mod-data-testing branch of Muluna, and load the mod as well as its dependencies. https://github.com/nicholasgower/planet ... ta-testing

Re: [2.0.58] mod-data prototypes are immutable after initial definition

Posted: Mon Jun 23, 2025 7:35 pm
by PyroGamer666
Here's the log file.

Re: [2.0.58] mod-data prototypes are immutable after initial definition

Posted: Mon Jun 23, 2025 7:56 pm
by boskid
Not a bug. There are some `data` missing when accessing the data table (while in data stage).

-- edit:
compare those two:

Code: Select all

data.raw["mod-data"]["Planetslib-rocket-part-recipe"]["muluna"] = "rocket-part-muluna"
vs

Code: Select all

data.raw["mod-data"]["Planetslib-rocket-part-recipe"].data["muluna"] = "rocket-part-muluna"