Code: Select all
for i, entity in pairs(data.raw.entity) do
if entity.module_slots > 1 then
entity.module_slots = 1
end
end
whats wrong?
Code: Select all
for i, entity in pairs(data.raw.entity) do
if entity.module_slots > 1 then
entity.module_slots = 1
end
end
Code: Select all
local types = {["mining-drill"]=true,["assembling-machine"]=true,lab=true,["rocket-silo"]=true, furnace=true, beacon=true}
for t, _ in pairs(types) do
for _, ent in pairs(data.raw[t]) do
if type(ent.module_specification) == "table" and type(ent.module_specification.module_slots) == "number" then
ent.module_specification.module_slots = 1
end
end
end
Code: Select all
type(ent.module_specification)
I'm a novice at this, and I expect the problem is something obvious.LuaEntityPrototype doesn't contain key module_specification
That sounds like a control.lua error. That data is only available during data stage. And if it's during data stage then you're probably looping through something that doesn't have a module_specification...Zephyrinius wrote:I was trying to do something similar, but when I try to access
I get the errorCode: Select all
type(ent.module_specification)
I'm a novice at this, and I expect the problem is something obvious.LuaEntityPrototype doesn't contain key module_specification