Page 1 of 1
Add modifier keys used to on_player_used_spider_remote
Posted: Wed Sep 02, 2020 11:41 am
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?
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Sun Nov 08, 2020 2:45 am
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.
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Sun Nov 08, 2020 5:22 am
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!
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Sun Nov 08, 2020 7:16 am
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

It was just something to throw out there on the off chance that a dev picks it up.
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Fri Nov 13, 2020 12:10 pm
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.
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Fri Nov 13, 2020 9:39 pm
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.
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Sat Nov 14, 2020 12:52 am
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!
Re: Add modifier keys used to on_player_used_spider_remote
Posted: Tue Dec 01, 2020 1:05 am
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...).