Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function minetest.get_control_bits(player)
- local input = player:get_key_pressed()
- local input_table = {up=false,down=false,left=false,right=false,jump=false,aux=false,sneak=false,leftclick=false,rightclick=false}
- local modifiers = {256,128,64,32,16,8,4,2,1}
- local keys = {"rightclick","leftclick","sneak","aux","jump","right","left","down","up"}
- --iterate through the table using the greatest value first
- for index,value in pairs(modifiers) do
- if input - value >= 0 then
- input_table[keys[index]] = true
- input = input - value
- end
- end
- return(input_table)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement