Page 1 of 1

entity that fires event when clicked

Posted: Sun Jan 29, 2017 7:38 pm
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?

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 12:53 am
by DaveMcW
The normal way is to put an item with type="selection-tool" in your cursor. See "Test mode" mod for example.

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 5:30 am
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.

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 6:13 am
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

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 7:26 am
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.

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 7:26 am
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!

Re: entity that fires event when clicked

Posted: Mon Jan 30, 2017 7:27 am
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.