From 6645c4cb304ad655c56f97b835424f6a5d89dd21 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 16 Mar 2021 17:43:32 +0100 Subject: [PATCH] Really --- mods/ENTITIES/mcl_boats/init.lua | 4 ++-- mods/ENTITIES/mcl_burning/api.lua | 2 +- mods/ENTITIES/mcl_item_entity/init.lua | 2 +- mods/ENVIRONMENT/mcl_weather/rain.lua | 8 +++++--- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 +- mods/ENVIRONMENT/mcl_weather/snow.lua | 6 ++++-- mods/ENVIRONMENT/mcl_weather/thunder.lua | 4 +++- mods/ITEMS/mcl_chests/init.lua | 2 +- mods/ITEMS/mcl_compass/init.lua | 2 +- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 168e76b703..c181a193b5 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -223,7 +223,7 @@ function boat.on_step(self, dtime, moveresult) self._regen_timer = regen_timer if moveresult and moveresult.collides then - for _, collision in ipairs(moveresult.collisions) do + for _, collision in pairs(moveresult.collisions) do local pos = collision.node_pos if collision.type == "node" and minetest.get_item_group(minetest.get_node(pos).name, "dig_by_boat") > 0 then minetest.dig_node(pos) @@ -305,7 +305,7 @@ function boat.on_step(self, dtime, moveresult) self._animation = 0 end - for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do + for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do local entity = obj:get_luaentity() if entity and entity._cmi_is_mob then attach_object(self, obj) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index 1a3365d140..723b29a8bd 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -267,7 +267,7 @@ function mcl_burning.fire_entity_step(self, dtime) if not parent or not mcl_burning.is_burning(parent) then do_remove = true else - for _, other in ipairs(minetest.get_objects_inside_radius(obj:get_pos(), 0)) do + for _, other in pairs(minetest.get_objects_inside_radius(obj:get_pos(), 0)) do local luaentity = obj:get_luaentity() if luaentity and luaentity.name == "mcl_burning:fire" and not luaentity.doing_step and not luaentity.removed then do_remove = true diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index e73e29da66..7546bd01c6 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -785,7 +785,7 @@ minetest.register_entity(":__builtin:item", { if self.physical_state then local own_stack = ItemStack(self.object:get_luaentity().itemstring) -- Merge with close entities of the same item - for _, object in ipairs(minetest.get_objects_inside_radius(p, 0.8)) do + for _, object in pairs(minetest.get_objects_inside_radius(p, 0.8)) do local obj = object:get_luaentity() if obj and obj.name == "__builtin:item" and obj.physical_state == false then diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 0afbb55397..d8425784a5 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -1,6 +1,8 @@ local PARTICLES_COUNT_RAIN = 30 local PARTICLES_COUNT_THUNDER = 45 +local get_connected_players = minetest.get_connected_players + mcl_weather.rain = { -- max rain particles created at time particles_count = PARTICLES_COUNT_RAIN, @@ -36,7 +38,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 ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do player:set_clouds({color="#5D5D5FE8"}) end end @@ -154,7 +156,7 @@ mcl_weather.rain.clear = function() mcl_weather.rain.init_done = false mcl_weather.rain.set_particles_mode("rain") mcl_weather.skycolor.remove_layer("weather-pack-rain-sky") - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do mcl_weather.rain.remove_sound(player) mcl_weather.rain.remove_player(player) end @@ -176,7 +178,7 @@ mcl_weather.rain.make_weather = function() mcl_weather.rain.init_done = true end - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then mcl_weather.rain.remove_sound(player) return false diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 6cc94b5c1b..061634fcb7 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -43,7 +43,7 @@ mcl_weather.skycolor = { -- Remove layer from colors table remove_layer = function(layer_name) - for k, name in ipairs(mcl_weather.skycolor.layer_names) do + for k, name in pairs(mcl_weather.skycolor.layer_names) do if name == layer_name then table.remove(mcl_weather.skycolor.layer_names, k) mcl_weather.skycolor.force_update = true diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index afe23c150b..3a0c539e3e 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -1,3 +1,5 @@ +local get_connected_players = minetest.get_connected_players + mcl_weather.snow = {} mcl_weather.snow.particles_count = 15 @@ -37,7 +39,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 ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do player:set_clouds({color="#ADADADE8"}) end mcl_weather.skycolor.active = true @@ -71,7 +73,7 @@ minetest.register_globalstep(function(dtime) mcl_weather.snow.init_done = true end - for _, player in ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then return false end diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index 7da3308dbc..ece6731709 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -1,3 +1,5 @@ +local get_connected_players = minetest.get_connected_players + -- turn off lightning mod 'auto mode' lightning.auto = false @@ -25,7 +27,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 ipairs(minetest.get_connected_players()) do + for _, player in pairs(get_connected_players()) do player:set_clouds({color="#3D3D3FE8"}) end mcl_weather.thunder.init_done = true diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 852a47fec5..42e39f5206 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -118,7 +118,7 @@ local function get_entity_pos(pos, dir, double) end local function find_entity(pos) - for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 0)) do + for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0)) do local luaentity = obj:get_luaentity() if luaentity and luaentity.name == "mcl_chests:chest" then return luaentity diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index f19bfe6a62..f154593037 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -52,7 +52,7 @@ minetest.register_globalstep(function(dtime) compass_image = math.floor((angle_relative/11.25) + 0.5) % compass_frames end - for j,stack in ipairs(player:get_inventory():get_list("main")) do + for j,stack in pairs(player:get_inventory():get_list("main")) do if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and minetest.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then local itemname = "mcl_compass:"..compass_image