Adding automatic belt loaders into a furnace entity

Place to get help with not working mods / modding interface.
Whovian44
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Sep 02, 2020 7:15 am
Contact:

Adding automatic belt loaders into a furnace entity

Post by Whovian44 »

the title includes everything that i'm trying to do, i'm making a furnace that belts in and out without inserters for a mod i'm working on and i don't know where to start, can i make a second entity that can't be targeted that acts like a loader and gets placed invisibly with the furnace, or is there some way to make it part of the furnace's block of code. Thank you!
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Adding automatic belt loaders into a furnace entity

Post by DaveMcW »

Whovian44 wrote: Wed Sep 02, 2020 7:22 amis there some way to make it part of the furnace's block of code.
No.
Whovian44 wrote: Wed Sep 02, 2020 7:22 amcan i make a second entity that can't be targeted that acts like a loader and gets placed invisibly with the furnace
Yes.

To make an entity invisible, in data.lua set all of its sprites to

Code: Select all

{
  filename = "__core__/graphics/empty.png",
  width = 1,
  height = 1,
}
To place the entity with the furnace, in control.lua add a handler to all the build events.

Code: Select all

function on_built(event) {
  local entity = event.created_entity or event.entity or event.destination
  if not entity or not entity.valid then return end
  if entity.name == "my-furnace" then
    -- Place the second entity
  end
}
script.on_event(defines.events.on_built_entity, on_built)
script.on_event(defines.events.on_robot_built_entity, on_built)
script.on_event(defines.events.script_raised_built, on_built)
script.on_event(defines.events.script_raised_revive, on_built)
script.on_event(defines.events.on_entity_cloned, on_built)
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Adding automatic belt loaders into a furnace entity

Post by darkfrei »

Whovian44 wrote: Wed Sep 02, 2020 7:22 am the title includes everything that i'm trying to do, i'm making a furnace that belts in and out without inserters for a mod i'm working on and i don't know where to start, can i make a second entity that can't be targeted that acts like a loader and gets placed invisibly with the furnace, or is there some way to make it part of the furnace's block of code. Thank you!
Like this one? https://mods.factorio.com/mod/Loader-Furnace

But you can probably to go the way of miniloaders: https://mods.factorio.com/mod/miniloader
It's not a loader, but hidden inserters in this entity.
Post Reply

Return to “Modding help”