diff --git a/archipelago-extractor/control.lua b/archipelago-extractor/control.lua index a701957..f4d32cf 100644 --- a/archipelago-extractor/control.lua +++ b/archipelago-extractor/control.lua @@ -34,7 +34,7 @@ end function dumpRecipeInfo(force) data_collection = {} for recipe_name, recipe in pairs(force.recipes) do - if recipe.enabled then + if recipe.enabled and not recipe.prototype.parameter then local recipe_data = {} recipe_data["ingredients"] = {} recipe_data["products"] = {} @@ -44,7 +44,19 @@ function dumpRecipeInfo(force) recipe_data["ingredients"][ingredient.name] = ingredient.amount end for _, product in pairs(recipe.products) do - recipe_data["products"][product.name] = product.amount + if product.amount then + if product.probability then + recipe_data["products"][product.name] = product.probability * product.amount + else + recipe_data["products"][product.name] = product.amount + end + else + if product.probability then + recipe_data["products"][product.name] = product.probability * (product.amount_min + product.amount_max) / 2 + else + recipe_data["products"][product.name] = (product.amount_min + product.amount_max) / 2 + end + end end data_collection[recipe_name] = recipe_data end @@ -128,7 +140,19 @@ end function dumpItemInfo() data_collection = {} for _, item in pairs(prototypes.item) do - data_collection[item.name] = item.stack_size + invalid = false + if item.hidden then + invalid = true + end + if item.flags and (item.flags["spawnable"] or item.flags["only-in-cursor"]) then + invalid = true + end + if item.parameter then + invalid = true + end + if not invalid then + data_collection[item.name] = item.stack_size + end end helpers.write_file("items.json", helpers.table_to_json(data_collection), false)