Disable user from changing inserter filter

Place to get help with not working mods / modding interface.
Post Reply
davidjs
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jul 22, 2017 10:46 am
Contact:

Disable user from changing inserter filter

Post by davidjs »

For my mod i want an inserter that does not require power but can only be used for a specific resource.
I have solved the power issue by making it a burner and automatically filling its burner inventory with 1 gazillion Joule when placed.
However, i don`t want the player to be able to abuse the inserter for any item.


So, Is there anyway i can enforce the filter on the inserter?

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

Re: Disable user from changing inserter filter

Post by eradicator »

You can set it to LuaEntity.operable = false on creation, preventing the player from opening the GUI. You also have to remove the fast-replaceable group to prevent blueprints from setting a filter on it (hopefully that it sufficient :p).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

davidjs
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jul 22, 2017 10:46 am
Contact:

Re: Disable user from changing inserter filter

Post by davidjs »

I just managed to do a quick " on_gui_opened => player.opened=nil"
But yeah "operable = false" makes a lot more sense x)

Totally forgot about the blueprints... Nice catch!

Post Reply

Return to “Modding help”