Is there something like this?
Code: Select all
for each item in data.raw.items do
if item.canbeininventory then
somefunction(item)
end
end
WarStalkeR.
Code: Select all
for each item in data.raw.items do
if item.canbeininventory then
somefunction(item)
end
end
Code: Select all
for i, item in pairs (data.raw.item) do
--if item.name == "my-item-name" then
somefunction(item)
--end
end
Thanks for help. But what am I doing wrong?darkfrei wrote:For scripting (control.lua) isCode: Select all
for i, item in pairs (game.items) do --if item.name == "my-item-name" then somefunction(item) --end end
Code: Select all
for i, item in pairs (game.items) do
if item.type == "item" or item.type == "ammo" or item.type == "armor" or item.type == "capsule" or item.type == "gun" or item.type == "mining-tool" or item.type == "item-with-entity-data" or item.type == "tool" or item.type == "repair-tool" then
voidextension.functions.extend(item)
end
end
It was data.luaBilka wrote:When are you calling the function? If you are doing it on load you have no access to the game object.
Code: Select all
for _, item in pairs (data.raw.item) do
Thanks. I needed only some items types that hard to dispose of and have huge quantities stacked eventually, i.e. ores, old inseters, sodium hydroxide.Optera wrote:data.raw.item is only a fraction of items going to inventory.
There also are item-with-entity-data, item-with-inventory, blueprints & deconstructors, capsules, ammo, guns, armor, equipment, and probably some more i forgot.
If you want a complete list look at Creative Mode.