Guest User

Untitled

a guest
Jul 2nd, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. Prototype definition:
  2.  
  3. data:extend({
  4. {
  5.   type = "custom-input",
  6.   name = "my-custom-input",
  7.   key_sequence = "SHIFT + R",
  8.   consuming = "script-only"
  9.  
  10.   -- 'consuming'
  11.   -- available options:
  12.   -- none: default if not defined
  13.   -- all: if this is the first input to get this key sequence then no other inputs listening for this sequence are fired
  14.   -- script-only: if this is the first *custom* input to get this key sequence then no other *custom* inputs listening for this sequence are fired. Normal game inputs will still be fired even if they match this sequence.
  15.   -- game-only: The opposite of script-only: blocks game inputs using the same key sequence but lets other custom inputs using the same key sequence fire.
  16. }})
  17.  
  18. Local definition:
  19.  
  20. [controls]
  21. my-custom-input=Potato controls
  22.  
  23. Subscribing to the event:
  24.  
  25. script.on_event("my-custom-input", function(event) game.players[event.player_index].print(event.input_name .. " ran on tick: " .. tostring(event.tick)) end)
Add Comment
Please, Sign In to add comment