For example if I want to fill the storage tank with 1000 water when it gets placed, I would do the following:
Code: Select all
function fill_storagetank(tank)
tank.fluidbox[1] = {type="water", amount=1000}
end
--function is called on_built_entity, that part works
script.on_event(defines.events.on_built_entity, function(event)
if event.created_entity.name == "storage-tank" then
fill_storagetank(event.created_entity)
end
end)
I am thinking that probably the fluidbox doesn't exist, because the tank is empty. Is that possible? But how do I create it?
If anyone could point me in the right direction here, I would appreciate it...