Allow mods to override animation globalstep

This commit is contained in:
LoneWolfHT 2022-02-07 11:44:02 -08:00 committed by Lars Müller
parent a6f3b89596
commit f665382017

View File

@ -178,8 +178,8 @@ function minetest.calculate_knockback(player, ...)
end
-- Check each player and apply animations
minetest.register_globalstep(function()
for _, player in pairs(minetest.get_connected_players()) do
function player_api.globalstep()
for _, player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local player_data = players[name]
local model = player_data and models[player_data.model]
@ -208,6 +208,11 @@ minetest.register_globalstep(function()
end
end
end
end
-- Mods can modify the globalstep by overriding player_api.globalstep
minetest.register_globalstep(function(...)
player_api.globalstep(players, ...)
end)
for _, api_function in pairs({"get_animation", "set_animation", "set_model", "set_textures"}) do