entity that fires event when clicked

Place to get help with not working mods / modding interface.
Post Reply
matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

entity that fires event when clicked

Post by matjojo »

I'm looking for a way to spawn a GUI piece when an entity is clicked.
Ways I thought of:

hotkey for mouse-1, and then see what is below the cursor(but I can't do that, see what is under the cursor)

create any entity that creates a GUI, detect that with player.opened and destroy the gui from the entity(but I can't do that, delete the 'chest'-gui)

anyone an idea?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: entity that fires event when clicked

Post by DaveMcW »

The normal way is to put an item with type="selection-tool" in your cursor. See "Test mode" mod for example.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: entity that fires event when clicked

Post by Adil »

matjojo wrote:hotkey for mouse-1, and then see what is below the cursor(but I can't do that, see what is under the cursor)
You can check player.selected.
I do that except I bind all my custom inputs for gui to shift-E.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

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

Re: entity that fires event when clicked

Post by darkfrei »

matjojo wrote:I'm looking for a way to spawn a GUI piece when an entity is clicked.
Ways I thought of:

hotkey for mouse-1, and then see what is below the cursor(but I can't do that, see what is under the cursor)

create any entity that creates a GUI, detect that with player.opened and destroy the gui from the entity(but I can't do that, delete the 'chest'-gui)

anyone an idea?
Some example
https://mods.factorio.com/mods/devilwar ... tinguisher

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: entity that fires event when clicked

Post by matjojo »

DaveMcW wrote:The normal way is to put an item with type="selection-tool" in your cursor. See "Test mode" mod for example.

Nah, that is not it. Not a clicked item but a clicked entity. Thanks anyway.

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: entity that fires event when clicked

Post by matjojo »

Adil wrote:
matjojo wrote:hotkey for mouse-1, and then see what is below the cursor(but I can't do that, see what is under the cursor)
You can check player.selected.
I do that except I bind all my custom inputs for gui to shift-E.
That should work, thanks a lot!

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: entity that fires event when clicked

Post by matjojo »

darkfrei wrote:
matjojo wrote:I'm looking for a way to spawn a GUI piece when an entity is clicked.
Ways I thought of:

hotkey for mouse-1, and then see what is below the cursor(but I can't do that, see what is under the cursor)

create any entity that creates a GUI, detect that with player.opened and destroy the gui from the entity(but I can't do that, delete the 'chest'-gui)

anyone an idea?
Some example
https://mods.factorio.com/mods/devilwar ... tinguisher
Nah, that is not it. This is an weapon type item, and that is not really what I'm looking for. Thanks anyway.

Post Reply

Return to “Modding help”