s_f Posted July 5, 2021 Share Posted July 5, 2021 Hi. Seeking help regarding a particular thing with recipes (via lua) The "[Recipe.GetAllItemTypes.*]" tags are often seen in vanilla recipes, which I assumed is a short hand for managing extensible list of tools that serve the same function (Hammer, CanOpener, Saw, Screwdriver). However, there seems to be only a few categories, and I am not sure how items are actually added to the list (I suspect it is the "Tags" definition in items scripts?) I've found seemingly related definitions in recipecode.lua and tried to access the functions, but failed. requiring the file itself also failed. (I am not sure, but does the file being on server/shared/client folder matters?) Recipe = {} Recipe.GetItemTypes = {} Recipe.OnCanPerform = {} Recipe.OnCreate = {} Recipe.OnGiveXP = {} Recipe.OnTest = {} function Recipe.GetItemTypes.CanOpener(scriptItems) scriptItems:addAll(getScriptManager():getItemsTag("CanOpener")) end function Recipe.GetItemTypes.Hammer(scriptItems) scriptItems:addAll(getScriptManager():getItemsTag("Hammer")) end function Recipe.GetItemTypes.Saw(scriptItems) scriptItems:addAll(getScriptManager():getItemsTag("Saw")) end function Recipe.GetItemTypes.Screwdriver(scriptItems) scriptItems:addAll(getScriptManager():getItemsTag("Screwdriver")) I wonder if this feature still working? If so, how can I access it in game to translate a list item id, e.g. "[Resource.GetItemTypes.CanOpener]" into the actual list of item ids in the list? thanks in advance Link to comment Share on other sites More sharing options...
s_f Posted July 10, 2021 Author Share Posted July 10, 2021 Adding more info It seems that the file "recipecode.lua" cannot be found/required. I have the testing code in "shared", but the above file is in "server". How is the server, shared and client folders managed? I had thought that they will be overlapped wrt require, but is not sure how the code should be split. If I am writing something in shared (as a utility) that needs the above file, how can I access it? Link to comment Share on other sites More sharing options...
Recommended Posts
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