Skip to content

Instantly share code, notes, and snippets.

@Quit

Quit/recipes.lua Secret

Created June 2, 2014 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quit/56bd48ea94db28aead76 to your computer and use it in GitHub Desktop.
Save Quit/56bd48ea94db28aead76 to your computer and use it in GitHub Desktop.
local recipes = radiant.resources.load_json('/stonehearth/entities/professions/carpenter/recipes')
local categories = {}
for i, value in pairs(recipes.craftable_recipes) do
local cat = categories[value.category]
-- Category already exists
if cat then
for _, recipe in pairs(value.recipes) do
table.insert(cat.recipes, recipe)
end
else
categories[value.category] = value
end
end
recipes.craftable_recipes = {}
for k, v in pairs(categories) do
table.insert(recipes.craftable_recipes, v)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment