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

Bugs that are actually features.
PyroGamer666
Inserter
Inserter
Posts: 25
Joined: Fri Aug 28, 2020 5:37 am
Contact:

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

Post 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 207 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
PyroGamer666
Inserter
Inserter
Posts: 25
Joined: Fri Aug 28, 2020 5:37 am
Contact:

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

Post by PyroGamer666 »

Here's the log file.
Attachments
factorio-current.log
(51.65 KiB) Downloaded 15 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4033
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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"
Post Reply

Return to “Not a bug”