Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --make the data from get_key_pressed usable
- 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}
- --iterate through the table using the highest value first
- local keys = {"rightclick","leftclick","sneak","aux","jump","right","left","down","up"}
- for index,data in pairs(keys) do
- local modifier = math.pow(2, 9-index)
- if input - modifier >= 0 then
- input_table[data] = true
- input = input - modifier
- end
- end
- return(input_table)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement