Mining Drones

by Klonan

Adds mining drones and mining depots

Content
a month ago
0.17 - 2.0
99.7K
Mining

g help with scripting

3 years ago
(updated 3 years ago)

Hi Klonan,

Sorry to bother you, but I'm really stuck and don't know where to ask.
I'm building a mod that uses mining depots as outposts that need to be rescued. When the player has destroyed all nearby spawners, I want to insert 20 drones in the depot so that they can start mining the nearby patch.
But no matter how much I've tried, I can't seem to insert them in the input inventory. I keep getting the error "attempt to call field 'get_inventory' (a nil value)". It would be much appreciated if you could point me in the right direction.

-- yes, depot is a LuaEntity
function builder.add_drones(depot)
    local inventory = depot.get_inventory(defines.inventory.assembling_machine_input)
    inventory.insert{name="mining-drone", count=20}
end

Probably obvious, but this is my first mod attempt (so please be gentle if I am missing something obvious.) :)

3 years ago

If its erroring on get_inventory, then depot isn't a proper LuaEntity, it shouldn't error on that

3 years ago

Okay thanks! Now I at least know what to focus on.

New response