At the moment I'm dealing with the Waiter mod, that adds alot new cooking recipes and therefore also new Ingredient Tags.
http://steamcommunity.com/sharedfiles/filedetails/?id=381565292
I wondered, why the author wrote things like:
AddIngredientValues({"fish", "eel"}, {meat=0.5, fish=1, seafood=1})
Just to add a seafood Tag...since the function is called "ADD..." and not "OverwriteIngredientValues".
But it seems AddIngredientValues really overwrites the tags. It is a mystery to me, why it was called "Add.." if this is not the case?
So to write a proper mod, that does not overwrites everything, one would have to use sth like this:
local cooking = require("cooking")
local ing = cooking.ingredients
local function NewTabl(tab,k,v) -- k has to be string
if type(k)=="string" then
tab[k] = v -- cause it is not possible to add a new key plus value and return it in one step?
end
return(tab)
end
function ingredientpostinit()
AddIngredientValues({"fish"}, NewTabl(ing["fish"].tags,"seafood",1))
end
I think my code is also not the best... When I deal with "ing" without deepcopying it, I might change the game ingredients directly...
You see, it is unnecessarily complicated...
And I was not able to call the GetIngredientValues() function from the cooking script...
Of course most modders does not use such a complicated construct and just overrides...
So I think you as the devs should make a mod function, that allows to really ADD new things. Of course also a Remove function would be good.
see scripts/cooking.lua for the function, you will see that it just overrides
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now