Fix bug and globalize `players` table

This commit is contained in:
LoneWolfHT 2022-02-07 12:32:49 -08:00 committed by Lars Müller
parent 268a8844b6
commit 0110e01826
1 changed files with 5 additions and 5 deletions

View File

@ -50,9 +50,12 @@ end
-- Player stats and animations
-- model, textures, animation
local players = {}
player_api.players = {}
player_api.player_attached = {}
-- Local for speed.
local players = player_api.players
local function get_player_data(player)
return assert(players[player:get_player_name()])
end
@ -211,11 +214,8 @@ function player_api.globalstep()
end
-- Mods can modify the globalstep by overriding player_api.globalstep
-- local for speed
local player_api_globalstep = player_api.globalstep
minetest.register_globalstep(function(...)
player_api_globalstep(players, ...)
player_api.globalstep(...)
end)
for _, api_function in pairs({"get_animation", "set_animation", "set_model", "set_textures"}) do