limit inserters / bots to certain items

Place to get help with not working mods / modding interface.

limit inserters / bots to certain items

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

Re: limit inserters / bots to certain items

Postby 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.
mrvn
Smart Inserter
Smart Inserter
 
Posts: 2094
Joined: Mon Sep 05, 2016 9:10 am

Re: limit inserters / bots to certain items

Postby 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.
User avatar
eradicator
Smart Inserter
Smart Inserter
 
Posts: 1412
Joined: Tue Jul 12, 2016 9:03 am
Location: Mod support languages: JA/DE/EN

Re: limit inserters / bots to certain items

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


Re: limit inserters / bots to certain items

Postby eradicator » Wed Mar 14, 2018 11:43 am

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

Code: Select all
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: 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
eradicator
Smart Inserter
Smart Inserter
 
Posts: 1412
Joined: Tue Jul 12, 2016 9:03 am
Location: Mod support languages: JA/DE/EN

Re: limit inserters / bots to certain items

Postby 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
darkfrei
Smart Inserter
Smart Inserter
 
Posts: 1166
Joined: Thu Nov 20, 2014 11:11 pm

Re: limit inserters / bots to certain items

Postby 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)
User avatar
eradicator
Smart Inserter
Smart Inserter
 
Posts: 1412
Joined: Tue Jul 12, 2016 9:03 am
Location: Mod support languages: JA/DE/EN


Return to Modding help

Who is online

Users browsing this forum: No registered users and 6 guests