limit inserters / bots to certain items

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

limit inserters / bots to certain items

Post by nosports »

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: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: limit inserters / bots to certain items

Post by mrvn »

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: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: limit inserters / bots to certain items

Post by eradicator »

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
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

Re: limit inserters / bots to certain items

Post by nosports »

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: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: limit inserters / bots to certain items

Post by eradicator »

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: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: limit inserters / bots to certain items

Post by darkfrei »

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: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: limit inserters / bots to certain items

Post by eradicator »

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”