Merge pull request 'small performance fixes' (#1146) from AFCMS/MineClone2:master into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1146
This commit is contained in:
Elias Fleckenstein 2021-02-18 16:21:25 +00:00
commit 793b5f616e
8 changed files with 102 additions and 100 deletions

View File

@ -36,7 +36,7 @@ mcl_weather.rain.set_sky_box = function()
{r=85, g=86, b=98},
{r=0, g=0, b=0}})
mcl_weather.skycolor.active = true
for _, player in pairs(minetest.get_connected_players()) do
for _, player in ipairs(minetest.get_connected_players()) do
player:set_clouds({color="#5D5D5FE8"})
end
end

View File

@ -37,7 +37,7 @@ mcl_weather.snow.set_sky_box = function()
{r=85, g=86, b=86},
{r=0, g=0, b=0}})
mcl_weather.skycolor.active = true
for _, player in pairs(minetest.get_connected_players()) do
for _, player in ipairs(minetest.get_connected_players()) do
player:set_clouds({color="#ADADADE8"})
end
mcl_weather.skycolor.active = true

View File

@ -25,7 +25,7 @@ minetest.register_globalstep(function(dtime)
{r=40, g=40, b=40},
{r=0, g=0, b=0}})
mcl_weather.skycolor.active = true
for _, player in pairs(minetest.get_connected_players()) do
for _, player in ipairs(minetest.get_connected_players()) do
player:set_clouds({color="#3D3D3FE8"})
end
mcl_weather.thunder.init_done = true

View File

@ -341,7 +341,7 @@ controls.register_on_hold(function(player, key, time)
end)
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
for _, player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local wielditem = player:get_wielded_item()
local wieldindex = player:get_wield_index()

View File

@ -137,7 +137,7 @@ local player_attached = mcl_player.player_attached
-- Check each player and apply animations
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
for _, player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local model_name = player_model[name]
local model = model_name and models[model_name]

View File

@ -52,7 +52,7 @@ minetest.register_globalstep(function(dtime)
time = 0
-- check players
for _,player in pairs(minetest.get_connected_players()) do
for _,player in ipairs(minetest.get_connected_players()) do
-- who am I?
local name = player:get_player_name()

View File

@ -19,7 +19,7 @@ minetest.register_globalstep(function(dtime)
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
for _,player in pairs(minetest.get_connected_players()) do
for _,player in ipairs(minetest.get_connected_players()) do
local controls = player:get_player_control()
name = player:get_player_name()
@ -118,7 +118,7 @@ minetest.register_globalstep(function(dtime)
time = 0
-- check players
for _,player in pairs(minetest.get_connected_players()) do
for _,player in ipairs(minetest.get_connected_players()) do
-- who am I?
local name = player:get_player_name()

View File

@ -7,6 +7,8 @@ mcl_skins = {
}
local S = minetest.get_translator("mcl_skins")
local has_mcl_armor = minetest.get_modpath("mcl_armor")
local has_mcl_inventory = minetest.get_modpath("mcl_inventory")
-- load skin list and metadata
local id, f, data, skin = 0
@ -105,11 +107,11 @@ mcl_skins.set_player_skin = function(player, skin_id)
mcl_skins.previews[playername] = preview
player:get_meta():set_string("mcl_skins:skin_id", tostring(skin_id))
mcl_skins.update_player_skin(player)
if minetest.get_modpath("mcl_armor") then
if has_mcl_armor then
armor.textures[playername].skin = skin_file
armor:update_player_visuals(player)
end
if minetest.get_modpath("mcl_inventory") then
if has_mcl_inventory then
mcl_inventory.update_inventory_formspec(player)
end
for i=1, #mcl_skins.registered_on_set_skins do