Attach GUI to SimpleEntityWithOwner?

Place to get help with not working mods / modding interface.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 169
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Attach GUI to SimpleEntityWithOwner?

Post by hgschmie »

I have a mod that revolves around a SimpleEntityWithOwner at the core. Now I want to add a gui to it. The GUI is fully custom and works fine if I attach it e.g. to a container.

However, if I register to receive the on_gui_opened event for my custom entities, nothing happens. I never receive an event for that.

Can I attach a GUI to such an entity or only to entities that already have a GUI? If I can not attach a GUI, what would be a good replacement (I need four directions so the entity needs to be rotatable but other than that rather bare-bones, which is why SimpleEntityWithOwner was attractive).

Thanks for any pointers. I did not really find anything on the forum.

-h
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 255
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: Attach GUI to SimpleEntityWithOwner?

Post by Osmo »

That is correct, you don't get on_gui_opened event for entities that don't have a gui. You could detect it with a custom input event, but it will function incorrectly (triggers on click rather than on release (or the other way around)).
The simplest rotatable entities i could think of are: storage-tank, valve, constant-combinator and display-panel. Storage tank is usually a good option, you can make it not have visible or functional pipe connections by making then linked.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 169
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: Attach GUI to SimpleEntityWithOwner?

Post by hgschmie »

Thanks for the quick answer. I will try a custom event first.
Post Reply

Return to “Modding help”