mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-28 01:23:43 +01:00
Merge branch 'master' into dropped
This commit is contained in:
commit
f825331bb2
6
init.lua
6
init.lua
@ -61,14 +61,14 @@ minetest.register_globalstep(function(dtime)
|
|||||||
for _, callback in pairs(controls.registered_on_press) do
|
for _, callback in pairs(controls.registered_on_press) do
|
||||||
callback(player, key)
|
callback(player, key)
|
||||||
end
|
end
|
||||||
controls.players[pname][key] = {true, os.clock()}
|
controls.players[pname][key] = {true, minetest.get_us_time()}
|
||||||
elseif key_status and controls.players[pname][key][1] then
|
elseif key_status and controls.players[pname][key][1] then
|
||||||
for _, callback in pairs(controls.registered_on_hold) do
|
for _, callback in pairs(controls.registered_on_hold) do
|
||||||
callback(player, key, os.clock() - controls.players[pname][key][2])
|
callback(player, key, (minetest.get_us_time() - controls.players[pname][key][2]) / 1e6)
|
||||||
end
|
end
|
||||||
elseif not key_status and controls.players[pname][key][1] then
|
elseif not key_status and controls.players[pname][key][1] then
|
||||||
for _, callback in pairs(controls.registered_on_release) do
|
for _, callback in pairs(controls.registered_on_release) do
|
||||||
callback(player, key, os.clock() - controls.players[pname][key][2])
|
callback(player, key, (minetest.get_us_time() - controls.players[pname][key][2]) / 1e6)
|
||||||
end
|
end
|
||||||
controls.players[pname][key] = {false}
|
controls.players[pname][key] = {false}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user