Add modifier keys used to on_player_used_spider_remote

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Add modifier keys used to on_player_used_spider_remote

Post by Xorimuth »

It would be really useful for https://mods.factorio.com/mod/SpidertronWaypoints and other similar mods to be able to detect which modifier keys (shift, control etc) have been pressed along with the click.

Currently the only way to use modifiers is to define a CustomInput, which you can listen for and act upon when the player is holding a remote. This means that you can either detect a normal click and its position (using on_player_used_spider_remote) or a normal click and its modifiers (using various CustomInputs), but not both at the same time.

Alternatively, being able to get the cursor position from a CustomInput that uses mouse-button-x would be amazing, but I presume that it isn't possible to implement?
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by raiguard »

When I requested modifier keys and mouse buttons for on_player_used_capsule, I was denied, so I wouldn't get your hopes up.
Don't forget, you're here forever.

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by PFQNiet »

Depending on event order, you might be able to listen for both the CustomInput and the on_player_used_spider_remote events, and amalgamate them. If a shift-click happens in the same tick that the player used a spider remote, then ta-da there's your modifier keys on the spider remote!

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by Xorimuth »

Raiguard wrote:
Sun Nov 08, 2020 2:45 am
When I requested modifier keys and mouse buttons for on_player_used_capsule, I was denied, so I wouldn't get your hopes up.
Don't worry, I never had much hope :D It was just something to throw out there on the off chance that a dev picks it up.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by Xorimuth »

PFQNiet wrote:
Sun Nov 08, 2020 5:22 am
Depending on event order, you might be able to listen for both the CustomInput and the on_player_used_spider_remote events, and amalgamate them. If a shift-click happens in the same tick that the player used a spider remote, then ta-da there's your modifier keys on the spider remote!
That's a very intriguing idea. I suppose that I could set a flag with both of the events and respond to them in the following tick (depending on which flag was set). I may try that some day.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by Xorimuth »

PFQNiet wrote:
Sun Nov 08, 2020 5:22 am
Depending on event order, you might be able to listen for both the CustomInput and the on_player_used_spider_remote events, and amalgamate them. If a shift-click happens in the same tick that the player used a spider remote, then ta-da there's your modifier keys on the spider remote!
Unfortunately this isn't possible. If you shift-click, then only the CustomInput is raised - you don't get the `on_player_used_spider_remote` because that event is only triggered by normal clicks.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by raiguard »

The idea to use a custominput was a brilliant one, and I would like to use it as well for Tapeline. However, capsules suffer the same problem as the spider remote - you simply cannot use them while holding shift or control. If that could be changed, then that would be enough to make it work!
Don't forget, you're here forever.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Add modifier keys used to on_player_used_spider_remote

Post by Xorimuth »

This should be fully possible to implement in 1.1 (albeit somewhat hacky) because you can now get the mouse position from CustomInput. From that you can check if the player is holding a spidertron remote and set the autopilot_target to that position (might be slightly more complex because you can't target any position eg in water...).
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Post Reply

Return to “Modding interface requests”