limit inserters / bots to certain items

Place to get help with not working mods / modding interface.
Post Reply
nosports
Fast Inserter
Fast Inserter
Posts: 114
Joined: Fri Jan 19, 2018 5:44 pm

limit inserters / bots to certain items

Post by nosports » Tue Mar 13, 2018 3:39 pm

Is it possible to limit (new, modded) inserters/bots to certain items/categorys ?

I did not find anything that will look like a payload category, only think is payload-size, but i think its more of numer of items to carry

mrvn
Smart Inserter
Smart Inserter
Posts: 2573
Joined: Mon Sep 05, 2016 9:10 am

Re: limit inserters / bots to certain items

Post by mrvn » Tue Mar 13, 2018 4:12 pm

For inserters there are filter inserters. You can set the filter from lua and hide the gui so users can't change it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2604
Joined: Tue Jul 12, 2016 9:03 am

Re: limit inserters / bots to certain items

Post by eradicator » Tue Mar 13, 2018 5:13 pm

Inserter filters are hard-limited to a maximum of 5 filters though. So if you need more there's not any good solution. For bots there is no possibility at all.

nosports
Fast Inserter
Fast Inserter
Posts: 114
Joined: Fri Jan 19, 2018 5:44 pm

Re: limit inserters / bots to certain items

Post by nosports » Wed Mar 14, 2018 11:09 am

mrvn wrote:For inserters there are filter inserters. You can set the filter from lua and hide the gui so users can't change it.
That were a way to go.....

as i am not a very avid lua-user - do you have some guides or examples for such inserters


User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2604
Joined: Tue Jul 12, 2016 9:03 am

Re: limit inserters / bots to certain items

Post by eradicator » Wed Mar 14, 2018 11:43 am

For disallowing the gui of an entity you need something like:

[code]script.on_event(defines.events.on_gui_opened,function(e)
if e.entity and e.entity.name == 'myentity' then
game.players[e.player_index].opened = nil
end
end)[/code]

Code: Select all

script.on_event(defines.events.on_built_entity,function(e)
  if e.created_entity.name == 'myentity' then
    e.created_entity.operable = false
    end
  end)
Last edited by eradicator on Wed Mar 14, 2018 1:03 pm, edited 1 time in total.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1511
Joined: Thu Nov 20, 2014 11:11 pm

Re: limit inserters / bots to certain items

Post by darkfrei » Wed Mar 14, 2018 11:48 am

GUI disabling is easy by data stage:

Code: Select all

enable_gui = false
See https://mods.factorio.com/mods/darkfrei/RITEG

Or by control stage
http://lua-api.factorio.com/latest/LuaE ... y.operable

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2604
Joined: Tue Jul 12, 2016 9:03 am

Re: limit inserters / bots to certain items

Post by eradicator » Wed Mar 14, 2018 1:00 pm

Oh right. Totally forgot about .operable. enable_gui is exclusive to the electric_energy_interface however and will have no effect on anything else. (Previous posts code has been updated)

Post Reply

Return to “Modding help”