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:
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
[2.0.58] mod-data prototypes are immutable after initial definition
-
- Inserter
- Posts: 25
- Joined: Fri Aug 28, 2020 5:37 am
- Contact:
-
- Inserter
- Posts: 25
- Joined: Fri Aug 28, 2020 5:37 am
- Contact:
Re: [2.0.58] mod-data prototypes are immutable after initial definition
Here's the log file.
- Attachments
-
- factorio-current.log
- (51.65 KiB) Downloaded 15 times
Re: [2.0.58] mod-data prototypes are immutable after initial definition
Not a bug. There are some `data` missing when accessing the data table (while in data stage).
-- edit:
compare those two:
vs
-- edit:
compare those two:
Code: Select all
data.raw["mod-data"]["Planetslib-rocket-part-recipe"]["muluna"] = "rocket-part-muluna"
Code: Select all
data.raw["mod-data"]["Planetslib-rocket-part-recipe"].data["muluna"] = "rocket-part-muluna"