mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-23 23:23:43 +01:00
check for removed player variable
fixes https://github.com/pandorabox-io/pandorabox.io/issues/467
This commit is contained in:
parent
004e19acc0
commit
b367fb0f65
6
init.lua
6
init.lua
@ -39,8 +39,14 @@ end)
|
|||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
|
if not controls.players[player_name] then
|
||||||
local player_controls = player:get_player_control()
|
local player_controls = player:get_player_control()
|
||||||
for cname, cbool in pairs(player_controls) do
|
for cname, cbool in pairs(player_controls) do
|
||||||
|
if not controls.players[player_name] then
|
||||||
|
-- player timed out but is still provided by get_connected_players(), disregard
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
--Press a key
|
--Press a key
|
||||||
if cbool==true and controls.players[player_name][cname][1]==false then
|
if cbool==true and controls.players[player_name][cname][1]==false then
|
||||||
for _, func in pairs(controls.registered_on_press) do
|
for _, func in pairs(controls.registered_on_press) do
|
||||||
|
Loading…
Reference in New Issue
Block a user