From 72e53a82d7cbf01137a3bb462c49d8a9908070dd Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 26 Apr 2021 19:16:27 +0200 Subject: [PATCH 01/24] Basic not working script --- tools/create_luacheck.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) mode change 100644 => 100755 tools/create_luacheck.py diff --git a/tools/create_luacheck.py b/tools/create_luacheck.py old mode 100644 new mode 100755 index e69de29bb2..31046a5754 --- a/tools/create_luacheck.py +++ b/tools/create_luacheck.py @@ -0,0 +1,22 @@ +import os +import re +from pathlib import Path + +path = "../mods/" +pattern = re.compile(r'[a-z]') + +pathlist = Path(path).rglob('*.lua') +for path in pathlist: + path_in_str = str(path) + print(path_in_str) + with open(path_in_str) as f: + for line in f: + if pattern.search(line): + print(line) + +for subdir, dirs, files in os.walk(path): + for file in files: + print(os.path.join(subdir, file)) + filepath = subdir + os.sep + file + if filepath.endswith(".lua"): + print(filepath) \ No newline at end of file From 0a2fcdc4e8901f847aab1b5299140a91f1ae8dad Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 27 Apr 2021 19:16:08 +0200 Subject: [PATCH 02/24] fixes --- tools/create_luacheck.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/create_luacheck.py b/tools/create_luacheck.py index 31046a5754..1c38c33f43 100755 --- a/tools/create_luacheck.py +++ b/tools/create_luacheck.py @@ -2,17 +2,25 @@ import os import re from pathlib import Path -path = "../mods/" -pattern = re.compile(r'[a-z]') +path = "./mods/" +# pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') +pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') + pathlist = Path(path).rglob('*.lua') for path in pathlist: path_in_str = str(path) - print(path_in_str) + # print(path_in_str) + trouve = False with open(path_in_str) as f: - for line in f: - if pattern.search(line): - print(line) + for i, line in enumerate(f.readlines()): + m = pattern.match(line) + if m: + print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip()) + trouve = True + break + if not trouve: + print(path_in_str, ": -") for subdir, dirs, files in os.walk(path): for file in files: From cbb014ed3867418d373dadbfc05e5d7dc90a8b4c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 3 May 2021 22:11:49 +0200 Subject: [PATCH 03/24] basic working script --- mods/MAPGEN/mcl_villages/const.lua | 2 +- tools/create_luacheck.py | 31 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/mods/MAPGEN/mcl_villages/const.lua b/mods/MAPGEN/mcl_villages/const.lua index 6621dbf3a3..e5cbc9b391 100644 --- a/mods/MAPGEN/mcl_villages/const.lua +++ b/mods/MAPGEN/mcl_villages/const.lua @@ -7,7 +7,7 @@ end --[[ Manually set in 'buildings.lua' -- material to replace cobblestone with -wallmaterial = { +local wallmaterial = { "mcl_core:junglewood", "mcl_core:sprucewood", "mcl_core:wood", diff --git a/tools/create_luacheck.py b/tools/create_luacheck.py index 1c38c33f43..a9caad38e4 100755 --- a/tools/create_luacheck.py +++ b/tools/create_luacheck.py @@ -4,8 +4,10 @@ from pathlib import Path path = "./mods/" # pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') -pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') +pattern = re.compile(r'^(?P[A-Za-z_0-9]+)[ ]*=[ ]*\{') +pattern_local = re.compile(r'local (?P[A-Za-z_0-9]+)') +global_vars = [] pathlist = Path(path).rglob('*.lua') for path in pathlist: @@ -13,18 +15,31 @@ for path in pathlist: # print(path_in_str) trouve = False with open(path_in_str) as f: + variables_locales = [] for i, line in enumerate(f.readlines()): m = pattern.match(line) if m: - print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip()) - trouve = True - break - if not trouve: - print(path_in_str, ": -") + nomtableau = m.group('nomtableau') + if nomtableau not in variables_locales: + print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip()) + global_vars.append(m.group('nomtableau').strip()) + trouve = True + break -for subdir, dirs, files in os.walk(path): + else: + n = pattern_local.match(line) + if n: + variables_locales.append(n.group('nomvar')) + + if not trouve: + nb_varloc = len(variables_locales) + #print(path_in_str, ": -", "({} variables locales)".format(nb_varloc) if nb_varloc > 0 else '') + +""" for subdir, dirs, files in os.walk(path): for file in files: print(os.path.join(subdir, file)) filepath = subdir + os.sep + file if filepath.endswith(".lua"): - print(filepath) \ No newline at end of file + print(filepath) """ + +print(', '.join(['"{}"'.format(v) for v in global_vars])) From 81ee51b0c2663db964f6801a1c1e163941be0281 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 10 May 2021 09:58:26 +0200 Subject: [PATCH 04/24] document script --- tools/README.md | 14 ++++++++++++++ tools/create_luacheck.py | 35 +++++++++++++++++------------------ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/tools/README.md b/tools/README.md index abcc73ae31..4dc378bc18 100644 --- a/tools/README.md +++ b/tools/README.md @@ -27,3 +27,17 @@ Usage: - Convert the textures - Put the new texture directory in the Minetest texture pack directory, just like any other Minetest texture pack + +## Luacheck Globals Generators +This is a Python script which list every single global tables in mineclone2 source code. +It outputs a list to be used in luacheck conf files. + +Modes of operation: +- List global tables + +Requirements: +- Know how to use the console +- Python 3 + +Usage: +- In the console, run `python3 ./tools/create_luacheck.py` in the MineClone2 directory diff --git a/tools/create_luacheck.py b/tools/create_luacheck.py index a9caad38e4..8b55c13762 100755 --- a/tools/create_luacheck.py +++ b/tools/create_luacheck.py @@ -2,44 +2,43 @@ import os import re from pathlib import Path +# Just run this script from mineclone2 directory to get a list of every global vars to use in luacheck configuration files + path = "./mods/" -# pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') -pattern = re.compile(r'^(?P[A-Za-z_0-9]+)[ ]*=[ ]*\{') -pattern_local = re.compile(r'local (?P[A-Za-z_0-9]+)') + +pattern = re.compile(r'^(?P[A-Za-z_0-9]+)[ ]*=[ ]*\{') +pattern_local = re.compile(r'local (?P[A-Za-z_0-9]+)') global_vars = [] + +print("---Copy/Paste output in your luacheck conf file---\n") + + pathlist = Path(path).rglob('*.lua') for path in pathlist: path_in_str = str(path) # print(path_in_str) trouve = False with open(path_in_str) as f: - variables_locales = [] + local_vars = [] for i, line in enumerate(f.readlines()): m = pattern.match(line) if m: - nomtableau = m.group('nomtableau') - if nomtableau not in variables_locales: - print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip()) - global_vars.append(m.group('nomtableau').strip()) - trouve = True + global_name = m.group('global_var') + if global_name not in local_vars: + #print(path_in_str, ":", i+1, ":", m.group('global_var').strip()) + global_vars.append(m.group('global_var').strip()) + found = True break else: n = pattern_local.match(line) if n: - variables_locales.append(n.group('nomvar')) + local_vars.append(n.group('local_var')) - if not trouve: + if not found: nb_varloc = len(variables_locales) #print(path_in_str, ": -", "({} variables locales)".format(nb_varloc) if nb_varloc > 0 else '') -""" for subdir, dirs, files in os.walk(path): - for file in files: - print(os.path.join(subdir, file)) - filepath = subdir + os.sep + file - if filepath.endswith(".lua"): - print(filepath) """ - print(', '.join(['"{}"'.format(v) for v in global_vars])) From 6ffb7f525a991ebbf6ed4832f000a2c9b2441b36 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 10 May 2021 09:40:16 +0000 Subject: [PATCH 05/24] Add more crafting recipes for wooden planks (including stripped wood) --- mods/ITEMS/mcl_core/crafting.lua | 109 +++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 36 deletions(-) diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index a0ad38a777..ded4364c3a 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -4,47 +4,84 @@ -- Crafting definition -- -minetest.register_craft({ - output = 'mcl_core:wood 4', - recipe = { - {'mcl_core:tree'}, - } -}) +local craft_oak_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:wood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end +local craft_dark_oak_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:darkwood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end +local craft_jungle_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:junglewood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end +local craft_acacia_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:acaciawood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end +local craft_spruce_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:sprucewood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end +local craft_birch_planks = function(subname) + minetest.register_craft({ + output = "mcl_core:birchwood 4", + recipe = { + {"mcl_core:"..subname}, + } + }) +end -minetest.register_craft({ - output = 'mcl_core:darkwood 4', - recipe = { - {'mcl_core:darktree'}, - } -}) +craft_oak_planks("tree") +craft_oak_planks("tree_bark") +craft_oak_planks("stripped_oak") +craft_oak_planks("stripped_oak_bark") -minetest.register_craft({ - output = 'mcl_core:junglewood 4', - recipe = { - {'mcl_core:jungletree'}, - } -}) +craft_dark_oak_planks("darktree") +craft_dark_oak_planks("darktree_bark") +craft_dark_oak_planks("stripped_dark_oak") +craft_dark_oak_planks("stripped_dark_oak_bark") -minetest.register_craft({ - output = 'mcl_core:acaciawood 4', - recipe = { - {'mcl_core:acaciatree'}, - } -}) +craft_jungle_planks("jungletree") +craft_jungle_planks("jungletree_bark") +craft_jungle_planks("stripped_jungle") +craft_jungle_planks("stripped_jungle_bark") -minetest.register_craft({ - output = 'mcl_core:sprucewood 4', - recipe = { - {'mcl_core:sprucetree'}, - } -}) +craft_acacia_planks("acaciatree") +craft_acacia_planks("acaciatree_bark") +craft_acacia_planks("stripped_acacia") +craft_acacia_planks("stripped_acacia_bark") -minetest.register_craft({ - output = 'mcl_core:birchwood 4', - recipe = { - {'mcl_core:birchtree'}, - } -}) +craft_spruce_planks("sprucetree") +craft_spruce_planks("sprucetree_bark") +craft_spruce_planks("stripped_spruce") +craft_spruce_planks("stripped_spruce_bark") + +craft_birch_planks("birchtree") +craft_birch_planks("birchtree_bark") +craft_birch_planks("stripped_birch") +craft_birch_planks("stripped_birch_bark") minetest.register_craft({ type = 'shapeless', From 9fa51dc6b9593a7723fde51ef23557b2a0b45137 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 10 May 2021 10:06:34 +0000 Subject: [PATCH 06/24] Simplify wooden planks crafting --- mods/ITEMS/mcl_core/crafting.lua | 95 ++++++++++---------------------- 1 file changed, 28 insertions(+), 67 deletions(-) diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index ded4364c3a..44f49a4d4d 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -4,84 +4,45 @@ -- Crafting definition -- -local craft_oak_planks = function(subname) +local craft_planks = function(output, input) minetest.register_craft({ - output = "mcl_core:wood 4", + output = "mcl_core:"..output.."wood 4", recipe = { - {"mcl_core:"..subname}, - } - }) -end -local craft_dark_oak_planks = function(subname) - minetest.register_craft({ - output = "mcl_core:darkwood 4", - recipe = { - {"mcl_core:"..subname}, - } - }) -end -local craft_jungle_planks = function(subname) - minetest.register_craft({ - output = "mcl_core:junglewood 4", - recipe = { - {"mcl_core:"..subname}, - } - }) -end -local craft_acacia_planks = function(subname) - minetest.register_craft({ - output = "mcl_core:acaciawood 4", - recipe = { - {"mcl_core:"..subname}, - } - }) -end -local craft_spruce_planks = function(subname) - minetest.register_craft({ - output = "mcl_core:sprucewood 4", - recipe = { - {"mcl_core:"..subname}, - } - }) -end -local craft_birch_planks = function(subname) - minetest.register_craft({ - output = "mcl_core:birchwood 4", - recipe = { - {"mcl_core:"..subname}, + {"mcl_core:"..input}, } }) end -craft_oak_planks("tree") -craft_oak_planks("tree_bark") -craft_oak_planks("stripped_oak") -craft_oak_planks("stripped_oak_bark") +craft_planks("", "tree") +craft_planks("", "tree_bark") +craft_planks("", "stripped_oak") +craft_planks("", "stripped_oak_bark") -craft_dark_oak_planks("darktree") -craft_dark_oak_planks("darktree_bark") -craft_dark_oak_planks("stripped_dark_oak") -craft_dark_oak_planks("stripped_dark_oak_bark") +craft_planks("dark", "darktree") +craft_planks("dark", "darktree_bark") +craft_planks("dark", "stripped_dark_oak") +craft_planks("dark", "stripped_dark_oak_bark") -craft_jungle_planks("jungletree") -craft_jungle_planks("jungletree_bark") -craft_jungle_planks("stripped_jungle") -craft_jungle_planks("stripped_jungle_bark") +craft_planks("jungle", "jungletree") +craft_planks("jungle", "jungletree_bark") +craft_planks("jungle", "stripped_jungle") +craft_planks("jungle", "stripped_jungle_bark") -craft_acacia_planks("acaciatree") -craft_acacia_planks("acaciatree_bark") -craft_acacia_planks("stripped_acacia") -craft_acacia_planks("stripped_acacia_bark") +craft_planks("acacia", "acaciatree") +craft_planks("acacia", "acaciatree_bark") +craft_planks("acacia", "stripped_acacia") +craft_planks("acacia", "stripped_acacia_bark") -craft_spruce_planks("sprucetree") -craft_spruce_planks("sprucetree_bark") -craft_spruce_planks("stripped_spruce") -craft_spruce_planks("stripped_spruce_bark") +craft_planks("spruce", "sprucetree") +craft_planks("spruce", "sprucetree_bark") +craft_planks("spruce", "stripped_spruce") +craft_planks("spruce", "stripped_spruce_bark") + +craft_planks("birch", "birchtree") +craft_planks("birch", "birchtree_bark") +craft_planks("birch", "stripped_birch") +craft_planks("birch", "stripped_birch_bark") -craft_birch_planks("birchtree") -craft_birch_planks("birchtree_bark") -craft_birch_planks("stripped_birch") -craft_birch_planks("stripped_birch_bark") minetest.register_craft({ type = 'shapeless', From 11d700b78594e8876f7718482f5fbb5313ff2ad0 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 10 May 2021 19:47:46 +0000 Subject: [PATCH 07/24] Update my credits in CREDITS.md --- CREDITS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CREDITS.md b/CREDITS.md index c6ca7d0fb3..296e7c23bf 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -22,6 +22,7 @@ * Nicu * aligator * Code-Sploit +* NO11 ## Contributors * Laurent Rocher @@ -40,7 +41,6 @@ * Jared Moody * Li0n * Midgard -* NO11 * Saku Laesvuori * Yukitty * ZedekThePD @@ -102,6 +102,7 @@ * leorockway * xMrVizzy * yutyo +* NO11 ## Translations * Wuzzy From 7e132866bf0570a6c8dc2f470492216816a6ca4c Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 10 May 2021 19:47:51 +0000 Subject: [PATCH 08/24] Update my credits in mcl_credits --- mods/HUD/mcl_credits/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_credits/init.lua b/mods/HUD/mcl_credits/init.lua index 4464a401b6..2943738753 100644 --- a/mods/HUD/mcl_credits/init.lua +++ b/mods/HUD/mcl_credits/init.lua @@ -28,6 +28,7 @@ mcl_credits.people = { "Nicu", "aligator", "Code-Sploit", + "NO11", }}, {"Contributors", 0x52FF00, { "Laurent Rocher", @@ -46,7 +47,6 @@ mcl_credits.people = { "Jared Moody", "Li0n", "Midgard", - "NO11", "Saku Laesvuori", "Yukitty", "ZedekThePD", @@ -107,7 +107,8 @@ mcl_credits.people = { "kingoscargames", "leorockway", "xMrVizzy", - "yutyo" + "yutyo", + "NO11", }}, {"Translations", 0x00FF60, { "Wuzzy", From 074e8c83892f809de38c59a54546273525581828 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 11 May 2021 00:43:17 +0200 Subject: [PATCH 09/24] remove unused optional depends to lucky_block lucky_block is mtg mod and never used at any place in the code --- mods/ENTITIES/mcl_mobs/mod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/mod.conf b/mods/ENTITIES/mcl_mobs/mod.conf index 0d622f6a9a..9dfb43aefc 100644 --- a/mods/ENTITIES/mcl_mobs/mod.conf +++ b/mods/ENTITIES/mcl_mobs/mod.conf @@ -2,4 +2,4 @@ name = mcl_mobs author = PilzAdam description = Adds a mob API for mods to add animals or monsters, etc. depends = mcl_particles -optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience +optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience From 052bb540baf9487d08fd8feb3bfc85052b545214 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Mon, 10 May 2021 20:06:38 -0400 Subject: [PATCH 10/24] Remove unused parent data for arrows --- mods/ITEMS/mcl_bows/arrow.lua | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index a6f0c13dbe..c34e934795 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -118,16 +118,6 @@ ARROW_ENTITY.on_step = function(self, dtime) dpos = vector.round(dpos) local node = minetest.get_node(dpos) - if self.object:get_attach() ~= nil and self.object:get_attach(parent):get_hp() < 1 then - self.object:remove() - end - - minetest.register_on_leaveplayer(function(player) - if self.object:get_attach(parent) == player then - self.object:remove() - end - end) - if self._stuck then self._stucktimer = self._stucktimer + dtime self._stuckrechecktimer = self._stuckrechecktimer + dtime From ad4e86decaa4a833ea9e90e623a662a4c987a34c Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Mon, 10 May 2021 20:17:43 -0400 Subject: [PATCH 11/24] Fix #1726 --- mods/PLAYER/mcl_hunger/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 6b99985748..d212e631a5 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -137,14 +137,14 @@ local timerMult = 1 -- Cycles from 0 to 7, each time when timer hits half a seco minetest.register_globalstep(function(dtime) main_timer = main_timer + dtime timer = timer + dtime - if main_timer > mcl_hunger.HUD_TICK or timer > 0.5 then + if main_timer > mcl_hunger.HUD_TICK or timer > 0.25 then if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end for _,player in pairs(minetest.get_connected_players()) do local name = player:get_player_name() local h = tonumber(mcl_hunger.get_hunger(player)) local hp = player:get_hp() - if timer > 0.5 then + if timer > 0.25 then -- Slow health regeneration, and hunger damage (every 4s). -- Regeneration rate based on tutorial video . -- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate. @@ -166,9 +166,9 @@ minetest.register_globalstep(function(dtime) end end end - if timer > 0.5 then + if timer > 0.25 then timer = 0 - timerMult = timerMult + 1 + timerMult = timerMult + 2 if timerMult > 7 then timerMult = 0 end From 0ad03acf469a900ff11009cd3a843783b5845aea Mon Sep 17 00:00:00 2001 From: AFCMS Date: Thu, 13 May 2021 22:55:17 +0200 Subject: [PATCH 12/24] improve mcl_worlds API --- mods/CORE/mcl_worlds/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/CORE/mcl_worlds/init.lua b/mods/CORE/mcl_worlds/init.lua index 6cdeaab7e0..435ce51c7f 100644 --- a/mods/CORE/mcl_worlds/init.lua +++ b/mods/CORE/mcl_worlds/init.lua @@ -112,10 +112,11 @@ local last_dimension = {} -- * player: Player who changed the dimension -- * dimension: New dimension ("overworld", "nether", "end", "void") function mcl_worlds.dimension_change(player, dimension) + local playername = player:get_player_name() for i=1, #mcl_worlds.registered_on_dimension_change do - mcl_worlds.registered_on_dimension_change[i](player, dimension) - last_dimension[player:get_player_name()] = dimension + mcl_worlds.registered_on_dimension_change[i](player, dimension, last_dimension[playername]) end + last_dimension[playername] = dimension end ----------------------- INTERNAL STUFF ---------------------- From d5ec2ccbd8f02f23482711be60260407bce70b9b Mon Sep 17 00:00:00 2001 From: AFCMS Date: Thu, 13 May 2021 23:09:47 +0200 Subject: [PATCH 13/24] fix doc --- mods/CORE/mcl_worlds/API.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/CORE/mcl_worlds/API.md b/mods/CORE/mcl_worlds/API.md index a5509431c2..dd96b01b54 100644 --- a/mods/CORE/mcl_worlds/API.md +++ b/mods/CORE/mcl_worlds/API.md @@ -61,20 +61,21 @@ In mc, you cant use clock in the nether and the end. * pos: position -## mcl_worlds.register_on_dimension_change(function(player, dimension)) +## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension)) Register a callback function func(player, dimension). It will be called whenever a player changes between dimensions. The void counts as dimension. -* player: player, the player who changed the dimension -* dimension: position, The new dimension of the player ("overworld", "nether", "end", "void"). +* player: player, the player who changed of dimension +* dimension: string, The new dimension of the player ("overworld", "nether", "end", "void"). +* last_dimension: string, The dimension where the player was ("overworld", "nether", "end", "void"). ## mcl_worlds.registered_on_dimension_change Table containing all function registered with mcl_worlds.register_on_dimension_change() ## mcl_worlds.dimension_change(player, dimension) -Notify this mod of a dimmension change of to +Notify this mod of a dimension change of to * player: player, player who changed the dimension * dimension: string, new dimension ("overworld", "nether", "end", "void") \ No newline at end of file From 866c097d56b12a8ada819abff86a49b59269edf5 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 14 May 2021 09:19:44 +0200 Subject: [PATCH 14/24] fix typo --- mods/ENTITIES/mobs_mc/guardian_elder.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 4fb989e2fb..e44796bad6 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -15,7 +15,7 @@ mobs:register_mob("mobs_mc:guardian_elder", { xp_min = 10, xp_max = 10, breath_max = -1, - passive = false, + passive = false, attack_type = "punch", pathfinding = 1, view_range = 16, From 86d1e0ac12046ec521207a5169aab1b69479f4c2 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 14 May 2021 09:34:40 +0200 Subject: [PATCH 15/24] fix duplicated assignement --- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index 3476bee4c7..c947e91859 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -15,7 +15,7 @@ with name "mobs_mc_gameconfig". ]] -- Set to false in your gameconfig mod if you create your own monster egg nodes. mobs_mc.create_monster_egg_nodes = true -mobs_mc.items = {} +--mobs_mc.items = {} mobs_mc.items = { -- Items defined in mobs_mc From bcea5a35efd1b69b32a3f7208b8ad611a28bdd64 Mon Sep 17 00:00:00 2001 From: Code-Sploit Date: Fri, 14 May 2021 08:22:10 +0000 Subject: [PATCH 16/24] Try to fix unknown variable in mcl_chorus_flower --- mods/MAPGEN/mcl_biomes/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 3655be7ebe..d4ebe00d33 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3974,7 +3974,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 = {} - local pr = PseudoRandom(blockseed + 14) + 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 f4c302e582319e2d92b3006384ee59901be213ec Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 14 May 2021 10:07:42 +0000 Subject: [PATCH 17/24] Fix #1718 (Give potion particles the same color as in mc) part1 --- mods/ITEMS/mcl_potions/potions.lua | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 2d76a217b0..b9c2aad24d 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -459,7 +459,7 @@ local healing_def = { _tt = S("+4 HP"), _tt_2 = S("+8 HP"), _longdesc = S("Instantly heals."), - color = "#CC0000", + color = "#F82423", effect = 4, instant = true, on_use = mcl_potions.healing_func, @@ -473,7 +473,7 @@ local harming_def = { _tt = S("-6 HP"), _tt_II = S("-12 HP"), _longdesc = S("Instantly deals damage."), - color = "#660099", + color = "#430A09", effect = -6, instant = true, on_use = mcl_potions.healing_func, @@ -486,7 +486,7 @@ local night_vision_def = { description = S("Night Vision"), _tt = nil, _longdesc = S("Increases the perceived brightness of light under a dark sky."), - color = "#1010AA", + color = "#1F1FA1", effect = nil, is_dur = true, on_use = mcl_potions.night_vision_func, @@ -498,7 +498,7 @@ local swiftness_def = { description = S("Swiftness"), _tt = nil, _longdesc = S("Increases walking speed."), - color = "#009999", + color = "#7CAFC6", effect = 1.2, is_dur = true, on_use = mcl_potions.swiftness_func, @@ -511,7 +511,7 @@ local slowness_def = { description = S("Slowness"), _tt = nil, _longdesc = S("Decreases walking speed."), - color = "#000080", + color = "#5A6C81", effect = 0.85, is_dur = true, on_use = mcl_potions.swiftness_func, @@ -525,7 +525,7 @@ local leaping_def = { description = S("Leaping"), _tt = nil, _longdesc = S("Increases jump strength."), - color = "#00CC33", + color = "#22FF4C", effect = 1.15, is_dur = true, on_use = mcl_potions.leaping_func, @@ -538,7 +538,7 @@ local poison_def = { description = S("Poison"), _tt = nil, _longdesc = S("Applies the poison effect which deals damage at a regular interval."), - color = "#447755", + color = "#4E9331", effect = 2.5, is_dur = true, on_use = mcl_potions.poison_func, @@ -552,7 +552,7 @@ local regeneration_def = { description = S("Regeneration"), _tt = nil, _longdesc = S("Regenerates health over time."), - color = "#B52CC2", + color = "#CD5CAB", effect = 2.5, is_dur = true, on_use = mcl_potions.regeneration_func, @@ -565,7 +565,7 @@ local invisibility_def = { description = S("Invisibility"), _tt = nil, _longdesc = S("Grants invisibility."), - color = "#B0B0B0", + color = "#7F8392", is_dur = true, on_use = mcl_potions.invisiblility_func, is_plus = true, @@ -576,7 +576,7 @@ local water_breathing_def = { description = S("Water Breathing"), _tt = nil, _longdesc = S("Grants limitless breath underwater."), - color = "#0000AA", + color = "#2E5299", is_dur = true, on_use = mcl_potions.water_breathing_func, is_plus = true, @@ -587,7 +587,7 @@ local fire_resistance_def = { description = S("Fire Resistance"), _tt = nil, _longdesc = S("Grants immunity to damage from heat sources like fire."), - color = "#D0A040", + color = "#E49A3A", is_dur = true, on_use = mcl_potions.fire_resistance_func, is_plus = true, @@ -611,22 +611,22 @@ end -- description = S("Weakness"), -- _tt_help = TODO, -- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#6600AA"), --- inventory_image = potion_image("#6600AA"), +-- wield_image = potion_image("#484D48"), +-- inventory_image = potion_image("#484D48"), -- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- stack_max = 1, -- -- on_place = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#6600AA") +-- mcl_potions._use_potion(itemstack, user, "#484D48") -- return itemstack -- end, -- -- on_secondary_use = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#6600AA") +-- mcl_potions._use_potion(itemstack, user, "#484D48") -- return itemstack -- end -- }) @@ -635,22 +635,22 @@ end -- description = S("Weakness +"), -- _tt_help = TODO, -- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#7700BB"), --- inventory_image = potion_image("#7700BB"), +-- wield_image = potion_image("#484D48"), +-- inventory_image = potion_image("#484D48"), -- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- stack_max = 1, -- -- on_place = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#7700BB") +-- mcl_potions._use_potion(itemstack, user, "#484D48") -- return itemstack -- end, -- -- on_secondary_use = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#7700BB") +-- mcl_potions._use_potion(itemstack, user, "#484D48") -- return itemstack -- end -- }) @@ -659,22 +659,22 @@ end -- description = S("Strength"), -- _tt_help = TODO, -- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#D444D4"), --- inventory_image = potion_image("#D444D4"), +-- wield_image = potion_image("#932423"), +-- inventory_image = potion_image("#932423"), -- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- stack_max = 1, -- -- on_place = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444D4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end, -- -- on_secondary_use = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444D4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end -- }) @@ -683,22 +683,22 @@ end -- description = S("Strength II"), -- _tt_help = TODO, -- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#D444E4"), --- inventory_image = potion_image("#D444E4"), +-- wield_image = potion_image("#932423"), +-- inventory_image = potion_image("#932423"), -- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- stack_max = 1, -- -- on_place = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444E4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end, -- -- on_secondary_use = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444E4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end -- }) @@ -707,22 +707,22 @@ end -- description = S("Strength +"), -- _tt_help = TODO, -- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#D444F4"), --- inventory_image = potion_image("#D444F4"), +-- wield_image = potion_image("#932423"), +-- inventory_image = potion_image("#932423"), -- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- stack_max = 1, -- -- on_place = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444F4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end, -- -- on_secondary_use = function(itemstack, user, pointed_thing) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#D444F4") +-- mcl_potions._use_potion(itemstack, user, "#932423") -- return itemstack -- end -- }) From be9fb5be47aa1e848f04746617f870eaf293f297 Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 14 May 2021 10:07:58 +0000 Subject: [PATCH 18/24] Fix #1718 (Give potion particles the same color as in mc) part2 --- mods/ITEMS/mcl_potions/functions.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 55a98ba9de..b4e1d94487 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -107,7 +107,7 @@ minetest.register_globalstep(function(dtime) EF.invisible[player].timer = EF.invisible[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#B0B0B0") end + if player:get_pos() then mcl_potions._add_spawner(player, "#7F8392") end if EF.invisible[player].timer >= EF.invisible[player].dur then mcl_potions.make_invisible(player, false) @@ -129,7 +129,7 @@ minetest.register_globalstep(function(dtime) EF.poisoned[player].timer = EF.poisoned[player].timer + dtime EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#225533") end + if player:get_pos() then mcl_potions._add_spawner(player, "#4E9331") end if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then if mcl_util.get_hp(player) - 1 > 0 then @@ -158,7 +158,7 @@ minetest.register_globalstep(function(dtime) EF.regenerating[player].timer = EF.regenerating[player].timer + dtime EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end + if player:get_pos() then mcl_potions._add_spawner(player, "#CD5CAB") end if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then @@ -192,7 +192,7 @@ minetest.register_globalstep(function(dtime) EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#0000AA") end + if player:get_pos() then mcl_potions._add_spawner(player, "#2E5299") end if player:get_breath() then if player:get_breath() < 10 then player:set_breath(10) end @@ -217,7 +217,7 @@ minetest.register_globalstep(function(dtime) EF.leaping[player].timer = EF.leaping[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#00CC33") end + if player:get_pos() then mcl_potions._add_spawner(player, "#22FF4C") end if EF.leaping[player].timer >= EF.leaping[player].dur then playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping") @@ -239,7 +239,7 @@ minetest.register_globalstep(function(dtime) EF.swift[player].timer = EF.swift[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#009999") end + if player:get_pos() then mcl_potions._add_spawner(player, "#7CAFC6") end if EF.swift[player].timer >= EF.swift[player].dur then playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness") @@ -261,7 +261,7 @@ minetest.register_globalstep(function(dtime) EF.night_vision[player].timer = EF.night_vision[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#1010AA") end + if player:get_pos() then mcl_potions._add_spawner(player, "#1F1FA1") end if EF.night_vision[player].timer >= EF.night_vision[player].dur then EF.night_vision[player] = nil @@ -286,7 +286,7 @@ minetest.register_globalstep(function(dtime) EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#E0B050") end + if player:get_pos() then mcl_potions._add_spawner(player, "#E49A3A") end if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then EF.fire_proof[player] = nil @@ -307,7 +307,7 @@ minetest.register_globalstep(function(dtime) EF.weak[player].timer = EF.weak[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end + if player:get_pos() then mcl_potions._add_spawner(player, "#484D48") end if EF.weak[player].timer >= EF.weak[player].dur then EF.weak[player] = nil @@ -328,7 +328,7 @@ minetest.register_globalstep(function(dtime) EF.strong[player].timer = EF.strong[player].timer + dtime - if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end + if player:get_pos() then mcl_potions._add_spawner(player, "#932423") end if EF.strong[player].timer >= EF.strong[player].dur then EF.strong[player] = nil From 9e095980c8427da79da234723114fa053d9b725a Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 14 May 2021 15:00:34 +0000 Subject: [PATCH 19/24] Simplify wooden planks crafting even more --- mods/ITEMS/mcl_core/crafting.lua | 43 +++++++++++--------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index 44f49a4d4d..f031c7ca2f 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -13,36 +13,21 @@ local craft_planks = function(output, input) }) end -craft_planks("", "tree") -craft_planks("", "tree_bark") -craft_planks("", "stripped_oak") -craft_planks("", "stripped_oak_bark") - -craft_planks("dark", "darktree") -craft_planks("dark", "darktree_bark") -craft_planks("dark", "stripped_dark_oak") -craft_planks("dark", "stripped_dark_oak_bark") - -craft_planks("jungle", "jungletree") -craft_planks("jungle", "jungletree_bark") -craft_planks("jungle", "stripped_jungle") -craft_planks("jungle", "stripped_jungle_bark") - -craft_planks("acacia", "acaciatree") -craft_planks("acacia", "acaciatree_bark") -craft_planks("acacia", "stripped_acacia") -craft_planks("acacia", "stripped_acacia_bark") - -craft_planks("spruce", "sprucetree") -craft_planks("spruce", "sprucetree_bark") -craft_planks("spruce", "stripped_spruce") -craft_planks("spruce", "stripped_spruce_bark") - -craft_planks("birch", "birchtree") -craft_planks("birch", "birchtree_bark") -craft_planks("birch", "stripped_birch") -craft_planks("birch", "stripped_birch_bark") +local planks = { + {"", "oak"}, + {"dark", "dark_oak"}, + {"jungle", "jungle"}, + {"acacia", "acacia"}, + {"spruce", "spruce"}, + {"birch", "birch"} +} +for _, p in pairs(planks) do + craft_planks(p[1], p[1].."tree") + craft_planks(p[1], p[1].."tree_bark") + craft_planks(p[1], "stripped_"..p[2]) + craft_planks(p[1], "stripped_"..p[2].."_bark") +end minetest.register_craft({ type = 'shapeless', From 9ae11194386aedcdeae247d4aca2350fd8f23a03 Mon Sep 17 00:00:00 2001 From: kay27 Date: Sat, 15 May 2021 03:17:16 +0400 Subject: [PATCH 20/24] [mcl_mobs] Fix server crash for mobs in unloaded areas, https://git.minetest.land/MineClone2/MineClone2/issues/1703 --- mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index eda7e88711..d75bda6c6b 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -938,10 +938,13 @@ mobs.mob_step = function(self, dtime) end end - if self.burn_timer == 0 and minetest_get_node_light(pos) > 12 and minetest_get_node_light(pos, 0.5) == 15 then - mcl_burning.set_on_fire(self.object, 1) - self.burn_timer = 1 --1.7 seconds - self.pause_timer = 0.4 + if self.burn_timer == 0 then + local light_current, light_day = minetest_get_node_light(pos), minetest_get_node_light(pos, 0.5) + if light_current and light_day and light_current > 12 and light_day == 15 then + mcl_burning.set_on_fire(self.object, 1) + self.burn_timer = 1 --1.7 seconds + self.pause_timer = 0.4 + end end end From cb82e3c9c55f7f9dd3269c870419987f64772c37 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sun, 16 May 2021 21:13:07 +0000 Subject: [PATCH 21/24] Make a cobweb protect from fall damage --- mods/PLAYER/mcl_playerplus/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 9436ae94da..7b7920ee09 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -549,6 +549,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) end return 0 end + if node.name == "mcl_core:cobweb" then + return 0 + end end pos = vector.add(pos, step) node = minetest.get_node(pos) From 04436ea5f765edc26529122f3586b59058604f80 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 18 May 2021 16:34:20 +0200 Subject: [PATCH 22/24] Fix that fucking mending armor crash --- mods/HUD/mcl_experience/init.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index fd78534fc9..b52611d5af 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -275,10 +275,6 @@ function mcl_experience.add_experience(player, experience) end stack:set_wear(math.floor(new_wear)) inv:set_stack(list, index, stack) - if can.list == "armor" then - local armor_inv = minetest.get_inventory({type = "detached", name = player:get_player_name() .. "_armor"}) - armor_inv:set_stack(list, index, stack) - end end local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level From f7052943ec8ef4ddbde3e1bcf6b50487bd3cfa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 1 May 2021 15:37:14 +0200 Subject: [PATCH 23/24] Fix rays not being cast in a specific direction A bug was introduced in 679e2b1b which caused explosions to not cast rays for environment destruction in the (+X, +Y, +Z) direction. This commit fixes that. --- mods/CORE/mcl_explosions/init.lua | 76 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index e59e3ea123..d3fb882ce0 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -66,46 +66,44 @@ local function compute_sphere_rays(radius) local rays = {} local sphere = {} - for i=1, 2 do + local function add_ray(pos) + sphere[hash_node_position(pos)] = pos + end + + for y = -radius, radius do + for z = -radius, radius do + for x = -radius, 0 do + local d = x * x + y * y + z * z + if d <= radius * radius then + add_ray(vector.new(x, y, z)) + add_ray(vector.new(-x, y, z)) + break + end + end + end + end + + for x = -radius, radius do + for z = -radius, radius do + for y = -radius, 0 do + local d = x * x + y * y + z * z + if d <= radius * radius then + add_ray(vector.new(x, y, z)) + add_ray(vector.new(x, -y, z)) + break + end + end + end + end + + for x = -radius, radius do for y = -radius, radius do - for z = -radius, radius do - for x = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[hash_node_position(pos)] = pos - break - end - end - end - end - end - - for i=1,2 do - for x = -radius, radius do - for z = -radius, radius do - for y = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[hash_node_position(pos)] = pos - break - end - end - end - end - end - - for i=1,2 do - for x = -radius, radius do - for y = -radius, radius do - for z = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[hash_node_position(pos)] = pos - break - end + for z = -radius, 0 do + local d = x * x + y * y + z * z + if d <= radius * radius then + add_ray(vector.new(x, y, z)) + add_ray(vector.new(x, y, -z)) + break end end end From 4d13eddcd6b2ee5321a42d1fe46e241fa7cfc631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 8 May 2021 19:59:48 +0200 Subject: [PATCH 24/24] Adjust explosion entity damage hitbox In mcl_explosions the hitbox used for calculating the damage of an entity is its collisionbox multiplied by two. This commit removes the multiplication by two because that makes explosion damage behave weirdly in some circumstances. It was most likely implemented that way because of a misinterpretation of the Minecraft wiki. --- mods/CORE/mcl_explosions/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index d3fb882ce0..dfae884cd5 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -258,12 +258,12 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc if collisionbox then -- Create rays from random points in the collision box - local x1 = collisionbox[1] * 2 - local y1 = collisionbox[2] * 2 - local z1 = collisionbox[3] * 2 - local x2 = collisionbox[4] * 2 - local y2 = collisionbox[5] * 2 - local z2 = collisionbox[6] * 2 + local x1 = collisionbox[1] + local y1 = collisionbox[2] + local z1 = collisionbox[3] + local x2 = collisionbox[4] + local y2 = collisionbox[5] + local z2 = collisionbox[6] local x_len = math.abs(x2 - x1) local y_len = math.abs(y2 - y1) local z_len = math.abs(z2 - z1)