Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions archipelago-extractor/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = {}
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down