I'm trying to make Spawners and Worms Minable, when you play with NE Buildings.
I'm testing if the entity has a minable settign already. In most cases it should not, but if it has, then skip the insert, if not, then I insert mine mining result.
Currently the first test is always true so nothing is inserted. If I remove the test, I get an error on the insert part.
My below code is not working and not exactly sure why:
Code: Select all
--- All other Spawners
local spawners = data.raw["unit-spawner"]
for k, v in pairs(spawners) do
if v.minable then
break
else
local minable = {hardness = 1.5, mining_time = 1.6, results = {{type="item", name="Natural_Evolution_Biter-Spawner-exhausted", amount=1},}}
table.insert(v.minable, minable)
end
end
--- All other turrets
local worms = data.raw["turret"]
for k, v in pairs(worms) do
if v.minable then
break
else
local minable = {hardness = 0.5, mining_time = 1.6, results = {{type="item", name="small-worm-hatching-exhausted", amount=1},}}
table.insert(v.minable, minable)
end
end
