Page 1 of 1

Safe to run: __quality__.data-updates ?

Posted: Fri Jan 03, 2025 1:02 pm
by 0n0w1c
Is running __quality__.data-updates from data-updates.lua supposed to be safe?

When I call it, it changes the recycling recipe for nutrients from spoilage to biter eggs.
To me, this is an unexpected result. I am not sure if it is a bug or I should not be calling it.

Re: Safe to run: __quality__.data-updates ?

Posted: Fri Jan 03, 2025 3:07 pm
by 0n0w1c

Code: Select all

    local recipe = data.raw.recipe[recipe_name]
    
    if mods["quality"] then
        local recycling = require("__quality__/prototypes/recycling")

        recycling.generate_recycling_recipe(recipe)
        recipe.auto_recycle = nil
    end
Maybe the proper way is to (re)-generate a specific recycling recipe?

Re: Safe to run: __quality__.data-updates ?

Posted: Fri Jan 03, 2025 3:27 pm
by robot256
No you're not supposed to call entire Lua files like that. In the data phase, all mods share the same Lua instance so all the functions defined already in Quality are available to you.

Instead, call the function that Quality defines and pass it the name of specific items you want to add recycling recipes for. Or at least read the files in the Quality mod and see what makes sense to call/borrow.