From 84a800f22bb0cff6986fc7d9766129858b058bb9 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 19:58:09 +0200 Subject: [PATCH 01/63] fix many warnings --- mods/PLAYER/mcl_hunger/hunger.lua | 2 +- mods/PLAYER/mcl_playerplus/init.lua | 2 -- mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.de.tr | 3 --- mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.es.tr | 3 --- mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.fr.tr | 3 --- mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.ru.tr | 3 --- mods/PLAYER/mcl_playerplus/locale/template.txt | 3 --- mods/PLAYER/mcl_skins/init.lua | 4 ++-- 8 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.de.tr delete mode 100644 mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.es.tr delete mode 100644 mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.fr.tr delete mode 100644 mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.ru.tr delete mode 100644 mods/PLAYER/mcl_playerplus/locale/template.txt diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index 51d7fdaeb..cf422dbf0 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -1,4 +1,4 @@ -local S = minetest.get_translator("mcl_hunger") +--local S = minetest.get_translator("mcl_hunger") -- wrapper for minetest.item_eat (this way we make sure other mods can't break this one) minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 7b7920ee0..3ad6ba6e8 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -1,5 +1,3 @@ -local S = minetest.get_translator("mcl_playerplus") - mcl_playerplus = { elytra = {}, } diff --git a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.de.tr b/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.de.tr deleted file mode 100644 index 44d486d08..000000000 --- a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.de.tr +++ /dev/null @@ -1,3 +0,0 @@ -# textdomain: mcl_playerplus -@1 suffocated to death.=@1 erstickte zu Tode. -@1 was prickled to death by a cactus.=@1 wurde von einem Kaktus zu Tode gepiekst. diff --git a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.es.tr b/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.es.tr deleted file mode 100644 index ef7705bce..000000000 --- a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.es.tr +++ /dev/null @@ -1,3 +0,0 @@ -# textdomain: mcl_playerplus -@1 suffocated to death.=@1 ahogado hasta la muerte. -@1 was prickled to death by a cactus.=@1 fue herido de muerte por un cactus. diff --git a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.fr.tr b/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.fr.tr deleted file mode 100644 index 6482bd736..000000000 --- a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.fr.tr +++ /dev/null @@ -1,3 +0,0 @@ -# textdomain: mcl_playerplus -@1 suffocated to death.=@1 étouffé à mort. -@1 was prickled to death by a cactus.=@1 a été piqué à mort par un cactus. diff --git a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.ru.tr b/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.ru.tr deleted file mode 100644 index a75bd4bd6..000000000 --- a/mods/PLAYER/mcl_playerplus/locale/mcl_playerplus.ru.tr +++ /dev/null @@ -1,3 +0,0 @@ -# textdomain: mcl_playerplus -@1 suffocated to death.=@1 задохнулся(ась). -@1 was prickled to death by a cactus.=@1 был(а) до смерти заколот(а) кактусом. diff --git a/mods/PLAYER/mcl_playerplus/locale/template.txt b/mods/PLAYER/mcl_playerplus/locale/template.txt deleted file mode 100644 index 49b1f96ac..000000000 --- a/mods/PLAYER/mcl_playerplus/locale/template.txt +++ /dev/null @@ -1,3 +0,0 @@ -# textdomain: mcl_playerplus -@1 suffocated to death.= -@1 was prickled to death by a cactus.= diff --git a/mods/PLAYER/mcl_skins/init.lua b/mods/PLAYER/mcl_skins/init.lua index 84f147da6..0f23519ab 100644 --- a/mods/PLAYER/mcl_skins/init.lua +++ b/mods/PLAYER/mcl_skins/init.lua @@ -87,7 +87,7 @@ mcl_skins.set_player_skin = function(player, skin_id) return false end local playername = player:get_player_name() - local skin, skin_file, preview + local skin, preview if skin_id == nil or type(skin_id) ~= "number" or skin_id < 0 or skin_id > mcl_skins.skin_count then return false elseif skin_id == 0 then @@ -109,7 +109,7 @@ mcl_skins.set_player_skin = function(player, skin_id) preview = "mcl_skins_player_dummy" end end - skin_file = skin .. ".png" + --local skin_file = skin .. ".png" mcl_skins.skins[playername] = skin mcl_skins.previews[playername] = preview player:get_meta():set_string("mcl_skins:skin_id", tostring(skin_id)) From 1b3763654e5801b33842e2d8441a33744f94a697 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 20:00:59 +0200 Subject: [PATCH 02/63] comment unused local function --- mods/ITEMS/mcl_tnt/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 19bd04a18..40455f8d0 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -114,7 +114,7 @@ function TNT:on_activate(staticdata) self.object:set_texture_mod("^mcl_tnt_blink.png") end -local function add_effects(pos, radius, drops) +--[[local function add_effects(pos, radius, drops) minetest.add_particlespawner({ amount = 64, time = 0.5, @@ -161,7 +161,7 @@ local function add_effects(pos, radius, drops) texture = texture, collisiondetection = true, }) -end +end]] function TNT:on_step(dtime) local pos = self.object:get_pos() From 1870a89af08f40a8dfd041108a3801e90571e3fe Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 20:01:59 +0200 Subject: [PATCH 03/63] remove unused var --- mods/MAPGEN/mcl_mapgen_core/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index bdcdb1b4d..285da25c2 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1904,7 +1904,7 @@ function mcl_mapgen_core.unregister_generator(id) if rec.vf then lvm = lvm - 1 end if rec.nf then nodes = nodes - 1 end if rec.needs_param2 then param2 = param2 - 1 end - if rec.needs_level0 then level0 = level0 - 1 end + --if rec.needs_level0 then level0 = level0 - 1 end end -- Generate basic layer-based nodes: void, bedrock, realm barrier, lava seas, etc. From a71a0e91611a758e5be4a7cd658792d9bd471304 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:04:18 +0200 Subject: [PATCH 04/63] fix even more warnings (nether portals and potions) --- mods/ITEMS/mcl_portals/portal_nether.lua | 18 +++++++++++++++--- mods/ITEMS/mcl_potions/functions.lua | 16 ++++++++-------- mods/MAPGEN/mcl_biomes/init.lua | 7 ++++--- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_portals/portal_nether.lua b/mods/ITEMS/mcl_portals/portal_nether.lua index a121f719c..ec8e40d22 100644 --- a/mods/ITEMS/mcl_portals/portal_nether.lua +++ b/mods/ITEMS/mcl_portals/portal_nether.lua @@ -137,8 +137,20 @@ local function find_exit(p, dx, dy, dz) if not p or not p.y or not p.z or not p.x then return end local dx, dy, dz = dx or DISTANCE_MAX, dy or DISTANCE_MAX, dz or DISTANCE_MAX if dx < 1 or dy < 1 or dz < 1 then return false end - local x, y, z = floor(p.x), floor(p.y), floor(p.z) - local x1, y1, z1, x2, y2, z2 = x-dx+1, y-dy+1, z-dz+1, x+dx-1, y+dy-1, z+dz-1 + + --y values aren't used + local x = floor(p.x) + --local y = floor(p.y) + local z = floor(p.z) + + local x1 = x-dx+1 + --local y1 = y-dy+1 + local z1 = z-dz+1 + + local x2 = x+dx-1 + --local y2 = y+dy-1 + local z2 = z+dz-1 + local k1x, k2x = floor(x1/256), floor(x2/256) local k1z, k2z = floor(z1/256), floor(z2/256) @@ -371,7 +383,7 @@ local function finalize_teleport(obj, exit) if is_player then name = obj:get_player_name() end - local y, dim = mcl_worlds.y_to_layer(exit.y) + local _, dim = mcl_worlds.y_to_layer(exit.y) -- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index b4e1d9448..09b95115a 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -558,8 +558,8 @@ function mcl_potions.make_invisible(player, toggle) local is_player = player:is_player() local entity = player:get_luaentity() - local playername = player:get_player_name() - local skin_file = "" + --local playername = player:get_player_name() + local skin_file if toggle then -- hide player @@ -567,22 +567,22 @@ function mcl_potions.make_invisible(player, toggle) if entity then EF.invisible[player].old_size = entity.visual_size - elseif not player:is_player() then -- if not a player or entity, do nothing + elseif not is_player then -- if not a player or entity, do nothing return end - if player:is_player() then - mcl_player.player_set_skin(player, "mobs_mc_empty.png") - elseif not player:is_player() then + if is_player then + mcl_player.player_set_skin(player, skin_file) + elseif not is_player then player:set_properties({visual_size = {x = 0, y = 0}}) end player:set_nametag_attributes({color = {a = 0}}) elseif EF.invisible[player] then -- show player - if player:is_player() then + if is_player then mcl_skins.update_player_skin(player) - elseif not player:is_player() then + elseif not is_player then player:set_properties({visual_size = EF.invisible[player].old_size}) end player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}}) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index d4ebe00d3..4e01df5f2 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3580,7 +3580,8 @@ local function register_decorations() local fern_minimal = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga", "ColdTaiga" } local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" } local fern_Jungle = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM" } - local fern_JungleM = { "JungleM" }, + --local fern_JungleM = { "JungleM" }, + register_grass_decoration("fern", -0.03, 0.09, fern_minimal) register_grass_decoration("fern", -0.015, 0.075, fern_minimal) register_grass_decoration("fern", 0, 0.06, fern_minimal) @@ -3591,7 +3592,7 @@ local function register_decorations() register_grass_decoration("fern", 0.05, 0.01, fern_Jungle) register_grass_decoration("fern", 0.07, -0.01, fern_Jungle) register_grass_decoration("fern", 0.09, -0.03, fern_Jungle) - register_grass_decoration("fern", 0.12, -0.03, fern_JungleM) + register_grass_decoration("fern", 0.12, -0.03, {"JungleM"}) local b_seagrass = {"ColdTaiga_ocean","ExtremeHills_ocean","ExtremeHillsM_ocean","ExtremeHills+_ocean","Taiga_ocean","MegaTaiga_ocean","MegaSpruceTaiga_ocean","StoneBeach_ocean","Plains_ocean","SunflowerPlains_ocean","Forest_ocean","FlowerForest_ocean","BirchForest_ocean","BirchForestM_ocean","RoofedForest_ocean","Swampland_ocean","Jungle_ocean","JungleM_ocean","JungleEdge_ocean","JungleEdgeM_ocean","MushroomIsland_ocean","Desert_ocean","Savanna_ocean","SavannaM_ocean","Mesa_ocean","MesaBryce_ocean","MesaPlateauF_ocean","MesaPlateauFM_ocean", "ColdTaiga_deep_ocean","ExtremeHills_deep_ocean","ExtremeHillsM_deep_ocean","ExtremeHills+_deep_ocean","Taiga_deep_ocean","MegaTaiga_deep_ocean","MegaSpruceTaiga_deep_ocean","StoneBeach_deep_ocean","Plains_deep_ocean","SunflowerPlains_deep_ocean","Forest_deep_ocean","FlowerForest_deep_ocean","BirchForest_deep_ocean","BirchForestM_deep_ocean","RoofedForest_deep_ocean","Swampland_deep_ocean","Jungle_deep_ocean","JungleM_deep_ocean","JungleEdge_deep_ocean","JungleEdgeM_deep_ocean","MushroomIsland_deep_ocean","Desert_deep_ocean","Savanna_deep_ocean","SavannaM_deep_ocean","Mesa_deep_ocean","MesaBryce_deep_ocean","MesaPlateauF_deep_ocean","MesaPlateauFM_deep_ocean", @@ -3974,7 +3975,7 @@ if mg_name ~= "singlenode" then mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed) local gennotify = minetest.get_mapgen_object("gennotify") --local poslist = {} - pr = PseudoRandom(blockseed + 14) + local pr = PseudoRandom(blockseed + 14) for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do local x, y, z = pos.x, pos.y, pos.z if x < -2 or x > 2 or z < -2 or z > 2 then From c1a717238b06bc345c67aaf0197e70d428ba6f2e Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:07:56 +0200 Subject: [PATCH 05/63] [mcl_portals] fix warnings --- mods/ITEMS/mcl_portals/portal_end.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_portals/portal_end.lua b/mods/ITEMS/mcl_portals/portal_end.lua index 192f5001c..5b402bdc0 100644 --- a/mods/ITEMS/mcl_portals/portal_end.lua +++ b/mods/ITEMS/mcl_portals/portal_end.lua @@ -1,10 +1,14 @@ local S = minetest.get_translator("mcl_portals") --- Parameters -local SPAWN_MIN = mcl_vars.mg_end_min+70 -local SPAWN_MAX = mcl_vars.mg_end_min+98 +local table = table +local vector = vector +local math = math -local mg_name = minetest.get_mapgen_setting("mg_name") +-- Parameters +--local SPAWN_MIN = mcl_vars.mg_end_min+70 +--local SPAWN_MAX = mcl_vars.mg_end_min+98 + +--local mg_name = minetest.get_mapgen_setting("mg_name") local destroy_portal = function(pos) local neighbors = { @@ -196,7 +200,6 @@ function mcl_portals.end_teleport(obj, pos) end end - local platform build_end_portal_destination(platform_pos) check_and_build_end_portal_destination(platform_pos) From e91ee174a47c4aa162ad4811795d68d8a34501bc Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:12:33 +0200 Subject: [PATCH 06/63] [mcl_ocean] fix warnings --- mods/ITEMS/mcl_ocean/kelp.lua | 5 ++--- mods/ITEMS/mcl_ocean/sea_pickle.lua | 2 +- mods/ITEMS/mcl_ocean/seagrass.lua | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 326b08a81..fb6045e78 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -38,7 +38,7 @@ local mt_is_creative_enabled = minetest.is_creative_enabled local mt_sound_play = minetest.sound_play local math = math -local string = string +--local string = string local table = table -- DEBUG: functions @@ -422,7 +422,7 @@ end function kelp.surface_after_dig_node(pos, node) - return mt_set_node(pos, {name=registred_nodes[node.name].node_dig_prediction}) + return mt_set_node(pos, {name=minetest.registered_nodes[node.name].node_dig_prediction}) end @@ -759,7 +759,6 @@ minetest.register_craftitem("mcl_ocean:dried_kelp", { groups = { food = 2, eatable = 1 }, on_place = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1), - groups = { food = 2, eatable = 1 }, _mcl_saturation = 0.6, }) diff --git a/mods/ITEMS/mcl_ocean/sea_pickle.lua b/mods/ITEMS/mcl_ocean/sea_pickle.lua index 45b934a92..067bb39a3 100644 --- a/mods/ITEMS/mcl_ocean/sea_pickle.lua +++ b/mods/ITEMS/mcl_ocean/sea_pickle.lua @@ -12,7 +12,7 @@ local function sea_pickle_on_place(itemstack, placer, pointed_thing) local node_under = minetest.get_node(pos_under) local node_above = minetest.get_node(pos_above) local def_under = minetest.registered_nodes[node_under.name] - local def_above = minetest.registered_nodes[node_above.name] + --local def_above = minetest.registered_nodes[node_above.name] if def_under and def_under.on_rightclick and not placer:get_player_control().sneak then return def_under.on_rightclick(pos_under, node_under, diff --git a/mods/ITEMS/mcl_ocean/seagrass.lua b/mods/ITEMS/mcl_ocean/seagrass.lua index 492205138..bd6400a32 100644 --- a/mods/ITEMS/mcl_ocean/seagrass.lua +++ b/mods/ITEMS/mcl_ocean/seagrass.lua @@ -105,7 +105,7 @@ for s=1, #surfaces do doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.") desc = S("Seagrass") doc_create = true - doc_img = "mcl_ocean_seagrass.png" + doc_img = "mcl_ocean_seagrass.png^[verticalframe:12:0" else doc_create = false end @@ -113,7 +113,7 @@ for s=1, #surfaces do _doc_items_entry_name = desc, _doc_items_longdesc = doc_longdesc, _doc_items_create_entry = doc_create, - _doc_items_image = "mcl_ocean_seagrass.png^[verticalframe:12:0", + _doc_items_image = doc_img, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "meshoptions", From 0113d290b79cbeea4153635b06d53d07d5363743 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:19:31 +0200 Subject: [PATCH 07/63] [mcl_mobspawners] fix warnings --- mods/ITEMS/mcl_mobspawners/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index fe01f4c52..bd9d0c53a 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -1,11 +1,14 @@ local S = minetest.get_translator("mcl_mobspawners") +local math = math +local table = table + mcl_mobspawners = {} local default_mob = "mobs_mc:pig" -- Mob spawner -local spawner_default = default_mob.." 0 15 4 15" +--local spawner_default = default_mob.." 0 15 4 15" local function get_mob_textures(mob) local list = minetest.registered_entities[mob].texture_list @@ -160,7 +163,7 @@ local spawn_mobs = function(pos, elapsed) -- check objects inside 8×8 area around spawner local objs = minetest.get_objects_inside_radius(pos, 8) local count = 0 - local ent = nil + local ent local timer = minetest.get_node_timer(pos) From 9edcc60ba243750bed8994b3896cb48b6a9206c6 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:21:32 +0200 Subject: [PATCH 08/63] [mcl_maps] fix warnings --- mods/ITEMS/mcl_maps/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_maps/init.lua b/mods/ITEMS/mcl_maps/init.lua index b2c03b354..ccdaf6dfd 100644 --- a/mods/ITEMS/mcl_maps/init.lua +++ b/mods/ITEMS/mcl_maps/init.lua @@ -5,7 +5,7 @@ local storage = minetest.get_mod_storage() local modpath = minetest.get_modpath("mcl_maps") local worldpath = minetest.get_worldpath() local map_textures_path = worldpath .. "/mcl_maps/" -local last_finished_id = storage:get_int("next_id") - 1 +--local last_finished_id = storage:get_int("next_id") - 1 minetest.mkdir(map_textures_path) From 0cac8f3f4411a316d235f93fffa87372ef6c92fc Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:22:09 +0200 Subject: [PATCH 09/63] [mcl_jukebox] fix warnings --- mods/ITEMS/mcl_jukebox/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_jukebox/init.lua b/mods/ITEMS/mcl_jukebox/init.lua index 067848f50..249603b58 100644 --- a/mods/ITEMS/mcl_jukebox/init.lua +++ b/mods/ITEMS/mcl_jukebox/init.lua @@ -72,7 +72,6 @@ local function now_playing(player, name) active_huds[playername] = nil end end, {playername, id, hud_sequence_numbers[playername]}) - end minetest.register_on_leaveplayer(function(player) From a200252ab883aef1f79c3107e6ffc2a63403d7a9 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:23:25 +0200 Subject: [PATCH 10/63] [mcl_itemframes] fix warnings --- mods/ITEMS/mcl_itemframes/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/init.lua b/mods/ITEMS/mcl_itemframes/init.lua index e0f9f9043..fbd4d545a 100644 --- a/mods/ITEMS/mcl_itemframes/init.lua +++ b/mods/ITEMS/mcl_itemframes/init.lua @@ -276,12 +276,12 @@ minetest.register_node("mcl_itemframes:item_frame",{ on_rotate = function(pos, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then -- Rotate face - local meta = minetest.get_meta(pos) + --local meta = minetest.get_meta(pos) local node = minetest.get_node(pos) local objs = nil if node.name == "mcl_itemframes:item_frame" then - objs = minetest.get_objects_inside_radius(pos, .5) + objs = minetest.get_objects_inside_radius(pos, 0.5) end if objs then for _, obj in ipairs(objs) do From b58e61b98825132a898dc9bc0fb08c60e2420bdf Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:25:28 +0200 Subject: [PATCH 11/63] [mcl_heads] fix warnings --- mods/ITEMS/mcl_heads/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 0f41adb89..4bcee2279 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -91,7 +91,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor) local itemstring = itemstack:get_name() local fakestack = ItemStack(itemstack) - local idef = fakestack:get_definition() + --local idef = fakestack:get_definition() local retval if wdir == 0 or wdir == 1 then return minetest.item_place(itemstack, placer, pointed_thing) @@ -101,7 +101,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor) if not retval then return itemstack end - itemstack,_ = minetest.item_place(fakestack, placer, pointed_thing, wdir) + itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) itemstack:set_name(itemstring) return itemstack end, From 45ab5c8e25a901e3c103df5f7f6c080b30de6f91 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:29:51 +0200 Subject: [PATCH 12/63] [mcl_flowers] fix warnings --- mods/ITEMS/mcl_flowers/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 7a2501f25..d07a125cb 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -180,12 +180,12 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im if not inv_img then inv_img = top_img end - local noncreative, create_entry, paramtype2, palette + local create_entry, paramtype2, palette if is_flower == nil then is_flower = true end - local bottom_groups = {flammable=2,fire_encouragement=60,fire_flammability=100, non_mycelium_plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, plant=1,double_plant=1,deco_block=1,not_in_creative_inventory=noncreative} + local bottom_groups = {flammable=2, fire_encouragement=60, fire_flammability=100, non_mycelium_plant=1, attached_node=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, plant=1, double_plant=1, deco_block=1} if is_flower then bottom_groups.flower = 1 bottom_groups.place_flowerlike = 1 @@ -200,7 +200,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im palette = "mcl_core_palette_grass.png" end if longdesc == nil then - noncreative = 1 + bottom_groups.not_in_creative_inventory = 1 create_entry = false end -- Drop itself by default From 82396bd994382fd4bd98bde770430c18ada01471 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:31:16 +0200 Subject: [PATCH 13/63] [mcl_fireworks] fix warnings (1000 remainings) --- mods/ITEMS/mcl_fireworks/register.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/ITEMS/mcl_fireworks/register.lua b/mods/ITEMS/mcl_fireworks/register.lua index 6ab55442c..c441254cb 100644 --- a/mods/ITEMS/mcl_fireworks/register.lua +++ b/mods/ITEMS/mcl_fireworks/register.lua @@ -1,7 +1,5 @@ local S = minetest.get_translator("mcl_fireworks") -local player_rocketing = {} - local tt_help = S("Flight Duration:") local description = S("Firework Rocket") From a1acf6d3c18c5e88a0e391447280a79bdc4c8565 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:49:03 +0200 Subject: [PATCH 14/63] [mcl_fishing] fix warnings --- mods/ITEMS/mcl_fishing/init.lua | 281 +++++++++++++++----------------- 1 file changed, 133 insertions(+), 148 deletions(-) diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 76526ee72..cc7c5cca5 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -2,6 +2,8 @@ local S = minetest.get_translator("mcl_fishing") +local math = math + local bobber_ENTITY={ physical = false, timer=0, @@ -31,143 +33,141 @@ local fish = function(itemstack, player, pointed_thing) end end - local pos = player:get_pos() + local pos = player:get_pos() - local objs = minetest.get_objects_inside_radius(pos, 125) - local num = 0 - local ent = nil - local noent = true - - local durability = 65 - local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") - if unbreaking > 0 then - durability = durability * (unbreaking + 1) - end + local objs = minetest.get_objects_inside_radius(pos, 125) + local ent + local noent = false - --Check for bobber if so handle. - for n = 1, #objs do - ent = objs[n]:get_luaentity() - if ent then - if ent.player and ent.objtype=="fishing" then - if (player:get_player_name() == ent.player) then - noent = false - if ent._dive == true then - local itemname - local items - local itemcount = 1 - local pr = PseudoRandom(os.time() * math.random(1, 100)) - local r = pr:next(1, 100) - local fish_values = {85, 84.8, 84.7, 84.5} - local junk_values = {10, 8.1, 6.1, 4.2} - local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3) - local index = luck_of_the_sea + 1 - local fish_value = fish_values[index] - local junk_value = junk_values[index] + fish_value - if r <= fish_value then - -- Fish - items = mcl_loot.get_loot({ - items = { - { itemstring = "mcl_fishing:fish_raw", weight = 60 }, - { itemstring = "mcl_fishing:salmon_raw", weight = 25 }, - { itemstring = "mcl_fishing:clownfish_raw", weight = 2 }, - { itemstring = "mcl_fishing:pufferfish_raw", weight = 13 }, - } - }, pr) - elseif r <= junk_value then - -- Junk - items = mcl_loot.get_loot({ - items = { - { itemstring = "mcl_core:bowl", weight = 10 }, - { itemstring = "mcl_fishing:fishing_rod", weight = 2, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage - { itemstring = "mcl_mobitems:leather", weight = 10 }, - { itemstring = "mcl_armor:boots_leather", weight = 10, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage - { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, - { itemstring = "mcl_core:stick", weight = 5 }, - { itemstring = "mcl_mobitems:string", weight = 5 }, - { itemstring = "mcl_potions:water", weight = 10 }, - { itemstring = "mcl_mobitems:bone", weight = 10 }, - { itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 }, - { itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook - } - }, pr) - else - -- Treasure - items = mcl_loot.get_loot({ - items = { - -- TODO: Enchanted Bow - { itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage - { itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)}, - -- TODO: Enchanted Fishing Rod - { itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage - { itemstring = "mcl_mobs:nametag", }, - { itemstring = "mcl_mobitems:saddle", }, - { itemstring = "mcl_flowers:waterlily", }, - } - }, pr) - end - local item - if #items >= 1 then - item = ItemStack(items[1]) - else - item = ItemStack() - end - local inv = player:get_inventory() - if inv:room_for_item("main", item) then - inv:add_item("main", item) - else - minetest.add_item(pos, item) - end - if mcl_experience.throw_experience then - mcl_experience.throw_experience(pos, math.random(1,6)) - end + local durability = 65 + local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") + if unbreaking > 0 then + durability = durability * (unbreaking + 1) + end - if not minetest.is_creative_enabled(player:get_player_name()) then - local idef = itemstack:get_definition() - itemstack:add_wear(65535/durability) -- 65 uses - if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then - minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) - end + --Check for bobber if so handle. + for n = 1, #objs do + ent = objs[n]:get_luaentity() + if ent then + if ent.player and ent.objtype=="fishing" then + if (player:get_player_name() == ent.player) then + if ent._dive == true then + local items + local pr = PseudoRandom(os.time() * math.random(1, 100)) + local r = pr:next(1, 100) + local fish_values = {85, 84.8, 84.7, 84.5} + local junk_values = {10, 8.1, 6.1, 4.2} + local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3) + local index = luck_of_the_sea + 1 + local fish_value = fish_values[index] + local junk_value = junk_values[index] + fish_value + if r <= fish_value then + -- Fish + items = mcl_loot.get_loot({ + items = { + { itemstring = "mcl_fishing:fish_raw", weight = 60 }, + { itemstring = "mcl_fishing:salmon_raw", weight = 25 }, + { itemstring = "mcl_fishing:clownfish_raw", weight = 2 }, + { itemstring = "mcl_fishing:pufferfish_raw", weight = 13 }, + } + }, pr) + elseif r <= junk_value then + -- Junk + items = mcl_loot.get_loot({ + items = { + { itemstring = "mcl_core:bowl", weight = 10 }, + { itemstring = "mcl_fishing:fishing_rod", weight = 2, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage + { itemstring = "mcl_mobitems:leather", weight = 10 }, + { itemstring = "mcl_armor:boots_leather", weight = 10, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage + { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, + { itemstring = "mcl_core:stick", weight = 5 }, + { itemstring = "mcl_mobitems:string", weight = 5 }, + { itemstring = "mcl_potions:water", weight = 10 }, + { itemstring = "mcl_mobitems:bone", weight = 10 }, + { itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 }, + { itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook + } + }, pr) + else + -- Treasure + items = mcl_loot.get_loot({ + items = { + -- TODO: Enchanted Bow + { itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage + { itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)}, + -- TODO: Enchanted Fishing Rod + { itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage + { itemstring = "mcl_mobs:nametag", }, + { itemstring = "mcl_mobitems:saddle", }, + { itemstring = "mcl_flowers:waterlily", }, + } + }, pr) + end + local item + if #items >= 1 then + item = ItemStack(items[1]) + else + item = ItemStack() + end + local inv = player:get_inventory() + if inv:room_for_item("main", item) then + inv:add_item("main", item) + else + minetest.add_item(pos, item) + end + if mcl_experience.throw_experience then + mcl_experience.throw_experience(pos, math.random(1,6)) + end + + if not minetest.is_creative_enabled(player:get_player_name()) then + local idef = itemstack:get_definition() + itemstack:add_wear(65535/durability) -- 65 uses + if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then + minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) end end - --Check if object is on land. - local epos = ent.object:get_pos() - epos.y = math.floor(epos.y) - local node = minetest.get_node(epos) - local def = minetest.registered_nodes[node.name] - if def.walkable then - if not minetest.is_creative_enabled(player:get_player_name()) then - local idef = itemstack:get_definition() - itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC. - if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then - minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) - end - end - end - --Destroy bobber. - ent.object:remove() - return itemstack end + --Check if object is on land. + local epos = ent.object:get_pos() + epos.y = math.floor(epos.y) + local node = minetest.get_node(epos) + local def = minetest.registered_nodes[node.name] + if def.walkable then + if not minetest.is_creative_enabled(player:get_player_name()) then + local idef = itemstack:get_definition() + itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC. + if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then + minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) + end + end + end + --Destroy bobber. + ent.object:remove() + noent = false + break end end end - --Check for flying bobber. - for n = 1, #objs do - ent = objs[n]:get_luaentity() - if ent then - if ent._thrower and ent.objtype=="fishing" then - if player:get_player_name() == ent._thrower then - noent = false - break - end + end + --Check for flying bobber. + for n = 1, #objs do + ent = objs[n]:get_luaentity() + if ent then + if ent._thrower and ent.objtype=="fishing" then + if player:get_player_name() == ent._thrower then + noent = false + break end end end - --If no bobber or flying_bobber exists then throw bobber. - if noent == true then - local playerpos = player:get_pos() - local dir = player:get_look_dir() - mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name()) - end + end + --If no bobber or flying_bobber exists then throw bobber. + if noent then + local playerpos = player:get_pos() + local dir = player:get_look_dir() + mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name()) + end + return itemstack end -- Movement function of bobber @@ -334,13 +334,11 @@ minetest.register_entity("mcl_fishing:flying_bobber_entity", flying_bobber_ENTIT mcl_throwing.register_throwable_object("mcl_fishing:flying_bobber", "mcl_fishing:flying_bobber_entity", 5) --- If player leaves area, remove bobber. -minetest.register_on_leaveplayer(function(player) +local function remove_bobber(player) local objs = minetest.get_objects_inside_radius(player:get_pos(), 250) - local ent = nil - local noent = true + for n = 1, #objs do - ent = objs[n]:get_luaentity() + local ent = objs[n]:get_luaentity() if ent then if ent.player and ent.objtype=="fishing" then ent.object:remove() @@ -349,26 +347,13 @@ minetest.register_on_leaveplayer(function(player) end end end -end) +end + +-- If player leaves area, remove bobber. +minetest.register_on_leaveplayer(remove_bobber) -- If player dies, remove bobber. -minetest.register_on_dieplayer(function(player) - local objs = minetest.get_objects_inside_radius(player:get_pos(), 250) - local num = 0 - local ent = nil - local noent = true - - for n = 1, #objs do - ent = objs[n]:get_luaentity() - if ent then - if ent.player and ent.objtype=="fishing" then - ent.object:remove() - elseif ent._thrower and ent.objtype=="fishing" then - ent.object:remove() - end - end - end -end) +minetest.register_on_dieplayer(remove_bobber) -- Fishing Rod minetest.register_tool("mcl_fishing:fishing_rod", { From fcc2087b9718c600f1de0d878a20391e06c54b65 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:50:28 +0200 Subject: [PATCH 15/63] [mcl_farming] fix warnings --- mods/ITEMS/mcl_farming/shared_functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index c4cb2fd71..025894a11 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -161,7 +161,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}, true) minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2}) - local intervals_counter = get_intervals_counter(pos, 1, 1) + --local intervals_counter = get_intervals_counter(pos, 1, 1) else return end @@ -190,7 +190,7 @@ end function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, stem_itemstring, stem_def, stem_drop, gourd_itemstring, gourd_def, grow_interval, grow_chance, connected_stem_texture, gourd_on_construct_extra) - local connected_stem_names = { + local connected_stem_names = { connected_stem_basename .. "_r", connected_stem_basename .. "_l", connected_stem_basename .. "_t", From 56310a3624bd41f50e6e14b8248e8af70be62e94 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sat, 22 May 2021 23:56:52 +0200 Subject: [PATCH 16/63] [mcl_end] fix some warnings --- mods/ITEMS/mcl_end/chorus_plant.lua | 13 ++++++------- mods/ITEMS/mcl_end/end_crystal.lua | 4 +++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index 597842867..b54259885 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -29,7 +29,7 @@ local no_detach = {} -- This detaches all chorus plants that are/were attached -- at start_pos. -mcl_end.detach_chorus_plant = function(start_pos, digger) +function mcl_end.detach_chorus_plant(start_pos, digger) -- This node should not call a detach function, do NOTHING local hash = minetest.hash_node_position(start_pos) if no_detach[hash] ~= nil then @@ -106,11 +106,11 @@ mcl_end.detach_chorus_plant = function(start_pos, digger) no_detach = {} end -mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger) +function mcl_end.check_detach_chorus_plant(pos, oldnode, oldmetadata, digger) mcl_end.detach_chorus_plant(pos, digger) end -mcl_end.check_blast_chorus_plant = function(pos) +function mcl_end.check_blast_chorus_plant(pos) minetest.remove_node(pos) mcl_end.detach_chorus_plant(pos) end @@ -139,7 +139,7 @@ minetest.register_node("mcl_end:chorus_flower", { node_placement_prediction = "", on_place = function(itemstack, placer, pointed_thing) local node_under = minetest.get_node(pointed_thing.under) - local node_above = minetest.get_node(pointed_thing.above) + --local node_above = minetest.get_node(pointed_thing.above) if placer and not placer:get_player_control().sneak then -- Use pointed node's on_rightclick function first, if present if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then @@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", { }) -- Grow a complete chorus plant at pos -mcl_end.grow_chorus_plant = function(pos, node, pr) +function mcl_end.grow_chorus_plant(pos, node, pr) local flowers = { pos } -- Plant initial flower (if it isn't there already) if not node then @@ -340,7 +340,7 @@ end -- Grow a single step of a chorus plant at pos. -- Pos must be a chorus flower. -mcl_end.grow_chorus_plant_step = function(pos, node, pr) +function mcl_end.grow_chorus_plant_step(pos, node, pr) local new_flower_buds = {} local above = { x = pos.x, y = pos.y + 1, z = pos.z } local node_above = minetest.get_node(above) @@ -408,7 +408,6 @@ mcl_end.grow_chorus_plant_step = function(pos, node, pr) elseif branching == true then branches = pr:next(0, 3) end - local branch_grown = false for b=1, branches do local next_branch = pr:next(1, #around) local branch = vector.add(pos, around[next_branch]) diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index 78fcc0e21..a188be383 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -1,5 +1,7 @@ local S = minetest.get_translator("mcl_end") +local vector = vector + local explosion_strength = 6 local directions = { @@ -45,7 +47,7 @@ local function set_crystal_animation(self) end local function spawn_crystal(pos) - local crystal = minetest.add_entity(pos, "mcl_end:crystal") + minetest.add_entity(pos, "mcl_end:crystal") if not vector.equals(pos, vector.floor(pos)) then return end if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end local portal_center From bbde3b551f08a3dbe8a727b5acd49e54f495df59 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:01:30 +0200 Subject: [PATCH 17/63] [mcl_enchanting] fix warnings --- mods/ITEMS/mcl_enchanting/engine.lua | 4 ++-- mods/ITEMS/mcl_enchanting/init.lua | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 89fdc393d..47db36870 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -250,7 +250,7 @@ local function get_after_use_callback(itemdef) itemstack:add_wear(digparams.wear) end - local enchantments = mcl_enchanting.get_enchantments(itemstack) + --local enchantments = mcl_enchanting.get_enchantments(itemstack) mcl_enchanting.update_groupcaps(itemstack) end end @@ -292,7 +292,7 @@ end function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure) local possible_enchantments, weights, accum_weight = {}, {}, 0 for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do - local supported, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1) + local _, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1) if primary or treasure then table.insert(possible_enchantments, enchantment) accum_weight = accum_weight + enchantment_def.weight diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 26fd5e19d..06f9b0f75 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -1,6 +1,9 @@ local modpath = minetest.get_modpath("mcl_enchanting") local S = minetest.get_translator("mcl_enchanting") +local math = math +local vector = vector + mcl_enchanting = { book_offset = vector.new(0, 0.75, 0), book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4}, @@ -122,7 +125,7 @@ minetest.register_chatcommand("forceenchant", { return false, S("Player '@1' cannot be found.", target_name) end local itemstack = target:get_wielded_item() - local can_enchant, errorstring, extra_info = mcl_enchanting.can_enchant(itemstack, enchantment, level) + local _, errorstring = mcl_enchanting.can_enchant(itemstack, enchantment, level) if errorstring == "enchantment invalid" then return false, S("There is no such enchantment '@1'.", enchantment) elseif errorstring == "item missing" then @@ -242,9 +245,9 @@ minetest.register_node("mcl_enchanting:table", { on_rotate = rotate, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local player_meta = clicker:get_meta() - local table_meta = minetest.get_meta(pos) - local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves") - local table_name = table_meta:get_string("name") + --local table_meta = minetest.get_meta(pos) + --local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves") + local table_name = minetest.get_meta(pos):get_string("name") if table_name == "" then table_name = S("Enchant") end From b3c0e7c1bd0c1ce7520b747722d7da40a4c2b597 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:01:53 +0200 Subject: [PATCH 18/63] [mcl_dye] fix warnings --- mods/ITEMS/mcl_dye/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 2897e96ec..863abd3d2 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -327,7 +327,7 @@ minetest.register_craftitem("mcl_dye:white", { _doc_items_usagehelp = S("Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place."), stack_max = 64, groups = dyelocal.dyes[1][4], - on_place = function(itemstack, user, pointed_thing) + on_place = function(itemstack, user, pointed_thing) -- Use pointed node's on_rightclick function first, if present local node = minetest.get_node(pointed_thing.under) if user and not user:get_player_control().sneak then From 30e83088d4dddf1349da06f87d8d1dbf669b4c3b Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:03:34 +0200 Subject: [PATCH 19/63] [mcl_doors] fix warnings --- mods/ITEMS/mcl_doors/api_trapdoors.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_doors/api_trapdoors.lua b/mods/ITEMS/mcl_doors/api_trapdoors.lua index c8f769c67..3999ad0bf 100644 --- a/mods/ITEMS/mcl_doors/api_trapdoors.lua +++ b/mods/ITEMS/mcl_doors/api_trapdoors.lua @@ -98,13 +98,11 @@ function mcl_doors:register_trapdoor(name, def) if not usagehelp and not def.only_redstone_can_open then usagehelp = S("To open or close this trapdoor, rightclick it or send a redstone signal to it.") end - if not tt_help then - if def.only_redstone_can_open then - tt_help = S("Openable by redstone power") - else - tt_help = S("Openable by players and redstone power") - end - end + if def.only_redstone_can_open then + tt_help = S("Openable by redstone power") + else + tt_help = S("Openable by players and redstone power") + end -- Closed trapdoor @@ -164,7 +162,7 @@ function mcl_doors:register_trapdoor(name, def) local fpos = get_fpos(placer, pointed_thing) - local origname = itemstack:get_name() + --local origname = itemstack:get_name() if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5) or (fpos < -0.5 and fpos > -0.999999999) then param2 = param2 + 20 From f9a86947e58316d2e336740bc2765f0df0a78f03 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:09:07 +0200 Subject: [PATCH 20/63] [mcl_core] fix warnings --- mods/ITEMS/mcl_core/nodes_base.lua | 5 ++--- mods/ITEMS/mcl_core/nodes_climb.lua | 1 - mods/ITEMS/mcl_core/nodes_glass.lua | 4 ++-- mods/ITEMS/mcl_core/nodes_liquid.lua | 7 +++++-- mods/ITEMS/mcl_core/nodes_misc.lua | 5 ++--- mods/ITEMS/mcl_core/nodes_trees.lua | 5 ++--- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 4477f0377..39015e53b 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -990,9 +990,8 @@ for i=1,8 do local itemcount = itemstack:get_count() local fakestack = ItemStack(itemstring.." "..itemcount) fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g))) - local success - itemstack, success = minetest.item_place(fakestack, placer, pointed_thing) - minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}, true) + itemstack = minetest.item_place(fakestack, placer, pointed_thing) + minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = pointed_thing.under}, true) itemstack:set_name(itemstring) return itemstack end diff --git a/mods/ITEMS/mcl_core/nodes_climb.lua b/mods/ITEMS/mcl_core/nodes_climb.lua index d9ecd76d3..3b2d3ab60 100644 --- a/mods/ITEMS/mcl_core/nodes_climb.lua +++ b/mods/ITEMS/mcl_core/nodes_climb.lua @@ -120,7 +120,6 @@ minetest.register_node("mcl_core:vine", { local node = minetest.get_node(under) local def = minetest.registered_nodes[node.name] if not def then return itemstack end - local groups = def.groups -- Check special rightclick action of pointed node if def and def.on_rightclick then diff --git a/mods/ITEMS/mcl_core/nodes_glass.lua b/mods/ITEMS/mcl_core/nodes_glass.lua index 85bf614f4..8c12d8b93 100644 --- a/mods/ITEMS/mcl_core/nodes_glass.lua +++ b/mods/ITEMS/mcl_core/nodes_glass.lua @@ -20,7 +20,7 @@ minetest.register_node("mcl_core:glass", { }) ------------------------ --- Create Color Glass -- +-- Create Color Glass -- ------------------------ local canonical_color = "yellow" function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color) @@ -54,7 +54,7 @@ function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color) _mcl_hardness = 0.3, _mcl_silk_touch_drop = true, }) - + minetest.register_craft({ output = 'mcl_core:glass_'..color..' 8', recipe = { diff --git a/mods/ITEMS/mcl_core/nodes_liquid.lua b/mods/ITEMS/mcl_core/nodes_liquid.lua index c49b685eb..99d33cf59 100644 --- a/mods/ITEMS/mcl_core/nodes_liquid.lua +++ b/mods/ITEMS/mcl_core/nodes_liquid.lua @@ -3,7 +3,10 @@ local S = minetest.get_translator("mcl_core") local N = function(s) return s end -local WATER_ALPHA = 179 +local vector = vector +local math = math + +--local WATER_ALPHA = 179 local WATER_VISC = 1 local LAVA_VISC = 7 local LIGHT_LAVA = minetest.LIGHT_MAX @@ -215,7 +218,7 @@ local emit_lava_particle = function(pos) return end local ppos = vector.add(pos, { x = math.random(-7, 7)/16, y = 0.45, z = math.random(-7, 7)/16}) - local spos = vector.add(ppos, { x = 0, y = -0.2, z = 0 }) + --local spos = vector.add(ppos, { x = 0, y = -0.2, z = 0 }) local vel = { x = math.random(-3, 3)/10, y = math.random(4, 7), z = math.random(-3, 3)/10 } local acc = { x = 0, y = -9.81, z = 0 } -- Lava droplet diff --git a/mods/ITEMS/mcl_core/nodes_misc.lua b/mods/ITEMS/mcl_core/nodes_misc.lua index 8b36f0696..a8188350a 100644 --- a/mods/ITEMS/mcl_core/nodes_misc.lua +++ b/mods/ITEMS/mcl_core/nodes_misc.lua @@ -31,7 +31,7 @@ minetest.register_node("mcl_core:slimeblock", { node_box = { type = "fixed", fixed = { - {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, } }, @@ -39,7 +39,6 @@ minetest.register_node("mcl_core:slimeblock", { type = "regular", }, tiles = {"mcl_core_slime.png"}, - paramtype = "light", use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true, stack_max = 64, -- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks @@ -213,7 +212,7 @@ minetest.register_node("mcl_core:barrier", { -- Same as barrier, but non-pointable. This node is only to be used internally to separate realms. -- It must NOT be used for anything else. -- This node only exists because Minetest does not have support for “dimensions” yet and needs to --- be removed when support for this is implemented. +-- be removed when support for this is implemented. minetest.register_node("mcl_core:realm_barrier", { description = S("Realm Barrier"), _doc_items_create_entry = false, diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 801810dbd..cc64cd9cf 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -81,7 +81,7 @@ local register_stripped_trunk = function(subname, description_stripped_trunk, de _mcl_blast_resistance = 2, _mcl_hardness = 2, }) - + minetest.register_craft({ output = "mcl_core:"..subname.."_bark 3", recipe = { @@ -107,13 +107,12 @@ local register_wooden_planks = function(subname, description, tiles) end local register_leaves = function(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance) - local drop if leafdecay_distance == nil then leafdecay_distance = 4 end local apple_chances = {200, 180, 160, 120, 40} local stick_chances = {50, 45, 30, 35, 10} - + local function get_drops(fortune_level) local drop = { max_items = 1, From b8488ce55ea4cbfc92cd2ff3734f04ff996cf81f Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:12:54 +0200 Subject: [PATCH 21/63] [mcl_core] fix missing warnings --- mods/ITEMS/mcl_core/craftitems.lua | 2 -- mods/ITEMS/mcl_core/functions.lua | 16 +++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_core/craftitems.lua b/mods/ITEMS/mcl_core/craftitems.lua index 2428bb5ea..886535473 100644 --- a/mods/ITEMS/mcl_core/craftitems.lua +++ b/mods/ITEMS/mcl_core/craftitems.lua @@ -28,7 +28,6 @@ minetest.register_craftitem("mcl_core:coal_lump", { description = S("Coal"), _doc_items_longdesc = S("“Coal” refers to coal lumps obtained by digging coal ore which can be found underground. Coal is your standard furnace fuel, but it can also be used to make torches, coal blocks and a few other things."), _doc_items_hidden = false, - groups = { coal=1 }, inventory_image = "default_coal_lump.png", stack_max = 64, groups = { craftitem=1, coal=1 }, @@ -38,7 +37,6 @@ minetest.register_craftitem("mcl_core:charcoal_lump", { description = S("Charcoal"), _doc_items_longdesc = S("Charcoal is an alternative furnace fuel created by cooking wood in a furnace. It has the same burning time as coal and also shares many of its crafting recipes, but it can not be used to create coal blocks."), _doc_items_hidden = false, - groups = { coal=1 }, inventory_image = "mcl_core_charcoal.png", stack_max = 64, groups = { craftitem=1, coal=1 }, diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 732c386b0..a6c21302e 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -24,7 +24,7 @@ minetest.register_abm({ for w=1, #water do local waternode = minetest.get_node(water[w]) - local watertype = minetest.registered_nodes[waternode.name].liquidtype + --local watertype = minetest.registered_nodes[waternode.name].liquidtype -- Lava on top of water: Water turns into stone if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then minetest.set_node(water[w], {name="mcl_core:stone"}) @@ -336,13 +336,12 @@ end -- oak tree. function mcl_core.generate_tree(pos, tree_type, options) pos.y = pos.y-1 - local nodename = minetest.get_node(pos).name + --local nodename = minetest.get_node(pos).name pos.y = pos.y+1 if not minetest.get_node_light(pos) then return end - local node local two_by_two = options and options.two_by_two local balloon = options and options.balloon @@ -390,7 +389,7 @@ end function mcl_core.generate_v6_oak_tree(pos) local trunk = "mcl_core:tree" local leaves = "mcl_core:leaves" - local node = {name = ""} + local node for dy=1,4 do pos.y = pos.y+dy if minetest.get_node(pos).name ~= "air" then @@ -409,10 +408,10 @@ function mcl_core.generate_v6_oak_tree(pos) node = {name = leaves} pos.y = pos.y+3 - local rarity = 0 + --[[local rarity = 0 if math.random(0, 10) == 3 then rarity = 1 - end + end]] for dx=-2,2 do for dz=-2,2 do for dy=0,3 do @@ -787,7 +786,6 @@ minetest.register_abm({ if pos == nil then return end - local can_change = false local above = {x=pos.x, y=pos.y+1, z=pos.z} local abovenode = minetest.get_node(above) if minetest.get_item_group(abovenode.name, "liquid") ~= 0 or minetest.get_item_group(abovenode.name, "opaque") == 1 then @@ -1021,7 +1019,7 @@ local sapling_grow_action = function(tree_id, soil_needed, one_by_one, two_by_tw if one_by_one and check_tree_growth(pos, tree_id) then -- Single sapling minetest.set_node(pos, {name="air"}) - local r = math.random(1, 12) + --local r = math.random(1, 12) mcl_core.generate_tree(pos, tree_id) return end @@ -1418,7 +1416,7 @@ minetest.register_abm({ for s=1, #surround do local spos = vector.add(p0, surround[s]) local maybe_vine = minetest.get_node(spos) - local surround_inverse = vector.multiply(surround[s], -1) + --local surround_inverse = vector.multiply(surround[s], -1) if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then minetest.remove_node(spos) vinedecay_particles(spos, maybe_vine) From 402a1d0088061138c65faa7a02fdeb7d56864a50 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:13:27 +0200 Subject: [PATCH 22/63] [mcl_core] fix last warning --- mods/ITEMS/mcl_core/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index a6c21302e..7f9a83bc9 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -23,7 +23,7 @@ minetest.register_abm({ local lavatype = minetest.registered_nodes[node.name].liquidtype for w=1, #water do - local waternode = minetest.get_node(water[w]) + --local waternode = minetest.get_node(water[w]) --local watertype = minetest.registered_nodes[waternode.name].liquidtype -- Lava on top of water: Water turns into stone if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then From 8ac5d32416124d23cb311d090d01b61e707d6d9c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:17:12 +0200 Subject: [PATCH 23/63] [mcl_compass] fix warnings --- mods/ITEMS/mcl_compass/init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index 2c71eeac0..31944fa88 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -4,7 +4,8 @@ mcl_compass = {} local compass_frames = 32 -local default_spawn_settings = minetest.settings:get("static_spawnpoint") +--Not sure spawn point should be dymanic (is it in mc?) +--local default_spawn_settings = minetest.settings:get("static_spawnpoint") -- Timer for random compass spinning local random_timer = 0 @@ -79,7 +80,9 @@ for i,img in ipairs(images) do if i == stereotype_frame then inv = 0 end - local use_doc, longdesc, usagehelp, tt + local use_doc, longdesc, tt + --Why is there no usage help? This should be fixed. + --local usagehelp use_doc = i == stereotype_frame if use_doc then tt = S("Points to the world origin") @@ -91,7 +94,7 @@ for i,img in ipairs(images) do _tt_help = tt, _doc_items_create_entry = use_doc, _doc_items_longdesc = longdesc, - _doc_items_usagehelp = usagehelp, + --_doc_items_usagehelp = usagehelp, inventory_image = img, wield_image = img, stack_max = 64, From df1eeba6b61905c045c7ba658cf1c31950a39b4d Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:18:42 +0200 Subject: [PATCH 24/63] [mcl_clock] fix warnings --- mods/ITEMS/mcl_clock/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/ITEMS/mcl_clock/init.lua b/mods/ITEMS/mcl_clock/init.lua index 0f6978447..0eb83ee80 100644 --- a/mods/ITEMS/mcl_clock/init.lua +++ b/mods/ITEMS/mcl_clock/init.lua @@ -96,8 +96,6 @@ minetest.register_globalstep(function(dtime) for p, player in pairs(minetest.get_connected_players()) do for s, stack in pairs(player:get_inventory():get_list("main")) do - local dim = mcl_worlds.pos_to_dimension(player:get_pos()) - local frame -- Clocks do not work in certain zones if not mcl_worlds.clock_works(player:get_pos()) then From 60736d04b8717e71459f29c5fd682a870094bb36 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:31:22 +0200 Subject: [PATCH 25/63] [mcl_chests] fix some warnings --- mods/ITEMS/mcl_chests/init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 824530eb3..b92ed4c01 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -162,13 +162,14 @@ Value: Otherwise: nil ]] local open_chests = {} -local function back_is_blocked(pos, dir) +--[[local function back_is_blocked(pos, dir) pos = vector.add(pos, dir) local def = minetest.registered_nodes[minetest.get_node(pos).name] pos.y = pos.y + 1 local def2 = minetest.registered_nodes[minetest.get_node(pos).name] return not def or def.groups.opaque == 1 or not def2 or def2.groups.opaque == 1 -end +end]] + -- To be called if a player opened a chest local player_chest_open = function(player, pos, node_name, textures, param2, double, sound, mesh, shulker) local name = player:get_player_name() @@ -696,7 +697,6 @@ minetest.register_node("mcl_chests:"..basename.."_right", { minetest.swap_node(p, { name = small_name, param2 = param2 }) create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest") - local meta = minetest.get_meta(pos) end, after_dig_node = drop_items_chest, on_blast = on_chest_blast, @@ -898,7 +898,7 @@ register_chest("trapped_chest_on", "trapped_chest" ) -local function close_if_trapped_chest(pos, player) +--[[local function close_if_trapped_chest(pos, player) local node = minetest.get_node(pos) if node.name == "mcl_chests:trapped_chest_on_small" then @@ -928,7 +928,7 @@ local function close_if_trapped_chest(pos, player) player_chest_close(player) end -end +end]] -- Disable chest when it has been closed minetest.register_on_player_receive_fields(function(player, formname, fields) @@ -1330,7 +1330,6 @@ minetest.register_craft({ -- Save metadata of shulker box when used in crafting minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) - local new = itemstack:get_name() if minetest.get_item_group(itemstack:get_name(), "shulker_box") ~= 1 then return end From 621a5a53a8e0ab6ac19c8015f342e589807490aa Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:32:04 +0200 Subject: [PATCH 26/63] [mcl_bucket] fix warnings --- mods/ITEMS/mcl_buckets/register.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index 43156716c..5e46b6ce0 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -10,12 +10,12 @@ local sound_place = function(itemname, pos) end end -local sound_take = function(itemname, pos) +--[[local sound_take = function(itemname, pos) local def = minetest.registered_nodes[itemname] if def and def.sounds and def.sounds.dug then minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end -end +end]] if mod_mcl_core then -- Lava bucket From ac459d3914a946d930ccf7025f2026fc452f2fe4 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:42:31 +0200 Subject: [PATCH 27/63] [mcl_bucket] fix warnings --- mods/ITEMS/mcl_buckets/init.lua | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 7e67eee8e..fd07006b7 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -9,7 +9,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava") local mod_doc = minetest.get_modpath("doc") local mod_mcl_core = minetest.get_modpath("mcl_core") -local mod_mclx_core = minetest.get_modpath("mclx_core") +--local mod_mclx_core = minetest.get_modpath("mclx_core") if mod_mcl_core then minetest.register_craft({ @@ -76,10 +76,11 @@ function mcl_buckets.register_liquid(def) local node = minetest.get_node(pointed_thing.under) local place_pos = pointed_thing.under local nn = node.name + local nodedef = minetest.registered_nodes[nn] -- Call on_rightclick if the pointed node defines it if user and not user:get_player_control().sneak then - if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then - return minetest.registered_nodes[nn].on_rightclick(place_pos, node, user, itemstack) or itemstack + if nodedef and nodedef.on_rightclick then + return nodedef.on_rightclick(place_pos, node, user, itemstack) or itemstack end end @@ -90,11 +91,9 @@ function mcl_buckets.register_liquid(def) node_place = def.source_place end -- Check if pointing to a buildable node - local item = itemstack:get_name() + --local item = itemstack:get_name() - if def.extra_check and def.extra_check(place_pos, user) == false then - -- Fail placement of liquid - elseif minetest.registered_nodes[nn] and minetest.registered_nodes[nn].buildable_to then + if def.extra_check and def.extra_check(place_pos, user) == true and nodedef and nodedef.buildable_to then -- buildable; replace the node local pns = user:get_player_name() if minetest.is_protected(place_pos, pns) then @@ -147,12 +146,12 @@ function mcl_buckets.register_liquid(def) end end, _on_dispense = function(stack, pos, droppos, dropnode, dropdir) - local iname = stack:get_name() + --local iname = stack:get_name() local buildable = minetest.registered_nodes[dropnode.name].buildable_to or dropnode.name == "mcl_portals:portal" - if def.extra_check and def.extra_check(droppos, nil) == false then + --if def.extra_check and def.extra_check(droppos, nil) == false then -- Fail placement of liquid - elseif buildable then + if def.extra_check and def.extra_check(droppos, nil) == true and buildable then -- buildable; replace the node local node_place if type(def.source_place) == "function" then @@ -208,8 +207,8 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { if not minetest.is_creative_enabled(user:get_player_name()) then new_bucket = ItemStack({name = liquiddef.itemname}) if liquiddef.on_take then - liquiddef.on_take(user) - end + liquiddef.on_take(user) + end end minetest.add_node(pointed_thing.under, {name="air"}) From fdfb586b16cce2ad9134206e779f4367bb5e5561 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:58:30 +0200 Subject: [PATCH 28/63] [mcl_brewing] fix warnings --- mods/ITEMS/mcl_brewing/init.lua | 37 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 617929ff7..1724a982d 100644 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -61,14 +61,14 @@ local brewing_formspec = "size[9,8.75]".. "listring[context;stand]" -local function swap_node(pos, name) +--[[local function swap_node(pos, name) local node = minetest.get_node(pos) if node.name == name then return end node.name = name minetest.swap_node(pos, node) -end +end]] local function brewable(inv) @@ -110,12 +110,13 @@ local function brewing_stand_timer(pos, elapsed) local BREW_TIME = 20 -- all brews brew the same local BURN_TIME = BREW_TIME * 10 - local input_item = meta:get_string("input_item") or "" + --local input_item = meta:get_string("input_item") or "" local stand_timer = meta:get_float("stand_timer") or 0 local fuel = meta:get_float("fuel") or 0 local inv = meta:get_inventory() - local input_list, stand_list, fuel_list, brew_output, d + --local input_list, stand_list, fuel_list + local brew_output, d local input_count, fuel_name, fuel_count, formspec, fuel_percent, brew_percent local update = true @@ -124,9 +125,9 @@ local function brewing_stand_timer(pos, elapsed) update = false - input_list = inv:get_list("input") - stand_list = inv:get_list("stand") - fuel_list = inv:get_list("fuel") + --input_list = inv:get_list("input") + --stand_list = inv:get_list("stand") + --fuel_list = inv:get_list("fuel") -- TODO ... fix this. Goal is to reset the process if the stand changes -- for i=1, inv:get_size("stand", i) do -- reset the process due to change @@ -237,7 +238,7 @@ local function brewing_stand_timer(pos, elapsed) end -local function allow_metadata_inventory_put(pos, listname, index, stack, player) +--[[local function allow_metadata_inventory_put(pos, listname, index, stack, player) local name = player:get_player_name() if minetest.is_protected(pos, name) then minetest.record_protection_violation(pos, name) @@ -273,7 +274,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) elseif listname == "stand" then return 0 end -end +end]] -- Drop input items of brewing_stand at pos with metadata meta @@ -315,12 +316,14 @@ local doc_string = S("When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.").."\n".. S("Different combinations of brewing materials and liquids will give different results. Try to experiment!") -local tiles = {"mcl_brewing_top.png", --top - "mcl_brewing_base.png", --bottom - "mcl_brewing_side.png", --right - "mcl_brewing_side.png", --left - "mcl_brewing_side.png", --back - "mcl_brewing_side.png^[transformFX"} --front +local tiles = { + "mcl_brewing_top.png", --top + "mcl_brewing_base.png", --bottom + "mcl_brewing_side.png", --right + "mcl_brewing_side.png", --left + "mcl_brewing_side.png", --back + "mcl_brewing_side.png^[transformFX", --front +} local allow_put = function(pos, listname, index, stack, player) local name = player:get_player_name() @@ -349,11 +352,11 @@ local on_put = function(pos, listname, index, stack, player) --some code here to enforce only potions getting placed on stands end -local after_dig = function(pos, oldnode, oldmetadata, digger) +--[[local after_dig = function(pos, oldnode, oldmetadata, digger) local meta = minetest.get_meta(pos) meta:from_table(oldmetadata) drop_brewing_stand_items(pos, meta) -end +end]] local on_destruct = function(pos) local meta = minetest.get_meta(pos) From b7bf566190cb9a4336ab2cd4b83f54383ce77142 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 01:06:34 +0200 Subject: [PATCH 29/63] [mcl_bows] fix warnings --- mods/ITEMS/mcl_bows/arrow.lua | 27 +++++++++++++++------------ mods/ITEMS/mcl_bows/bow.lua | 9 ++++----- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index c34e93479..a56b2e7cf 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -1,29 +1,32 @@ local S = minetest.get_translator("mcl_bows") +local math = math +local vector = vector + -- Time in seconds after which a stuck arrow is deleted local ARROW_TIMEOUT = 60 -- Time after which stuck arrow is rechecked for being stuck local STUCK_RECHECK_TIME = 5 -local GRAVITY = 9.81 +--local GRAVITY = 9.81 local YAW_OFFSET = -math.pi/2 -local dir_to_pitch = function(dir) - local dir2 = vector.normalize(dir) +local function dir_to_pitch(dir) + --local dir2 = vector.normalize(dir) local xz = math.abs(dir.x) + math.abs(dir.z) return -math.atan2(-dir.y, xz) end -local random_arrow_positions = function(positions, placement) - if positions == 'x' then +local function random_arrow_positions(positions, placement) + if positions == "x" then return math.random(-4, 4) - elseif positions == 'y' then + elseif positions == "y" then return math.random(0, 10) end - if placement == 'front' and positions == 'z' then + if placement == "front" and positions == "z" then return 3 - elseif placement == 'back' and positions == 'z' then + elseif placement == "back" and positions == "z" then return -3 end return 0 @@ -257,12 +260,12 @@ ARROW_ENTITY.on_step = function(self, dtime) damage_groups={fleshy=self._damage}, }, self.object:get_velocity()) if obj:is_player() then - local placement = '' + local placement self._placement = math.random(1, 2) if self._placement == 1 then - placement = 'front' + placement = "front" else - placement = 'back' + placement = "back" end self._in_player = true if self._placement == 2 then @@ -393,7 +396,7 @@ ARROW_ENTITY.on_step = function(self, dtime) if not v then v = 0 end - local old_v = self._viscosity + --local old_v = self._viscosity self._viscosity = v local vpenalty = math.max(0.1, 0.98 - 0.1 * v) if math.abs(vel.x) > 0.001 then diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 2257fcc5e..f752142c2 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -228,11 +228,10 @@ end controls.register_on_release(function(player, key, time) if key~="RMB" then return end - local inv = minetest.get_inventory({type="player", name=player:get_player_name()}) + --local inv = minetest.get_inventory({type="player", name=player:get_player_name()}) local wielditem = player:get_wielded_item() if (wielditem:get_name()=="mcl_bows:bow_0" or wielditem:get_name()=="mcl_bows:bow_1" or wielditem:get_name()=="mcl_bows:bow_2" or wielditem:get_name()=="mcl_bows:bow_0_enchanted" or wielditem:get_name()=="mcl_bows:bow_1_enchanted" or wielditem:get_name()=="mcl_bows:bow_2_enchanted") then - local has_shot = false local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name()) local speed, damage @@ -272,7 +271,7 @@ controls.register_on_release(function(player, key, time) damage = math.max(1, math.floor(9 * charge_ratio)) end - has_shot = player_shoot_arrow(wielditem, player, speed, damage, is_critical) + local has_shot = player_shoot_arrow(wielditem, player, speed, damage, is_critical) if enchanted then wielditem:set_name("mcl_bows:bow_enchanted") @@ -299,7 +298,7 @@ controls.register_on_hold(function(player, key, time) if key ~= "RMB" or not (creative or get_arrow(player)) then return end - local inv = minetest.get_inventory({type="player", name=name}) + --local inv = minetest.get_inventory({type="player", name=name}) local wielditem = player:get_wielded_item() if bow_load[name] == nil and (wielditem:get_name()=="mcl_bows:bow" or wielditem:get_name()=="mcl_bows:bow_enchanted") and wielditem:get_meta():get("active") and (creative or get_arrow(player)) then local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name()) @@ -346,7 +345,7 @@ minetest.register_globalstep(function(dtime) local name = player:get_player_name() local wielditem = player:get_wielded_item() local wieldindex = player:get_wield_index() - local controls = player:get_player_control() + --local controls = player:get_player_control() if type(bow_load[name]) == "number" and ((wielditem:get_name()~="mcl_bows:bow_0" and wielditem:get_name()~="mcl_bows:bow_1" and wielditem:get_name()~="mcl_bows:bow_2" and wielditem:get_name()~="mcl_bows:bow_0_enchanted" and wielditem:get_name()~="mcl_bows:bow_1_enchanted" and wielditem:get_name()~="mcl_bows:bow_2_enchanted") or wieldindex ~= bow_index[name]) then reset_bow_state(player, true) end From 892f4b96c94879929dd0261c5901098b671bb03d Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 01:07:10 +0200 Subject: [PATCH 30/63] [mcl_books] fix warnings --- mods/ITEMS/mcl_books/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_books/init.lua b/mods/ITEMS/mcl_books/init.lua index 95b45e69e..86f896707 100644 --- a/mods/ITEMS/mcl_books/init.lua +++ b/mods/ITEMS/mcl_books/init.lua @@ -238,7 +238,6 @@ minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craf end local original - local index for i = 1, player:get_inventory():get_size("craft") do if old_craft_grid[i]:get_name() == "mcl_books:written_book" then original = old_craft_grid[i] From 203c7e2c846666ce585ac7895c975894b3576b41 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 01:09:45 +0200 Subject: [PATCH 31/63] [mcl_beds] fix warnings --- mods/ITEMS/mcl_beds/api.lua | 6 ++++-- mods/ITEMS/mcl_beds/functions.lua | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index c0b25b1c5..ee59bc34b 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -48,7 +48,9 @@ local function rotate(pos, node, user, mode, new_param2) return false end - local new_dir, newp = minetest_facedir_to_dir(new_param2) + local newp + local new_dir = minetest_facedir_to_dir(new_param2) + if bottom then newp = vector_add(pos, new_dir) else @@ -153,7 +155,7 @@ function mcl_beds.register_bed(name, def) paramtype2 = "facedir", is_ground_content = false, stack_max = 1, - groups = {handy=1, flammable = 3, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1}, + groups = {handy=1, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1}, _mcl_hardness = 0.2, _mcl_blast_resistance = 1, sounds = def.sounds or default_sounds, diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index ecd749603..f1bd096f4 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -319,14 +319,14 @@ function mcl_beds.on_rightclick(pos, player, is_top) -- move to bed if not mcl_beds.player[name] then - local success, message + local message if is_top then - success, message = lay_down(player, ppos, pos) + _, message = lay_down(player, ppos, pos) else local node = minetest.get_node(pos) local dir = minetest.facedir_to_dir(node.param2) local other = vector.add(pos, dir) - success, message = lay_down(player, ppos, other) + _, message = lay_down(player, ppos, other) end if message then mcl_tmp_message.message(player, message) From be5eb621fda50bbbdb93139f466d550cbbb39189 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 10:52:52 +0200 Subject: [PATCH 32/63] [mcl_books] fix warnings --- mods/ITEMS/mcl_books/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_books/init.lua b/mods/ITEMS/mcl_books/init.lua index 86f896707..b7bd20d9a 100644 --- a/mods/ITEMS/mcl_books/init.lua +++ b/mods/ITEMS/mcl_books/init.lua @@ -241,7 +241,6 @@ minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craf for i = 1, player:get_inventory():get_size("craft") do if old_craft_grid[i]:get_name() == "mcl_books:written_book" then original = old_craft_grid[i] - index = i end end if not original then From 8f6a97eefe32583fe8301174f2072f03df5790ab Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 10:57:07 +0200 Subject: [PATCH 33/63] [mcl_beds] fix warnings --- mods/ITEMS/mcl_beds/functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index f1bd096f4..fd156757b 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -321,12 +321,12 @@ function mcl_beds.on_rightclick(pos, player, is_top) if not mcl_beds.player[name] then local message if is_top then - _, message = lay_down(player, ppos, pos) + message = select(2, lay_down(player, ppos, pos)) else local node = minetest.get_node(pos) local dir = minetest.facedir_to_dir(node.param2) local other = vector.add(pos, dir) - _, message = lay_down(player, ppos, other) + message = select(2, lay_down(player, ppos, other)) end if message then mcl_tmp_message.message(player, message) From 4bc473bc29ccc262449e2cb27e260a35322dd3b6 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 10:59:07 +0200 Subject: [PATCH 34/63] [mcl_banners] fix some warnings --- mods/ITEMS/mcl_banners/patterncraft.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index fbd0c9e33..516624301 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -426,7 +426,6 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i if (pitem == d and minetest.get_item_group(itemname, "dye") == 0) or (pitem == e and itemname ~= e and inv_i ~= banner_index) then pattern_ok = false break - else end inv_i = inv_i + 1 if inv_i > max_i then From a9c49853aa023e8d2dbd1b56f962218ca18cbc29 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:01:29 +0200 Subject: [PATCH 35/63] [mesecons_pressureplates] fix warnings --- mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua index 2e161ae4d..34730760d 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua @@ -116,7 +116,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te wield_image = image_w, paramtype = "light", walkable = false, - description = description, + description = description, on_timer = pp_on_timer, on_construct = function(pos) minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL) From e75a2e3a671ed314adc60f8e0d1e82a146ef70b4 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:02:13 +0200 Subject: [PATCH 36/63] [mesecons_pistons] fix warnings --- mods/ITEMS/REDSTONE/mesecons_pistons/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index 3230d9804..f37ffb761 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -124,7 +124,7 @@ local piston_off = function (pos, node) local dir = piston_get_direction(pistonspec.dir, node) local pullpos = vector.add(pos, vector.multiply(dir, 2)) local meta = minetest.get_meta(pos) - local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos) + local success, stack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos) if success then mesecon.mvps_process_stack(pos, dir, stack) end From c580c1ccad64a2886970a659d47f29d6c974842c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:17:19 +0200 Subject: [PATCH 37/63] [mesecons_pistons] unify code style --- mods/ITEMS/REDSTONE/mesecons_pistons/init.lua | 271 ++++++++++-------- 1 file changed, 151 insertions(+), 120 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index f37ffb761..0073aeb48 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -2,29 +2,36 @@ local S = minetest.get_translator("mesecons_pistons") local PISTON_MAXIMUM_PUSH = 12 --- Get mesecon rules of pistons -local piston_rules = -{{x=0, y=0, z=1}, --everything apart from z- (pusher side) - {x=1, y=0, z=0}, - {x=-1, y=0, z=0}, - {x=0, y=1, z=0}, - {x=0, y=-1, z=0}} +--Get mesecon rules of pistons -local piston_up_rules = -{{x=0, y=0, z=-1}, --everything apart from y+ (pusher side) - {x=0, y=0, z=1}, - {x=-1, y=0, z=0}, - {x=1, y=0, z=0}, - {x=0, y=-1, z=0}} +--everything apart from z- (pusher side) +local piston_rules = { + {x=0, y=0, z=1}, + {x=1, y=0, z=0}, + {x=-1, y=0, z=0}, + {x=0, y=1, z=0}, + {x=0, y=-1, z=0}, +} -local piston_down_rules = -{{x=0, y=0, z=-1}, --everything apart from y- (pusher side) - {x=0, y=0, z=1}, - {x=-1, y=0, z=0}, - {x=1, y=0, z=0}, - {x=0, y=1, z=0}} +--everything apart from y+ (pusher side) +local piston_up_rules = { + {x=0, y=0, z=-1}, + {x=0, y=0, z=1}, + {x=-1, y=0, z=0}, + {x=1, y=0, z=0}, + {x=0, y=-1, z=0}, +} -local piston_get_rules = function (node) +--everything apart from y- (pusher side) +local piston_down_rules = { + {x=0, y=0, z=-1}, + {x=0, y=0, z=1}, + {x=-1, y=0, z=0}, + {x=1, y=0, z=0}, + {x=0, y=1, z=0}, +} + +local function piston_get_rules(node) local rules = piston_rules for i = 1, node.param2 do rules = mesecon.rotate_rules_left(rules) @@ -32,7 +39,7 @@ local piston_get_rules = function (node) return rules end -local piston_facedir_direction = function (node) +local function piston_facedir_direction(node) local rules = {{x = 0, y = 0, z = -1}} for i = 1, node.param2 do rules = mesecon.rotate_rules_left(rules) @@ -40,7 +47,7 @@ local piston_facedir_direction = function (node) return rules[1] end -local piston_get_direction = function (dir, node) +local function piston_get_direction(dir, node) if type(dir) == "function" then return dir(node) else @@ -50,7 +57,7 @@ end -- Remove pusher of piston. -- To be used when piston was destroyed or dug. -local piston_remove_pusher = function (pos, oldnode) +local function piston_remove_pusher(pos, oldnode) local pistonspec = minetest.registered_nodes[oldnode.name].mesecons_piston local dir = piston_get_direction(pistonspec.dir, oldnode) @@ -70,7 +77,7 @@ end -- Remove base node of piston. -- To be used when pusher was destroyed. -local piston_remove_base = function (pos, oldnode) +local function piston_remove_base(pos, oldnode) local basenodename = minetest.registered_nodes[oldnode.name].corresponding_piston local pistonspec = minetest.registered_nodes[basenodename].mesecons_piston @@ -89,7 +96,7 @@ local piston_remove_base = function (pos, oldnode) end end -local piston_on = function (pos, node) +local function piston_on(pos, node) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston local dir = piston_get_direction(pistonspec.dir, node) @@ -113,7 +120,7 @@ local piston_on = function (pos, node) end end -local piston_off = function (pos, node) +local function piston_off(pos, node) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname}) piston_remove_pusher (pos, node) @@ -130,7 +137,7 @@ local piston_off = function (pos, node) end end -local piston_orientate = function (pos, placer) +local function piston_orientate(pos, placer) mesecon.mvps_set_owner(pos, placer) -- not placed by player @@ -158,14 +165,14 @@ local piston_pusher_box = { fixed = { {-2/16, -2/16, -.5 + pt, 2/16, 2/16, .5 + pt}, {-.5 , -.5 , -.5 , .5 , .5 , -.5 + pt}, - } + }, } local piston_on_box = { type = "fixed", fixed = { {-.5, -.5, -.5 + pt, .5, .5, .5} - } + }, } @@ -195,18 +202,20 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { "mesecons_piston_bottom.png^[transformR270", "mesecons_piston_back.png", "mesecons_piston_pusher_front.png" - }, - groups = {handy = 1, piston=1}, + }, + groups = {handy=1, piston=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, after_place_node = piston_orientate, mesecons_piston = pistonspec_normal, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_on = piston_on, - rules = piston_get_rules - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_get_rules + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) @@ -227,8 +236,8 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { "mesecons_piston_bottom.png^[transformR270", "mesecons_piston_back.png", "mesecons_piston_on_front.png" - }, - groups = {handy=1, piston=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -238,10 +247,12 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { selection_box = piston_on_box, mesecons_piston = pistonspec_normal, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_get_rules - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_get_rules + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -257,10 +268,10 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", { "mesecons_piston_pusher_right.png", "mesecons_piston_pusher_back.png", "mesecons_piston_pusher_front.png" - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 1 }, + groups = {piston_pusher=1}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -299,7 +310,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { "mesecons_piston_bottom.png^[transformR270", "mesecons_piston_back.png", "mesecons_piston_pusher_front_sticky.png" - }, + }, groups = {handy=1, piston=2}, paramtype = "light", paramtype2 = "facedir", @@ -307,10 +318,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { after_place_node = piston_orientate, mesecons_piston = pistonspec_sticky, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_on = piston_on, - rules = piston_get_rules - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_get_rules + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) @@ -331,8 +344,8 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { "mesecons_piston_bottom.png^[transformR270", "mesecons_piston_back.png", "mesecons_piston_on_front.png" - }, - groups = {handy=1, piston=2, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=2, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -342,10 +355,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { selection_box = piston_on_box, mesecons_piston = pistonspec_sticky, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_get_rules - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_get_rules + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -361,10 +376,10 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", { "mesecons_piston_pusher_right.png", "mesecons_piston_pusher_back.png", "mesecons_piston_pusher_front_sticky.png" - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 2 }, + groups = {piston_pusher=2}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -388,14 +403,14 @@ local piston_up_pusher_box = { fixed = { {-2/16, -.5 - pt, -2/16, 2/16, .5 - pt, 2/16}, {-.5 , .5 - pt, -.5 , .5 , .5 , .5}, - } + }, } local piston_up_on_box = { type = "fixed", fixed = { {-.5, -.5, -.5 , .5, .5-pt, .5} - } + }, } -- Normal @@ -404,7 +419,7 @@ local pistonspec_normal_up = { offname = "mesecons_pistons:piston_up_normal_off", onname = "mesecons_pistons:piston_up_normal_on", dir = {x = 0, y = 1, z = 0}, - pusher = "mesecons_pistons:piston_up_pusher_normal" + pusher = "mesecons_pistons:piston_up_pusher_normal", } -- offstate @@ -416,17 +431,19 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", { "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", - }, - groups = {handy=1, piston=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, drop = "mesecons_pistons:piston_normal_off", mesecons_piston = pistonspec_normal_up, - mesecons = {effector={ - action_on = piston_on, - rules = piston_up_rules, - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_up_rules, + }, + }, sounds = mcl_sounds.node_sound_stone_defaults({ footstep = mcl_sounds.node_sound_wood_defaults().footstep }), @@ -451,8 +468,8 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", { "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", - }, - groups = {handy=1, piston_=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston_=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -462,10 +479,12 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", { selection_box = piston_up_on_box, mesecons_piston = pistonspec_normal_up, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_up_rules, - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_up_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -481,10 +500,10 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_normal", { "mesecons_piston_pusher_right.png^[transformR90", "mesecons_piston_pusher_bottom.png", "mesecons_piston_pusher_top.png^[transformR180", - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 1 }, + groups = {piston_pusher=1}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -507,7 +526,7 @@ local pistonspec_sticky_up = { onname = "mesecons_pistons:piston_up_sticky_on", dir = {x = 0, y = 1, z = 0}, pusher = "mesecons_pistons:piston_up_pusher_sticky", - sticky = true + sticky = true, } -- offstate @@ -519,8 +538,8 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", { "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", - }, - groups = {handy=1, piston=2, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=2, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -529,10 +548,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", { sounds = mcl_sounds.node_sound_stone_defaults({ footstep = mcl_sounds.node_sound_wood_defaults().footstep }), - mesecons = {effector={ - action_on = piston_on, - rules = piston_up_rules, - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_up_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) @@ -554,8 +575,8 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", { "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", "mesecons_piston_bottom.png", - }, - groups = {handy=1, piston=2, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=2, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -565,10 +586,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", { selection_box = piston_up_on_box, mesecons_piston = pistonspec_sticky_up, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_up_rules, - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_up_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -584,10 +607,10 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_sticky", { "mesecons_piston_pusher_right.png^[transformR90", "mesecons_piston_pusher_bottom.png", "mesecons_piston_pusher_top.png^[transformR180", - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 2 }, + groups = {piston_pusher=2}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -611,14 +634,14 @@ local piston_down_pusher_box = { fixed = { {-2/16, -.5 + pt, -2/16, 2/16, .5 + pt, 2/16}, {-.5 , -.5 , -.5 , .5 , -.5 + pt, .5}, - } + }, } local piston_down_on_box = { type = "fixed", fixed = { {-.5, -.5+pt, -.5 , .5, .5, .5} - } + }, } @@ -641,18 +664,20 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", { "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", - }, - groups = {handy=1, piston=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, drop = "mesecons_pistons:piston_normal_off", mesecons_piston = pistonspec_normal_down, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_on = piston_on, - rules = piston_down_rules, - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_down_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) @@ -674,8 +699,8 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", { "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", - }, - groups = {handy=1, piston=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -685,10 +710,12 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", { selection_box = piston_down_on_box, mesecons_piston = pistonspec_normal_down, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_down_rules, - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_down_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -704,10 +731,10 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_normal", { "mesecons_piston_pusher_right.png^[transformR270", "mesecons_piston_pusher_bottom.png^[transformR180", "mesecons_piston_pusher_top.png", - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 1 }, + groups = {piston_pusher=1}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -727,7 +754,7 @@ local pistonspec_sticky_down = { offname = "mesecons_pistons:piston_down_sticky_off", dir = {x = 0, y = -1, z = 0}, pusher = "mesecons_pistons:piston_down_pusher_sticky", - sticky = true + sticky = true, } -- offstate @@ -739,7 +766,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", { "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", - }, + }, groups = {handy=1, piston=2, not_in_creative_inventory = 1}, paramtype = "light", paramtype2 = "facedir", @@ -747,10 +774,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", { drop = "mesecons_pistons:piston_sticky_off", mesecons_piston = pistonspec_sticky_down, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_on = piston_on, - rules = piston_down_rules, - }}, + mesecons = { + effector = { + action_on = piston_on, + rules = piston_down_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) @@ -772,8 +801,8 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", { "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180", - }, - groups = {handy=1, piston=1, not_in_creative_inventory = 1}, + }, + groups = {handy=1, piston=1, not_in_creative_inventory=1}, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -783,10 +812,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", { selection_box = piston_down_on_box, mesecons_piston = pistonspec_sticky_down, sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = {effector={ - action_off = piston_off, - rules = piston_down_rules, - }}, + mesecons = { + effector = { + action_off = piston_off, + rules = piston_down_rules, + }, + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, @@ -802,10 +833,10 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_sticky", { "mesecons_piston_pusher_right.png^[transformR270", "mesecons_piston_pusher_bottom.png^[transformR180", "mesecons_piston_pusher_top.png", - }, + }, paramtype = "light", paramtype2 = "facedir", - groups = { piston_pusher = 2 }, + groups = {piston_pusher=2}, is_ground_content = false, after_destruct = piston_remove_base, diggable = false, @@ -839,7 +870,7 @@ minetest.register_craft({ {"group:wood", "group:wood", "group:wood"}, {"mcl_core:cobble", "mcl_core:iron_ingot", "mcl_core:cobble"}, {"mcl_core:cobble", "mesecons:redstone", "mcl_core:cobble"}, - } + }, }) minetest.register_craft({ @@ -847,7 +878,7 @@ minetest.register_craft({ recipe = { {"mcl_mobitems:slimeball"}, {"mesecons_pistons:piston_normal_off"}, - } + }, }) -- Add entry aliases for the Help From 21fdf492e26a2ad35261c89f4c07478d279eb3d2 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:20:21 +0200 Subject: [PATCH 38/63] [mcl_anvils] fix warnings --- mods/ITEMS/mcl_anvils/init.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_anvils/init.lua b/mods/ITEMS/mcl_anvils/init.lua index c3c238e7f..09f4d954c 100644 --- a/mods/ITEMS/mcl_anvils/init.lua +++ b/mods/ITEMS/mcl_anvils/init.lua @@ -41,7 +41,7 @@ end -- needs to be used up to repair the tool. local function get_consumed_materials(tool, material) local wear = tool:get_wear() - local health = (MAX_WEAR - wear) + --local health = (MAX_WEAR - wear) local matsize = material:get_count() local materials_used = 0 for m=1, math.min(4, matsize) do @@ -74,10 +74,9 @@ end local function update_anvil_slots(meta) local inv = meta:get_inventory() local new_name = meta:get_string("set_name") - local input1, input2, output - input1 = inv:get_stack("input", 1) - input2 = inv:get_stack("input", 2) - output = inv:get_stack("output", 1) + local input1 = inv:get_stack("input", 1) + local input2 = inv:get_stack("input", 2) + --local output = inv:get_stack("output", 1) local new_output, name_item local just_rename = false @@ -243,7 +242,6 @@ end -- Returns true if anvil was destroyed. local function damage_anvil(pos) local node = minetest.get_node(pos) - local new if node.name == "mcl_anvils:anvil" then minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2}) damage_particles(pos, node) @@ -278,7 +276,6 @@ local function damage_anvil_by_using(pos) end local function damage_anvil_by_falling(pos, distance) - local chance local r = math.random(1, 100) if distance > 1 then if r <= (5*distance) then From 43f418c6c0ac2d3b2298ff496d005733652d7d5d Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:22:45 +0200 Subject: [PATCH 39/63] [mesecons_wire] fix warnings --- mods/ITEMS/REDSTONE/mesecons_wires/init.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua index e0c5ac531..3d00e5f20 100644 --- a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua @@ -33,7 +33,7 @@ local wire_getconnect = function (from_pos, self_pos) if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].mesecons then -- rules of node to possibly connect to - local rules = {} + local rules if (minetest.registered_nodes[node.name].mesecon_wire) then rules = wire_rules else @@ -214,8 +214,7 @@ local function register_wires() local dot_off = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_off local dot_on = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_on - local tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off } - local tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on } + local tiles_off, tiles_on local wirehelp, tt, longdesc, usagehelp, img, desc_off, desc_on if nodeid == "00000000" then @@ -238,8 +237,8 @@ S("Read the help entries on the other redstone components to learn how redstone else -- Connected redstone wire table.insert(nodebox, box_center) - tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off, } - tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on, } + tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off } + tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on } wirehelp = false desc_off = S("Redstone Trail (@1)", nodeid) desc_on = S("Powered Redstone Trail (@1)", nodeid) From dc10448c6e35235e339725bf956d57595a907039 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:25:22 +0200 Subject: [PATCH 40/63] [mesecons_mvps] fix warnings --- mods/ITEMS/REDSTONE/mesecons_mvps/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua index 8cd5ae872..fedb8fa5d 100644 --- a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua @@ -1,3 +1,5 @@ +local table = table + --register stoppers for movestones/pistons mesecon.mvps_stoppers = {} @@ -6,8 +8,6 @@ mesecon.mvps_droppers = {} mesecon.on_mvps_move = {} mesecon.mvps_unmov = {} -local is_protected = minetest.is_protected - --- Objects (entities) that cannot be moved function mesecon.register_mvps_unmov(objectname) mesecon.mvps_unmov[objectname] = true; @@ -151,6 +151,7 @@ function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos) -- add connected nodes to frontiers, connected is a vector list -- the vectors must be absolute positions local connected = {} + local has_loop if minetest.registered_nodes[nn.name] and minetest.registered_nodes[nn.name].mvps_sticky then connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos) @@ -258,7 +259,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name, n.meta = minetest.get_meta(n.pos):to_table() local is_dropper = mesecon.is_mvps_dropper(n.node, movedir, nodes, id) if is_dropper then - local drops = minetest.get_node_drops(n.node.name, "") + --local drops = minetest.get_node_drops(n.node.name, "") minetest.dig_node(n.pos) else minetest.remove_node(n.pos) From e6f72e0c60967a152d0485f46fe161b526487af0 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:29:32 +0200 Subject: [PATCH 41/63] [mesecons_delayer] fix warnings --- mods/ITEMS/REDSTONE/mesecons_delayer/init.lua | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua b/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua index caf5e9652..7fba42179 100644 --- a/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua @@ -145,8 +145,8 @@ end -- Register the 2 (states) x 4 (delay times) delayers for i = 1, 4 do -local groups = {} -if i == 1 then +local groups +if i == 1 then groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i} else groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i,not_in_creative_inventory=1} @@ -156,29 +156,29 @@ local delaytime = DELAYS[i] local boxes if i == 1 then -boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch -} + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch + } elseif i == 2 then -boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch -} + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch + } elseif i == 3 then -boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch -} + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch + } elseif i == 4 then -boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch -} + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch + } end local help, tt, longdesc, usagehelp, icon, on_construct @@ -248,7 +248,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { "mesecons_delayer_ends_off.png", }, use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - wield_image = "mesecons_delayer_off.png", + --wield_image = "mesecons_delayer_off.png", walkable = true, selection_box = { type = "fixed", From 4fd0ea8a880980349acb9e09ebe625a3842ade0c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:36:30 +0200 Subject: [PATCH 42/63] [mesecons_delayer] fix code style issues --- mods/ITEMS/REDSTONE/mesecons_delayer/init.lua | 444 +++++++++--------- 1 file changed, 218 insertions(+), 226 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua b/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua index 7fba42179..0a330ef2c 100644 --- a/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_delayer/init.lua @@ -4,7 +4,7 @@ local DELAYS = { 0.1, 0.2, 0.3, 0.4 } local DEFAULT_DELAY = DELAYS[1] -- Function that get the input/output rules of the delayer -local delayer_get_output_rules = function(node) +local function delayer_get_output_rules(node) local rules = {{x = -1, y = 0, z = 0, spread=true}} for i = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) @@ -12,7 +12,7 @@ local delayer_get_output_rules = function(node) return rules end -local delayer_get_input_rules = function(node) +local function delayer_get_input_rules(node) local rules = {{x = 1, y = 0, z = 0}} for i = 0, node.param2 do rules = mesecon.rotate_rules_left(rules) @@ -22,7 +22,7 @@ end -- Return the sides of a delayer. -- Those are used to toggle the lock state. -local delayer_get_sides = function(node) +local function delayer_get_sides(node) local rules = { {x = 0, y = 0, z = -1}, {x = 0, y = 0, z = 1}, @@ -35,7 +35,7 @@ end -- Make the repeater at pos try to lock any repeater it faces. -- Returns true if a repeater was locked. -local check_lock_repeater = function(pos, node) +local function check_lock_repeater(pos, node) -- Check the repeater at pos and look if it faces -- a repeater placed sideways. -- If yes, lock the second repeater. @@ -67,7 +67,7 @@ end -- Make the repeater at pos try to unlock any repeater it faces. -- Returns true if a repeater was unlocked. -local check_unlock_repeater = function(pos, node) +local function check_unlock_repeater(pos, node) -- Check the repeater at pos and look if it faces -- a repeater placed sideways. -- If yes, also check if the second repeater doesn't receive @@ -119,21 +119,19 @@ local check_unlock_repeater = function(pos, node) end -- Functions that are called after the delay time -local delayer_activate = function(pos, node) +local function delayer_activate(pos, node) local def = minetest.registered_nodes[node.name] local time = def.delayer_time minetest.set_node(pos, {name=def.delayer_onstate, param2=node.param2}) mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(node)}, time, nil) - check_lock_repeater(pos, node) end -local delayer_deactivate = function(pos, node) +local function delayer_deactivate(pos, node) local def = minetest.registered_nodes[node.name] local time = def.delayer_time minetest.set_node(pos, {name=def.delayer_offstate, param2=node.param2}) mesecon.queue:add_action(pos, "receptor_off", {delayer_get_output_rules(node)}, time, nil) - check_unlock_repeater(pos, node) end @@ -145,236 +143,230 @@ end -- Register the 2 (states) x 4 (delay times) delayers for i = 1, 4 do -local groups -if i == 1 then - groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i} -else - groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i,not_in_creative_inventory=1} -end + local groups + if i == 1 then + groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i} + else + groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i,not_in_creative_inventory=1} + end -local delaytime = DELAYS[i] + local delaytime = DELAYS[i] -local boxes -if i == 1 then - boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch - } -elseif i == 2 then - boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch - } -elseif i == 3 then - boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch - } -elseif i == 4 then - boxes = { - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab - { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch - { -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch - } -end + local boxes + if i == 1 then + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch + } + elseif i == 2 then + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch + } + elseif i == 3 then + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch + } + elseif i == 4 then + boxes = { + { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab + { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch + { -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch + } + end -local help, tt, longdesc, usagehelp, icon, on_construct -if i == 1 then - help = true - tt = S("Transmits redstone power only in one direction").."\n".. - S("Delays signal").."\n".. - S("Output locks when getting active redstone repeater signal from the side") - longdesc = S("Redstone repeaters are versatile redstone components with multiple purposes: 1. They only allow signals to travel in one direction. 2. They delay the signal. 3. Optionally, they can lock their output in one state.") - usagehelp = S("To power a redstone repeater, send a signal in “arrow” direction (the input). The signal goes out on the opposite side (the output) with a delay. To change the delay, use the redstone repeater. The delay is between 0.1 and 0.4 seconds long and can be changed in steps of 0.1 seconds. It is indicated by the position of the moving redstone torch.").."\n".. - S("To lock a repeater, send a signal from an adjacent repeater into one of its sides. While locked, the moving redstone torch disappears, the output doesn't change and the input signal is ignored.") - icon = "mesecons_delayer_item.png" - - -- Check sides of constructed repeater and lock it, if required - on_construct = function(pos) - local node = minetest.get_node(pos) - local sides = delayer_get_sides(node) - for s=1, #sides do - local spos = vector.add(pos, sides[s]) - local snode = minetest.get_node(spos) - -- Is there a powered repeater at one of our sides? - local g = minetest.get_item_group(snode.name, "redstone_repeater") - if g ~= 0 and mesecon.is_receptor_on(snode.name) then - -- The other repeater must also face towards the constructed node - local sface = delayer_get_output_rules(snode)[1] - local sface_pos = vector.add(spos, sface) - if vector.equals(sface_pos, pos) then - -- Repeater is facing towards us! Now we just need to lock the costructed node - if mesecon.is_powered(pos, delayer_get_input_rules(node)[1]) ~= false then - local newnode = {name="mesecons_delayer:delayer_on_locked", param2 = node.param2} - minetest.set_node(pos, newnode) - mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(newnode)}, DEFAULT_DELAY, nil) - else - minetest.set_node(pos, {name="mesecons_delayer:delayer_off_locked", param2 = node.param2}) + local help, tt, longdesc, usagehelp, icon, on_construct + if i == 1 then + help = true + tt = S("Transmits redstone power only in one direction").."\n".. + S("Delays signal").."\n".. + S("Output locks when getting active redstone repeater signal from the side") + longdesc = S("Redstone repeaters are versatile redstone components with multiple purposes: 1. They only allow signals to travel in one direction. 2. They delay the signal. 3. Optionally, they can lock their output in one state.") + usagehelp = S("To power a redstone repeater, send a signal in “arrow” direction (the input). The signal goes out on the opposite side (the output) with a delay. To change the delay, use the redstone repeater. The delay is between 0.1 and 0.4 seconds long and can be changed in steps of 0.1 seconds. It is indicated by the position of the moving redstone torch.").."\n".. + S("To lock a repeater, send a signal from an adjacent repeater into one of its sides. While locked, the moving redstone torch disappears, the output doesn't change and the input signal is ignored.") + icon = "mesecons_delayer_item.png" + -- Check sides of constructed repeater and lock it, if required + on_construct = function(pos) + local node = minetest.get_node(pos) + local sides = delayer_get_sides(node) + for s=1, #sides do + local spos = vector.add(pos, sides[s]) + local snode = minetest.get_node(spos) + -- Is there a powered repeater at one of our sides? + local g = minetest.get_item_group(snode.name, "redstone_repeater") + if g ~= 0 and mesecon.is_receptor_on(snode.name) then + -- The other repeater must also face towards the constructed node + local sface = delayer_get_output_rules(snode)[1] + local sface_pos = vector.add(spos, sface) + if vector.equals(sface_pos, pos) then + -- Repeater is facing towards us! Now we just need to lock the costructed node + if mesecon.is_powered(pos, delayer_get_input_rules(node)[1]) ~= false then + local newnode = {name="mesecons_delayer:delayer_on_locked", param2 = node.param2} + minetest.set_node(pos, newnode) + mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(newnode)}, DEFAULT_DELAY, nil) + else + minetest.set_node(pos, {name="mesecons_delayer:delayer_off_locked", param2 = node.param2}) + end + break end - break end end end + else + help = false end -else - help = false -end -local desc_off -if i == 1 then - desc_off = S("Redstone Repeater") -else - desc_off = S("Redstone Repeater (Delay @1)", i) -end + local desc_off + if i == 1 then + desc_off = S("Redstone Repeater") + else + desc_off = S("Redstone Repeater (Delay @1)", i) + end -minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { - description = desc_off, - inventory_image = icon, - wield_image = icon, - _tt_help = tt, - _doc_items_create_entry = help, - _doc_items_longdesc = longdesc, - _doc_items_usagehelp = usagehelp, - drawtype = "nodebox", - tiles = { - "mesecons_delayer_off.png", - "mcl_stairs_stone_slab_top.png", - "mesecons_delayer_sides_off.png", - "mesecons_delayer_sides_off.png", - "mesecons_delayer_ends_off.png", - "mesecons_delayer_ends_off.png", - }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - --wield_image = "mesecons_delayer_off.png", - walkable = true, - selection_box = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, - }, - collision_box = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, - }, - node_box = { - type = "fixed", - fixed = boxes - }, - groups = groups, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = false, - is_ground_content = false, - drop = 'mesecons_delayer:delayer_off_1', - on_rightclick = function (pos, node, clicker) - local protname = clicker:get_player_name() - if minetest.is_protected(pos, protname) then - minetest.record_protection_violation(pos, protname) - return - end - if node.name=="mesecons_delayer:delayer_off_1" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_off_2", param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_off_2" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_off_3", param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_off_3" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_off_4", param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_off_4" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_off_1", param2=node.param2}) - end - end, - on_construct = on_construct, - delayer_time = delaytime, - delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i), - delayer_lockstate = "mesecons_delayer:delayer_off_locked", - sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = { - receptor = - { - state = mesecon.state.off, - rules = delayer_get_output_rules + minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { + description = desc_off, + inventory_image = icon, + wield_image = icon, + _tt_help = tt, + _doc_items_create_entry = help, + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, + drawtype = "nodebox", + tiles = { + "mesecons_delayer_off.png", + "mcl_stairs_stone_slab_top.png", + "mesecons_delayer_sides_off.png", + "mesecons_delayer_sides_off.png", + "mesecons_delayer_ends_off.png", + "mesecons_delayer_ends_off.png", }, - effector = - { - rules = delayer_get_input_rules, - action_on = delayer_activate - } - }, - on_rotate = on_rotate, -}) - - -minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), { - description = S("Redstone Repeater (Delay @1, Powered)", i), - _doc_items_create_entry = false, - drawtype = "nodebox", - tiles = { - "mesecons_delayer_on.png", - "mcl_stairs_stone_slab_top.png", - "mesecons_delayer_sides_on.png", - "mesecons_delayer_sides_on.png", - "mesecons_delayer_ends_on.png", - "mesecons_delayer_ends_on.png", - }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - walkable = true, - selection_box = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, - }, - collision_box = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, - }, - node_box = { - type = "fixed", - fixed = boxes - }, - groups = {dig_immediate = 3, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, attached_node=1, redstone_repeater=i, not_in_creative_inventory = 1}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = false, - is_ground_content = false, - drop = 'mesecons_delayer:delayer_off_1', - on_rightclick = function (pos, node, clicker) - local protname = clicker:get_player_name() - if minetest.is_protected(pos, protname) then - minetest.record_protection_violation(pos, protname) - return - end - if node.name=="mesecons_delayer:delayer_on_1" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_on_2",param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_on_2" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_on_3",param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_on_3" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_on_4",param2=node.param2}) - elseif node.name=="mesecons_delayer:delayer_on_4" then - minetest.set_node(pos, {name="mesecons_delayer:delayer_on_1",param2=node.param2}) - end - end, - after_dig_node = function(pos, oldnode) - check_unlock_repeater(pos, oldnode) - end, - delayer_time = delaytime, - delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i), - delayer_lockstate = "mesecons_delayer:delayer_on_locked", - sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = { - receptor = - { - state = mesecon.state.on, - rules = delayer_get_output_rules + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + --wield_image = "mesecons_delayer_off.png", + walkable = true, + selection_box = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, }, - effector = - { - rules = delayer_get_input_rules, - action_off = delayer_deactivate - } - }, - on_rotate = on_rotate, -}) + collision_box = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, + }, + node_box = { + type = "fixed", + fixed = boxes + }, + groups = groups, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = false, + is_ground_content = false, + drop = 'mesecons_delayer:delayer_off_1', + on_rightclick = function (pos, node, clicker) + local protname = clicker:get_player_name() + if minetest.is_protected(pos, protname) then + minetest.record_protection_violation(pos, protname) + return + end + if node.name=="mesecons_delayer:delayer_off_1" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_off_2", param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_off_2" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_off_3", param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_off_3" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_off_4", param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_off_4" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_off_1", param2=node.param2}) + end + end, + on_construct = on_construct, + delayer_time = delaytime, + delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i), + delayer_lockstate = "mesecons_delayer:delayer_off_locked", + sounds = mcl_sounds.node_sound_stone_defaults(), + mesecons = { + receptor = { + state = mesecon.state.off, + rules = delayer_get_output_rules, + }, + effector = { + rules = delayer_get_input_rules, + action_on = delayer_activate, + }, + }, + on_rotate = on_rotate, + }) + minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), { + description = S("Redstone Repeater (Delay @1, Powered)", i), + _doc_items_create_entry = false, + drawtype = "nodebox", + tiles = { + "mesecons_delayer_on.png", + "mcl_stairs_stone_slab_top.png", + "mesecons_delayer_sides_on.png", + "mesecons_delayer_sides_on.png", + "mesecons_delayer_ends_on.png", + "mesecons_delayer_ends_on.png", + }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + walkable = true, + selection_box = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, + }, + collision_box = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, + }, + node_box = { + type = "fixed", + fixed = boxes + }, + groups = {dig_immediate = 3, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, attached_node=1, redstone_repeater=i, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = false, + is_ground_content = false, + drop = 'mesecons_delayer:delayer_off_1', + on_rightclick = function (pos, node, clicker) + local protname = clicker:get_player_name() + if minetest.is_protected(pos, protname) then + minetest.record_protection_violation(pos, protname) + return + end + --HACK! we already know the node name, so we should generate the function to avoid multiple checks + if node.name=="mesecons_delayer:delayer_on_1" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_on_2",param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_on_2" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_on_3",param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_on_3" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_on_4",param2=node.param2}) + elseif node.name=="mesecons_delayer:delayer_on_4" then + minetest.set_node(pos, {name="mesecons_delayer:delayer_on_1",param2=node.param2}) + end + end, + after_dig_node = function(pos, oldnode) + check_unlock_repeater(pos, oldnode) + end, + delayer_time = delaytime, + delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i), + delayer_lockstate = "mesecons_delayer:delayer_on_locked", + sounds = mcl_sounds.node_sound_stone_defaults(), + mesecons = { + receptor = { + state = mesecon.state.on, + rules = delayer_get_output_rules, + }, + effector = { + rules = delayer_get_input_rules, + action_off = delayer_deactivate, + }, + }, + on_rotate = on_rotate, + }) end From ddc157acbf495de0bdbf624874a293a11b8e69f0 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:37:51 +0200 Subject: [PATCH 43/63] [mesecons_commandblock] fix warnings --- mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua index 1928f809c..9c0914efb 100644 --- a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua @@ -72,7 +72,7 @@ end local function check_commands(commands, player_name) for _, command in pairs(commands:split("\n")) do local pos = command:find(" ") - local cmd, param = command, "" + local cmd = command if pos then cmd = command:sub(1, pos - 1) end @@ -103,10 +103,10 @@ local function commandblock_action_on(pos, node) if node.name ~= "mesecons_commandblock:commandblock_off" then return end - + local meta = minetest.get_meta(pos) local commander = meta:get_string("commander") - + if not command_blocks_activated then --minetest.chat_send_player(commander, msg_not_activated) return From 962ae359af048f9e23bf4e38aafd99580db59d1a Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:41:01 +0200 Subject: [PATCH 44/63] [mesecons] fix warnings --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 12 ++++-------- mods/ITEMS/REDSTONE/mesecons/services.lua | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index f4ed9df4e..a5bcb80e8 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -329,7 +329,7 @@ function mesecon.get_conductor_on(node_off, rulename) return conductor.states[tonumber(binstate,2)+1] end end - return offstate + return conductor.offstate end function mesecon.get_conductor_off(node_on, rulename) @@ -345,7 +345,7 @@ function mesecon.get_conductor_off(node_on, rulename) return conductor.states[tonumber(binstate,2)+1] end end - return onstate + return conductor.onstate end function mesecon.conductor_get_rules(node) @@ -391,9 +391,7 @@ function mesecon.turnon(pos, link) local f = table.remove(frontiers, 1) local node = get_node_force(f.pos) - if not node then - -- Area does not exist; do nothing - elseif mesecon.is_conductor_off(node, f.link) then + if node and mesecon.is_conductor_off(node, f.link) then local rules = mesecon.conductor_get_rules(node) -- Call turnon on neighbors @@ -453,9 +451,7 @@ function mesecon.turnoff(pos, link) local f = table.remove(frontiers, 1) local node = get_node_force(f.pos) - if not node then - -- No-op - elseif mesecon.is_conductor_on(node, f.link) then + if node and mesecon.is_conductor_on(node, f.link) then local rules = mesecon.conductor_get_rules(node) for _, r in pairs(mesecon.rule2meta(f.link, rules)) do local np = vector.add(f.pos, r) diff --git a/mods/ITEMS/REDSTONE/mesecons/services.lua b/mods/ITEMS/REDSTONE/mesecons/services.lua index 9addda8bd..1e3e6237b 100644 --- a/mods/ITEMS/REDSTONE/mesecons/services.lua +++ b/mods/ITEMS/REDSTONE/mesecons/services.lua @@ -77,7 +77,7 @@ mesecon.on_dignode = function(pos, node) mesecon.receptor_off(pos, mesecon.receptor_get_rules(node)) end if minetest.get_item_group(node.name, "opaque") == 1 then - local sources = mesecon.is_powered(pos) + --local sources = mesecon.is_powered(pos) local neighbors = mesecon.mcl_get_neighbors(pos) for n=1, #neighbors do local npos = neighbors[n].pos From b814fe47f9b5a2ca21501988b968feac01bada34 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:47:59 +0200 Subject: [PATCH 45/63] [mcl_observers] fix warnings --- mods/ITEMS/REDSTONE/mcl_observers/init.lua | 317 +++++++++++---------- 1 file changed, 161 insertions(+), 156 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 932f4f643..8f7f6c262 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -11,7 +11,7 @@ local realtime = true local rules_flat = { { x = 0, y = 0, z = -1, spread = true }, } -local get_rules_flat = function(node) +local function get_rules_flat(node) local rules = rules_flat for i=1, node.param2 do rules = mesecon.rotate_rules_left(rules) @@ -46,7 +46,7 @@ end -- and update the observer state if needed. -- TODO: Also scan metadata changes. -- TODO: Ignore some node changes. -local observer_scan = function(pos, initialize) +local function observer_scan(pos, initialize) local node = minetest.get_node(pos) local front if node.name == "mcl_observers:observer_up_off" or node.name == "mcl_observers:observer_up_on" then @@ -87,14 +87,14 @@ local observer_scan = function(pos, initialize) end -- Vertical orientation (CURRENTLY DISABLED) -local observer_orientate = function(pos, placer) +local function observer_orientate(pos, placer) -- Not placed by player if not placer then return end -- Placer pitch in degrees local pitch = placer:get_look_vertical() * (180 / math.pi) - local node = minetest.get_node(pos) + --local node = minetest.get_node(pos) if pitch > 55 then -- player looking upwards -- Observer looking downwards minetest.set_node(pos, {name="mcl_observers:observer_down_off"}) @@ -104,162 +104,167 @@ local observer_orientate = function(pos, placer) end end -mesecon.register_node("mcl_observers:observer", -{ - is_ground_content = false, - sounds = mcl_sounds.node_sound_stone_defaults(), - paramtype2 = "facedir", - on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, -}, -{ - description = S("Observer"), - _tt_help = S("Emits redstone pulse when block in front changes"), - _doc_items_longdesc = S("An observer is a redstone component which observes the block in front of it and sends a very short redstone pulse whenever this block changes."), - _doc_items_usagehelp = S("Place the observer directly in front of the block you want to observe with the “face” looking at the block. The arrow points to the side of the output, which is at the opposite side of the “face”. You can place your redstone dust or any other component here."), +mesecon.register_node("mcl_observers:observer", { + is_ground_content = false, + sounds = mcl_sounds.node_sound_stone_defaults(), + paramtype2 = "facedir", + on_rotate = false, + _mcl_blast_resistance = 3.5, + _mcl_hardness = 3.5, + }, { + description = S("Observer"), + _tt_help = S("Emits redstone pulse when block in front changes"), + _doc_items_longdesc = S("An observer is a redstone component which observes the block in front of it and sends a very short redstone pulse whenever this block changes."), + _doc_items_usagehelp = S("Place the observer directly in front of the block you want to observe with the “face” looking at the block. The arrow points to the side of the output, which is at the opposite side of the “face”. You can place your redstone dust or any other component here."), - groups = {pickaxey=1, material_stone=1, not_opaque=1, }, - tiles = { - "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", - "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", - "mcl_observers_observer_front.png", "mcl_observers_observer_back.png", - }, - mesecons = { receptor = { - state = mesecon.state.off, - rules = get_rules_flat, - }}, - on_construct = function(pos) - if not realtime then - observer_scan(pos, true) - end - end, - after_place_node = observer_orientate, -}, -{ - _doc_items_create_entry = false, - groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, - tiles = { - "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", - "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", - "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png", - }, - mesecons = { receptor = { - state = mesecon.state.on, - rules = get_rules_flat, - }}, + groups = {pickaxey=1, material_stone=1, not_opaque=1, }, + tiles = { + "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", + "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", + "mcl_observers_observer_front.png", "mcl_observers_observer_back.png", + }, + mesecons = { + receptor = { + state = mesecon.state.off, + rules = get_rules_flat, + }, + }, + on_construct = function(pos) + if not realtime then + observer_scan(pos, true) + end + end, + after_place_node = observer_orientate, + }, { + _doc_items_create_entry = false, + groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, + tiles = { + "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", + "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", + "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png", + }, + mesecons = { + receptor = { + state = mesecon.state.on, + rules = get_rules_flat, + } + }, - -- VERY quickly disable observer after construction - on_construct = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(mcl_vars.redstone_tick) - end, - on_timer = function(pos, elapsed) - local node = minetest.get_node(pos) - minetest.set_node(pos, {name = "mcl_observers:observer_off", param2 = node.param2}) - mesecon.receptor_off(pos, get_rules_flat(node)) - end, -} + -- VERY quickly disable observer after construction + on_construct = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(mcl_vars.redstone_tick) + end, + on_timer = function(pos, elapsed) + local node = minetest.get_node(pos) + minetest.set_node(pos, {name = "mcl_observers:observer_off", param2 = node.param2}) + mesecon.receptor_off(pos, get_rules_flat(node)) + end, + } ) -mesecon.register_node("mcl_observers:observer_down", -{ - is_ground_content = false, - sounds = mcl_sounds.node_sound_stone_defaults(), - groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, - on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, - drop = "mcl_observers:observer_off", -}, -{ - tiles = { - "mcl_observers_observer_back.png", "mcl_observers_observer_front.png", - "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90", - "mcl_observers_observer_top.png", "mcl_observers_observer_top.png", - }, - mesecons = { receptor = { - state = mesecon.state.off, - rules = rules_down, - }}, - on_construct = function(pos) - if not realtime then - observer_scan(pos, true) - end - end, -}, -{ - _doc_items_create_entry = false, - tiles = { - "mcl_observers_observer_back_lit.png", "mcl_observers_observer_front.png", - "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90", - "mcl_observers_observer_top.png", "mcl_observers_observer_top.png", - }, - mesecons = { receptor = { - state = mesecon.state.on, - rules = rules_down, - }}, +mesecon.register_node("mcl_observers:observer_down", { + is_ground_content = false, + sounds = mcl_sounds.node_sound_stone_defaults(), + groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, + on_rotate = false, + _mcl_blast_resistance = 3.5, + _mcl_hardness = 3.5, + drop = "mcl_observers:observer_off", + }, { + tiles = { + "mcl_observers_observer_back.png", "mcl_observers_observer_front.png", + "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90", + "mcl_observers_observer_top.png", "mcl_observers_observer_top.png", + }, + mesecons = { + receptor = { + state = mesecon.state.off, + rules = rules_down, + }, + }, + on_construct = function(pos) + if not realtime then + observer_scan(pos, true) + end + end, + }, { + _doc_items_create_entry = false, + tiles = { + "mcl_observers_observer_back_lit.png", "mcl_observers_observer_front.png", + "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90", + "mcl_observers_observer_top.png", "mcl_observers_observer_top.png", + }, + mesecons = { + receptor = { + state = mesecon.state.on, + rules = rules_down, + }, + }, - -- VERY quickly disable observer after construction - on_construct = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(mcl_vars.redstone_tick) - end, - on_timer = function(pos, elapsed) - local node = minetest.get_node(pos) - minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2}) - mesecon.receptor_off(pos, rules_down) - end, -}) + -- VERY quickly disable observer after construction + on_construct = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(mcl_vars.redstone_tick) + end, + on_timer = function(pos, elapsed) + local node = minetest.get_node(pos) + minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2}) + mesecon.receptor_off(pos, rules_down) + end, + } +) -mesecon.register_node("mcl_observers:observer_up", -{ - is_ground_content = false, - sounds = mcl_sounds.node_sound_stone_defaults(), - groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, - on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, - drop = "mcl_observers:observer_off", -}, -{ - tiles = { - "mcl_observers_observer_front.png", "mcl_observers_observer_back.png", - "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270", - "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180", - }, - mesecons = { receptor = { - state = mesecon.state.off, - rules = rules_up, - }}, - on_construct = function(pos) - if not realtime then - observer_scan(pos, true) - end - end, -}, -{ - _doc_items_create_entry = false, - tiles = { - "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png", - "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270", - "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180", - }, - mesecons = { receptor = { - state = mesecon.state.on, - rules = rules_up, - }}, +mesecon.register_node("mcl_observers:observer_up", { + is_ground_content = false, + sounds = mcl_sounds.node_sound_stone_defaults(), + groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, + on_rotate = false, + _mcl_blast_resistance = 3.5, + _mcl_hardness = 3.5, + drop = "mcl_observers:observer_off", + }, { + tiles = { + "mcl_observers_observer_front.png", "mcl_observers_observer_back.png", + "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270", + "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180", + }, + mesecons = { + receptor = { + state = mesecon.state.off, + rules = rules_up, + }, + }, + on_construct = function(pos) + if not realtime then + observer_scan(pos, true) + end + end, + }, { + _doc_items_create_entry = false, + tiles = { + "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png", + "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270", + "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180", + }, + mesecons = { + receptor = { + state = mesecon.state.on, + rules = rules_up, + }, + }, - -- VERY quickly disable observer after construction - on_construct = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(mcl_vars.redstone_tick) - end, - on_timer = function(pos, elapsed) - minetest.set_node(pos, {name = "mcl_observers:observer_up_off"}) - mesecon.receptor_off(pos, rules_up) - end, -}) + -- VERY quickly disable observer after construction + on_construct = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(mcl_vars.redstone_tick) + end, + on_timer = function(pos, elapsed) + minetest.set_node(pos, {name = "mcl_observers:observer_up_off"}) + mesecon.receptor_off(pos, rules_up) + end, + } +) minetest.register_craft({ output = "mcl_observers:observer_off", @@ -267,7 +272,7 @@ minetest.register_craft({ { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, - } + }, }) minetest.register_craft({ output = "mcl_observers:observer_off", @@ -275,7 +280,7 @@ minetest.register_craft({ { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, - } + }, }) if realtime then @@ -454,7 +459,7 @@ minetest.register_lbm({ "mcl_observers:observer_down_on", "mcl_observers:observer_up_on", }, - run_at_every_load = true, + run_at_every_load = true, action = function(pos) minetest.after(1, mcl_observers.observer_activate, {x=pos.x, y=pos.y, z=pos.z}) end, From d43b2149e6b07883c9443d1ef26375ddd7205699 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:50:16 +0200 Subject: [PATCH 46/63] [mcl_dispensers] fix warnings --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 200 ++++++++++---------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 02ed70aed..73bc1f0da 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -96,125 +96,127 @@ local dispenserdef = { end, _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, - mesecons = {effector = { - -- Dispense random item when triggered - action_on = function (pos, node) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local droppos, dropdir - if node.name == "mcl_dispensers:dispenser" then - dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) - droppos = vector.add(pos, dropdir) - elseif node.name == "mcl_dispensers:dispenser_up" then - dropdir = {x=0, y=1, z=0} - droppos = {x=pos.x, y=pos.y+1, z=pos.z} - elseif node.name == "mcl_dispensers:dispenser_down" then - dropdir = {x=0, y=-1, z=0} - droppos = {x=pos.x, y=pos.y-1, z=pos.z} - end - local dropnode = minetest.get_node(droppos) - local dropnodedef = minetest.registered_nodes[dropnode.name] - local stacks = {} - for i=1,inv:get_size("main") do - local stack = inv:get_stack("main", i) - if not stack:is_empty() then - table.insert(stacks, {stack = stack, stackpos = i}) + mesecons = { + effector = { + -- Dispense random item when triggered + action_on = function (pos, node) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local droppos, dropdir + if node.name == "mcl_dispensers:dispenser" then + dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) + droppos = vector.add(pos, dropdir) + elseif node.name == "mcl_dispensers:dispenser_up" then + dropdir = {x=0, y=1, z=0} + droppos = {x=pos.x, y=pos.y+1, z=pos.z} + elseif node.name == "mcl_dispensers:dispenser_down" then + dropdir = {x=0, y=-1, z=0} + droppos = {x=pos.x, y=pos.y-1, z=pos.z} end - end - if #stacks >= 1 then - local r = math.random(1, #stacks) - local stack = stacks[r].stack - local dropitem = ItemStack(stack) - dropitem:set_count(1) - local stack_id = stacks[r].stackpos - local stackdef = stack:get_definition() - local iname = stack:get_name() - local igroups = minetest.registered_items[iname].groups + local dropnode = minetest.get_node(droppos) + local dropnodedef = minetest.registered_nodes[dropnode.name] + local stacks = {} + for i=1,inv:get_size("main") do + local stack = inv:get_stack("main", i) + if not stack:is_empty() then + table.insert(stacks, {stack = stack, stackpos = i}) + end + end + if #stacks >= 1 then + local r = math.random(1, #stacks) + local stack = stacks[r].stack + local dropitem = ItemStack(stack) + dropitem:set_count(1) + local stack_id = stacks[r].stackpos + local stackdef = stack:get_definition() + local iname = stack:get_name() + local igroups = minetest.registered_items[iname].groups - --[===[ Dispense item ]===] + --[===[ Dispense item ]===] - -- Hardcoded dispensions -- + -- Hardcoded dispensions -- - -- Armor, mob heads and pumpkins - if igroups.armor then - local droppos_below = {x = droppos.x, y = droppos.y - 1, z = droppos.z} + -- Armor, mob heads and pumpkins + if igroups.armor then + local droppos_below = {x = droppos.x, y = droppos.y - 1, z = droppos.z} - for _, objs in ipairs({minetest.get_objects_inside_radius(droppos, 1), minetest.get_objects_inside_radius(droppos_below, 1)}) do - for _, obj in ipairs(objs) do - stack = mcl_armor.equip(stack, obj) + for _, objs in ipairs({minetest.get_objects_inside_radius(droppos, 1), minetest.get_objects_inside_radius(droppos_below, 1)}) do + for _, obj in ipairs(objs) do + stack = mcl_armor.equip(stack, obj) + if stack:is_empty() then + break + end + end if stack:is_empty() then break end end - if stack:is_empty() then - break - end - end - -- Place head or pumpkin as node, if equipping it as armor has failed - if not stack:is_empty() then - if igroups.head or iname == "mcl_farming:pumpkin_face" then - if dropnodedef.buildable_to then - minetest.set_node(droppos, {name = iname, param2 = node.param2}) - stack:take_item() + -- Place head or pumpkin as node, if equipping it as armor has failed + if not stack:is_empty() then + if igroups.head or iname == "mcl_farming:pumpkin_face" then + if dropnodedef.buildable_to then + minetest.set_node(droppos, {name = iname, param2 = node.param2}) + stack:take_item() + end end end - end - inv:set_stack("main", stack_id, stack) - -- Spawn Egg - elseif igroups.spawn_egg then - -- Spawn mob - if not dropnodedef.walkable then - pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } } - minetest.add_entity(droppos, stack:get_name()) - - stack:take_item() inv:set_stack("main", stack_id, stack) - end + -- Spawn Egg + elseif igroups.spawn_egg then + -- Spawn mob + if not dropnodedef.walkable then + --pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } } + minetest.add_entity(droppos, stack:get_name()) - -- Generalized dispension - elseif (not dropnodedef.walkable or stackdef._dispense_into_walkable) then - --[[ _on_dispense(stack, pos, droppos, dropnode, dropdir) - * stack: Itemstack which is dispense - * pos: Position of dispenser - * droppos: Position to which to dispense item - * dropnode: Node of droppos - * dropdir: Drop direction - - _dispense_into_walkable: If true, can dispense into walkable nodes - ]] - if stackdef._on_dispense then - -- Item-specific dispension (if defined) - local od_ret = stackdef._on_dispense(dropitem, pos, droppos, dropnode, dropdir) - if od_ret then - local newcount = stack:get_count() - 1 - stack:set_count(newcount) - inv:set_stack("main", stack_id, stack) - if newcount == 0 then - inv:set_stack("main", stack_id, od_ret) - elseif inv:room_for_item("main", od_ret) then - inv:add_item("main", od_ret) - else - minetest.add_item(droppos, dropitem) - end - else stack:take_item() inv:set_stack("main", stack_id, stack) end - else - -- Drop item otherwise - minetest.add_item(droppos, dropitem) - stack:take_item() - inv:set_stack("main", stack_id, stack) + + -- Generalized dispension + elseif (not dropnodedef.walkable or stackdef._dispense_into_walkable) then + --[[ _on_dispense(stack, pos, droppos, dropnode, dropdir) + * stack: Itemstack which is dispense + * pos: Position of dispenser + * droppos: Position to which to dispense item + * dropnode: Node of droppos + * dropdir: Drop direction + + _dispense_into_walkable: If true, can dispense into walkable nodes + ]] + if stackdef._on_dispense then + -- Item-specific dispension (if defined) + local od_ret = stackdef._on_dispense(dropitem, pos, droppos, dropnode, dropdir) + if od_ret then + local newcount = stack:get_count() - 1 + stack:set_count(newcount) + inv:set_stack("main", stack_id, stack) + if newcount == 0 then + inv:set_stack("main", stack_id, od_ret) + elseif inv:room_for_item("main", od_ret) then + inv:add_item("main", od_ret) + else + minetest.add_item(droppos, dropitem) + end + else + stack:take_item() + inv:set_stack("main", stack_id, stack) + end + else + -- Drop item otherwise + minetest.add_item(droppos, dropitem) + stack:take_item() + inv:set_stack("main", stack_id, stack) + end end + + end - - - end - end, - rules = mesecon.rules.alldirs, - }}, + end, + rules = mesecon.rules.alldirs, + }, + }, on_rotate = on_rotate, } From 3fbcacac3bb2270ab7db60adfc9bf393687a35fc Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:50:58 +0200 Subject: [PATCH 47/63] [show_wielded_item] fix warnings --- mods/HUD/show_wielded_item/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/HUD/show_wielded_item/init.lua b/mods/HUD/show_wielded_item/init.lua index bc06bee43..456dc23e0 100644 --- a/mods/HUD/show_wielded_item/init.lua +++ b/mods/HUD/show_wielded_item/init.lua @@ -11,7 +11,7 @@ local xp_mod = minetest.get_modpath("mcl_experience") local function set_hud(player) if not player:is_player() then return end - local player_name = player:get_player_name() + local player_name = player:get_player_name() -- Fixed offset in config file local fixed = tonumber(minetest.settings:get("show_wielded_item_y_offset")) local off @@ -84,7 +84,7 @@ minetest.register_globalstep(function(dtime) wield[player_name] = wname dtimes[player_name] = 0 - if huds[player_name] then + if huds[player_name] then local def = minetest.registered_items[wname] local meta = wstack:get_meta() From 52b147365706979ce1544926218a08193708eb75 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:53:05 +0200 Subject: [PATCH 48/63] [mcl_comparators] fix warnings --- mods/ITEMS/REDSTONE/mcl_comparators/init.lua | 168 +++++++++---------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua index cd194b0d1..a76821543 100644 --- a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua @@ -217,94 +217,94 @@ if minetest.get_modpath("screwdriver") then end for _, mode in pairs{"comp", "sub"} do -for _, state in pairs{mesecon.state.on, mesecon.state.off} do - local state_str = state_strs[state] - local nodename = - "mcl_comparators:comparator_"..state_strs[state].."_"..mode + for _, state in pairs{mesecon.state.on, mesecon.state.off} do + local state_str = state_strs[state] + local nodename = + "mcl_comparators:comparator_"..state_str.."_"..mode - -- Help - local longdesc, usagehelp, use_help - if state_strs[state] == "off" and mode == "comp" then - longdesc = S("Redstone comparators are multi-purpose redstone components.").."\n".. - S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.") + -- Help + local longdesc, usagehelp, use_help + if state_str == "off" and mode == "comp" then + longdesc = S("Redstone comparators are multi-purpose redstone components.").."\n".. + S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.") - usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n".. - S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n".. - S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n".. - S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n".. - S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.") - else - use_help = false - end + usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n".. + S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n".. + S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n".. + S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n".. + S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.") + else + use_help = false + end - local nodedef = { - description = S("Redstone Comparator"), - inventory_image = icon, - wield_image = icon, - _doc_items_create_entry = use_help, - _doc_items_longdesc = longdesc, - _doc_items_usagehelp = usagehelp, - drawtype = "nodebox", - tiles = get_tiles(state_strs[state], mode), - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - wield_image = "mcl_comparators_off.png", - walkable = true, - selection_box = collision_box, - collision_box = collision_box, - node_box = { - type = "fixed", - fixed = node_boxes[mode], - }, - groups = groups, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = false, - is_ground_content = false, - drop = 'mcl_comparators:comparator_off_comp', - on_construct = update_self, - on_rightclick = - make_rightclick_handler(state_strs[state], mode), - comparator_mode = mode, - comparator_onstate = "mcl_comparators:comparator_on_"..mode, - comparator_offstate = "mcl_comparators:comparator_off_"..mode, - sounds = mcl_sounds.node_sound_stone_defaults(), - mesecons = { - receptor = { - state = state, - rules = comparator_get_output_rules, + local nodedef = { + description = S("Redstone Comparator"), + inventory_image = icon, + wield_image = icon, + _doc_items_create_entry = use_help, + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, + drawtype = "nodebox", + tiles = get_tiles(state_str, mode), + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + --wield_image = "mcl_comparators_off.png", + walkable = true, + selection_box = collision_box, + collision_box = collision_box, + node_box = { + type = "fixed", + fixed = node_boxes[mode], }, - effector = { - rules = comparator_get_input_rules, - action_change = update_self, - } - }, - on_rotate = on_rotate, - } + groups = groups, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = false, + is_ground_content = false, + drop = 'mcl_comparators:comparator_off_comp', + on_construct = update_self, + on_rightclick = + make_rightclick_handler(state_str, mode), + comparator_mode = mode, + comparator_onstate = "mcl_comparators:comparator_on_"..mode, + comparator_offstate = "mcl_comparators:comparator_off_"..mode, + sounds = mcl_sounds.node_sound_stone_defaults(), + mesecons = { + receptor = { + state = state, + rules = comparator_get_output_rules, + }, + effector = { + rules = comparator_get_input_rules, + action_change = update_self, + } + }, + on_rotate = on_rotate, + } - if mode == "comp" and state == mesecon.state.off then - -- This is the prototype - nodedef._doc_items_create_entry = true - else - nodedef.groups = table.copy(nodedef.groups) - nodedef.groups.not_in_creative_inventory = 1 - local extra_desc = {} - if mode == "sub" or state == mesecon.state.on then - nodedef.inventory_image = nil + if mode == "comp" and state == mesecon.state.off then + -- This is the prototype + nodedef._doc_items_create_entry = true + else + nodedef.groups = table.copy(nodedef.groups) + nodedef.groups.not_in_creative_inventory = 1 + --local extra_desc = {} + if mode == "sub" or state == mesecon.state.on then + nodedef.inventory_image = nil + end + local desc = nodedef.description + if mode ~= "sub" and state == mesecon.state.on then + desc = S("Redstone Comparator (Powered)") + elseif mode == "sub" and state ~= mesecon.state.on then + desc = S("Redstone Comparator (Subtract)") + elseif mode == "sub" and state == mesecon.state.on then + desc = S("Redstone Comparator (Subtract, Powered)") + end + nodedef.description = desc end - local desc = nodedef.description - if mode ~= "sub" and state == mesecon.state.on then - desc = S("Redstone Comparator (Powered)") - elseif mode == "sub" and state ~= mesecon.state.on then - desc = S("Redstone Comparator (Subtract)") - elseif mode == "sub" and state == mesecon.state.on then - desc = S("Redstone Comparator (Subtract, Powered)") - end - nodedef.description = desc + + minetest.register_node(nodename, nodedef) + mcl_wip.register_wip_item(nodename) end - - minetest.register_node(nodename, nodedef) - mcl_wip.register_wip_item(nodename) -end end -- Register recipies @@ -351,9 +351,9 @@ minetest.register_abm({ -- Add entry aliases for the Help if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", - "nodes", "mcl_comparators:comparator_off_sub") + "nodes", "mcl_comparators:comparator_off_sub") doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", - "nodes", "mcl_comparators:comparator_on_comp") + "nodes", "mcl_comparators:comparator_on_comp") doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", - "nodes", "mcl_comparators:comparator_on_sub") + "nodes", "mcl_comparators:comparator_on_sub") end From 8baea02f2401e0b896dfb4be1e255bf1f4a06a03 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 13:20:00 +0200 Subject: [PATCH 49/63] [mcl_inventory] fix warnings --- mods/HUD/mcl_inventory/creative.lua | 26 ++++++++++++-------------- mods/HUD/mcl_inventory/init.lua | 8 +++----- mods/HUD/mcl_inventory/mod.conf | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 61ba39b10..4d73aca35 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -7,7 +7,7 @@ local players = {} -- Containing all the items for each Creative Mode tab local inventory_lists = {} -local mod_player = minetest.get_modpath("mcl_player") ~= nil +--local mod_player = minetest.get_modpath("mcl_player") ~= nil -- Create tables local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"} @@ -161,7 +161,7 @@ end local function init(player) local playername = player:get_player_name() - local inv = minetest.create_detached_inventory("creative_"..playername, { + minetest.create_detached_inventory("creative_"..playername, { allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) if minetest.is_creative_enabled(playername) then return count @@ -203,7 +203,7 @@ local offset = {} -- string offset: local boffset = {} -- local hoch = {} local filtername = {} -local bg = {} +--local bg = {} local noffset_x_start = -0.24 local noffset_x = noffset_x_start @@ -257,7 +257,6 @@ hoch["mobs"] = "_down" hoch["matr"] = "_down" hoch["inv"] = "_down" -filtername = {} filtername["blocks"] = S("Building Blocks") filtername["deco"] = S("Decoration Blocks") filtername["redstone"] = S("Redstone") @@ -272,9 +271,9 @@ filtername["brew"] = S("Brewing") filtername["matr"] = S("Materials") filtername["inv"] = S("Survival Inventory") -local dark_bg = "crafting_creative_bg_dark.png" +--local dark_bg = "crafting_creative_bg_dark.png" -local function reset_menu_item_bg() +--[[local function reset_menu_item_bg() bg["blocks"] = dark_bg bg["deco"] = dark_bg bg["redstone"] = dark_bg @@ -289,11 +288,11 @@ local function reset_menu_item_bg() bg["matr"] = dark_bg bg["inv"] = dark_bg bg["default"] = dark_bg -end +end]] mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_size, show, page, filter) - reset_menu_item_bg() + --reset_menu_item_bg() pagenum = math.floor(pagenum) or 1 local playername = player:get_player_name() @@ -310,7 +309,6 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz end local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1)) local name = "nix" - local formspec = "" local main_list local listrings = "listring[detached:creative_"..playername..";main]".. "listring[current_player;main]".. @@ -322,7 +320,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz players[playername].page = page end end - bg[name] = "crafting_creative_bg.png" + --bg[name] = "crafting_creative_bg.png" local inv_bg = "crafting_inventory_creative.png" if name == "inv" then @@ -428,7 +426,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]" end - formspec = "size[10,9.3]".. + local formspec = "size[10,9.3]".. "no_prepend[]".. mcl_vars.gui_nonbg..mcl_vars.gui_bg_color.. "background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]".. @@ -560,7 +558,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end -- Figure out current scroll bar from formspec - local formspec = player:get_inventory_formspec() + --local formspec = player:get_inventory_formspec() local start_i = players[name].start_i @@ -628,7 +626,7 @@ if minetest.is_creative_enabled("") then end mcl_inventory.update_inventory_formspec = function(player) - local page = nil + local page local name = player:get_player_name() @@ -639,7 +637,7 @@ if minetest.is_creative_enabled("") then end -- Figure out current scroll bar from formspec - local formspec = player:get_inventory_formspec() + --local formspec = player:get_inventory_formspec() local start_i = players[name].start_i local inv_size diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index 1744ec089..4c50a6c13 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -3,8 +3,8 @@ local F = minetest.formspec_escape mcl_inventory = {} -local mod_player = minetest.get_modpath("mcl_player") ~= nil -local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil +--local mod_player = minetest.get_modpath("mcl_player") ~= nil +--local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil -- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left function return_item(itemstack, dropper, pos, inv) @@ -60,8 +60,6 @@ local function set_inventory(player, armor_change_only) inv:set_width("craft", 2) inv:set_size("craft", 4) - local player_name = player:get_player_name() - -- Show armor and player image local player_preview if minetest.settings:get_bool("3d_player_preview", true) then @@ -180,6 +178,6 @@ minetest.register_on_joinplayer(function(player) end) if minetest.is_creative_enabled("") then - dofile(minetest.get_modpath("mcl_inventory").."/creative.lua") + dofile(minetest.get_modpath(minetest.get_current_modname()).."/creative.lua") end diff --git a/mods/HUD/mcl_inventory/mod.conf b/mods/HUD/mcl_inventory/mod.conf index fa6b2c2f4..7585d9f70 100644 --- a/mods/HUD/mcl_inventory/mod.conf +++ b/mods/HUD/mcl_inventory/mod.conf @@ -1,6 +1,6 @@ name = mcl_inventory author = BlockMen description = Adds the player inventory and creative inventory. -depends = mcl_init, mcl_formspec -optional_depends = mcl_player, _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting +depends = mcl_init, mcl_formspec, mcl_player +optional_depends = _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide From 8536e2c033cf51ef99989d56e7c400fdc444f2f8 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 13:33:36 +0200 Subject: [PATCH 50/63] [mcl_experience] fix warnings --- mods/HUD/mcl_experience/init.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index b52611d5a..53376c63f 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -1,5 +1,11 @@ local S = minetest.get_translator("mcl_experience") + mcl_experience = {} + +local vector = vector +local math = math +local string = string + local pool = {} local registered_nodes local max_xp = 2^31-1 @@ -262,7 +268,6 @@ function mcl_experience.add_experience(player, experience) if #final_candidates > 0 then local can = final_candidates[math.random(#final_candidates)] local stack, list, index, wear = can.stack, can.list, can.index, can.wear - local unbreaking_level = mcl_enchanting.get_enchantment(stack, "unbreaking") local uses = mcl_util.calculate_durability(stack) local multiplier = 2 * 65535 / uses local repair = experience * multiplier @@ -329,14 +334,12 @@ minetest.register_on_dieplayer(function(player) mcl_experience.throw_experience(player:get_pos(), xp_amount) end) - -local name local collector, pos, pos2 local direction, distance, player_velocity, goal local currentvel, acceleration, multiplier, velocity local node, vel, def local is_moving, is_slippery, slippery, slip_factor -local size, data +local size local function xp_step(self, dtime) --if item set to be collected then only execute go to player if self.collected == true then From ce9258b7647f5b20db044a5e926dea4a6010e5a7 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 13:43:59 +0200 Subject: [PATCH 51/63] [awards] fix warnings --- .luacheckrc | 9 +++++++++ mods/HUD/awards/triggers.lua | 16 ++++------------ mods/HUD/awards/unified_inventory.lua | 5 ++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 556b2e8f0..2497a10ff 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -40,4 +40,13 @@ read_globals = { "factorial" } }, + ------ + --MODS + ------ + + --GENERAL + "default", + + --HUD + "sfinv", "unified_inventory", } \ No newline at end of file diff --git a/mods/HUD/awards/triggers.lua b/mods/HUD/awards/triggers.lua index 318a4b281..995dd005c 100644 --- a/mods/HUD/awards/triggers.lua +++ b/mods/HUD/awards/triggers.lua @@ -250,9 +250,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger) local tnodedug = string.split(entry.node, ":") local tmod = tnodedug[1] local titem = tnodedug[2] - if not tmod or not titem or not data.count[tmod] or not data.count[tmod][titem] then - -- table running failed! - elseif data.count[tmod][titem] > entry.target-1 then + if tmod and titem and data.count[tmod] and data.count[tmod][titem] and data.count[tmod][titem] > entry.target-1 then return entry.award end elseif awards.get_total_item_count(data, "count") > entry.target-1 then @@ -277,9 +275,7 @@ minetest.register_on_placenode(function(pos, node, digger) local tnodedug = string.split(entry.node, ":") local tmod = tnodedug[1] local titem = tnodedug[2] - if not tmod or not titem or not data.place[tmod] or not data.place[tmod][titem] then - -- table running failed! - elseif data.place[tmod][titem] > entry.target-1 then + if tmod and titem and data.place[tmod] and data.place[tmod][titem] and data.place[tmod][titem] > entry.target-1 then return entry.award end elseif awards.get_total_item_count(data, "place") > entry.target-1 then @@ -303,9 +299,7 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, local titemstring = string.split(entry.item, ":") local tmod = titemstring[1] local titem = titemstring[2] - if not tmod or not titem or not data.eat[tmod] or not data.eat[tmod][titem] then - -- table running failed! - elseif data.eat[tmod][titem] > entry.target-1 then + if tmod and titem and data.eat[tmod] and data.eat[tmod][titem] and data.eat[tmod][titem] > entry.target-1 then return entry.award end elseif awards.get_total_item_count(data, "eat") > entry.target-1 then @@ -331,9 +325,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv local titemcrafted = string.split(entry.item, ":") local tmod = titemcrafted[1] local titem = titemcrafted[2] - if not tmod or not titem or not data.craft[tmod] or not data.craft[tmod][titem] then - -- table running failed! - elseif data.craft[tmod][titem] > entry.target-1 then + if tmod and titem and data.craft[tmod] and data.craft[tmod][titem] and data.craft[tmod][titem] > entry.target-1 then return entry.award end elseif awards.get_total_item_count(data, "craft") > entry.target-1 then diff --git a/mods/HUD/awards/unified_inventory.lua b/mods/HUD/awards/unified_inventory.lua index be5ca5f94..3dc238e1a 100644 --- a/mods/HUD/awards/unified_inventory.lua +++ b/mods/HUD/awards/unified_inventory.lua @@ -1,6 +1,5 @@ -if minetest.get_modpath("unified_inventory") ~= nil then - local S = minetest.get_translator("awards") - +if minetest.get_modpath("unified_inventory") then + local S = minetest.get_translator(minetest.get_current_modname()) unified_inventory.register_button("awards", { type = "image", image = "awards_ui_icon.png", From c19c05443e27bd3a552e1b9fc0d8838b2aefe462 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 13:46:08 +0200 Subject: [PATCH 52/63] [mcl_craftguide] fix warnings --- mods/HELP/mcl_craftguide/init.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index d05d8b3d0..bfaef6011 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -417,9 +417,9 @@ local function get_tooltip(item, groups, cooktime, burntime) -- and just print the normal item name without special formatting if groups[1] == "compass" or groups[1] == "clock" then groupstr = reg_items[item].description - elseif group_names[groups[1]] then + elseif g then -- Use the special group name string - groupstr = minetest.colorize(gcol, group_names[groups[1]]) + groupstr = minetest.colorize(gcol, g) else --[[ Fallback: Generic group explanation: This always works, but the internally used group name (which @@ -545,7 +545,7 @@ local function get_recipe_fs(data, iY) if custom_recipe or shapeless or recipe.type == "cooking" then local icon = custom_recipe and custom_recipe.icon or - shapeless and "shapeless" or "furnace" + shapeless and "shapeless" or "furnace" if recipe.type == "cooking" then icon = "default_furnace_front_active.png" @@ -638,7 +638,7 @@ local function make_formspec(name) fs[#fs + 1] = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]" fs[#fs + 1] = fmt([[ tooltip[size_inc;%s] - tooltip[size_dec;%s] ]], + tooltip[size_dec;%s] ]], ESC(S("Increase window size")), ESC(S("Decrease window size"))) @@ -656,9 +656,9 @@ local function make_formspec(name) ]] fs[#fs + 1] = fmt([[ tooltip[search;%s] - tooltip[clear;%s] - tooltip[prev;%s] - tooltip[next;%s] ]], + tooltip[clear;%s] + tooltip[prev;%s] + tooltip[next;%s] ]], ESC(S("Search")), ESC(S("Reset")), ESC(S("Previous page")), From 58510b00ee4eca35a4c0c49192b913a30bdad172 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 13:51:54 +0200 Subject: [PATCH 53/63] [mcl_tt] fix some warnings --- mods/HELP/mcl_tt/snippets_base.lua | 10 +++++----- mods/HELP/mcl_tt/snippets_mcl.lua | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/HELP/mcl_tt/snippets_base.lua b/mods/HELP/mcl_tt/snippets_base.lua index 8242f2c19..bd5495721 100644 --- a/mods/HELP/mcl_tt/snippets_base.lua +++ b/mods/HELP/mcl_tt/snippets_base.lua @@ -1,6 +1,6 @@ local S = minetest.get_translator("mcl_tt") -local function get_min_digtime(caps) +--[[local function get_min_digtime(caps) local mintime local unique = true local maxlevel = caps.maxlevel @@ -25,7 +25,7 @@ local function get_min_digtime(caps) end end return mintime, unique -end +end]] local function newline(str) if str ~= "" then @@ -47,7 +47,7 @@ tt.register_snippet(function(itemstring, toolcaps) local minestring = "" local capstr = "" local caplines = 0 - for k,v in pairs(groupcaps) do + for _,v in pairs(groupcaps) do local speedstr = "" local miningusesstr = "" -- Mining capabilities @@ -153,9 +153,9 @@ tt.register_snippet(function(itemstring, toolcaps) end) -- Weapon stats -tt.register_snippet(function(itemstring) +--[[tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] -end) +end)]] -- Food tt.register_snippet(function(itemstring) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 3d13df751..b10021640 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_tt") -- Armor tt.register_snippet(function(itemstring) - local def = minetest.registered_items[itemstring] + --local def = minetest.registered_items[itemstring] local s = "" local head = minetest.get_item_group(itemstring, "armor_head") local torso = minetest.get_item_group(itemstring, "armor_torso") @@ -26,7 +26,7 @@ tt.register_snippet(function(itemstring) return s end) tt.register_snippet(function(itemstring, _, itemstack) - local def = minetest.registered_items[itemstring] + --local def = minetest.registered_items[itemstring] local s = "" local use = minetest.get_item_group(itemstring, "mcl_armor_uses") local pts = minetest.get_item_group(itemstring, "mcl_armor_points") @@ -75,7 +75,7 @@ tt.register_snippet(function(itemstring) end) tt.register_snippet(function(itemstring) - local def = minetest.registered_items[itemstring] + --local def = minetest.registered_items[itemstring] if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then return S("Deals damage when falling"), mcl_colors.YELLOW end From 5975b20cffc3843d501ba14c42571b8a9c04596b Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:02:47 +0200 Subject: [PATCH 54/63] [mcl_doc] fix warnings --- mods/HELP/mcl_doc/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/HELP/mcl_doc/init.lua b/mods/HELP/mcl_doc/init.lua index d926550f8..fa6ae6c05 100644 --- a/mods/HELP/mcl_doc/init.lua +++ b/mods/HELP/mcl_doc/init.lua @@ -154,7 +154,7 @@ doc.sub.items.register_factoid(nil, "use", function(itemstring, def) return s end) doc.sub.items.register_factoid(nil, "groups", function(itemstring, def) - local def = minetest.registered_items[itemstring] + --local def = minetest.registered_items[itemstring] local s = "" local use = minetest.get_item_group(itemstring, "mcl_armor_uses") local pts = minetest.get_item_group(itemstring, "mcl_armor_points") @@ -289,7 +289,7 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def) local itemname = item:get_name() local itemcount = item:get_count() local idef = minetest.registered_items[itemname] - local text = "" + local text if idef.description and idef.description ~= "" then text = idef.description else From 4fd0bf2c3fb0961e765aebf3bc6798725c9c7aa6 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:12:19 +0200 Subject: [PATCH 55/63] [doc_items] fix warnings --- mods/HELP/doc/doc_items/init.lua | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/mods/HELP/doc/doc_items/init.lua b/mods/HELP/doc/doc_items/init.lua index ec4da620e..edba0dae3 100644 --- a/mods/HELP/doc/doc_items/init.lua +++ b/mods/HELP/doc/doc_items/init.lua @@ -164,7 +164,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses) local useslines = 0 for k,v in pairs(groupcaps) do -- Mining capabilities - local minrating, maxrating + --[[local minrating, maxrating if v.times then for rating, time in pairs(v.times) do if minrating == nil then minrating = rating else @@ -177,7 +177,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses) else minrating = 1 maxrating = 1 - end + end]] local maxlevel = v.maxlevel if not maxlevel then -- Default from tool.h @@ -577,11 +577,8 @@ doc.add_category("nodes", { description = S("Item reference of blocks and other things which are capable of occupying space"), build_formspec = function(data, playername) if data then - local formstring = "" - local datastring = "" - - formstring = entry_image(data) - datastring = factoids_header(data, "nodes") + local formstring = entry_image(data) + local datastring = factoids_header(data, "nodes") local liquid = data.def.liquidtype ~= "none" and minetest.get_item_group(data.itemstring, "fake_liquid") == 0 if not forbidden_core_factoids.basics then @@ -834,7 +831,7 @@ doc.add_category("nodes", { elseif type(data.def.drop) == "table" and data.def.drop.items ~= nil then local max = data.def.drop.max_items local dropstring = "" - local dropstring_base = "" + local dropstring_base if max == nil then dropstring_base = N("This block will drop the following items when mined: @1.") elseif max == 1 then @@ -852,7 +849,7 @@ doc.add_category("nodes", { local rarity_history = {} for i=1,#data.def.drop.items do local local_rarity = data.def.drop.items[i].rarity - local chance = 1 + local chance local rarity = 1 if local_rarity == nil then local_rarity = 1 @@ -937,7 +934,6 @@ doc.add_category("nodes", { end local rarity = probtable.rarity - local raritystring = "" -- No percentage if there's only one possible guaranteed drop if not(rarity == 1 and #data.def.drop.items == 1) then local chance = (1/rarity)*100 @@ -1086,11 +1082,8 @@ doc.add_category("tools", { end, build_formspec = function(data, playername) if data then - local formstring = "" - local datastring = "" - - formstring = entry_image(data) - datastring = factoids_header(data, "tools") + local formstring = entry_image(data) + local datastring = factoids_header(data, "tools") -- Overwritten durability info if type(data.def._doc_items_durability) == "number" then @@ -1120,11 +1113,8 @@ doc.add_category("craftitems", { description = S("Item reference of items which are neither blocks, tools or weapons (esp. crafting items)"), build_formspec = function(data, playername) if data then - local formstring = "" - local datastring = "" - - formstring = entry_image(data) - datastring = factoids_header(data, "craftitems") + local formstring = entry_image(data) + local datastring = factoids_header(data, "craftitems") datastring = datastring .. factoids_footer(data, playername, "craftitems") formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2) From 21b7647731fce4a11ce99dd47e3fdbd3d43fd56a Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:23:37 +0200 Subject: [PATCH 56/63] [doc] fix warnings --- .luacheckrc | 2 +- mods/HELP/doc/doc/init.lua | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 2497a10ff..910d73a11 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -48,5 +48,5 @@ read_globals = { "default", --HUD - "sfinv", "unified_inventory", + "sfinv", "sfinv_buttons", "unified_inventory", "cmsg", "inventory_plus", } \ No newline at end of file diff --git a/mods/HELP/doc/doc/init.lua b/mods/HELP/doc/doc/init.lua index 029914a53..a04d83bda 100644 --- a/mods/HELP/doc/doc/init.lua +++ b/mods/HELP/doc/doc/init.lua @@ -233,7 +233,7 @@ end -- Returns true if the specified entry has been viewed by the player function doc.entry_viewed(playername, category_id, entry_id) - local entry, category_id, entry_id = get_entry(category_id, entry_id) + local _, category_id, entry_id = get_entry(category_id, entry_id) if doc.data.players[playername].stored_data.viewed[category_id] == nil then return false else @@ -243,7 +243,7 @@ end -- Returns true if the specified entry is hidden from the player function doc.entry_revealed(playername, category_id, entry_id) - local entry, category_id, entry_id = get_entry(category_id, entry_id) + local _, category_id, entry_id = get_entry(category_id, entry_id) local hidden = doc.data.categories[category_id].entries[entry_id].hidden if doc.data.players[playername].stored_data.revealed[category_id] == nil then return not hidden @@ -302,7 +302,7 @@ function doc.show_entry(playername, category_id, entry_id, ignore_hidden) minetest.show_formspec(playername, "doc:error_no_categories", doc.formspec_error_no_categories()) return end - local entry, category_id, entry_id = get_entry(category_id, entry_id) + local _, category_id, entry_id = get_entry(category_id, entry_id) if ignore_hidden or doc.entry_revealed(playername, category_id, entry_id) then local playerdata = doc.data.players[playername] playerdata.category = category_id @@ -587,8 +587,6 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width, formstring = formstring .. "label["..nx..","..ny..";"..i.."]" pos = pos + 1 end - local bw, bh - return formstring, ih end From 5f8d79b37ab4c0e02634ae5e19d5f18e07d49cd4 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:44:50 +0200 Subject: [PATCH 57/63] [mcl_weather] fix warnings --- mods/ENVIRONMENT/mcl_weather/rain.lua | 4 +- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 6 +- mods/ENVIRONMENT/mcl_weather/snow.lua | 118 +++++++++--------- mods/ENVIRONMENT/mcl_weather/thunder.lua | 88 +++++++------ mods/ENVIRONMENT/mcl_weather/weather_core.lua | 30 ++--- 5 files changed, 122 insertions(+), 124 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index d8425784a..786e08fa9 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -249,7 +249,7 @@ if mcl_weather.allow_abm then end end end - }) + }) -- Wetten the soil minetest.register_abm({ @@ -264,7 +264,7 @@ if mcl_weather.allow_abm then end end end - }) + }) end if mcl_weather.reg_weathers.rain == nil then diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 061634fcb..488f6b1a1 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -11,7 +11,7 @@ mcl_weather.skycolor = { -- Update interval. update_interval = 15, - -- Main sky colors: starts from midnight to midnight. + -- Main sky colors: starts from midnight to midnight. -- Please do not set directly. Use add_layer instead. colors = {}, @@ -205,8 +205,8 @@ mcl_weather.skycolor = { -- Returns first player sky color. I assume that all players are in same color layout. get_current_bg_color = function() local players = mcl_weather.skycolor.utils.get_players(nil) - for _, player in ipairs(players) do - return player:get_sky() + if players[1] then + return players[1]:get_sky() end return nil end diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index 3a0c539e3..9ec9fbac1 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -5,80 +5,80 @@ mcl_weather.snow = {} mcl_weather.snow.particles_count = 15 mcl_weather.snow.init_done = false --- calculates coordinates and draw particles for snow weather +-- calculates coordinates and draw particles for snow weather mcl_weather.snow.add_snow_particles = function(player) - mcl_weather.rain.last_rp_count = 0 - for i=mcl_weather.snow.particles_count, 1,-1 do - local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player) - random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7) - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then - mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1 - minetest.add_particle({ - pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, - velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001}, - acceleration = {x = 0, y=0, z = 0}, - expirationtime = 8.0, - size = 1, - collisiondetection = true, - collision_removal = true, - object_collision = false, - vertical = false, - texture = mcl_weather.snow.get_texture(), - playername = player:get_player_name() - }) - end - end + mcl_weather.rain.last_rp_count = 0 + for i=mcl_weather.snow.particles_count, 1,-1 do + local random_pos_x, _, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player) + local random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7) + if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then + mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1 + minetest.add_particle({ + pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, + velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001}, + acceleration = {x = 0, y=0, z = 0}, + expirationtime = 8.0, + size = 1, + collisiondetection = true, + collision_removal = true, + object_collision = false, + vertical = false, + texture = mcl_weather.snow.get_texture(), + playername = player:get_player_name() + }) + end + end end mcl_weather.snow.set_sky_box = function() - mcl_weather.skycolor.add_layer( - "weather-pack-snow-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=86}, - {r=135, g=135, b=135}, - {r=85, g=86, b=86}, - {r=0, g=0, b=0}}) - mcl_weather.skycolor.active = true - for _, player in pairs(get_connected_players()) do - player:set_clouds({color="#ADADADE8"}) - end - mcl_weather.skycolor.active = true + mcl_weather.skycolor.add_layer( + "weather-pack-snow-sky", + {{r=0, g=0, b=0}, + {r=85, g=86, b=86}, + {r=135, g=135, b=135}, + {r=85, g=86, b=86}, + {r=0, g=0, b=0}}) + mcl_weather.skycolor.active = true + for _, player in pairs(get_connected_players()) do + player:set_clouds({color="#ADADADE8"}) + end + mcl_weather.skycolor.active = true end -mcl_weather.snow.clear = function() - mcl_weather.skycolor.remove_layer("weather-pack-snow-sky") - mcl_weather.snow.init_done = false +function mcl_weather.snow.clear() + mcl_weather.skycolor.remove_layer("weather-pack-snow-sky") + mcl_weather.snow.init_done = false end -- Simple random texture getter -mcl_weather.snow.get_texture = function() - return "weather_pack_snow_snowflake"..math.random(1,2)..".png" +function mcl_weather.snow.get_texture() + return "weather_pack_snow_snowflake"..math.random(1,2)..".png" end local timer = 0 minetest.register_globalstep(function(dtime) - if mcl_weather.state ~= "snow" then - return false - end - - timer = timer + dtime; - if timer >= 0.5 then - timer = 0 - else - return - end + if mcl_weather.state ~= "snow" then + return false + end - if mcl_weather.snow.init_done == false then - mcl_weather.snow.set_sky_box() - mcl_weather.snow.init_done = true - end + timer = timer + dtime; + if timer >= 0.5 then + timer = 0 + else + return + end - 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 - mcl_weather.snow.add_snow_particles(player) - end + if mcl_weather.snow.init_done == false then + mcl_weather.snow.set_sky_box() + mcl_weather.snow.init_done = true + end + + 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 + mcl_weather.snow.add_snow_particles(player) + end end) -- register snow weather diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index ece673170..f8e5a0371 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -4,60 +4,58 @@ local get_connected_players = minetest.get_connected_players lightning.auto = false mcl_weather.thunder = { - next_strike = 0, - min_delay = 3, - max_delay = 12, - init_done = false, + next_strike = 0, + min_delay = 3, + max_delay = 12, + init_done = false, } minetest.register_globalstep(function(dtime) - if mcl_weather.get_weather() ~= "thunder" then - return false - end - - mcl_weather.rain.set_particles_mode("thunder") - mcl_weather.rain.make_weather() + if mcl_weather.get_weather() ~= "thunder" then + return false + end - if mcl_weather.thunder.init_done == false then - mcl_weather.skycolor.add_layer( - "weather-pack-thunder-sky", - {{r=0, g=0, b=0}, - {r=40, g=40, b=40}, - {r=85, g=86, b=86}, - {r=40, g=40, b=40}, - {r=0, g=0, b=0}}) - mcl_weather.skycolor.active = true - for _, player in pairs(get_connected_players()) do - player:set_clouds({color="#3D3D3FE8"}) - end - mcl_weather.thunder.init_done = true - end - - if (mcl_weather.thunder.next_strike <= minetest.get_gametime()) then - lightning.strike() - local delay = math.random(mcl_weather.thunder.min_delay, mcl_weather.thunder.max_delay) - mcl_weather.thunder.next_strike = minetest.get_gametime() + delay - end + mcl_weather.rain.set_particles_mode("thunder") + mcl_weather.rain.make_weather() + if mcl_weather.thunder.init_done == false then + mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", { + {r=0, g=0, b=0}, + {r=40, g=40, b=40}, + {r=85, g=86, b=86}, + {r=40, g=40, b=40}, + {r=0, g=0, b=0}, + }) + mcl_weather.skycolor.active = true + for _, player in pairs(get_connected_players()) do + player:set_clouds({color="#3D3D3FE8"}) + end + mcl_weather.thunder.init_done = true + end + if (mcl_weather.thunder.next_strike <= minetest.get_gametime()) then + lightning.strike() + local delay = math.random(mcl_weather.thunder.min_delay, mcl_weather.thunder.max_delay) + mcl_weather.thunder.next_strike = minetest.get_gametime() + delay + end end) -mcl_weather.thunder.clear = function() - mcl_weather.rain.clear() - mcl_weather.skycolor.remove_layer("weather-pack-thunder-sky") - mcl_weather.skycolor.remove_layer("lightning") - mcl_weather.thunder.init_done = false +function mcl_weather.thunder.clear() + mcl_weather.rain.clear() + mcl_weather.skycolor.remove_layer("weather-pack-thunder-sky") + mcl_weather.skycolor.remove_layer("lightning") + mcl_weather.thunder.init_done = false end -- register thunderstorm weather if mcl_weather.reg_weathers.thunder == nil then - mcl_weather.reg_weathers.thunder = { - clear = mcl_weather.thunder.clear, - light_factor = 0.33333, - -- 10min - 20min - min_duration = 600, - max_duration = 1200, - transitions = { - [100] = "rain", - } - } + mcl_weather.reg_weathers.thunder = { + clear = mcl_weather.thunder.clear, + light_factor = 0.33333, + -- 10min - 20min + min_duration = 600, + max_duration = 1200, + transitions = { + [100] = "rain", + }, + } end diff --git a/mods/ENVIRONMENT/mcl_weather/weather_core.lua b/mods/ENVIRONMENT/mcl_weather/weather_core.lua index d3772dc7e..b8deba318 100644 --- a/mods/ENVIRONMENT/mcl_weather/weather_core.lua +++ b/mods/ENVIRONMENT/mcl_weather/weather_core.lua @@ -1,27 +1,29 @@ local S = minetest.get_translator("mcl_weather") +local math = math + -- weather states, 'none' is default, other states depends from active mods mcl_weather.state = "none" - + -- player list for saving player meta info mcl_weather.players = {} - + -- default weather check interval for global step mcl_weather.check_interval = 5 - + -- weather min duration mcl_weather.min_duration = 600 - + -- weather max duration mcl_weather.max_duration = 9000 -- weather calculated end time mcl_weather.end_time = nil - + -- registered weathers mcl_weather.reg_weathers = {} --- global flag to disable/enable ABM logic. +-- global flag to disable/enable ABM logic. mcl_weather.allow_abm = true mcl_weather.reg_weathers["none"] = { @@ -51,7 +53,7 @@ mcl_weather.get_rand_end_time = function(min_duration, max_duration) r = math.random(min_duration, max_duration) else r = math.random(mcl_weather.min_duration, mcl_weather.max_duration) - end + end return minetest.get_gametime() + r end @@ -80,8 +82,8 @@ end mcl_weather.is_underwater = function(player) local ppos = player:get_pos() local offset = player:get_eye_offset() - local player_eye_pos = {x = ppos.x + offset.x, - y = ppos.y + offset.y + 1.5, + local player_eye_pos = {x = ppos.x + offset.x, + y = ppos.y + offset.y + 1.5, z = ppos.z + offset.z} local node_level = minetest.get_node_level(player_eye_pos) if node_level == 8 or node_level == 7 then @@ -91,14 +93,12 @@ mcl_weather.is_underwater = function(player) end -- trying to locate position for particles by player look direction for performance reason. --- it is costly to generate many particles around player so goal is focus mainly on front view. +-- it is costly to generate many particles around player so goal is focus mainly on front view. mcl_weather.get_random_pos_by_player_look_dir = function(player) local look_dir = player:get_look_dir() local player_pos = player:get_pos() - local random_pos_x = 0 - local random_pos_y = 0 - local random_pos_z = 0 + local random_pos_x, random_pos_y, random_pos_z if look_dir.x > 0 then if look_dir.z > 0 then @@ -208,7 +208,7 @@ minetest.register_privilege("weather_manager", { give_to_singleplayer = false }) --- Weather command definition. Set +-- Weather command definition. Set minetest.register_chatcommand("weather", { params = "(clear | rain | snow | thunder) []", description = S("Changes the weather to the specified parameter."), @@ -270,7 +270,7 @@ minetest.register_chatcommand("toggledownfall", { local weather_allow_abm = minetest.settings:get_bool("weather_allow_abm") if weather_allow_abm ~= nil and weather_allow_abm == false then mcl_weather.allow_abm = false -end +end local load_weather = function() From 36dc18e9da888db5f01c9730c5ef28e900aeab80 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:46:13 +0200 Subject: [PATCH 58/63] [mcl_void_damage] fix warnings --- mods/ENVIRONMENT/mcl_void_damage/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_void_damage/init.lua b/mods/ENVIRONMENT/mcl_void_damage/init.lua index 24f7d0e4b..c3819c1da 100644 --- a/mods/ENVIRONMENT/mcl_void_damage/init.lua +++ b/mods/ENVIRONMENT/mcl_void_damage/init.lua @@ -1,5 +1,5 @@ local S = minetest.get_translator("mcl_void_damage") -local enable_damage = minetest.settings:get_bool("enable_damage") +--local enable_damage = minetest.settings:get_bool("enable_damage") local pos_to_dim = mcl_worlds.pos_to_dimension local dim_change = mcl_worlds.dimension_change @@ -39,9 +39,9 @@ minetest.register_on_mods_loaded(function() end self._void_timer = 0 - local void, void_deadly = is_in_void(pos) + local _, void_deadly = is_in_void(pos) if void_deadly then - local ent = obj:get_luaentity() + --local ent = obj:get_luaentity() obj:remove() return end @@ -61,7 +61,7 @@ minetest.register_globalstep(function(dtime) for p=1, #players do local player = players[p] local pos = player:get_pos() - local void, void_deadly = is_in_void(pos) + local _, void_deadly = is_in_void(pos) if void_deadly then local immortal_val = player:get_armor_groups().immortal local is_immortal = false From 9f41c6fc64b1255bd87dce954708187dc54f9e91 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:48:52 +0200 Subject: [PATCH 59/63] [mcl_moon] fix warnings --- mods/ENVIRONMENT/mcl_moon/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_moon/init.lua b/mods/ENVIRONMENT/mcl_moon/init.lua index 4ee2623a6..1a5030b4e 100644 --- a/mods/ENVIRONMENT/mcl_moon/init.lua +++ b/mods/ENVIRONMENT/mcl_moon/init.lua @@ -4,11 +4,9 @@ local SHEET_W = 4 local SHEET_H = 2 -- Randomize initial moon phase, based on map seed -local phase_offset local mg_seed = minetest.get_mapgen_setting("seed") local rand = PseudoRandom(mg_seed) local phase_offset = rand:next(0, MOON_PHASES - 1) -rand = nil minetest.log("info", "[mcl_moon] Moon phase offset of this world: "..phase_offset) From b0a3cffad0414ced64bdb32b049b77ae2439c869 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:50:38 +0200 Subject: [PATCH 60/63] [lightning] fix warnings --- mods/ENVIRONMENT/lightning/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 4a58866f9..2b79bf5ce 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -134,6 +134,7 @@ lightning.strike = function(pos) sound_play({ name = "lightning_thunder", gain = 10 }, { pos = pos, max_hear_distance = 500 }, true) -- damage nearby objects, transform mobs + -- TODO: use an API insteed of hardcoding this behaviour local objs = get_objects_inside_radius(pos2, 3.5) for o=1, #objs do local obj = objs[o] @@ -153,7 +154,7 @@ lightning.strike = function(pos) end obj:set_properties({textures = lua.base_texture}) -- villager → witch (no damage) - elseif lua and lua.name == "mobs_mc:villager" then + --elseif lua and lua.name == "mobs_mc:villager" then -- Witches are incomplete, this code is unused -- TODO: Enable this code when witches are working. --[[ From 470f7b70bcf44b93f26dde66b836759a5371b8ff Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 14:54:20 +0200 Subject: [PATCH 61/63] [mobs_mc_gameconfig] fix warning --- mods/ENTITIES/mobs_mc_gameconfig/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua index 06d7eb87f..27cb4b4bf 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua +++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua @@ -200,14 +200,14 @@ end mobs_mc.override.enderman_block_texture_overrides = { ["mcl_core:cactus"] = ctable, -- FIXME: replace colorize colors with colors from palette - ["mcl_core:dirt_with_grass"] = - { - "mcl_core_grass_block_top.png^[colorize:green:90", - "default_dirt.png", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", - "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"} + ["mcl_core:dirt_with_grass"] = { + "mcl_core_grass_block_top.png^[colorize:green:90", + "default_dirt.png", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + "default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)", + }, } -- List of nodes on which mobs can spawn From 335405f1310d9bc0bcc6d8ef9ccf8ffe618ee3cd Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 15:10:20 +0200 Subject: [PATCH 62/63] [mobs_mc] fix warnings --- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 3 +-- mods/ENTITIES/mobs_mc/2_throwing.lua | 2 +- mods/ENTITIES/mobs_mc/4_heads.lua | 3 ++- mods/ENTITIES/mobs_mc/blaze.lua | 2 +- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 4 ++-- mods/ENTITIES/mobs_mc/ender_dragon.lua | 13 ++++++------- mods/ENTITIES/mobs_mc/enderman.lua | 4 ++-- mods/ENTITIES/mobs_mc/guardian.lua | 3 +-- mods/ENTITIES/mobs_mc/guardian_elder.lua | 1 - mods/ENTITIES/mobs_mc/horse.lua | 6 +++--- mods/ENTITIES/mobs_mc/iron_golem.lua | 2 +- mods/ENTITIES/mobs_mc/llama.lua | 12 ++++++------ mods/ENTITIES/mobs_mc/ocelot.lua | 2 +- mods/ENTITIES/mobs_mc/parrot.lua | 2 +- mods/ENTITIES/mobs_mc/pig.lua | 4 ++-- mods/ENTITIES/mobs_mc/sheep.lua | 5 ++--- mods/ENTITIES/mobs_mc/silverfish.lua | 1 - mods/ENTITIES/mobs_mc/skeleton+stray.lua | 6 +----- mods/ENTITIES/mobs_mc/vex.lua | 3 +-- mods/ENTITIES/mobs_mc/wither.lua | 3 +-- mods/ENTITIES/mobs_mc/wolf.lua | 4 ++-- 21 files changed, 37 insertions(+), 48 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index c947e9185..f21d946fe 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -83,7 +83,7 @@ mobs_mc.items = { water_source = "default:water_source", water_flowing = "default:water_flowing", river_water_source = "default:river_water_source", - water_flowing = "default:river_water_flowing", + --water_flowing = "default:river_water_flowing", black_dye = "dye:black", poppy = "flowers:rose", dandelion = "flowers:dandelion_yellow", @@ -128,7 +128,6 @@ mobs_mc.items = { nether_portal = "nether:portal", netherrack = "nether:rack", - nether_brick_block = "nether:brick", -- Wool (Minecraft color scheme) wool_white = "wool:white", diff --git a/mods/ENTITIES/mobs_mc/2_throwing.lua b/mods/ENTITIES/mobs_mc/2_throwing.lua index 23ae86d80..6f01ae6e6 100644 --- a/mods/ENTITIES/mobs_mc/2_throwing.lua +++ b/mods/ENTITIES/mobs_mc/2_throwing.lua @@ -6,7 +6,7 @@ -- NOTE: Strings intentionally not marked for translation, other mods already have these items. -- TODO: Remove this file eventually, all items here are already outsourced in other mods. -local S = minetest.get_translator("mobs_mc") +--local S = minetest.get_translator("mobs_mc") --maikerumines throwing code --arrow (weapon) diff --git a/mods/ENTITIES/mobs_mc/4_heads.lua b/mods/ENTITIES/mobs_mc/4_heads.lua index 01b8ee577..2ba0d548b 100644 --- a/mods/ENTITIES/mobs_mc/4_heads.lua +++ b/mods/ENTITIES/mobs_mc/4_heads.lua @@ -3,8 +3,9 @@ -- NOTE: Strings intentionally not marked for translation, other mods already have these items. -- TODO: Remove this file eventually, all items here are already outsourced in other mods. +-- TODO: Add translation. -local S = minetest.get_translator("mobs_mc") +--local S = minetest.get_translator("mobs_mc") -- Heads system diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index 146e8da70..a5e6f2bd3 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -20,7 +20,7 @@ mobs:register_mob("mobs_mc:blaze", { xp_max = 10, tilt_fly = false, hostile = true, - rotate = 270, + --rotate = 270, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3}, rotate = -180, visual = "mesh", diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 0d6d31ffe..6100e5899 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -89,7 +89,7 @@ local cow_def = { --head code has_head = true, head_bone = "head", - + swap_y_with_x = false, reverse_head_yaw = false, @@ -168,7 +168,7 @@ mooshroom_def.on_rightclick = function(self, clicker) pos.y = pos.y + 0.5 minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew}) end - end + end end mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 2111105d3..d2d040ad2 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -16,7 +16,7 @@ mobs:register_mob("mobs_mc:enderdragon", { shoot_arrow = function(self, pos, dir) -- 2-4 damage per arrow local dmg = math.random(2,4) - mobs.shoot_projectile_handling("mobs_mc:dragon_fireball", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + mobs.shoot_projectile_handling("mobs_mc:dragon_fireball", pos, dir, self.object:get_yaw(), self.object, nil, dmg) end, hp_max = 200, hp_min = 200, @@ -24,7 +24,6 @@ mobs:register_mob("mobs_mc:enderdragon", { xp_max = 500, collisionbox = {-2, 0, -2, 2, 2, 2}, eye_height = 1, - physical = false, visual = "mesh", mesh = "mobs_mc_dragon.b3d", textures = { @@ -60,8 +59,6 @@ mobs:register_mob("mobs_mc:enderdragon", { arrow = "mobs_mc:dragon_fireball", shoot_interval = 0.5, shoot_offset = -1.0, - xp_min = 500, - xp_max = 500, animation = { fly_speed = 8, stand_speed = 8, stand_start = 0, stand_end = 20, @@ -114,8 +111,8 @@ mobs:register_mob("mobs_mc:enderdragon", { fire_resistant = true, }) - -local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false +--TODO: replace this setting by a proper gamerules system +local mobs_griefing = minetest.settings:get_bool("mobs_griefing", true) -- dragon fireball (projectile) mobs:register_arrow("mobs_mc:dragon_fireball", { @@ -143,7 +140,9 @@ mobs:register_arrow("mobs_mc:dragon_fireball", { -- node hit, explode hit_node = function(self, pos, node) --mobs:boom(self, pos, 2) - mcl_explosions.explode(self.object:get_pos(), 2,{ drop_chance = 1.0 }) + if mobs_griefing then + mcl_explosions.explode(self.object:get_pos(), 2, { drop_chance = 1.0 }) + end end }) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 9ebc3d6fa..0b6985711 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -318,12 +318,12 @@ mobs:register_mob("mobs_mc:enderman", { for n = 1, #objs do local obj = objs[n] if obj then - if minetest.is_player(obj) then + --if minetest.is_player(obj) then -- Warp from players during day. --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then -- self:teleport(nil) --end - else + if not obj:is_player() then local lua = obj:get_luaentity() if lua then if lua.name == "mcl_bows:arrow_entity" or lua.name == "mcl_throwing:snowball_entity" then diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index 241ac3444..0916010d2 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -13,7 +13,7 @@ mobs:register_mob("mobs_mc:guardian", { xp_min = 10, xp_max = 10, breath_max = -1, - passive = false, + passive = false, attack_type = "punch", pathfinding = 1, view_range = 16, @@ -94,7 +94,6 @@ mobs:register_mob("mobs_mc:guardian", { makes_footstep_sound = false, fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, jump = false, - view_range = 16, }) -- Spawning disabled due to size issues diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index e44796bad..0c871da7a 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -104,7 +104,6 @@ mobs:register_mob("mobs_mc:guardian_elder", { makes_footstep_sound = false, fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, jump = false, - view_range = 16, }) -- Spawning disabled due to size issues <- what do you mean? -j4i diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 461c60efd..db23d410b 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -38,9 +38,9 @@ end local can_equip_horse_armor = function(entity_id) return entity_id == "mobs_mc:horse" or entity_id == "mobs_mc:skeleton_horse" or entity_id == "mobs_mc:zombie_horse" end -local can_equip_chest = function(entity_id) +--[[local can_equip_chest = function(entity_id) return entity_id == "mobs_mc:mule" or entity_id == "mobs_mc:donkey" -end +end]] local can_breed = function(entity_id) return entity_id == "mobs_mc:horse" or "mobs_mc:mule" or entity_id == "mobs_mc:donkey" end @@ -314,7 +314,7 @@ local horse = { -- Make sure tamed horse is mature and being clicked by owner only if self.tamed and not self.child and self.owner == clicker:get_player_name() then - local inv = clicker:get_inventory() + --local inv = clicker:get_inventory() -- detatch player already riding horse if self.driver and clicker == self.driver then diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index 48e573e13..d68dc157b 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -18,7 +18,7 @@ mobs:register_mob("mobs_mc:iron_golem", { passive = true, rotate = 270, hp_min = 100, - hp_max = 100, + hp_max = 100, protect = true, neutral = true, breath_max = -1, diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 58f565ec1..9803b582b 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -35,7 +35,7 @@ mobs:register_mob("mobs_mc:llama", { shoot_arrow = function(self, pos, dir) -- 2-4 damage per arrow local dmg = 1 - mobs.shoot_projectile_handling("mobs_mc:spit", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + mobs.shoot_projectile_handling("mobs_mc:spit", pos, dir, self.object:get_yaw(), self.object, nil, dmg) end, hp_min = 15, hp_max = 30, @@ -146,7 +146,7 @@ mobs:register_mob("mobs_mc:llama", { self.tamed = true self.owner = clicker:get_player_name() return - end + end --ignore other logic --make baby grow faster @@ -307,19 +307,19 @@ mobs:register_arrow("mobs_mc:spit", { tail_distance_divider = 4, hit_player = function(self, player) - if rawget(_G, "armor") and armor.last_damage_types then + --[[if rawget(_G, "armor") and armor.last_damage_types then armor.last_damage_types[player:get_player_name()] = "spit" - end + end]] player:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = self._damage}, }, nil) end, - hit_mob = function(self, mob) + hit_mob = function(self, mob) mob:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = _damage}, + damage_groups = {fleshy = self._damage}, }, nil) end, diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index e36abec77..933d7aad4 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -151,7 +151,7 @@ end mobs:register_mob("mobs_mc:cat", cat) -local base_spawn_chance = 5000 +--local base_spawn_chance = 5000 -- Spawn ocelot --they get the same as the llama because I'm trying to rework so much of this code right now -j4i diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index de52c6252..88ab54ff5 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -44,7 +44,7 @@ mobs:register_mob("mobs_mc:parrot", { max = 2, looting = "common",}, }, - animation = { + animation = { stand_speed = 50, walk_speed = 50, fly_speed = 50, diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index d7433a092..14c9595b6 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -130,7 +130,7 @@ mobs:register_mob("mobs_mc:pig", { -- Put saddle on pig local item = clicker:get_wielded_item() local wielditem = item - + if item:get_name() == mobs_mc.items.saddle and self.saddle ~= "yes" then self.base_texture = { "blank.png", -- baby @@ -163,7 +163,7 @@ mobs:register_mob("mobs_mc:pig", { end -- Mount or detach player - local name = clicker:get_player_name() + --local name = clicker:get_player_name() if self.driver and clicker == self.driver then -- Detach if already attached mobs.detach(clicker, {x=1, y=0, z=0}) diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 1527fd6da..7e01a1403 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -79,11 +79,11 @@ mobs:register_mob("mobs_mc:sheep", { makes_footstep_sound = true, walk_velocity = 1, run_velocity = 3, - + --head code has_head = true, head_bone = "head", - + swap_y_with_x = false, reverse_head_yaw = false, @@ -150,7 +150,6 @@ mobs:register_mob("mobs_mc:sheep", { do_custom = function(self, dtime) if not self.initial_color_set then local r = math.random(0,100000) - local textures if r <= 81836 then -- 81.836% self.color = "unicolor_white" diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index 148c4c722..05485bc51 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -46,7 +46,6 @@ mobs:register_mob("mobs_mc:silverfish", { view_range = 16, attack_type = "punch", damage = 1, - reach = 1, }) mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "mobs_mc_spawn_icon_silverfish.png", 0) diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 37b1fc6dd..e0aaef215 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -31,12 +31,8 @@ local skeleton = { group_attack = true, visual = "mesh", mesh = "mobs_mc_skeleton.b3d", - textures = { { - "mcl_bows_bow_0.png", -- bow - "mobs_mc_skeleton.png", -- skeleton - } }, - --head code + --head code has_head = false, head_bone = "head", diff --git a/mods/ENTITIES/mobs_mc/vex.lua b/mods/ENTITIES/mobs_mc/vex.lua index c23643cda..da162e5bf 100644 --- a/mods/ENTITIES/mobs_mc/vex.lua +++ b/mods/ENTITIES/mobs_mc/vex.lua @@ -15,7 +15,7 @@ mobs:register_mob("mobs_mc:vex", { spawn_class = "hostile", pathfinding = 1, passive = false, - attack_type = "punch", + attack_type = "dogfight", physical = false, hp_min = 14, hp_max = 14, @@ -36,7 +36,6 @@ mobs:register_mob("mobs_mc:vex", { view_range = 16, walk_velocity = 3.2, run_velocity = 5.9, - attack_type = "dogfight", sounds = { -- TODO: random death = "mobs_mc_vex_death", diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 7c9072f43..8bd8f5341 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -26,7 +26,6 @@ mobs:register_mob("mobs_mc:wither", { {"mobs_mc_wither.png"}, }, visual_size = {x=4, y=4}, - makes_footstep_sound = true, view_range = 16, fear_height = 4, walk_velocity = 2, @@ -81,7 +80,7 @@ mobs:register_mob("mobs_mc:wither", { end, }) -local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false +--local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false mobs:register_arrow("mobs_mc:wither_skull", { visual = "sprite", diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index 89a4b4629..2ce142c33 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -35,7 +35,7 @@ local wolf = { --head code has_head = false, head_bone = "head", - + swap_y_with_x = false, reverse_head_yaw = false, @@ -186,7 +186,7 @@ dog.on_rightclick = function(self, clicker) if is_food(item:get_name()) then -- Feed to increase health local hp = self.health - local hp_add = 0 + local hp_add -- Use eatable group to determine health boost local eatable = minetest.get_item_group(item, "eatable") if eatable > 0 then From b6dd8d5c44db47fd04cadc3ca180e6d8c38f9c39 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 15:13:44 +0200 Subject: [PATCH 63/63] [mcl_paintings] fix warnings --- mods/ENTITIES/mcl_paintings/init.lua | 20 +++++++++++--------- mods/ENTITIES/mcl_paintings/paintings.lua | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_paintings/init.lua b/mods/ENTITIES/mcl_paintings/init.lua index cb85ee5f8..be210c74c 100644 --- a/mods/ENTITIES/mcl_paintings/init.lua +++ b/mods/ENTITIES/mcl_paintings/init.lua @@ -4,9 +4,11 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/paintings.lua") local S = minetest.get_translator("mcl_paintings") +local math = math + local wood = "[combine:16x16:-192,0=mcl_paintings_paintings.png" -local is_protected = function(pos, name) +local function is_protected(pos, name) if minetest.is_protected(pos, name) then minetest.record_protection_violation(pos, name) return true @@ -17,7 +19,7 @@ end -- Check if there's a painting for provided painting size. -- If yes, returns the arguments. -- If not, returns the next smaller available painting. -local shrink_painting = function(x, y) +local function shrink_painting(x, y) if x > 4 or y > 4 then return nil end @@ -43,7 +45,7 @@ local shrink_painting = function(x, y) end end -local get_painting = function(x, y, motive) +local function get_painting(x, y, motive) local painting = mcl_paintings.paintings[y] and mcl_paintings.paintings[y][x] and mcl_paintings.paintings[y][x][motive] if not painting then return nil @@ -53,7 +55,7 @@ local get_painting = function(x, y, motive) return "[combine:"..sx.."x"..sy..":"..px..","..py.."=mcl_paintings_paintings.png" end -local get_random_painting = function(x, y) +local function get_random_painting(x, y) if not mcl_paintings.paintings[y] or not mcl_paintings.paintings[y][x] then return nil end @@ -65,7 +67,7 @@ local get_random_painting = function(x, y) return get_painting(x, y, r), r end -local size_to_minmax = function(size) +--[[local function size_to_minmax(size) local min, max if size == 2 then min = -0.5 @@ -81,13 +83,13 @@ local size_to_minmax = function(size) max = 0.5 end return min, max -end +end]] -local size_to_minmax_entity = function(size) +local function size_to_minmax_entity(size) return -size/2, size/2 end -local set_entity = function(object) +local function set_entity(object) local ent = object:get_luaentity() local wallm = ent._facing local xsize = ent._xsize @@ -169,7 +171,7 @@ minetest.register_entity("mcl_paintings:painting", { on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) -- Drop as item on punch if puncher and puncher:is_player() then - kname = puncher:get_player_name() + local kname = puncher:get_player_name() local pos = self._pos if not pos then pos = self.object:get_pos() diff --git a/mods/ENTITIES/mcl_paintings/paintings.lua b/mods/ENTITIES/mcl_paintings/paintings.lua index d606306c2..ccf584364 100644 --- a/mods/ENTITIES/mcl_paintings/paintings.lua +++ b/mods/ENTITIES/mcl_paintings/paintings.lua @@ -3,7 +3,7 @@ local TS = 16 -- texture size mcl_paintings.paintings = { [1] = { [1] = { - { cx = 0, cy = 0 }, + { cx = 0, cy = 0 }, { cx = TS, cy = 0 }, { cx = 2*TS, cy = 0 }, { cx = 3*TS, cy = 0 }, @@ -26,7 +26,7 @@ mcl_paintings.paintings = { { cx = 0, cy = 4*TS }, { cx = TS, cy = 4*TS }, }, - [2] = { + [2] = { { cx = 0, cy = 8*TS }, { cx = 2*TS, cy = 8*TS }, { cx = 4*TS, cy = 8*TS }, @@ -35,7 +35,7 @@ mcl_paintings.paintings = { { cx = 10*TS, cy = 8*TS }, }, [3] = 2, - [4] = { + [4] = { { cx = 0, cy = 6*TS }, }, },