[closed] allow hook in to inbuilt keyboard shortcuts
Posted: Sat Oct 01, 2016 5:18 am
Looking through the various .cfg locale files, I spotted these __CONTROL__ values:
There are probably others. Anyway...
It would be supremely useful if mods could listen to the resulting events (some are already available as standard events) even if the `event` object that results from them doesn't contain any useful information. Simply knowing the key has been pressed will be hugely useful to mods.
For example:
The benefit here is that mod doesn't need to define a `custom-input` prototype, it can just listen for the inbuilt input events.
However, if a custom-input approach is preferred, then can we at least reference the __CONTROL__ value as the keys definition, so that the custom-input will always be synchronised with the players choice of keyboard shortcut for the standard game input.
For example:
Code: Select all
* toggle-driving
* build
* build-ghost
* close-gui
* move-up, down, left, right
* open-character-gui
* open-gui
* stack-transfer
* rotate
* shoot-enemy
* next-weapon
* show-info
* mine
* pick-items
* (assuming but not seen) drop-items
It would be supremely useful if mods could listen to the resulting events (some are already available as standard events) even if the `event` object that results from them doesn't contain any useful information. Simply knowing the key has been pressed will be hugely useful to mods.
For example:
Code: Select all
script.on_event( 'mine', function(event)
-- i know the player tried to *start* mining
end )
However, if a custom-input approach is preferred, then can we at least reference the __CONTROL__ value as the keys definition, so that the custom-input will always be synchronised with the players choice of keyboard shortcut for the standard game input.
For example:
Code: Select all
data:extend {
{
type = 'custom-input',
name = "mine",
key_sequence = "__CONTROL__mine",
consuming = <whatever>
}
}