[2.0.25] Custom input linked to clicking fires twice on remote view
Posted: Sat Dec 14, 2024 3:09 am
I have a custom input
{
type = "custom-input",
name = "RTClick",
key_sequence = "",
linked_game_control = "open-gui",
hidden = true
}
I use this to detect when the player clicks certain entities to toggle the visibility of a RenderObject. In normal game view this fires the toggle for visibility once as I expect. However from remote view the input fires once when I click down and once when I let go, meaning it toggles twice and ends up back to what it was originally in the course of one full click. This always happens unless I drag the map while the mouse button is down, in which case the custom input will not fire when I let go of the mouse button.
To reproduce:
1. Make a custom input with the game control linked to open-gui like shown above.
2. In control.lua make the custom input do something like print the game tick.
3. In normal game view, click down and let go, the event will fire once no matter how long you hold the click down for.
4. Go to remote view, click down, the event will fire once, then without dragging the view let go and the event will fire again.
5. In remote view, click down, the event will fire once, then if you do drag the map view around and let go the event will NOT fire again.
None of my other custom inputs fire twice like this, they only fire once in both views as normal.
While I'm on the topic it would be cool to have a way to intentionally set the release of a key be a custom input like this
{
type = "custom-input",
name = "RTClick",
key_sequence = "",
linked_game_control = "open-gui",
hidden = true
}
I use this to detect when the player clicks certain entities to toggle the visibility of a RenderObject. In normal game view this fires the toggle for visibility once as I expect. However from remote view the input fires once when I click down and once when I let go, meaning it toggles twice and ends up back to what it was originally in the course of one full click. This always happens unless I drag the map while the mouse button is down, in which case the custom input will not fire when I let go of the mouse button.
To reproduce:
1. Make a custom input with the game control linked to open-gui like shown above.
2. In control.lua make the custom input do something like print the game tick.
3. In normal game view, click down and let go, the event will fire once no matter how long you hold the click down for.
4. Go to remote view, click down, the event will fire once, then without dragging the view let go and the event will fire again.
5. In remote view, click down, the event will fire once, then if you do drag the map view around and let go the event will NOT fire again.
None of my other custom inputs fire twice like this, they only fire once in both views as normal.
While I'm on the topic it would be cool to have a way to intentionally set the release of a key be a custom input like this