1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 15:00:18 +01:00

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

View File

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