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",256},{"leftclick",128},{"sneak",64},{"aux",32},{"jump",16},{"right",8},{"left",4},{"down",2},{"up",1}}
- for _,data in pairs(keys) do
- if input - data[2] >= 0 then
- input_table[data[1]] = true
- input = input - data[2]
- end
- end
- return(input_table)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement