why are we have a lot of item types?
I've made some table:
Code: Select all
item_type_list = {
"ammo",
"armor",
"gun",
"item",
"capsule",
"repair-tool",
"mining-tool",
"item-with-entity-data",
"rail-planner",
"tool",
"blueprint",
"deconstruction-item",
"blueprint-book",
"selection-tool",
"item-with-tags",
"item-with-label",
"item-with-inventory",
"module"
}
Code: Select all
local item =
data.raw.item[result_name]
or data.raw["item-with-entity-data"][result_name]
or data.raw["mining-tool"][result_name]
or data.raw["gun"][result_name]
or data.raw["ammo"][result_name]
or data.raw["armor"][result_name]
or data.raw["repair-tool"][result_name]
or data.raw["mining-tool"][result_name]
or data.raw["capsule"][result_name]
or data.raw["fluid"][result_name]
or data.raw["module"][result_name]
or data.raw["rail-planner"][result_name]
or data.raw["tool"][result_name]
or data.raw["blueprint"][result_name]
or data.raw["deconstruction-item"][result_name]
or data.raw["blueprint-book"][result_name]
or data.raw["selection-tool"][result_name]
or data.raw["item-with-tags"][result_name]
or data.raw["item-with-label"][result_name]
or data.raw["item-with-inventory"][result_name]
It's looks a little bit too complicated.