From df60ec947d36a7c152bd24610761baae89dc5086 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 16 Aug 2024 21:58:04 +0200 Subject: [PATCH 001/273] Not all mangrove trees were post-processed (#4584) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mangrove tree variants 4, 5 and bees nest were not post processed with root growth. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4584 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_biomes/init.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index b3b825071..2cde3fc2a 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -4027,7 +4027,7 @@ local function register_decorations() rotation = "random", }) minetest.register_decoration({ - name = "mcl_biomes:mangrove_tree_4", + name = "mcl_biomes:mangrove_tree_5", deco_type = "schematic", place_on = {"mcl_mud:mud"}, sidelen = 80, @@ -4040,6 +4040,7 @@ local function register_decorations() rotation = "random", }) minetest.register_decoration({ + name = "mcl_biomes:mangrove_bee_nest", deco_type = "schematic", place_on = {"mcl_mud:mud"}, sidelen = 80, @@ -6099,6 +6100,9 @@ if mg_name ~= "singlenode" then minetest.get_decoration_id("mcl_biomes:mangrove_tree_1"), minetest.get_decoration_id("mcl_biomes:mangrove_tree_2"), minetest.get_decoration_id("mcl_biomes:mangrove_tree_3"), + minetest.get_decoration_id("mcl_biomes:mangrove_tree_4"), + minetest.get_decoration_id("mcl_biomes:mangrove_tree_5"), + minetest.get_decoration_id("mcl_biomes:mangrove_bee_nest"), } for _, f in pairs(deco_ids_fungus) do minetest.set_gen_notify({decoration = true}, {f}) @@ -6158,29 +6162,20 @@ if mg_name ~= "singlenode" then if not (maxp.y < mcl_vars.mg_overworld_min or minp.y > mcl_vars.mg_overworld_max) then local biomemap = minetest.get_mapgen_object("biomemap") - --minetest.log("mangrove stuff: " .. dump(biomemap)) local swamp_biome_id = minetest.get_biome_id("MangroveSwamp") local swamp_shore_id = minetest.get_biome_id("MangroveSwamp_shore") local is_swamp = table.indexof(biomemap, swamp_biome_id) ~= -1 local is_swamp_shore = table.indexof(biomemap, swamp_shore_id) ~= -1 - if is_swamp or is_swamp_shore then - --minetest.log("Mangrove swamp biomes...") - --minetest.log("is_swamp: " .. dump(is_swamp)) - --minetest.log("is_swamp_shore: " .. dump(is_swamp_shore)) mangrove_roots_gen(gennotify, pr) - else - --minetest.log("is not mangrove swamp biomes...") end end if not (maxp.y < mcl_vars.mg_end_min or minp.y > mcl_vars.mg_end_max) then - --minetest.log("chorus stuff") chorus_gen(gennotify, pr) end if not (maxp.y < mcl_vars.mg_nether_min or minp.y > mcl_vars.mg_nether_max) then - --minetest.log("nether stuff") crimson_warped_gen(gennotify) end end) From 5e6e4967f0fdeca5e771ba412d6a320497f576b7 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 16 Aug 2024 22:01:19 +0200 Subject: [PATCH 002/273] Fix crying obsidian particles (#4583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LUAs `math.random(a,b)` expects a and b to be integers. `size` was only randomized once. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4583 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_core/functions.lua | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index b520777d6..64d3e2197 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1658,32 +1658,30 @@ end -- Obsidian crying - local crobby_particle = { - velocity = vector.new(0,0,0), - size = math.random(1.3,2.5), + velocity = vector.zero(), + acceleration = vector.zero(), texture = "mcl_core_crying_obsidian_tear.png", + collisiondetection = false, collision_removal = false, } - minetest.register_abm({ label = "Obsidian cries", nodenames = {"mcl_core:crying_obsidian"}, interval = 5, chance = 10, action = function(pos, node) - minetest.after(math.random(0.1,1.5),function() + minetest.after(0.1 + math.random() * 1.4, function() local pt = table.copy(crobby_particle) - pt.acceleration = vector.new(0,0,0) - pt.collisiondetection = false - pt.expirationtime = math.random(0.5,1.5) - pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5)) + pt.size = 1.3 + math.random() * 1.2 + pt.expirationtime = 0.5 + math.random() + pt.pos = vector.offset(pos, math.random() - 0.5, -0.51, math.random() - 0.5) minetest.add_particle(pt) - minetest.after(pt.expirationtime,function() - pt.acceleration = vector.new(0,-9,0) + minetest.after(pt.expirationtime, function() + pt.acceleration = vector.new(0, -9, 0) pt.collisiondetection = true - pt.expirationtime = math.random(1.2,4.5) + pt.expirationtime = 1.2 + math.random() * 3.3 minetest.add_particle(pt) end) end) From ee4d1efaa5394887930a4cf9c8cdf7e93d177737 Mon Sep 17 00:00:00 2001 From: goodspeed Date: Fri, 16 Aug 2024 22:03:01 +0200 Subject: [PATCH 003/273] Turn 8 snow layers stacked together into snow block (fixes #4483) (#4591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4591 Reviewed-by: Mikita Wiśniewski Co-authored-by: goodspeed Co-committed-by: goodspeed --- mods/ITEMS/mcl_core/nodes_base.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index db2561082..28e83a7a7 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -1051,7 +1051,15 @@ for i=1,8 do local itemstring = itemstack:get_name() local itemcount = itemstack:get_count() local fakestack = ItemStack(itemstring.." "..itemcount) - fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g))) + if i+g < 8 then + fakestack:set_name("mcl_core:snow_"..(i+g)) + else + -- To stack `mcl_core:snow_8', just replacing it with `mcl_core:snowblock' Issue#4483 + if i+g == 9 then + fakestack:set_count(itemcount + 1) + end + fakestack:set_name("mcl_core:snowblock") + end 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) From 86e344640708d65a964b6cf4e8c600219832c5c6 Mon Sep 17 00:00:00 2001 From: THE-NERD2 Date: Fri, 16 Aug 2024 22:21:18 +0200 Subject: [PATCH 004/273] Update mount.lua to fix horse riding problem (#4580) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, horses would continue to move even after the movement key was released. This was because mcl_mobs.drive was returning before stopping the horse. This commit makes mcl_mobs.drive stop the horse before returning. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4580 Reviewed-by: Mikita Wiśniewski Co-authored-by: THE-NERD2 Co-committed-by: THE-NERD2 --- mods/ENTITIES/mcl_mobs/mount.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/mount.lua b/mods/ENTITIES/mcl_mobs/mount.lua index 21c52157a..e6b6de78f 100644 --- a/mods/ENTITIES/mcl_mobs/mount.lua +++ b/mods/ENTITIES/mcl_mobs/mount.lua @@ -258,6 +258,18 @@ function mcl_mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) end end + -- Stop! + local s = get_sign(entity.v) + + entity.v = entity.v - 0.02 * s + + if s ~= get_sign(entity.v) then + + entity.object:set_velocity({x = 0, y = 0, z = 0}) + entity.v = 0 + return + end + -- if not moving then set animation and return if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then @@ -273,18 +285,6 @@ function mcl_mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) mcl_mobs:set_animation(entity, moving_anim) end - -- Stop! - local s = get_sign(entity.v) - - entity.v = entity.v - 0.02 * s - - if s ~= get_sign(entity.v) then - - entity.object:set_velocity({x = 0, y = 0, z = 0}) - entity.v = 0 - return - end - -- enforce speed limit forward and reverse local max_spd = entity.max_speed_reverse From 95aadd40b9e2bf0b5968fa5ed53f903838f051fb Mon Sep 17 00:00:00 2001 From: blitzdoughnuts Date: Fri, 16 Aug 2024 22:28:08 +0200 Subject: [PATCH 005/273] Add charcoal blocks as an item (#4589) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: blitzdoughnuts Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4589 Reviewed-by: Mikita Wiśniewski Co-authored-by: blitzdoughnuts Co-committed-by: blitzdoughnuts --- LEGAL.md | 3 +++ mods/ITEMS/mcl_core/crafting.lua | 22 +++++++++++++++++++ mods/ITEMS/mcl_core/locale/mcl_core.de.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.es.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.fr.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.ja.tr | 4 +++- mods/ITEMS/mcl_core/locale/mcl_core.pl.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.ru.tr | 2 ++ mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr | 2 ++ mods/ITEMS/mcl_core/locale/template.txt | 2 ++ mods/ITEMS/mcl_core/nodes_base.lua | 12 ++++++++++ textures/mcl_core_charcoal_block.png | Bin 0 -> 224 bytes 13 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 textures/mcl_core_charcoal_block.png diff --git a/LEGAL.md b/LEGAL.md index d95f17624..a9c1be5ea 100644 --- a/LEGAL.md +++ b/LEGAL.md @@ -46,6 +46,9 @@ Armor trim models were created by Aeonix_Aeon Source: License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) +Charcoal block texture was created by [blitzdoughnuts](https://gitlab.com/ApplemunchFromDaDead), based on the Pixel Perfection coal block. +License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/) + The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/) All other files, unless mentioned otherwise, fall under: diff --git a/mods/ITEMS/mcl_core/crafting.lua b/mods/ITEMS/mcl_core/crafting.lua index ffba04a7b..7baddbefd 100644 --- a/mods/ITEMS/mcl_core/crafting.lua +++ b/mods/ITEMS/mcl_core/crafting.lua @@ -165,6 +165,22 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "mcl_core:charcoalblock", + recipe = { + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + {"mcl_core:charcoal_lump", "mcl_core:charcoal_lump", "mcl_core:charcoal_lump"}, + } +}) + +minetest.register_craft({ + output = "mcl_core:charcoal_lump 9", + recipe = { + {"mcl_core:charcoalblock"}, + } +}) + minetest.register_craft({ output = "mcl_core:ironblock", recipe = { @@ -497,6 +513,12 @@ minetest.register_craft({ burntime = 800, }) +minetest.register_craft({ + type = "fuel", + recipe = "mcl_core:charcoalblock", + burntime = 800, +}) + minetest.register_craft({ type = "fuel", recipe = "mcl_core:coal_lump", diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index 4f9071825..3be982bbb 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Birkenholzplanken Birch leaves are grown from birch trees.=Birkenblätter wachsen an Birken. Black Stained Glass=Schwarzes Buntglas Block of Coal=Kohleblock +Block of Charcoal= Block of Diamond=Diamantblock Block of Emerald=Smaragdblock Block of Gold=Goldblock Block of Iron=Eisenblock Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Kohleblöcke sind für eine kompakte Aufbewahrung von Kohle nützlich und sehr nützlich als Ofenbrennstoff. Ein Kohleblock ist so effizient wie 10 mal Kohle. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Blaues Buntglas Bone Block=Knochenblock Bone blocks are decorative blocks and a compact storage of bone meal.=Knochenblöcke sind Deko-Blöcke und geeignet zur kompakten Aufbewahrung von Knochenmehl. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.es.tr b/mods/ITEMS/mcl_core/locale/mcl_core.es.tr index cf16e5bda..9d276152e 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.es.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.es.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Madera de abedul Birch leaves are grown from birch trees.=Las hojas de abedul se cultivan a partir de abedules. Black Stained Glass=Cristal negro Block of Coal=Bloque de carbón +Block of Charcoal= Block of Diamond=Bloque de diamante Block of Emerald=Bloque de esmeralda Block of Gold=Bloque de oro Block of Iron=Bloque de hierro Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Los bloques de carbón son útiles como almacenamiento compacto de carbón y son muy útiles como combustible de horno. Un bloque de carbón es tan eficiente como 10 de carbón. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Cristal azul Bone Block=Bloque de hueso Bone blocks are decorative blocks and a compact storage of bone meal.=Los bloques óseos son bloques decorativos y un almacenamiento compacto de harina de huesos. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr b/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr index db90b43c6..bd0809653 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.fr.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Planches de bouleau Birch leaves are grown from birch trees.=Les feuilles de bouleau poussent sur les bouleaux. Black Stained Glass=Verre noir Block of Coal=Bloc de charbon +Block of Charcoal= Block of Diamond=Bloc de diamant Block of Emerald=Bloc d'émeraude Block of Gold=Bloc d'or Block of Iron=Bloc de fer Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Les blocs de charbon sont utiles pour stocker du charbon et très utiles comme combustible de four. Un bloc de charbon est aussi efficace que 10 charbon. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Verre bleu Bone Block=Bloc d'os Bone blocks are decorative blocks and a compact storage of bone meal.=Les blocs d'os sont des blocs décoratifs et servent à stocker la poudre d'os. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr b/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr index 401b02700..a722d51c9 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.ja.tr @@ -35,11 +35,13 @@ Birch Wood Planks=シラカバの板材 Birch leaves are grown from birch trees.=シラカバの葉は、シラカバの木から育ちます。 Black Stained Glass=黒色ガラス Block of Coal=石炭ブロック +Block of Charcoal= Block of Diamond=ダイヤモンドブロック Block of Emerald=エメラルドブロック Block of Gold=金ブロック Block of Iron=鉄ブロック Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=石炭ブロックは、石炭をコンパクトに保管でき、炉の燃料として非常に便利です。1個の石炭ブロックは、10個の石炭と同じ効率です。 +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=青色ガラス Bone Block=骨ブロック Bone blocks are decorative blocks and a compact storage of bone meal.=骨ブロックは装飾用ブロックで、骨粉をコンパクトに保管できます。 @@ -283,4 +285,4 @@ Grows on sand or dirt next to water=水辺の砂や土の上に生育 Stackable=スタック可能 Crying Obsidian=泣く黒曜石 Crying obsidian is a luminous obsidian that can generate as part of ruined portals.=泣く黒曜石は、廃墟のポータルの一部として生成可能な、発光する黒曜石です。 -Enchanted Golden Apple=エンチャントされた金のリンゴ \ No newline at end of file +Enchanted Golden Apple=エンチャントされた金のリンゴ diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr b/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr index 669e4bc9b..94b19a4e8 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.pl.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Brzozowe deski Birch leaves are grown from birch trees.=Brzozowe liście rosną na brzozach. Black Stained Glass=Czarne szkło Block of Coal=Blok węgla +Block of Charcoal= Block of Diamond=Blok diamentu Block of Emerald=Blok szmaragdu Block of Gold=Blok złota Block of Iron=Blok żelaza Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Bloki węgla są użyteczne do kompaktowego przechowywania diamentów i bardzo użyteczne jako paliwo do pieca. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Niebieskie szkło Bone Block=Blok kości Bone blocks are decorative blocks and a compact storage of bone meal.=Bloki kości są blokami dekoracyjnymi i są użyteczne do kompaktowego przechowywania mączki kostnej. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr b/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr index c8ed5b8c3..b593181e2 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.pt_BR.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Tábuas de Bétula Birch leaves are grown from birch trees.=Folhas de bétula crescem a partir de árvores de bétula. Black Stained Glass=Vidro Tingido de Preto Block of Coal=Bloco de Carvão +Block of Charcoal= Block of Diamond=Bloco de Diamante Block of Emerald=Bloco de Esmeralda Block of Gold=Bloco de Ouro Block of Iron=Bloco de Ferro Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Blocos de carvão são úteis para armzenad carvão de forma compacta e muito úteis como combustível de fornalas. Um bloco de carvão é tão eficiente quanto 10 carvões. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=Vidro Tingido de Azul Bone Block=Bloco de Osso Bone blocks are decorative blocks and a compact storage of bone meal.=Blocos de osso são blocos decorativos e uma forma compacta de armazenar farinha de osso. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr b/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr index 6f29bd37e..25cb17343 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.ru.tr @@ -35,11 +35,13 @@ Birch Wood Planks=Берёзовые доски Birch leaves are grown from birch trees.=Листва берёзы произрастает на берёзах. Black Stained Glass=Чёрное стекло Block of Coal=Угольный блок +Block of Charcoal=Блок древесного угля Block of Diamond=Алмазный блок Block of Emerald=Изумрудный блок Block of Gold=Золотой блок Block of Iron=Железный блок Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=Угольный блок удобен для компактного хранения угля, а также полезен как топливо для печи. +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.=Блок древесного угля удобен для компактного хранения древесного угля, а также полезен как топливо для печи. Blue Stained Glass=Синее стекло Bone Block=Костный блок Bone blocks are decorative blocks and a compact storage of bone meal.=Костные блоки это декоративные блоки, а также способ компактного хранения костной муки. diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr b/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr index 74f3297a1..93fa55d1a 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.zh_TW.tr @@ -34,11 +34,13 @@ Birch Wood Planks=白樺樹木材 Birch leaves are grown from birch trees.=白樺樹葉是由白樺樹樹生長出來的。 Black Stained Glass=黑色玻璃 Block of Coal=煤炭磚 +Block of Charcoal= Block of Diamond=鑽石磚 Block of Emerald=綠寶石磚 Block of Gold=金磚 Block of Iron=鐵磚 Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.=煤炭磚作為煤炭的省位存儲方式,作為熔爐燃料非常有用。一個煤炭磚的燃燒時間相當於10塊煤炭。 +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass=藍色玻璃 Bone Block=骨塊 Bone blocks are decorative blocks and a compact storage of bone meal.=骨粉塊是一個裝飾方塊,也是骨粉的省位存儲方式。 diff --git a/mods/ITEMS/mcl_core/locale/template.txt b/mods/ITEMS/mcl_core/locale/template.txt index 911746699..6ea2e21f2 100644 --- a/mods/ITEMS/mcl_core/locale/template.txt +++ b/mods/ITEMS/mcl_core/locale/template.txt @@ -35,11 +35,13 @@ Birch Wood Planks= Birch leaves are grown from birch trees.= Black Stained Glass= Block of Coal= +Block of Charcoal= Block of Diamond= Block of Emerald= Block of Gold= Block of Iron= Blocks of coal are useful as a compact storage of coal and very useful as a furnace fuel. A block of coal is as efficient as 10 coal.= +Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal.= Blue Stained Glass= Bone Block= Bone blocks are decorative blocks and a compact storage of bone meal.= diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 28e83a7a7..b691c6dfe 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -798,6 +798,18 @@ minetest.register_node("mcl_core:coalblock", { _mcl_hardness = 5, }) +minetest.register_node("mcl_core:charcoalblock", { + description = S("Block of Charcoal"), + _doc_items_longdesc = S("Blocks of charcoal are useful as a compact storage of charcoal and very useful as a furnace fuel. A block of charcoal is as efficient as 10 charcoal."), + tiles = {"mcl_core_charcoal_block.png"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=1, flammable=1, building_block=1, material_stone=1, fire_encouragement=5, fire_flammability=5}, + sounds = mcl_sounds.node_sound_stone_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, +}) + minetest.register_node("mcl_core:ironblock", { description = S("Block of Iron"), _doc_items_longdesc = S("A block of iron is mostly a decorative block but also useful as a compact storage of iron ingots."), diff --git a/textures/mcl_core_charcoal_block.png b/textures/mcl_core_charcoal_block.png new file mode 100644 index 0000000000000000000000000000000000000000..bd33b910eefdd946b8f2f273c9f219d4495a4ed3 GIT binary patch literal 224 zcmV<603ZK}P)?2DmXqSH3b zWlF3U)Gv3zz!Ok0n((YZK@Rlllz{lE0te`~6R=eodnLTph%i87&4s-^y%Cx@Y(ulbW0000 Date: Fri, 16 Aug 2024 22:50:54 +0000 Subject: [PATCH 006/273] Make ladder placable on any solid block --- mods/ITEMS/mcl_core/nodes_climb.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_climb.lua b/mods/ITEMS/mcl_core/nodes_climb.lua index 0de0e9abd..e7c66ed1a 100644 --- a/mods/ITEMS/mcl_core/nodes_climb.lua +++ b/mods/ITEMS/mcl_core/nodes_climb.lua @@ -40,7 +40,7 @@ end minetest.register_node("mcl_core:ladder", { description = S("Ladder"), _doc_items_longdesc = S( - "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns."), + "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks."), drawtype = "signlike", is_ground_content = false, tiles = { "default_ladder.png" }, @@ -85,9 +85,8 @@ minetest.register_node("mcl_core:ladder", { end local groups = def.groups - -- Don't allow to place the ladder at particular nodes - if (groups and (groups.glass or groups.leaves or groups.slab)) or - node.name == "mcl_core:ladder" or node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then + -- Don't allow to place the ladder at non-solid nodes + if (groups and (not groups.solid)) then return itemstack end From c03f9abd184a74495ded0bc742bdae8e97e4ac4d Mon Sep 17 00:00:00 2001 From: William Goodspeed Date: Fri, 16 Aug 2024 22:52:58 +0000 Subject: [PATCH 007/273] Fix the placement check of ladder The old code takes the first return val of `minetest.item_place_node' which is `itemstack'. Therefore, the variable `success' in the old code is always true. The new code takes the second val which will be nil if an invalid node placement occured. This check is necessary since the ladder may be placed in the front of pointed block while there is a node with hole (slabs, fences etc.) at the same place resulting an invalid placement and sound played when it shouldn't be played. --- mods/ITEMS/mcl_core/nodes_climb.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_climb.lua b/mods/ITEMS/mcl_core/nodes_climb.lua index e7c66ed1a..88c5980b4 100644 --- a/mods/ITEMS/mcl_core/nodes_climb.lua +++ b/mods/ITEMS/mcl_core/nodes_climb.lua @@ -104,9 +104,10 @@ minetest.register_node("mcl_core:ladder", { return itemstack end local idef = itemstack:get_definition() - local success = minetest.item_place_node(itemstack, placer, pointed_thing) + local itemstack, pos = minetest.item_place_node(itemstack, placer, pointed_thing) - if success then + -- A non-nil pos indicates the node was placed in a valid position. + if pos then if idef.sounds and idef.sounds.place then minetest.sound_play(idef.sounds.place, { pos = above, gain = 1 }, true) end From ff386e395fedf48a795e0cca259acfbbb1e05bfe Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 13:47:18 +0200 Subject: [PATCH 008/273] Un-hardcode blast resistance, hardness for walls, now only based on their material --- mods/ITEMS/mcl_blackstone/init.lua | 13 +++++-------- mods/ITEMS/mcl_deepslate/init.lua | 7 ++++++- mods/ITEMS/mcl_ocean/prismarine.lua | 4 ++-- mods/ITEMS/mcl_walls/API.md | 4 +++- mods/ITEMS/mcl_walls/init.lua | 2 +- mods/ITEMS/mcl_walls/register.lua | 30 ++++++++++++++--------------- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 63d085877..66dac8558 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -230,14 +230,11 @@ mcl_walls.register_wall( "mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone", - { - "mcl_blackstone_top.png", - "mcl_blackstone_top.png", - "mcl_blackstone_side.png" - }, - "", - { cracky=3, pickaxey=1, material_stone=1 } -) + nil, + nil, + nil, + minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_hardness, + minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_blast_resistance) --lavacooling diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index 0abb0c579..637030059 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -221,7 +221,12 @@ local function register_deepslate_variant(item, desc, longdesc) mcl_walls.register_wall( "mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), - "mcl_deepslate:deepslate_"..item) + "mcl_deepslate:deepslate_"..item, + nil, + nil, + nil, + minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_hardness, + minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_blast_resistance) end end diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index fff07cb7e..71ffb94ce 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 1.5,--ffffixme _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 1.5,--fixmetoo _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index 63621ade1..567134ae7 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to VoxeLibre. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds, hardness, blast_resistance)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, hardness, blast_resistance, sounds)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -24,6 +24,8 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `tiles`: Wall textures table, same syntax as for `minetest.register_node` (optional if `source` is set) * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) +* `hardness`: Hardness of node (optional, default is 2) +* `blast_resistance`: Blast resistance of node (optional, default is 6 like most stone walls) * `sounds`: Sound table (optional, by default default uses stone sounds) * `hardness`: Hardness of node (optional, default matches `source` node or fallback value 2) * `blast_resistance`: Blast resistance of node (optional, default matches `source` node or fallback value 6) diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 09a35b549..15f7ae369 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -100,7 +100,7 @@ local full_blocks = { * hardness: Hardness of node (optional, default matches `source` node or fallback value 2) * blast_resistance: Blast resistance of node (optional, default matches `source` node or fallback value 6) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds, hardness, blast_resistance) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, hardness, blast_resistance, sounds) local base_groups = groups if not base_groups then diff --git a/mods/ITEMS/mcl_walls/register.lua b/mods/ITEMS/mcl_walls/register.lua index c2859935e..70bf187e8 100644 --- a/mods/ITEMS/mcl_walls/register.lua +++ b/mods/ITEMS/mcl_walls/register.lua @@ -1,17 +1,17 @@ local S = minetest.get_translator(minetest.get_current_modname()) -mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}) -mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}) -mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite") -mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite") -mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite") -mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block") -mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone") -mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone") -mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick") -mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy") -mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine") -mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks") -mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick") -mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick") -mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks") +mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:cobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:cobble"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite", nil, nil, nil, minetest.registered_nodes["mcl_core:andesite"]._mcl_hardness, minetest.registered_nodes["mcl_core:andesite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite", nil, nil, nil, minetest.registered_nodes["mcl_core:granite"]._mcl_hardness, minetest.registered_nodes["mcl_core:granite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite", nil, nil, nil, minetest.registered_nodes["mcl_core:diorite"]._mcl_hardness, minetest.registered_nodes["mcl_core:diorite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block", nil, nil, nil, minetest.registered_nodes["mcl_core:brick_block"]._mcl_hardness, minetest.registered_nodes["mcl_core:brick_block"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:sandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:sandstone"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine", nil, nil, nil, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_hardness, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks", nil, nil, nil, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks", nil, nil, nil, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_blast_resistance) From 7a05c3219828e608347ca5875e0b78df989460b0 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 13:49:00 +0200 Subject: [PATCH 009/273] Fix prismarine bricks and dark variant blast res. Should be 6 like regular prismarine --- mods/ITEMS/mcl_ocean/prismarine.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index 71ffb94ce..fff07cb7e 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5,--ffffixme + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5,--fixmetoo + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) From 5bce56cdd6e274cb1360f469e0d7a7051cdf2ebd Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 16:14:36 +0200 Subject: [PATCH 010/273] Walls use `source` parameter for default hardness and blast resistance If no `source` given, fallbacks are 2 and 6 respectively --- mods/ITEMS/mcl_deepslate/init.lua | 7 +------ mods/ITEMS/mcl_walls/API.md | 4 +--- mods/ITEMS/mcl_walls/init.lua | 2 +- mods/ITEMS/mcl_walls/register.lua | 30 +++++++++++++++--------------- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index 637030059..0abb0c579 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -221,12 +221,7 @@ local function register_deepslate_variant(item, desc, longdesc) mcl_walls.register_wall( "mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), - "mcl_deepslate:deepslate_"..item, - nil, - nil, - nil, - minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_hardness, - minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_blast_resistance) + "mcl_deepslate:deepslate_"..item) end end diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index 567134ae7..63621ade1 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to VoxeLibre. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, hardness, blast_resistance, sounds)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds, hardness, blast_resistance)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -24,8 +24,6 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `tiles`: Wall textures table, same syntax as for `minetest.register_node` (optional if `source` is set) * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) -* `hardness`: Hardness of node (optional, default is 2) -* `blast_resistance`: Blast resistance of node (optional, default is 6 like most stone walls) * `sounds`: Sound table (optional, by default default uses stone sounds) * `hardness`: Hardness of node (optional, default matches `source` node or fallback value 2) * `blast_resistance`: Blast resistance of node (optional, default matches `source` node or fallback value 6) diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 15f7ae369..09a35b549 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -100,7 +100,7 @@ local full_blocks = { * hardness: Hardness of node (optional, default matches `source` node or fallback value 2) * blast_resistance: Blast resistance of node (optional, default matches `source` node or fallback value 6) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, hardness, blast_resistance, sounds) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds, hardness, blast_resistance) local base_groups = groups if not base_groups then diff --git a/mods/ITEMS/mcl_walls/register.lua b/mods/ITEMS/mcl_walls/register.lua index 70bf187e8..c2859935e 100644 --- a/mods/ITEMS/mcl_walls/register.lua +++ b/mods/ITEMS/mcl_walls/register.lua @@ -1,17 +1,17 @@ local S = minetest.get_translator(minetest.get_current_modname()) -mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:cobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:cobble"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite", nil, nil, nil, minetest.registered_nodes["mcl_core:andesite"]._mcl_hardness, minetest.registered_nodes["mcl_core:andesite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite", nil, nil, nil, minetest.registered_nodes["mcl_core:granite"]._mcl_hardness, minetest.registered_nodes["mcl_core:granite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite", nil, nil, nil, minetest.registered_nodes["mcl_core:diorite"]._mcl_hardness, minetest.registered_nodes["mcl_core:diorite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block", nil, nil, nil, minetest.registered_nodes["mcl_core:brick_block"]._mcl_hardness, minetest.registered_nodes["mcl_core:brick_block"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:sandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:sandstone"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine", nil, nil, nil, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_hardness, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks", nil, nil, nil, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks", nil, nil, nil, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}) +mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}) +mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite") +mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite") +mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite") +mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block") +mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone") +mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone") +mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick") +mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy") +mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine") +mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks") +mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick") +mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick") +mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks") From 38d76091735a5d7c3c21ee68277d8f47c411ed10 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 17:11:35 +0200 Subject: [PATCH 011/273] Forgot about blackstone --- mods/ITEMS/mcl_blackstone/init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 66dac8558..5c63f8ee4 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -229,12 +229,8 @@ mcl_stairs.register_stair_and_slab("blackstone_brick_polished", "mcl_blackstone: mcl_walls.register_wall( "mcl_blackstone:wall", S("Blackstone Wall"), - "mcl_blackstone:blackstone", - nil, - nil, - nil, - minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_hardness, - minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_blast_resistance) + "mcl_blackstone:blackstone" +) --lavacooling From 1471ad7181c02d16cf5185f4694d1917c6c0056b Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 19 Sep 2023 18:35:39 +0200 Subject: [PATCH 012/273] Un-hardcode most slabs and stairs --- mods/ITEMS/mcl_cherry_blossom/nodes.lua | 4 +-- mods/ITEMS/mcl_mangrove/init.lua | 4 +-- mods/ITEMS/mcl_stairs/register.lua | 36 ++++++++++++------------- mods/ITEMS/mclx_stairs/init.lua | 14 +++++----- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 403982872..84d1a8a1b 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -51,13 +51,13 @@ mcl_stairs.register_stair("cherrywood", "mcl_cherry_blossom:cherrywood", {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_cherry_blossom_planks.png"}, S("Cherry Stairs"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("cherrywood", "mcl_cherry_blossom:cherrywood", {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_cherry_blossom_planks.png"}, S("Cherry Slab"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, S("Double Cherry Slab")) -- Signs diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index a8ab01370..ac02966f3 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -322,14 +322,14 @@ mcl_stairs.register_stair("mangrove_wood", "mcl_mangrove:mangrove_wood", {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_mangrove_planks.png"}, S("Mangrove Wood Stairs"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("mangrove_wood", "mcl_mangrove:mangrove_wood", {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {"mcl_mangrove_planks.png"}, S("Mangrove Wood Slab"), - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, S("Double Mangrove Wood Slab")) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index b59880e48..6138e692c 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -20,13 +20,13 @@ for w=1, #woods do {handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {wood[2]}, wood[3], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab(wood[1], "mcl_core:"..wood[1], {handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, {wood[2]}, wood[4], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, wood[5]) end @@ -47,7 +47,7 @@ mcl_stairs.register_slab("stone", "mcl_core:stone_smooth", {pickaxey=1, material_stone=1}, {"mcl_stairs_stone_slab_top.png", "mcl_stairs_stone_slab_top.png", "mcl_stairs_stone_slab_side.png"}, S("Polished Stone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Polished Stone Slab")) mcl_stairs.register_stair("andesite", "mcl_core:andesite", @@ -177,14 +177,14 @@ mcl_stairs.register_stair("stonebrick", "mcl_core:stonebrick", {pickaxey=1, material_stone=1}, {"default_stone_brick.png"}, S("Stone Bricks Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, - nil, "mcl_core:stonebrick") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + nil) mcl_stairs.register_slab("stonebrick", "mcl_core:stonebrick", {pickaxey=1, material_stone=1}, {"default_stone_brick.png"}, S("Stone Bricks Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Stone Bricks Slab"), "mcl_core:stonebrick") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Stone Bricks Slab")) mcl_stairs.register_stair("quartzblock", "mcl_nether:quartz_block", {pickaxey=1, material_stone=1}, @@ -216,14 +216,14 @@ mcl_stairs.register_stair_and_slab("nether_brick", "mcl_nether:nether_brick", {"mcl_nether_nether_brick.png"}, S("Nether Brick Stairs"), S("Nether Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Nether Brick Slab"), nil) mcl_stairs.register_stair_and_slab("red_nether_brick", "mcl_nether:red_nether_brick", {pickaxey=1, material_stone=1}, {"mcl_nether_red_nether_brick.png"}, S("Red Nether Brick Stairs"), S("Red Nether Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Red Nether Brick Slab"), nil) mcl_stairs.register_stair_and_slab("end_bricks", "mcl_end:end_bricks", @@ -298,52 +298,52 @@ mcl_stairs.register_slab("andesite_smooth", "mcl_core:andesite_smooth", {pickaxey=1}, {"mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_stairs_andesite_smooth_slab.png"}, S("Polished Andesite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Andesite Slab")) mcl_stairs.register_stair("andesite_smooth", "mcl_core:andesite_smooth", {pickaxey=1}, {"mcl_stairs_andesite_smooth_slab.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_core_andesite_smooth.png", "mcl_stairs_andesite_smooth_slab.png"}, S("Polished Andesite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("granite_smooth", "mcl_core:granite_smooth", {pickaxey=1}, {"mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_stairs_granite_smooth_slab.png"}, S("Polished Granite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Granite Slab")) mcl_stairs.register_stair("granite_smooth", "mcl_core:granite_smooth", {pickaxey=1}, {"mcl_stairs_granite_smooth_slab.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_core_granite_smooth.png", "mcl_stairs_granite_smooth_slab.png"}, S("Polished Granite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("diorite_smooth", "mcl_core:diorite_smooth", {pickaxey=1}, {"mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_stairs_diorite_smooth_slab.png"}, S("Polished Diorite Slab"), - nil, 6, nil, + nil, nil, nil, S("Double Polished Diorite Slab")) mcl_stairs.register_stair("diorite_smooth", "mcl_core:diorite_smooth", {pickaxey=1}, {"mcl_stairs_diorite_smooth_slab.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_core_diorite_smooth.png", "mcl_stairs_diorite_smooth_slab.png"}, S("Polished Diorite Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("stonebrickmossy", "mcl_core:stonebrickmossy", {pickaxey=1}, {"mcl_core_stonebrick_mossy.png"}, S("Mossy Stone Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, + mcl_sounds.node_sound_stone_defaults(), nil, nil, nil) mcl_stairs.register_slab("stonebrickmossy", "mcl_core:stonebrickmossy", {pickaxey=1}, {"mcl_core_stonebrick_mossy.png"}, S("Mossy Stone Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Mossy Stone Brick Slab"), "mcl_core:stonebrickmossy") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Mossy Stone Brick Slab")) diff --git a/mods/ITEMS/mclx_stairs/init.lua b/mods/ITEMS/mclx_stairs/init.lua index effa87f13..65dd59431 100644 --- a/mods/ITEMS/mclx_stairs/init.lua +++ b/mods/ITEMS/mclx_stairs/init.lua @@ -22,13 +22,13 @@ for b=1, #barks do {handy=1,axey=1, flammable=3, bark_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, {minetest.registered_nodes[id].tiles[3]}, bark[2], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab(sub, id, {handy=1,axey=1, flammable=3, bark_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, {minetest.registered_nodes[id].tiles[3]}, bark[3], - mcl_sounds.node_sound_wood_defaults(), 3, 2, + mcl_sounds.node_sound_wood_defaults(), nil, nil, bark[4]) end @@ -42,7 +42,7 @@ mcl_stairs.register_stair("lapisblock", "mcl_core:lapisblock", {pickaxey=3}, {"mcl_stairs_lapis_block_slab.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_core_lapis_block.png", "mcl_stairs_lapis_block_slab.png"}, S("Lapis Lazuli Stairs"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("goldblock", "mcl_core:goldblock", @@ -55,7 +55,7 @@ mcl_stairs.register_stair("goldblock", "mcl_core:goldblock", {pickaxey=4}, {"mcl_stairs_gold_block_slab.png", "default_gold_block.png", "default_gold_block.png", "default_gold_block.png", "default_gold_block.png", "mcl_stairs_gold_block_slab.png"}, S("Stairs of Gold"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_slab("ironblock", "mcl_core:ironblock", @@ -68,21 +68,21 @@ mcl_stairs.register_stair("ironblock", "mcl_core:ironblock", {pickaxey=2}, {"mcl_stairs_iron_block_slab.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "mcl_stairs_iron_block_slab.png"}, S("Stairs of Iron"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("stonebrickcracked", "mcl_core:stonebrickcracked", {pickaxey=1}, {"mcl_core_stonebrick_cracked.png"}, S("Cracked Stone Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, + mcl_sounds.node_sound_stone_defaults(), nil, nil, "woodlike") mcl_stairs.register_slab("stonebrickcracked", "mcl_core:stonebrickcracked", {pickaxey=1}, {"mcl_core_stonebrick_cracked.png"}, S("Cracked Stone Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Cracked Stone Brick Slab")) local block = {} From 2312989503bf1c9f7d858fbc32cd9328505e6faa Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 19 Sep 2023 21:57:49 +0200 Subject: [PATCH 013/273] Fix several hardness and blast resistance values --- mods/ITEMS/mcl_blackstone/init.lua | 5 ++- mods/ITEMS/mcl_compass/init.lua | 4 +-- mods/ITEMS/mcl_copper/nodes.lua | 44 +++++++++++++------------- mods/ITEMS/mcl_core/nodes_base.lua | 2 +- mods/ITEMS/mcl_deepslate/init.lua | 4 +-- mods/ITEMS/mcl_lightning_rods/init.lua | 3 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 5c63f8ee4..be5bcc5db 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -34,7 +34,7 @@ minetest.register_node("mcl_blackstone:blackstone_gilded", { } }, _mcl_blast_resistance = 2, - _mcl_hardness = 2, + _mcl_hardness = 1.5, _mcl_silk_touch_drop = true, _mcl_fortune_drop = { discrete_uniform_distribution = true, @@ -229,8 +229,7 @@ mcl_stairs.register_stair_and_slab("blackstone_brick_polished", "mcl_blackstone: mcl_walls.register_wall( "mcl_blackstone:wall", S("Blackstone Wall"), - "mcl_blackstone:blackstone" -) + "mcl_blackstone:blackstone") --lavacooling diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index 2905c0b3b..0117b3a89 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -312,8 +312,8 @@ minetest.register_node("mcl_compass:lodestone",{ "lodestone_side4.png" }, groups = {pickaxey=1, material_stone=1}, - _mcl_hardness = 1.5, - _mcl_blast_resistance = 6, + _mcl_hardness = 3.5, + _mcl_blast_resistance = 3.5, sounds = mcl_sounds.node_sound_stone_defaults() }) diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index af5a49a1c..f2ebe03ec 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -58,7 +58,7 @@ minetest.register_node("mcl_copper:block_exposed", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_weathered", _mcl_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_stripped_variant = "mcl_copper:block", @@ -72,7 +72,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed", }) @@ -84,7 +84,7 @@ minetest.register_node("mcl_copper:block_weathered", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_oxidized", _mcl_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_stripped_variant = "mcl_copper:block_exposed", @@ -98,7 +98,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered", }) @@ -110,7 +110,7 @@ minetest.register_node("mcl_copper:block_oxidized", { groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized", _mcl_stripped_variant = "mcl_copper:block_weathered", }) @@ -123,7 +123,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_oxidized", }) @@ -135,7 +135,7 @@ minetest.register_node("mcl_copper:block_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_exposed_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_cut", }) @@ -148,7 +148,7 @@ minetest.register_node("mcl_copper:waxed_block_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_cut", }) @@ -160,7 +160,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_waxed_variant = "mcl_copper:waxed_block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_weathered_cut", _mcl_stripped_variant = "mcl_copper:block_cut", @@ -174,7 +174,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", }) @@ -186,7 +186,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_oxidized_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_weathered_cut", @@ -200,7 +200,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", }) @@ -212,7 +212,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", { groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", }) @@ -225,7 +225,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, - _mcl_hardness = 5, + _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block_oxidized_cut", }) @@ -289,54 +289,54 @@ mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, S("Stairs of Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, S("Waxed Stairs of Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, S("Stairs of Exposed Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, S("Waxed Stairs of Exposed Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut", {pickaxey = 2, oxidizable = 1}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Stairs of Weathered Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Waxed Stairs of Weathered Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", {pickaxey = 2}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, S("Stairs of Oxidized Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", {pickaxey = 2, waxed = 1}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, S("Waxed Stairs of Oxidized Cut Copper"), - nil, 6, nil, + nil, nil, nil, "woodlike") diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index b691c6dfe..73b1e28e3 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -288,7 +288,7 @@ minetest.register_node("mcl_core:stone_smooth", { sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, _mcl_blast_resistance = 6, - _mcl_hardness = 1.5, + _mcl_hardness = 2, }) minetest.register_node("mcl_core:granite", { diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index 0abb0c579..cbeae2d53 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -38,8 +38,8 @@ minetest.register_node("mcl_deepslate:infested_deepslate", { drop = "", sounds = mcl_sounds.node_sound_stone_defaults(), after_dig_node = spawn_silverfish, - _mcl_hardness = 0, - _mcl_blast_resistance = 0.5, + _mcl_hardness = 1.5, + _mcl_blast_resistance = 0.75, }) minetest.register_node("mcl_deepslate:tuff", { diff --git a/mods/ITEMS/mcl_lightning_rods/init.lua b/mods/ITEMS/mcl_lightning_rods/init.lua index 3cd2dc1dc..b7d10e090 100644 --- a/mods/ITEMS/mcl_lightning_rods/init.lua +++ b/mods/ITEMS/mcl_lightning_rods/init.lua @@ -60,7 +60,8 @@ local rod_def = { return minetest.item_place(itemstack, placer, pointed_thing, param2) end, - _mcl_blast_resistance = 0, + _mcl_blast_resistance = 6, + _mcl_hardness = 3, } minetest.register_node("mcl_lightning_rods:rod", rod_def) From cbafdfa585fb94f26a3c4042ec047d5798146216 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 19 Sep 2023 22:02:13 +0200 Subject: [PATCH 014/273] Make monster eggs' hardness consistent with MC Change blast resistance to 0.75, add an optional hardness override parameter, because cobble is unique here (Still instant-minable, this is a separate issue) --- mods/ITEMS/mcl_monster_eggs/init.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_monster_eggs/init.lua b/mods/ITEMS/mcl_monster_eggs/init.lua index f58717d04..42db03c8f 100644 --- a/mods/ITEMS/mcl_monster_eggs/init.lua +++ b/mods/ITEMS/mcl_monster_eggs/init.lua @@ -10,10 +10,15 @@ local function spawn_silverfish(pos, oldnode, oldmetadata, digger) end -- Template function for registering monster egg blocks -local function register_block(subname, description, tiles, is_ground_content) +local function register_block(subname, description, tiles, is_ground_content, hardness_override) if is_ground_content == nil then is_ground_content = false end + -- Default hardness matches for stone and stone brick variants; cobble has 1.0 + local hardness = 0.75 + if hardness_override then + hardness = hardness_override + end minetest.register_node("mcl_monster_eggs:monster_egg_"..subname, { description = description, tiles = tiles, @@ -24,14 +29,14 @@ local function register_block(subname, description, tiles, is_ground_content) after_dig_node = spawn_silverfish, _tt_help = S("Hides a silverfish"), _doc_items_longdesc = S("An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart."), - _mcl_hardness = 0, - _mcl_blast_resistance = 0.5, + _mcl_hardness = hardness, + _mcl_blast_resistance = 0.75, }) end -- Register all the monster egg blocks register_block("stone", S("Infested Stone"), {"default_stone.png"}, true) -register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"}) +register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"}, nil, 1.0) register_block("stonebrick", S("Infested Stone Bricks"), {"default_stone_brick.png"}) register_block("stonebrickcracked", S("Infested Cracked Stone Bricks"), {"mcl_core_stonebrick_cracked.png"}) register_block("stonebrickmossy", S("Infested Mossy Stone Bricks"), {"mcl_core_stonebrick_mossy.png"}) From 0408f9c3d8d4c0b18f56acba0839ff4024bb8364 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 19 Sep 2023 23:26:32 +0200 Subject: [PATCH 015/273] Update hardness and blast res for value not matching the wiki - Notably, smooth sandstone (and red) is much more durable than other sandstone variants - Ender chest isn't actually more explosion resistant than obsidian, hmm --- mods/ITEMS/REDSTONE/mcl_observers/init.lua | 12 +++---- mods/ITEMS/REDSTONE/mesecons_pistons/init.lua | 24 +++++++------- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 4 +-- mods/ITEMS/mcl_beds/api.lua | 2 +- mods/ITEMS/mcl_brewing/init.lua | 32 +++++++++---------- mods/ITEMS/mcl_chests/ender.lua | 2 +- mods/ITEMS/mcl_chests/shulkers.lua | 2 +- mods/ITEMS/mcl_colorblocks/init.lua | 2 +- mods/ITEMS/mcl_core/nodes_base.lua | 18 +++++------ mods/ITEMS/mcl_crimson/init.lua | 6 ++-- mods/ITEMS/mcl_end/chorus_plant.lua | 4 +-- mods/ITEMS/mcl_farming/soil.lua | 2 +- mods/ITEMS/mcl_lectern/init.lua | 4 +-- mods/ITEMS/mcl_sculk/init.lua | 2 +- 14 files changed, 57 insertions(+), 59 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 6045b5677..dfdbeb8a9 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -113,8 +113,8 @@ mesecon.register_node("mcl_observers:observer", { sounds = mcl_sounds.node_sound_stone_defaults(), paramtype2 = "facedir", on_rotate = false, - _mcl_blast_resistance = 3.5, - _mcl_hardness = 3.5, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, }, { description = S("Observer"), _tt_help = S("Emits redstone pulse when block in front changes"), @@ -172,8 +172,8 @@ mesecon.register_node("mcl_observers:observer_down", { 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, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, drop = "mcl_observers:observer_off", }, { tiles = { @@ -224,8 +224,8 @@ mesecon.register_node("mcl_observers:observer_up", { 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, + _mcl_blast_resistance = 3, + _mcl_hardness = 3, drop = "mcl_observers:observer_off", }, { tiles = { diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index 262ac6eb5..57272317e 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -218,7 +218,7 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_up_normal_off"}) @@ -255,7 +255,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -326,7 +326,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_up_sticky_off"}) @@ -363,7 +363,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -449,7 +449,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", { footstep = mcl_sounds.node_sound_wood_defaults().footstep }), _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_down_normal_off"}) @@ -487,7 +487,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -556,7 +556,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_down_sticky_off"}) @@ -594,7 +594,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -680,7 +680,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_normal_off"}) @@ -718,7 +718,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) @@ -782,7 +782,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then minetest.set_node(pos, {name="mesecons_pistons:piston_sticky_off"}) @@ -820,7 +820,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", { }, }, _mcl_blast_resistance = 0.5, - _mcl_hardness = 0.5, + _mcl_hardness = 1.5, on_rotate = false, }) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 33e0cebaa..98a3a9257 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -62,7 +62,7 @@ local bamboo_def = { inventory_image = "mcl_bamboo_bamboo_shoot.png", wield_image = "mcl_bamboo_bamboo_shoot.png", _mcl_blast_resistance = 1, - _mcl_hardness = 1.5, + _mcl_hardness = 1, node_box = { type = "fixed", fixed = { @@ -277,7 +277,7 @@ local bamboo_block_def = { sounds = node_sound, paramtype2 = "facedir", drops = "mcl_bamboo:bamboo_block", - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 2, _mcl_hardness = 2, _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = mcl_util.rotate_axis, diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index b96953017..34cd8cf31 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -288,7 +288,7 @@ function mcl_beds.register_bed(name, def) is_ground_content = false, groups = {handy = 1, flammable = -1, bed = 2, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, not_in_creative_inventory = 1}, _mcl_hardness = 0.2, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, sounds = def.sounds or default_sounds, drop = "", selection_box = common_box, diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 937d9089c..1021b1517 100644 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -456,8 +456,8 @@ minetest.register_node("mcl_brewing:stand_000", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -537,8 +537,8 @@ minetest.register_node("mcl_brewing:stand_100", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -617,8 +617,8 @@ minetest.register_node("mcl_brewing:stand_010", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -692,8 +692,8 @@ minetest.register_node("mcl_brewing:stand_001", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -777,8 +777,8 @@ minetest.register_node("mcl_brewing:stand_110", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -858,8 +858,8 @@ minetest.register_node("mcl_brewing:stand_101", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -939,8 +939,8 @@ minetest.register_node("mcl_brewing:stand_011", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, @@ -1027,8 +1027,8 @@ minetest.register_node("mcl_brewing:stand_111", { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 1, - _mcl_hardness = 1, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, on_destruct = on_destruct, allow_metadata_inventory_take = allow_take, allow_metadata_inventory_put = allow_put, diff --git a/mods/ITEMS/mcl_chests/ender.lua b/mods/ITEMS/mcl_chests/ender.lua index cf3e7b0fe..d76d627bb 100644 --- a/mods/ITEMS/mcl_chests/ender.lua +++ b/mods/ITEMS/mcl_chests/ender.lua @@ -94,7 +94,7 @@ minetest.register_node("mcl_chests:ender_chest_small", { mcl_chests.player_chest_close(sender) end end, - _mcl_blast_resistance = 3000, + _mcl_blast_resistance = 600, _mcl_hardness = 22.5, _mcl_silk_touch_drop = { "mcl_chests:ender_chest" }, on_rotate = mcl_chests.simple_rotate, diff --git a/mods/ITEMS/mcl_chests/shulkers.lua b/mods/ITEMS/mcl_chests/shulkers.lua index b6ada6c46..f7e16dc11 100644 --- a/mods/ITEMS/mcl_chests/shulkers.lua +++ b/mods/ITEMS/mcl_chests/shulkers.lua @@ -295,7 +295,7 @@ for color, desc in pairs(boxtypes) do end end, on_rotate = mcl_chests.simple_rotate, - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 2, _mcl_hardness = 2, _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) local meta = minetest.get_meta(pos) diff --git a/mods/ITEMS/mcl_colorblocks/init.lua b/mods/ITEMS/mcl_colorblocks/init.lua index dff30484a..72406014f 100644 --- a/mods/ITEMS/mcl_colorblocks/init.lua +++ b/mods/ITEMS/mcl_colorblocks/init.lua @@ -162,7 +162,7 @@ for _, row in ipairs(block.dyes) do stack_max = 64, is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4.2, + _mcl_blast_resistance = 1.4, _mcl_hardness = 1.4, on_rotate = on_rotate, }) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 73b1e28e3..595019741 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -424,7 +424,7 @@ minetest.register_node("mcl_core:grass_path", { footstep = {name="default_grass_footstep", gain=0.1}, }), _mcl_blast_resistance = 0.65, - _mcl_hardness = 0.6, + _mcl_hardness = 0.65, }) -- TODO: Add particles @@ -497,8 +497,8 @@ minetest.register_node("mcl_core:podzol", { sounds = mcl_sounds.node_sound_dirt_defaults(), on_construct = mcl_core.on_snowable_construct, _mcl_snowed = "mcl_core:podzol_snow", - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, _mcl_silk_touch_drop = true, }) mcl_core.register_snowed_node("mcl_core:podzol_snow", "mcl_core:podzol", nil, nil, false, S("Podzol with Snow")) @@ -600,8 +600,8 @@ minetest.register_node("mcl_core:sandstonesmooth", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = 0.8, + _mcl_hardness = 0.8, }) minetest.register_node("mcl_core:sandstonecarved", { @@ -687,8 +687,8 @@ minetest.register_node("mcl_core:redsandstonesmooth2", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) --- @@ -1139,8 +1139,8 @@ minetest.register_node("mcl_core:snowblock", { on_construct = mcl_core.on_snow_construct, after_destruct = mcl_core.after_snow_destruct, drop = "mcl_throwing:snowball 4", - _mcl_blast_resistance = 0.1, - _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.2, + _mcl_hardness = 0.2, _mcl_silk_touch_drop = true, }) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 3a7862019..60263017d 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -191,8 +191,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { "mcl_crimson:twisting_vines", "mcl_crimson:twisting_vines", }, - _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.2, + _mcl_blast_resistance = 0, }) minetest.register_node("mcl_crimson:weeping_vines", { @@ -281,8 +280,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { "mcl_crimson:weeping_vines", "mcl_crimson:weeping_vines", }, - _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.2, + _mcl_blast_resistance = 0, }) minetest.register_node("mcl_crimson:nether_sprouts", { diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index 7f2064a3e..7e6530192 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -230,7 +230,7 @@ minetest.register_node("mcl_end:chorus_flower_dead", { groups = {handy=1,axey=1, deco_block = 1, dig_by_piston = 1, destroy_by_lava_flow = 1,chorus_plant = 1, not_in_creative_inventory=1}, after_dig_node = mcl_end.check_detach_chorus_plant, on_blast = mcl_end.check_blast_chorus_plant, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) @@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", { end, after_dig_node = mcl_end.check_detach_chorus_plant, on_blast = mcl_end.check_blast_chorus_plant, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index a6721cc26..e91feb1e8 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -44,7 +44,7 @@ minetest.register_node("mcl_farming:soil_wet", { end, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, dirtifier=1, soil=3, soil_sapling=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 0.5, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) diff --git a/mods/ITEMS/mcl_lectern/init.lua b/mods/ITEMS/mcl_lectern/init.lua index e98422249..2f6018a12 100644 --- a/mods/ITEMS/mcl_lectern/init.lua +++ b/mods/ITEMS/mcl_lectern/init.lua @@ -31,8 +31,8 @@ local lectern_def = { walkable = true, is_ground_content = false, node_placement_prediction = "", - _mcl_blast_resistance = 3, - _mcl_hardness = 2, + _mcl_blast_resistance = 2.5, + _mcl_hardness = 2.5, selection_box = { type = "fixed", fixed = { diff --git a/mods/ITEMS/mcl_sculk/init.lua b/mods/ITEMS/mcl_sculk/init.lua index 4af60178e..2bedfef24 100644 --- a/mods/ITEMS/mcl_sculk/init.lua +++ b/mods/ITEMS/mcl_sculk/init.lua @@ -194,7 +194,7 @@ minetest.register_node("mcl_sculk:sculk", { is_ground_content = false, on_destruct = sculk_on_destruct, _mcl_blast_resistance = 0.2, - _mcl_hardness = 0.6, + _mcl_hardness = 0.2, _mcl_silk_touch_drop = true, }) From 49b2491b7072473e64321c3c1ed65d28f266b796 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 26 Sep 2023 12:45:41 +0200 Subject: [PATCH 016/273] Fix the other bed node --- mods/ITEMS/mcl_beds/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index 34cd8cf31..7abadb85a 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -210,7 +210,7 @@ function mcl_beds.register_bed(name, def) stack_max = 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, + _mcl_blast_resistance = 0.2, sounds = def.sounds or default_sounds, selection_box = common_box, collision_box = common_box, From b237c4642db475d42d442297de395b89a8334ccd Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Tue, 26 Sep 2023 13:20:16 +0200 Subject: [PATCH 017/273] Revert "Forgot about blackstone" I left it in from another branch, didn't want to force push. This reverts commit 58d2f59192073acf9f55406358bf48244e008b9b. Revert "Walls use `source` parameter for default hardness and blast resistance" I left it in from another branch, didn't want to force push. This reverts commit e8944cc145dc59db53a9368d8ae269edf366e742. Revert "Fix prismarine bricks and dark variant blast res." I left it in from another branch, didn't want to force push. This reverts commit 6125d625bc6ce15644cf8b579599f75da5bffd07. Revert "Un-hardcode blast resistance, hardness for walls," I left it in from another branch, didn't want to force push. This reverts commit 26e873703151bc4bfaf7588ad1e3afa731a05fbd. Revert "All wood-type and nether-type fences now match material's blast resistance" I left it in from another branch, didn't want to force push. This reverts commit a1e20f29162462120fb1c046c2d34f8fcebfb413. --- mods/ITEMS/mcl_bamboo/bamboo_items.lua | 21 ++-------- mods/ITEMS/mcl_blackstone/init.lua | 5 +-- mods/ITEMS/mcl_cherry_blossom/nodes.lua | 13 ++----- mods/ITEMS/mcl_deepslate/init.lua | 5 +-- mods/ITEMS/mcl_fences/init.lua | 21 +--------- mods/ITEMS/mcl_ocean/prismarine.lua | 4 +- mods/ITEMS/mcl_walls/API.md | 4 +- mods/ITEMS/mcl_walls/init.lua | 52 +++++++++---------------- 8 files changed, 32 insertions(+), 93 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index a7a28257e..6ad8e4f58 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -192,23 +192,10 @@ if minetest.get_modpath("mcl_fences") then local wood_groups = { handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20 } local wood_connect = { "group:fence_wood" } - local fence_id = mcl_fences.register_fence( - id, - S("Bamboo Fence"), - "mcl_bamboo_fence_bamboo.png", - wood_groups, - minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, - minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - wood_connect, node_sound) - - local gate_id = mcl_fences.register_fence_gate( - id, - S("Bamboo Fence Gate"), - "mcl_bamboo_fence_gate_bamboo.png", - wood_groups, - minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, - minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - node_sound) -- note: about missing params.. will use defaults. + local fence_id = mcl_fences.register_fence(id, S("Bamboo Fence"), "mcl_bamboo_fence_bamboo.png", wood_groups, + 2, 15, wood_connect, node_sound) + local gate_id = mcl_fences.register_fence_gate(id, S("Bamboo Fence Gate"), "mcl_bamboo_fence_gate_bamboo.png", + wood_groups, 2, 15, node_sound) -- note: about missing params.. will use defaults. mcl_bamboo.mcl_log(dump(fence_id)) mcl_bamboo.mcl_log(dump(gate_id)) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index be5bcc5db..c8dafbe6c 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -226,10 +226,7 @@ mcl_stairs.register_stair_and_slab("blackstone_brick_polished", "mcl_blackstone: S("Double Polished Blackstone Brick Slab"), nil) --Wall -mcl_walls.register_wall( - "mcl_blackstone:wall", - S("Blackstone Wall"), - "mcl_blackstone:blackstone") +mcl_walls.register_wall("mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone") --lavacooling diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 84d1a8a1b..6e13cacd9 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -66,16 +66,9 @@ mcl_signs.register_sign_custom("mcl_cherry_blossom", "_cherrywood", "mcl_cherry_blossom_sign_inv.png", "mcl_cherry_blossom_sign_inv.png", S("Cherry Sign")) -- Fences & Gates -mcl_fences.register_fence_and_fence_gate( - "cherry_fence", - S("Cherry Fence"), - S("Cherry Gate"), - "mcl_cherry_blossom_planks.png", - {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, - minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, - minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - {"group:fence_wood"}, - mcl_sounds.node_sound_wood_defaults()) +mcl_fences.register_fence_and_fence_gate("cherry_fence", S("Cherry Fence"), S("Cherry Gate"), + "mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, 2, 15, + {"group:fence_wood"}, mcl_sounds.node_sound_wood_defaults()) -- Redstone mesecon.register_pressure_plate( diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index cbeae2d53..f13c1319d 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -218,10 +218,7 @@ local function register_deepslate_variant(item, desc, longdesc) end if item ~= "chiseled" then mcl_stairs.register_stair_and_slab_simple("deepslate_"..item, "mcl_deepslate:deepslate_"..item, S(desc.." Stairs"), S(desc.." Slab"), S("Double "..desc.." Slab")) - mcl_walls.register_wall( - "mcl_deepslate:deepslate"..item.."wall", - S(desc.." Wall"), - "mcl_deepslate:deepslate_"..item) + mcl_walls.register_wall("mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), "mcl_deepslate:deepslate_"..item) end end diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index 5555fbfc0..b14d103d2 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -269,16 +269,7 @@ for w=1, #woods do id = wood[1].."_fence" id_gate = wood[1].."_fence_gate" end - mcl_fences.register_fence_and_fence_gate( - id, - wood[2], - wood[3], - wood[4], - wood_groups, - minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, - minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - wood_connect, - wood_sounds) + mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds) minetest.register_craft({ output = "mcl_fences:"..id.." 3", @@ -298,15 +289,7 @@ end -- Nether Brick Fence (without fence gate!) -mcl_fences.register_fence( - "nether_brick_fence", - S("Nether Brick Fence"), - "mcl_fences_fence_nether_brick.png", - {pickaxey=1, deco_block=1, fence_nether_brick=1}, - minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, - minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance, - {"group:fence_nether_brick"}, - mcl_sounds.node_sound_stone_defaults()) +mcl_fences.register_fence("nether_brick_fence", S("Nether Brick Fence"), "mcl_fences_fence_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults()) minetest.register_craft({ output = "mcl_fences:nether_brick_fence 6", diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index fff07cb7e..32d17538d 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 6, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index 63621ade1..8adf6e8b4 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to VoxeLibre. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds, hardness, blast_resistance)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -25,8 +25,6 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) * `sounds`: Sound table (optional, by default default uses stone sounds) -* `hardness`: Hardness of node (optional, default matches `source` node or fallback value 2) -* `blast_resistance`: Blast resistance of node (optional, default matches `source` node or fallback value 6) The following groups will automatically be added to the nodes (where applicable), you do not need to add them to the `groups` table: diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 09a35b549..57212e7dd 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -97,10 +97,8 @@ local full_blocks = { * inventory_image: Inventory image (optional) * groups: Base group memberships (optional, default is {pickaxey=1}) * sounds: Sound table (optional, default is stone) -* hardness: Hardness of node (optional, default matches `source` node or fallback value 2) -* blast_resistance: Blast resistance of node (optional, default matches `source` node or fallback value 6) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds, hardness, blast_resistance) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds) local base_groups = groups if not base_groups then @@ -114,29 +112,15 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory local main_node_groups = table.copy(base_groups) main_node_groups.deco_block = 1 - if source then - -- Default values from `source` node - if not hardness then - hardness = minetest.registered_nodes[source]._mcl_hardness - end - if not blast_resistance then - blast_resistance = minetest.registered_nodes[source]._mcl_blast_resistance - end - if not sounds then - sounds = minetest.registered_nodes[source].sounds - end - if not tiles then - if minetest.registered_nodes[source] then - tiles = minetest.registered_nodes[source].tiles - end - end - else - -- Fallback in case no `source` given - if not hardness then - hardness = 2 - end - if not blast_resistance then - blast_resistance = 6 + -- TODO: Stop hardcoding blast resistance + + if not sounds then + sounds = mcl_sounds.node_sound_stone_defaults() + end + + if (not tiles) and source then + if minetest.registered_nodes[source] then + tiles = minetest.registered_nodes[source].tiles end end @@ -185,8 +169,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = take }, sounds = sounds, - _mcl_blast_resistance = blast_resistance, - _mcl_hardness = hardness, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) -- Add entry alias for the Help @@ -213,8 +197,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[1]} }, sounds = sounds, - _mcl_blast_resistance = blast_resistance, - _mcl_hardness = hardness, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -239,8 +223,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[2]} }, sounds = sounds, - _mcl_blast_resistance = blast_resistance, - _mcl_hardness = hardness, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -271,8 +255,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2}, on_construct = update_wall, sounds = sounds, - _mcl_blast_resistance = blast_resistance, - _mcl_hardness = hardness, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) if source then minetest.register_craft({ From b0b5cc1265ef396da7e3f405463c15b8e36e165e Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Wed, 27 Sep 2023 16:15:43 +0200 Subject: [PATCH 018/273] Remaining stairs/slabs inherit properties instead of hardcoding - Fix smooth quartz attributes - Alternative recipes for (red) sandstone, quartz, purpur slabs/stairs have been added explicitly --- mods/ITEMS/mcl_nether/init.lua | 4 +- mods/ITEMS/mcl_stairs/API.md | 37 ++++++- mods/ITEMS/mcl_stairs/register.lua | 163 +++++++++++++---------------- 3 files changed, 108 insertions(+), 96 deletions(-) diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index b69355d5d..da0bd47f2 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -259,8 +259,8 @@ minetest.register_node("mcl_nether:quartz_smooth", { tiles = {"mcl_nether_quartz_block_bottom.png"}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 0.8, - _mcl_hardness = 0.8, + _mcl_blast_resistance = 6, + _mcl_hardness = 2, }) minetest.register_craftitem("mcl_nether:glowstone_dust", { diff --git a/mods/ITEMS/mcl_stairs/API.md b/mods/ITEMS/mcl_stairs/API.md index 6c91754b7..5b142d85b 100644 --- a/mods/ITEMS/mcl_stairs/API.md +++ b/mods/ITEMS/mcl_stairs/API.md @@ -11,7 +11,8 @@ mcl_stairs.register_stair_and_slab_simple("platinum", "example:platinum", "Plati ``` ## `mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)` -Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. +Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. If multiple nodes should craft into the same stairs/slab, see +`mcl_stairs.register_craft_stairs` or `mcl_stairs.register_craft_slab` This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead. @@ -44,7 +45,7 @@ The itemstrings for the registered nodes will be of the form: ### Parameters * `subname`: Name fragment for node itemstrings (see above) -* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead +* `recipeitem`: Item for crafting recipe and attribute inheritance. Do not use `group:` prefix here, alternative recipes can be registered using `mcl_stairs.register_craft_stairs(subname, recipeitem_or_group)`. * `groups`: Groups used for stair * `images`: Textures * `description`: Stair description/tooltip @@ -81,3 +82,35 @@ The itemstrings for the registered nodes will be of the form: * `double_description`: Node description/tooltip for double slab * Other parameters: Same as for `register_stair` +## `mcl_stairs.register_craft_stairs(subname, recipeitem)` +Just registers a recipe for `mcl_stairs:stair_`. +Useful if a node variant should craft the same stairs as the base node, since the above functions use the same +parameter for crafting material and attribute inheritance. +e.g. 6 Purpur Pillar -> 4 Purpur Stairs is an alternate recipe. + +Creates staircase recipes with 6 input items, both left-facing and right-facing. Outputs 4 stairs. + +The itemstring for the output node will be of the form: + +* `mcl_stairs:stair_`: Normal stair + +### Parameters +* `subname`: Name fragment for node itemstring (see above) +* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead + +## `mcl_stairs.register_craft_slab(subname, recipeitem)` +Just registers a recipe for `mcl_stairs:slab_`. +Useful if a node variant should craft the same stairs as the base node, since the above functions use the same +parameter for crafting material and attribute inheritance. +e.g. 3 Quartz Pillar -> 6 Quartz Slab is an alternate recipe. + +Creates slab recipe with 3 input items in any horizontal line. Outputs 6 slabs. + +The itemstring for the output node will be of the form: + +* `mcl_stairs:slab_`: Slab + +### Parameters +* `subname`: Name fragment for node itemstring (see above) +* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead + diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index 6138e692c..920d8387d 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -1,10 +1,39 @@ -- Register all Minecraft stairs and slabs --- Note about hardness: For some reason, the hardness of slabs and stairs don't always match nicely, so that some --- slabs actually take slightly longer to be dug than their stair counterparts. --- Note sure if it is a good idea to preserve this oddity. local S = minetest.get_translator(minetest.get_current_modname()) +-- Cut Sandstone Stairs do not exist, and register_stair_and_slab does not allow multiple recipes +-- (e.g. using group:node) if we try to copy the properties of the node at the same parameter. +-- The missing recipes can be added separately via these: +function mcl_stairs.register_craft_stairs(subname, recipeitem) + minetest.register_craft({ + output = "mcl_stairs:stair_" .. subname .. " 4", + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + -- Flipped recipe + minetest.register_craft({ + output = "mcl_stairs:stair_" .. subname .. " 4", + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +function mcl_stairs.register_craft_slab(subname, recipeitem) + minetest.register_craft({ + output = "mcl_stairs:slab_" .. subname .. " 6", + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + local woods = { { "wood", "default_wood.png", S("Oak Wood Stairs"), S("Oak Wood Slab"), S("Double Oak Wood Slab") }, { "junglewood", "default_junglewood.png", S("Jungle Wood Stairs"), S("Jungle Wood Slab"), S("Double Jungle Wood Slab") }, @@ -86,91 +115,45 @@ mcl_stairs.register_slab("diorite", "mcl_core:diorite", mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double Diorite Slab")) -mcl_stairs.register_stair("cobble", "mcl_core:cobble", - {pickaxey=1, material_stone=1}, - {"default_cobble.png"}, - S("Cobblestone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("cobble", "mcl_core:cobble", - {pickaxey=1, material_stone=1}, - {"default_cobble.png"}, - S("Cobblestone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Cobblestone Slab")) - -mcl_stairs.register_stair("mossycobble", "mcl_core:mossycobble", - {pickaxey=1, material_stone=1}, - {"default_mossycobble.png"}, - S("Mossy Cobblestone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("mossycobble", "mcl_core:mossycobble", - {pickaxey=1, material_stone=1}, - {"default_mossycobble.png"}, - S("Mossy Cobblestone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Mossy Cobblestone Slab")) - -mcl_stairs.register_stair("brick_block", "mcl_core:brick_block", - {pickaxey=1, material_stone=1}, - {"default_brick.png"}, - S("Brick Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("brick_block", "mcl_core:brick_block", - {pickaxey=1, material_stone=1}, - {"default_brick.png"}, - S("Brick Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Brick Slab")) - -mcl_stairs.register_stair("sandstone", "mcl_core:sandstone", +mcl_stairs.register_stair_and_slab("sandstone", "mcl_core:sandstone", {pickaxey=1, material_stone=1}, {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, S("Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_core:sandstone") --fixme: extra parameter from previous release -mcl_stairs.register_slab("sandstone", "mcl_core:sandstone", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, S("Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Sandstone Slab"), "mcl_core:sandstone") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Sandstone Slab")) +mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonesmooth") -- Comment this line out if Cut Sandstone Stairs are implemented +mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonecarved") +mcl_stairs.register_craft_slab("sandstone", "mcl_core:sandstonecarved") -mcl_stairs.register_stair("sandstonesmooth2", "mcl_core:sandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png"}, - S("Smooth Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("sandstonesmooth2", "mcl_core:sandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_sandstone_top.png"}, - S("Smooth Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Smooth Sandstone Slab")) +-- mcl_stairs.register_stair_and_slab("sandstonesmooth", "mcl_core:sandstonesmooth", +-- {pickaxey=1, material_stone=1}, +-- {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_smooth.png"}, +-- S("Cut Sandstone Stairs"), S("Cut Sandstone Slab"), +-- mcl_sounds.node_sound_stone_defaults(), nil, nil, +-- S("Double Cut Sandstone Slab")) -mcl_stairs.register_stair("redsandstone", "mcl_core:redsandstone", +mcl_stairs.register_stair_and_slab_simple("sandstonesmooth2", "mcl_core:sandstonesmooth2", S("Smooth Sandstone Stairs"), S("Smooth Sandstone Slab"), S("Double Smooth Sandstone Slab")) + +mcl_stairs.register_stair_and_slab("redsandstone", "mcl_core:redsandstone", {pickaxey=1, material_stone=1}, {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"}, S("Red Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_core:redsandstone") --fixme: extra parameter from previous release -mcl_stairs.register_slab("redsandstone", "mcl_core:redsandstone", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"}, S("Red Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Red Sandstone Slab"), "mcl_core:redsandstone") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Red Sandstone Slab")) +mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonesmooth") -- Comment this line out if Cut Red Sandstone Stairs are implemented +mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonecarved") +mcl_stairs.register_craft_slab("redsandstone", "mcl_core:redsandstonecarved") -mcl_stairs.register_stair("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png"}, - S("Smooth Red Sandstone Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8) -mcl_stairs.register_slab("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", - {pickaxey=1, material_stone=1}, - {"mcl_core_red_sandstone_top.png"}, - S("Smooth Red Sandstone Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Smooth Red Sandstone Slab")) +-- mcl_stairs.register_stair_and_slab("redsandstonesmooth", "mcl_core:redsandstonesmooth", +-- {pickaxey=1, material_stone=1}, +-- {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_smooth.png"}, +-- S("Cut Red Sandstone Stairs"), S("Cut Red Sandstone Slab"), +-- mcl_sounds.node_sound_stone_defaults(), nil, nil, +-- S("Double Cut Red Sandstone Slab")) + +mcl_stairs.register_stair_and_slab_simple("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", S("Smooth Red Sandstone Stairs"), S("Smooth Red Sandstone Slab"), S("Double Smooth Red Sandstone Slab")) -- Intentionally not group:stonebrick because of mclx_stairs mcl_stairs.register_stair("stonebrick", "mcl_core:stonebrick", @@ -186,18 +169,17 @@ mcl_stairs.register_slab("stonebrick", "mcl_core:stonebrick", mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Stone Bricks Slab")) -mcl_stairs.register_stair("quartzblock", "mcl_nether:quartz_block", +mcl_stairs.register_stair_and_slab("quartzblock", "mcl_nether:quartz_block", {pickaxey=1, material_stone=1}, {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, S("Quartz Stairs"), - mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8, - nil, "mcl_nether:quartz_block") --fixme: extra parameter from previous release -mcl_stairs.register_slab("quartzblock", "mcl_nether:quartz_block", - {pickaxey=1, material_stone=1}, - {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, S("Quartz Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, - S("Double Quartz Slab"), "mcl_nether:quartz_block") --fixme: extra parameter from previous release + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Quartz Slab")) +mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_pillar") +mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_chiseled") +mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_pillar") +mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_chiseled") mcl_stairs.register_stair("quartz_smooth", "mcl_nether:quartz_smooth", {pickaxey=1, material_stone=1}, @@ -234,18 +216,15 @@ mcl_stairs.register_stair_and_slab("end_bricks", "mcl_end:end_bricks", mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double End Stone Brick Slab"), nil) -mcl_stairs.register_stair("purpur_block", "mcl_end:purpur_block", +mcl_stairs.register_stair_and_slab("purpur_block", "mcl_end:purpur_block", {pickaxey=1, material_stone=1}, {"mcl_end_purpur_block.png"}, S("Purpur Stairs"), - mcl_sounds.node_sound_stone_defaults(), 6, 1.5, - nil) -mcl_stairs.register_slab("purpur_block", "mcl_end:purpur_block", - {pickaxey=1, material_stone=1}, - {"mcl_end_purpur_block.png"}, S("Purpur Slab"), - mcl_sounds.node_sound_stone_defaults(), 6, 2, + mcl_sounds.node_sound_stone_defaults(), nil, nil, S("Double Purpur Slab")) +mcl_stairs.register_craft_stairs("purpur_block", "mcl_end:purpur_pillar") +mcl_stairs.register_craft_slab("purpur_block", "mcl_end:purpur_pillar") mcl_stairs.register_stair("prismarine", "mcl_ocean:prismarine", {pickaxey=1, material_stone=1}, From b79a19f4d61191a5cdb9d11ba4164e8f28d20145 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 9 Jun 2024 22:38:20 +0100 Subject: [PATCH 019/273] Add crimson/warped planks (_hyphae_wood) blast res Relates to (#4414) --- mods/ITEMS/mcl_crimson/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 60263017d..9ec326a3c 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -463,6 +463,7 @@ minetest.register_node("mcl_crimson:warped_hyphae_wood", { tiles = {"mcl_crimson_warped_hyphae_wood.png"}, groups = {handy = 5,axey = 1, wood=1,building_block = 1, material_wood = 1}, sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 3, _mcl_hardness = 2, }) @@ -660,6 +661,7 @@ minetest.register_node("mcl_crimson:crimson_hyphae_wood", { tiles = {"mcl_crimson_crimson_hyphae_wood.png"}, groups = {handy = 5, axey = 1, wood = 1, building_block = 1, material_wood = 1}, sounds = mcl_sounds.node_sound_wood_defaults(), + _mcl_blast_resistance = 3, _mcl_hardness = 2, }) From b3087118fa8152411865702fc5dc4fa071030f33 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 9 Jun 2024 22:46:57 +0100 Subject: [PATCH 020/273] Fix Gilded Blackstone blast res. (now 6) --- mods/ITEMS/mcl_blackstone/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index c8dafbe6c..fdc9e7d4e 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -33,7 +33,7 @@ minetest.register_node("mcl_blackstone:blackstone_gilded", { {items = {"mcl_blackstone:blackstone_gilded"}, rarity = 1}, } }, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, _mcl_silk_touch_drop = true, _mcl_fortune_drop = { From 8b9666137dd55c57dd85bb7b815ec95c97f54817 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sat, 16 Sep 2023 22:57:15 +0200 Subject: [PATCH 021/273] All wood-type and nether-type fences now match material's blast resistance --- mods/ITEMS/mcl_bamboo/bamboo_items.lua | 21 +++++++++++++++++---- mods/ITEMS/mcl_cherry_blossom/nodes.lua | 13 ++++++++++--- mods/ITEMS/mcl_fences/init.lua | 21 +++++++++++++++++++-- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index 6ad8e4f58..a7a28257e 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -192,10 +192,23 @@ if minetest.get_modpath("mcl_fences") then local wood_groups = { handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20 } local wood_connect = { "group:fence_wood" } - local fence_id = mcl_fences.register_fence(id, S("Bamboo Fence"), "mcl_bamboo_fence_bamboo.png", wood_groups, - 2, 15, wood_connect, node_sound) - local gate_id = mcl_fences.register_fence_gate(id, S("Bamboo Fence Gate"), "mcl_bamboo_fence_gate_bamboo.png", - wood_groups, 2, 15, node_sound) -- note: about missing params.. will use defaults. + local fence_id = mcl_fences.register_fence( + id, + S("Bamboo Fence"), + "mcl_bamboo_fence_bamboo.png", + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + wood_connect, node_sound) + + local gate_id = mcl_fences.register_fence_gate( + id, + S("Bamboo Fence Gate"), + "mcl_bamboo_fence_gate_bamboo.png", + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + node_sound) -- note: about missing params.. will use defaults. mcl_bamboo.mcl_log(dump(fence_id)) mcl_bamboo.mcl_log(dump(gate_id)) diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 6e13cacd9..84d1a8a1b 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -66,9 +66,16 @@ mcl_signs.register_sign_custom("mcl_cherry_blossom", "_cherrywood", "mcl_cherry_blossom_sign_inv.png", "mcl_cherry_blossom_sign_inv.png", S("Cherry Sign")) -- Fences & Gates -mcl_fences.register_fence_and_fence_gate("cherry_fence", S("Cherry Fence"), S("Cherry Gate"), - "mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, 2, 15, - {"group:fence_wood"}, mcl_sounds.node_sound_wood_defaults()) +mcl_fences.register_fence_and_fence_gate( + "cherry_fence", + S("Cherry Fence"), + S("Cherry Gate"), + "mcl_cherry_blossom_planks.png", + {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + {"group:fence_wood"}, + mcl_sounds.node_sound_wood_defaults()) -- Redstone mesecon.register_pressure_plate( diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index b14d103d2..5555fbfc0 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -269,7 +269,16 @@ for w=1, #woods do id = wood[1].."_fence" id_gate = wood[1].."_fence_gate" end - mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds) + mcl_fences.register_fence_and_fence_gate( + id, + wood[2], + wood[3], + wood[4], + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + wood_connect, + wood_sounds) minetest.register_craft({ output = "mcl_fences:"..id.." 3", @@ -289,7 +298,15 @@ end -- Nether Brick Fence (without fence gate!) -mcl_fences.register_fence("nether_brick_fence", S("Nether Brick Fence"), "mcl_fences_fence_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults()) +mcl_fences.register_fence( + "nether_brick_fence", + S("Nether Brick Fence"), + "mcl_fences_fence_nether_brick.png", + {pickaxey=1, deco_block=1, fence_nether_brick=1}, + minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, + minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance, + {"group:fence_nether_brick"}, + mcl_sounds.node_sound_stone_defaults()) minetest.register_craft({ output = "mcl_fences:nether_brick_fence 6", From f8fcd9954ffd2576134dd2e5dc4322478d0f6b46 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sat, 3 Aug 2024 20:26:39 +0200 Subject: [PATCH 022/273] Add back *some* changes that I reverted; and fix typo "Cherry Gate" --- mods/ITEMS/mcl_bamboo/bamboo_items.lua | 2 +- .../locale/mcl_cherry_blossom.fr.tr | 2 +- .../locale/mcl_cherry_blossom.pt_BR.tr | 2 +- .../locale/mcl_cherry_blossom.ru.tr | 2 +- .../mcl_cherry_blossom/locale/template.txt | 2 +- mods/ITEMS/mcl_cherry_blossom/nodes.lua | 2 +- mods/ITEMS/mcl_ocean/prismarine.lua | 4 +- mods/ITEMS/mcl_walls/API.md | 4 +- mods/ITEMS/mcl_walls/init.lua | 52 ++++++++++++------- 9 files changed, 45 insertions(+), 27 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index a7a28257e..83f26b340 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -208,7 +208,7 @@ if minetest.get_modpath("mcl_fences") then wood_groups, minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, - node_sound) -- note: about missing params.. will use defaults. + node_sound) mcl_bamboo.mcl_log(dump(fence_id)) mcl_bamboo.mcl_log(dump(gate_id)) diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr index 2f6b7db22..7cc9bd47c 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.fr.tr @@ -19,6 +19,6 @@ Cherry Slab=Dalle en cerisier Double Cherry Slab=Double Dalle en cerisier Cherry Sign=Panneau de cerisier Cherry Fence=Barrière en cerisier -Cherry Gate=Portillion en cerisier +Cherry Fence Gate=Portillion en cerisier Cherry Pressure Plate=Plaque de pression en cerisier Cherry Button=Bouton de Cerisier diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr index e3dc6d2fd..1cbe31bd2 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.pt_BR.tr @@ -19,6 +19,6 @@ Cherry Slab=Laje de Cerejeira Double Cherry Slab=Laje Dupla de Cerejeira Cherry Sign=Placa de Cerejeira Cherry Fence=Cerca de Cerejeira -Cherry Gate=Portão de Cerejeira +Cherry Fence Gate=Portão de Cerejeira Cherry Pressure Plate=Placa de Pressão de Cerejeira Cherry Button=Botão de Cerejeira diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr index 1dc530f7a..9959561d2 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.ru.tr @@ -19,6 +19,6 @@ Cherry Slab=Вишнёвая плита Double Cherry Slab=Двойная вишнёвая плита Cherry Sign=Вишнёвая табличка Cherry Fence=Вишнёвый забор -Cherry Gate=Вишнёвая калитка +Cherry Fence Gate=Вишнёвая калитка Cherry Pressure Plate=Вишнёвая нажимная плита Cherry Button=Вишнёвая кнопка diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/template.txt b/mods/ITEMS/mcl_cherry_blossom/locale/template.txt index 39ba7026a..a1aee1194 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/template.txt +++ b/mods/ITEMS/mcl_cherry_blossom/locale/template.txt @@ -19,6 +19,6 @@ Cherry Slab= Double Cherry Slab= Cherry Sign= Cherry Fence= -Cherry Gate= +Cherry Fence Gate= Cherry Pressure Plate= Cherry Button= diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 84d1a8a1b..5b9e0ce49 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -69,7 +69,7 @@ mcl_signs.register_sign_custom("mcl_cherry_blossom", "_cherrywood", mcl_fences.register_fence_and_fence_gate( "cherry_fence", S("Cherry Fence"), - S("Cherry Gate"), + S("Cherry Fence Gate"), "mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index 32d17538d..fff07cb7e 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index 8adf6e8b4..63621ade1 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to VoxeLibre. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds, hardness, blast_resistance)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -25,6 +25,8 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) * `sounds`: Sound table (optional, by default default uses stone sounds) +* `hardness`: Hardness of node (optional, default matches `source` node or fallback value 2) +* `blast_resistance`: Blast resistance of node (optional, default matches `source` node or fallback value 6) The following groups will automatically be added to the nodes (where applicable), you do not need to add them to the `groups` table: diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 57212e7dd..09a35b549 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -97,8 +97,10 @@ local full_blocks = { * inventory_image: Inventory image (optional) * groups: Base group memberships (optional, default is {pickaxey=1}) * sounds: Sound table (optional, default is stone) +* hardness: Hardness of node (optional, default matches `source` node or fallback value 2) +* blast_resistance: Blast resistance of node (optional, default matches `source` node or fallback value 6) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds, hardness, blast_resistance) local base_groups = groups if not base_groups then @@ -112,15 +114,29 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory local main_node_groups = table.copy(base_groups) main_node_groups.deco_block = 1 - -- TODO: Stop hardcoding blast resistance - - if not sounds then - sounds = mcl_sounds.node_sound_stone_defaults() - end - - if (not tiles) and source then - if minetest.registered_nodes[source] then - tiles = minetest.registered_nodes[source].tiles + if source then + -- Default values from `source` node + if not hardness then + hardness = minetest.registered_nodes[source]._mcl_hardness + end + if not blast_resistance then + blast_resistance = minetest.registered_nodes[source]._mcl_blast_resistance + end + if not sounds then + sounds = minetest.registered_nodes[source].sounds + end + if not tiles then + if minetest.registered_nodes[source] then + tiles = minetest.registered_nodes[source].tiles + end + end + else + -- Fallback in case no `source` given + if not hardness then + hardness = 2 + end + if not blast_resistance then + blast_resistance = 6 end end @@ -169,8 +185,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = take }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help @@ -197,8 +213,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[1]} }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -223,8 +239,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[2]} }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -255,8 +271,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2}, on_construct = update_wall, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) if source then minetest.register_craft({ From 293eb6d021e6bb90f0c199aacdc467a17a23fcee Mon Sep 17 00:00:00 2001 From: WillConker Date: Sun, 18 Aug 2024 05:40:25 +0200 Subject: [PATCH 023/273] Stop tnt colliding with entities (#4476) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4476 Reviewed-by: the-real-herowl Co-authored-by: WillConker Co-committed-by: WillConker --- mods/ITEMS/mcl_tnt/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 4d7be3125..a839611b9 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -116,6 +116,7 @@ minetest.register_node("mcl_tnt:tnt", { local TNT = { -- Static definition physical = true, -- Collides with things + collide_with_objects = false, --weight = -100, collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, visual = "cube", From 77bcf6cff397fc0f49c792270a8a8e55520f2f90 Mon Sep 17 00:00:00 2001 From: William Goodspeed Date: Sun, 18 Aug 2024 10:43:41 +0000 Subject: [PATCH 024/273] Allowing `hb.change_bar' called with hudbar uninitialized Calling `hb.change_bar' with hunger bar on damage disabled server will crash the server. To not overload other functions to check `enable_damage' over and over, simply make `hb.change_bar' able to be called with uninitialized identifiers. #4586 --- mods/HUD/hudbars/init.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mods/HUD/hudbars/init.lua b/mods/HUD/hudbars/init.lua index 7f86a959d..543692d51 100644 --- a/mods/HUD/hudbars/init.lua +++ b/mods/HUD/hudbars/init.lua @@ -330,9 +330,16 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value, new_icon local name = player:get_player_name() local hudtable = hb.get_hudtable(identifier) + + -- hb.change_hudbar may be called with a non-existing hudbar like hunger. + if hudtable == nil then + return false + end + if not hudtable.hudstate[name] then return false end + local value_changed, max_changed = false, false if new_value then From a6136ad1584d3baa546acb2a829218699c094c7f Mon Sep 17 00:00:00 2001 From: William Goodspeed Date: Sun, 18 Aug 2024 10:48:37 +0000 Subject: [PATCH 025/273] Removing absorption bar on damage disabled servers The absorption effect won't work on damage disabled servers and the health bar and hunger bar is also hidden leaving the absorption bar alone which makes it look not good. So not initializing it on those servers might be a good idea. --- mods/ITEMS/mcl_potions/functions.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index a1c838814..b59749d2a 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1260,7 +1260,11 @@ local function potions_init_icons(player) }) table.insert(icon_ids[name], id) end - hb.init_hudbar(player, "absorption") + + -- Absorption bar in damage disabled server is unneccessary + if minetest.settings:get_bool("enable_damage") == true then + hb.init_hudbar(player, "absorption") + end end local function potions_set_icons(player) From 406e0e8169d803132ac03e3e935b96e13243a166 Mon Sep 17 00:00:00 2001 From: WillConker Date: Sun, 18 Aug 2024 06:25:04 +0200 Subject: [PATCH 026/273] Made soul speed and depth strider speed boosts additive instead of exclusive (#4422) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4422 Reviewed-by: the-real-herowl Co-authored-by: WillConker Co-committed-by: WillConker --- mods/PLAYER/mcl_playerplus/init.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 646030202..ad1143c9d 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -512,23 +512,27 @@ minetest.register_globalstep(function(dtime) local boots = player:get_inventory():get_stack("armor", 5) local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") if soul_speed > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", soul_speed * 0.105 + 1.3) + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) else if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.1) + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.1) else - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4) + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4) end end - elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then + else + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:soul_speed") + end + if get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then local boots = player:get_inventory():get_stack("armor", 5) local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider") - if depth_strider > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", (depth_strider / 3) + 0.75) + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:depth_strider", (depth_strider / 3) + 0.75) + else + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider") end else - playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider") end -- Is player suffocating inside node? (Only for solid full opaque cube type nodes @@ -679,6 +683,8 @@ minetest.register_on_joinplayer(function(player) player:respawn() minetest.log("warning", name .. " joined the game with 0 hp and has been forced to respawn") end + + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") end) -- clear when player leaves From 948da34755d89edbcaf5567935364c46b84845e8 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 18 Aug 2024 08:45:49 +0200 Subject: [PATCH 027/273] Readded missing stairs and slabs (#4601) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also *probably* fixed their blast res and hardness Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4601 Reviewed-by: Mikita Wiśniewski Co-authored-by: the-real-herowl Co-committed-by: the-real-herowl --- mods/ITEMS/mcl_stairs/register.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index 920d8387d..7c0935a3c 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -115,6 +115,30 @@ mcl_stairs.register_slab("diorite", "mcl_core:diorite", mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double Diorite Slab")) +mcl_stairs.register_stair_and_slab("cobble", "mcl_core:cobble", + {pickaxey=1, material_stone=1}, + {"default_cobble.png"}, + S("Cobblestone Stairs"), + S("Cobblestone Slab"), + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Cobblestone Slab")) + +mcl_stairs.register_stair_and_slab("mossycobble", "mcl_core:mossycobble", + {pickaxey=1, material_stone=1}, + {"default_mossycobble.png"}, + S("Mossy Cobblestone Stairs"), + S("Mossy Cobblestone Slab"), + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Mossy Cobblestone Slab")) + +mcl_stairs.register_stair_and_slab("brick_block", "mcl_core:brick_block", + {pickaxey=1, material_stone=1}, + {"default_brick.png"}, + S("Brick Stairs"), + S("Brick Slab"), + mcl_sounds.node_sound_stone_defaults(), nil, nil, + S("Double Brick Slab")) + mcl_stairs.register_stair_and_slab("sandstone", "mcl_core:sandstone", {pickaxey=1, material_stone=1}, {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, From 2ad59c6df9e8e4f6960054275ba95239ac9dd723 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 18 Aug 2024 12:05:35 +0200 Subject: [PATCH 028/273] Stop lightning striking positions that don't have rain (#4386) Stops lighting from being able to strike in locations where rain doesn't occur, but allows lightning in adjacent areas where is allowed. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4386 Reviewed-by: the-real-herowl Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ENVIRONMENT/mcl_weather/thunder.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index f8e5a0371..c594cde37 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -10,6 +10,10 @@ mcl_weather.thunder = { init_done = false, } +lightning.register_on_strike(function(pos, pos2, objects) + if not mcl_weather.has_rain(pos) then return nil, true end +end) + minetest.register_globalstep(function(dtime) if mcl_weather.get_weather() ~= "thunder" then return false From 11168f226a6bde3cae125c4f401a3a1509b67255 Mon Sep 17 00:00:00 2001 From: WillConker Date: Mon, 1 Jul 2024 18:24:31 +0100 Subject: [PATCH 029/273] Revert "WaterLoggedRootsKelpFix (#3994)" This reverts commit a425d359f5cd2a4d6f7666f746923d1030dc938e. --- mods/ITEMS/mcl_mangrove/init.lua | 2 +- mods/ITEMS/mcl_ocean/kelp.lua | 3 +-- mods/ITEMS/mcl_sponges/init.lua | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index ac02966f3..ba20ac2a6 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -221,7 +221,7 @@ local wlroots = { liquids_pointable = true, drop = "mcl_mangrove:mangrove_roots", groups = { - handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, waterlogged = 1, not_in_creative_inventory=1 }, + handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, _mcl_blast_resistance = 100, _mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode on_construct = function(pos) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 530d96093..1084dfa77 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -267,8 +267,7 @@ function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flow -- Flowing liquid: Grow 1 step, but also turn the tip node into a liquid source. if downward_flowing then local alt_liq = mt_registered_nodes[node_tip.name].liquid_alternative_source - local alt_liq_accessible = mt_get_item_group(node_tip.name,"waterlogged") -- returns 0 if it isn't waterlogged. - if alt_liq and not alt_liq_accessible then + if alt_liq then mt_set_node(pos_tip, {name=alt_liq}) end end diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 87f40e3ae..e9755479b 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -155,7 +155,7 @@ minetest.register_node("mcl_sponges:sponge_wet", { buildable_to = false, stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {handy=1, hoey=1, waterlogged = 1, building_block=1}, + groups = {handy=1, hoey=1, building_block=1}, on_place = place_wet_sponge, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, @@ -175,7 +175,7 @@ if minetest.get_modpath("mclx_core") then buildable_to = false, stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {handy=1, waterlogged = 1, building_block=1}, + groups = {handy=1, building_block=1}, on_place = place_wet_sponge, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, From 15fa3ff7751a1c089e5e507f5c64ed9bfbe33f57 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 3 Nov 2023 15:22:19 +0100 Subject: [PATCH 030/273] Fix crash when growing kelp into water logged mangrove roots --- mods/ITEMS/mcl_mangrove/init.lua | 2 +- mods/ITEMS/mcl_ocean/kelp.lua | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index ba20ac2a6..a192b2ffc 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -221,7 +221,7 @@ local wlroots = { liquids_pointable = true, drop = "mcl_mangrove:mangrove_roots", groups = { - handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, + handy = 1, hoey = 1, water=4, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, _mcl_blast_resistance = 100, _mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode on_construct = function(pos) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 1084dfa77..0b43b9775 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -81,7 +81,8 @@ end -- Is this water? -- Returns the liquidtype, if indeed water. function kelp.is_submerged(node) - if mt_get_item_group(node.name, "water") ~= 0 then + local g = mt_get_item_group(node.name, "water") + if g > 0 and g <= 3 then -- Expected only "source" and "flowing" from water liquids return mt_registered_nodes[node.name].liquidtype end @@ -267,7 +268,7 @@ function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flow -- Flowing liquid: Grow 1 step, but also turn the tip node into a liquid source. if downward_flowing then local alt_liq = mt_registered_nodes[node_tip.name].liquid_alternative_source - if alt_liq then + if alt_liq and mt_registered_nodes[alt_liq] then mt_set_node(pos_tip, {name=alt_liq}) end end From 161dd7d379c473dd9521567cb231c15f22646a92 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 27 May 2024 08:04:22 +0000 Subject: [PATCH 031/273] Start refactor --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 537 +++++++++++----------- 1 file changed, 278 insertions(+), 259 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 87952845b..bc8c4d8f7 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,10 +1,11 @@ -local mods_loaded = false +-- Constants local NIGHT_VISION_RATIO = 0.45 - local MINIMUM_LIGHT_LEVEL = 0.2 +local DEFAULT_WATER_COLOR = "#3F76E4" -local water_color = "#3F76E4" - +-- Module state +local mods_loaded = false +local water_color = DEFAULT_WATER_COLOR local mg_name = minetest.get_mapgen_setting("mg_name") function mcl_weather.set_sky_box_clear(player, sky, fog) @@ -65,7 +66,7 @@ local function get_light_modifier(time) return light_multiplier end -mcl_weather.skycolor = { +local skycolor = { -- Should be activated before do any effect. active = true, @@ -88,287 +89,305 @@ mcl_weather.skycolor = { -- Table for tracking layer order layer_names = {}, - -- To layer to colors table - add_layer = function(layer_name, layer_color, instant_update) - mcl_weather.skycolor.colors[layer_name] = layer_color - table.insert(mcl_weather.skycolor.layer_names, layer_name) - mcl_weather.skycolor.force_update = true - end, + utils = {}, +} +mcl_weather.skycolor = skycolor +local skycolor_utils = skycolor.utils - current_layer_name = function() - return mcl_weather.skycolor.layer_names[#mcl_weather.skycolor.layer_names] - end, +-- To layer to colors table +function skycolor.add_layer(layer_name, layer_color, instant_update) + mcl_weather.skycolor.colors[layer_name] = layer_color + table.insert(mcl_weather.skycolor.layer_names, layer_name) + mcl_weather.skycolor.force_update = true +end - -- Retrieve layer from colors table - retrieve_layer = function() - local last_layer = mcl_weather.skycolor.current_layer_name() - return mcl_weather.skycolor.colors[last_layer] - end, +function skycolor.current_layer_name() + return mcl_weather.skycolor.layer_names[#mcl_weather.skycolor.layer_names] +end - -- Remove layer from colors table - remove_layer = function(layer_name) - for k, name in pairs(mcl_weather.skycolor.layer_names) do - if name == layer_name then - table.remove(mcl_weather.skycolor.layer_names, k) - mcl_weather.skycolor.force_update = true - return - end +-- Retrieve layer from colors table +function skycolor.retrieve_layer() + local last_layer = mcl_weather.skycolor.current_layer_name() + return mcl_weather.skycolor.colors[last_layer] +end + +-- Remove layer from colors table +function skycolor.remove_layer(layer_name) + for k, name in pairs(mcl_weather.skycolor.layer_names) do + if name == layer_name then + table.remove(mcl_weather.skycolor.layer_names, k) + mcl_weather.skycolor.force_update = true + return end - end, + end +end - -- Wrapper for updating day/night ratio that respects night vision - override_day_night_ratio = function(player, ratio) - local meta = player:get_meta() - local has_night_vision = meta:get_int("night_vision") == 1 - local has_darkness = meta:get_int("darkness") == 1 - local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 - local arg - if has_darkness and not is_visited_shepherd then - if has_night_vision then arg = 0.1 - else arg = 0 end - else - -- Apply night vision only for dark sky - local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then - if ratio == nil then - arg = NIGHT_VISION_RATIO - else - arg = math.max(ratio, NIGHT_VISION_RATIO) - end +-- Wrapper for updating day/night ratio that respects night vision +function skycolor.override_day_night_ratio(player, ratio) + local meta = player:get_meta() + local has_night_vision = meta:get_int("night_vision") == 1 + local has_darkness = meta:get_int("darkness") == 1 + local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 + local arg + if has_darkness and not is_visited_shepherd then + if has_night_vision then arg = 0.1 + else arg = 0 end + else + -- Apply night vision only for dark sky + local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then + if ratio == nil then + arg = NIGHT_VISION_RATIO else - arg = ratio + arg = math.max(ratio, NIGHT_VISION_RATIO) end + else + arg = ratio end - player:override_day_night_ratio(arg) - end, + end + player:override_day_night_ratio(arg) +end - -- Update sky color. If players not specified update sky for all players. - update_sky_color = function(players) - -- Override day/night ratio as well - players = mcl_weather.skycolor.utils.get_players(players) - for _, player in ipairs(players) do - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name - if minetest.get_item_group(checkname, "water") ~= 0 then +function water_sky(player) + local pos = player:get_pos() + local water_color = DEFAULT_WATER_COLOR + + local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name + if minetest.get_item_group(checkname, "water") == 0 then return end + + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then water_color = biome._mcl_waterfogcolor end + if not biome then water_color = "#3F76E4" end + + if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end + + return { + sky = { type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + indoors = water_color, + fog_sun_tint = water_color, + fog_moon_tint = water_color, + fog_tint_type = "custom" + }, + clouds = false, + } + } +end + +-- Update sky color. If players not specified update sky for all players. +function skycolor.update_sky_color(players) + -- Override day/night ratio as well + players = mcl_weather.skycolor.utils.get_players(players) + for _, player in ipairs(players) do + + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) + + local res = water_sky(player) + if res and res.sky then + player:set_sky(res.sky) + end + + if dim == "overworld" then + local biomesky + local biomefog + if mg_name ~= "v6" and mg_name ~= "singlenode" then local biome_index = minetest.get_biome_data(player:get_pos()).biome local biome_name = minetest.get_biome_name(biome_index) local biome = minetest.registered_biomes[biome_name] - if biome then water_color = biome._mcl_waterfogcolor end - if not biome then water_color = "#3F76E4" end - if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end - player:set_sky({ type = "regular", - sky_color = { - day_sky = water_color, - day_horizon = water_color, - dawn_sky = water_color, - dawn_horizon = water_color, - night_sky = water_color, - night_horizon = water_color, - indoors = water_color, - fog_sun_tint = water_color, - fog_moon_tint = water_color, - fog_tint_type = "custom" - }, - clouds = false, - }) + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end end - if dim == "overworld" then - local biomesky - local biomefog - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - if (mcl_weather.state == "none") then - -- Clear weather - mcl_weather.set_sky_box_clear(player,biomesky,biomefog) - player:set_sun({visible = true, sunrise_visible = true}) - player:set_moon({visible = true}) - player:set_stars({visible = true}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif not has_weather then - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - elseif has_weather then - -- Weather skies - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - - local light_factor = mcl_weather.get_current_light_factor() - if mcl_weather.skycolor.current_layer_name() == "lightning" then - mcl_weather.skycolor.override_day_night_ratio(player, 1) - elseif light_factor then - local time = minetest.get_timeofday() - local light_multiplier = get_light_modifier(time) - local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) - mcl_weather.skycolor.override_day_night_ratio(player, new_light) - else - mcl_weather.skycolor.override_day_night_ratio(player, nil) - end - end - elseif dim == "end" then - local biomesky = "#000000" - local biomefog = "#A080A0" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - local t = "mcl_playerplus_end_sky.png" - player:set_sky({ type = "skybox", - base_color = biomesky, - textures = {t,t,t,t,t,t}, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, 0.5) - elseif dim == "nether" then - local biomesky = "#6EB1FF" - local biomefog = "#330808" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end + if (mcl_weather.state == "none") then + -- Clear weather + mcl_weather.set_sky_box_clear(player,biomesky,biomefog) + player:set_sun({visible = true, sunrise_visible = true}) + player:set_moon({visible = true}) + player:set_stars({visible = true}) + mcl_weather.skycolor.override_day_night_ratio(player, nil) + elseif not has_weather then + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) mcl_weather.set_sky_color(player, { type = "regular", sky_color = { - day_sky = biomefog, - day_horizon = biomefog, - dawn_sky = biomefog, - dawn_horizon = biomefog, - night_sky = biomefog, - night_horizon = biomefog, - indoors = biomefog, - fog_sun_tint = biomefog, - fog_moon_tint = biomefog, - fog_tint_type = "custom" + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, }, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif dim == "void" then - player:set_sky({ type = "plain", - base_color = "#000000", - clouds = false, + clouds = true, + }) + player:set_sun({visible = false, sunrise_visible = false}) + player:set_moon({visible = false}) + player:set_stars({visible = false}) + elseif has_weather then + -- Weather skies + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0) + mcl_weather.set_sky_color(player, { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, }) player:set_sun({visible = false, sunrise_visible = false}) player:set_moon({visible = false}) player:set_stars({visible = false}) - end - end - end, - -- Returns current layer color in {r, g, b} format - get_sky_layer_color = function(timeofday) - if #mcl_weather.skycolor.layer_names == 0 then - return nil - end - - -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * mcl_weather.skycolor.max_val. - local rounded_time = math.floor(timeofday * mcl_weather.skycolor.max_val) - local color = mcl_weather.skycolor.utils.convert_to_rgb(mcl_weather.skycolor.min_val, mcl_weather.skycolor.max_val, rounded_time, mcl_weather.skycolor.retrieve_layer()) - return color - end, - - utils = { - convert_to_rgb = function(minval, maxval, current_val, colors) - local max_index = #colors - 1 - local val = (current_val-minval) / (maxval-minval) * max_index + 1.0 - local index1 = math.floor(val) - local index2 = math.min(math.floor(val)+1, max_index + 1) - local f = val - index1 - local c1 = colors[index1] - local c2 = colors[index2] - return {r=math.floor(c1.r + f*(c2.r - c1.r)), g=math.floor(c1.g + f*(c2.g-c1.g)), b=math.floor(c1.b + f*(c2.b - c1.b))} - end, - - -- Simply getter. Ether returns user given players list or get all connected players if none provided - get_players = function(players) - if players == nil or #players == 0 then - if mods_loaded then - players = minetest.get_connected_players() - elseif players == nil then - players = {} + local light_factor = mcl_weather.get_current_light_factor() + if mcl_weather.skycolor.current_layer_name() == "lightning" then + mcl_weather.skycolor.override_day_night_ratio(player, 1) + elseif light_factor then + local time = minetest.get_timeofday() + local light_multiplier = get_light_modifier(time) + local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) + mcl_weather.skycolor.override_day_night_ratio(player, new_light) + else + mcl_weather.skycolor.override_day_night_ratio(player, nil) end end - return players - end, - - -- 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) - if players[1] then - return players[1]:get_sky(true).sky_color + elseif dim == "end" then + local biomesky = "#000000" + local biomefog = "#A080A0" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end end - return nil + local t = "mcl_playerplus_end_sky.png" + player:set_sky({ type = "skybox", + base_color = biomesky, + textures = {t,t,t,t,t,t}, + clouds = false, + }) + player:set_sun({visible = false , sunrise_visible = false}) + player:set_moon({visible = false}) + player:set_stars({visible = false}) + mcl_weather.skycolor.override_day_night_ratio(player, 0.5) + elseif dim == "nether" then + local biomesky = "#6EB1FF" + local biomefog = "#330808" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. + biomefog = biome._mcl_fogcolor + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end + end + mcl_weather.set_sky_color(player, { + type = "regular", + sky_color = { + day_sky = biomefog, + day_horizon = biomefog, + dawn_sky = biomefog, + dawn_horizon = biomefog, + night_sky = biomefog, + night_horizon = biomefog, + indoors = biomefog, + fog_sun_tint = biomefog, + fog_moon_tint = biomefog, + fog_tint_type = "custom" + }, + clouds = false, + }) + player:set_sun({visible = false , sunrise_visible = false}) + player:set_moon({visible = false}) + player:set_stars({visible = false}) + mcl_weather.skycolor.override_day_night_ratio(player, nil) + elseif dim == "void" then + player:set_sky({ type = "plain", + base_color = "#000000", + clouds = false, + }) + player:set_sun({visible = false, sunrise_visible = false}) + player:set_moon({visible = false}) + player:set_stars({visible = false}) end - }, + end +end -- END function skycolor.update_sky_color(players) -} +-- Returns current layer color in {r, g, b} format +function skycolor.get_sky_layer_color(timeofday) + if #mcl_weather.skycolor.layer_names == 0 then + return nil + end + + -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * mcl_weather.skycolor.max_val. + local rounded_time = math.floor(timeofday * mcl_weather.skycolor.max_val) + local color = mcl_weather.skycolor.utils.convert_to_rgb(mcl_weather.skycolor.min_val, mcl_weather.skycolor.max_val, rounded_time, mcl_weather.skycolor.retrieve_layer()) + return color +end + +function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) + local max_index = #colors - 1 + local val = (current_val-minval) / (maxval-minval) * max_index + 1.0 + local index1 = math.floor(val) + local index2 = math.min(math.floor(val)+1, max_index + 1) + local f = val - index1 + local c1 = colors[index1] + local c2 = colors[index2] + return {r=math.floor(c1.r + f*(c2.r - c1.r)), g=math.floor(c1.g + f*(c2.g-c1.g)), b=math.floor(c1.b + f*(c2.b - c1.b))} +end + +-- Simply getter. Ether returns user given players list or get all connected players if none provided +function skycolor_utils.get_players(players) + if players == nil or #players == 0 then + if mods_loaded then + players = minetest.get_connected_players() + elseif players == nil then + players = {} + end + end + return players +end + +-- Returns first player sky color. I assume that all players are in same color layout. +function skycolor_utils.get_current_bg_color() + local players = mcl_weather.skycolor.utils.get_players(nil) + if players[1] then + return players[1]:get_sky(true).sky_color + end + return nil +end local timer = 0 minetest.register_globalstep(function(dtime) From f2a638f8e9296cddcb1a0b7007b027e383f1a9ee Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 27 May 2024 10:37:42 +0000 Subject: [PATCH 032/273] Fix random crash in darkness effect in mcl_potions, finish refactoring of mcl_weather.skycolor that also makes darkness effect more reliable --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 453 +++++++++++++--------- mods/ITEMS/mcl_mobitems/init.lua | 1 + mods/ITEMS/mcl_potions/functions.lua | 2 +- 3 files changed, 261 insertions(+), 195 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index bc8c4d8f7..5e1214e8c 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -124,33 +124,16 @@ end -- Wrapper for updating day/night ratio that respects night vision function skycolor.override_day_night_ratio(player, ratio) - local meta = player:get_meta() - local has_night_vision = meta:get_int("night_vision") == 1 - local has_darkness = meta:get_int("darkness") == 1 - local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 - local arg - if has_darkness and not is_visited_shepherd then - if has_night_vision then arg = 0.1 - else arg = 0 end - else - -- Apply night vision only for dark sky - local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then - if ratio == nil then - arg = NIGHT_VISION_RATIO - else - arg = math.max(ratio, NIGHT_VISION_RATIO) - end - else - arg = ratio - end - end - player:override_day_night_ratio(arg) + player._skycolor_day_night_ratio = ratio + skycolor.update_player_sky_color(player) + player._skycolor_day_night_ratio = nil end -function water_sky(player) + + + + +function water_sky(player, sky_data) local pos = player:get_pos() local water_color = DEFAULT_WATER_COLOR @@ -165,183 +148,265 @@ function water_sky(player) if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end - return { - sky = { type = "regular", - sky_color = { - day_sky = water_color, - day_horizon = water_color, - dawn_sky = water_color, - dawn_horizon = water_color, - night_sky = water_color, - night_horizon = water_color, - indoors = water_color, - fog_sun_tint = water_color, - fog_moon_tint = water_color, - fog_tint_type = "custom" - }, - clouds = false, - } + sky_data.sky = { type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + indoors = water_color, + fog_sun_tint = water_color, + fog_moon_tint = water_color, + fog_tint_type = "custom" + }, + clouds = false, } end + + + + +local dimension_handlers = {} +function dimension_handlers.overworld(player, sky_data) + local pos = player:get_pos() + local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) + + local biomesky + local biomefog + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end + end + if (mcl_weather.state == "none") then + -- Clear weather + mcl_weather.set_sky_box_clear(player,biomesky,biomefog) + sky_data.sun = {visible = true, sunrise_visible = true} + sky_data.moon = {visible = true} + sky_data.stars = {visible = true} + elseif not has_weather then + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + elseif has_weather then + -- Weather skies + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + + local light_factor = mcl_weather.get_current_light_factor() + if mcl_weather.skycolor.current_layer_name() == "lightning" then + sky_data.day_night_ratio = 1 + elseif light_factor then + local time = minetest.get_timeofday() + local light_multiplier = get_light_modifier(time) + local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) + sky_data.day_night_ratio = new_light + end + end +end +dimension_handlers["end"] = function(player, sky_data) + local biomesky = "#000000" + local biomefog = "#A080A0" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end + end + local t = "mcl_playerplus_end_sky.png" + sky_data.sky = { type = "skybox", + base_color = biomesky, + textures = {t,t,t,t,t,t}, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + sky_data.day_night_ratio = 0.5 +end +function dimension_handlers.nether(player, sky_data) + local biomesky = "#6EB1FF" + local biomefog = "#330808" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. + biomefog = biome._mcl_fogcolor + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end + end + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = biomefog, + day_horizon = biomefog, + dawn_sky = biomefog, + dawn_horizon = biomefog, + night_sky = biomefog, + night_horizon = biomefog, + indoors = biomefog, + fog_sun_tint = biomefog, + fog_moon_tint = biomefog, + fog_tint_type = "custom" + }, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end +function dimension_handlers.void(player, sky_data) + sky_data.sky = { type = "plain", + base_color = "#000000", + clouds = false, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +function dimension(player, sky_data) + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + + local handler = dimension_handlers[dim] + if handler then return handler(player, sky_data) end +end + + + + + +local effects_handlers = {} +function effects_handlers.darkness(player, meta, effect, sky_data) + -- No darkness effect if visited by shepherd + if meta:get_int("mcl_shepherd:special") == 1 then return end + + -- High stars + sky_data.stars = {visible = false} + + -- Minor visibility if the player has the night vision effect + if mcl_potions.has_effect(player, "night_vision") then + sky_data.day_night_ratio = 0.1 + else + sky_data.day_night_ratio = 0 + end +end +local DIM_ALLOW_NIGHT_VISION = { + overworld = true, + void = true, +} +function effects_handlers.night_vision(player, meta, effect, sky_data) + -- Apply night vision only for dark sky + if not (minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none") then return end + + -- Only some dimensions allow night vision + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + if not DIM_ALLOW_NIGHT_VISION[dim] then return end + + -- Apply night vision + sky_data.day_night_ratio = math.max(sky_data.day_night_ratio or 0, NIGHT_VISION_RATIO) +end +local has_mcl_potions = false +local function effects(player, sky_data) + if not has_mcl_potions then + if not minetest.get_modpath("mcl_potions") then return end + has_mcl_potions = true + end + + local meta = player:get_meta() + for name,effect in pairs(mcl_potions.registered_effects) do + local effect_data = mcl_potions.get_effect(player, name) + if effect_data then + local hook = effect.mcl_weather_skycolor or effects_handlers[name] + if hook then hook(player, meta, effect_data, sky_data) end + end + end + + -- Handle night vision for shepheard + if meta:get_int("mcl_shepherd:special") == 1 then + return effects_handlers.night_vision(player, meta, {}, sky_data) + end +end + + + + +function skycolor.update_player_sky_color(player) + local sky_data = { + day_night_ratio = player._skycolor_day_night_ratio + } + + water_sky(player, sky_data) + dimension(player, sky_data) + effects(player, sky_data) + + if sky_data.sky then player:set_sky(sky_data.sky) end + if sky_data.sun then player:set_sun(sky_data.sun) end + if sky_data.moon then player:set_moon(sky_data.moon) end + if sky_data.stars then player:set_stars(sky_data.stars) end + player:override_day_night_ratio(sky_data.day_night_ratio) +end + -- Update sky color. If players not specified update sky for all players. function skycolor.update_sky_color(players) -- Override day/night ratio as well players = mcl_weather.skycolor.utils.get_players(players) + local update = skycolor.update_player_sky_color for _, player in ipairs(players) do - - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - - local res = water_sky(player) - if res and res.sky then - player:set_sky(res.sky) - end - - if dim == "overworld" then - local biomesky - local biomefog - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - if (mcl_weather.state == "none") then - -- Clear weather - mcl_weather.set_sky_box_clear(player,biomesky,biomefog) - player:set_sun({visible = true, sunrise_visible = true}) - player:set_moon({visible = true}) - player:set_stars({visible = true}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif not has_weather then - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - elseif has_weather then - -- Weather skies - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - - local light_factor = mcl_weather.get_current_light_factor() - if mcl_weather.skycolor.current_layer_name() == "lightning" then - mcl_weather.skycolor.override_day_night_ratio(player, 1) - elseif light_factor then - local time = minetest.get_timeofday() - local light_multiplier = get_light_modifier(time) - local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) - mcl_weather.skycolor.override_day_night_ratio(player, new_light) - else - mcl_weather.skycolor.override_day_night_ratio(player, nil) - end - end - elseif dim == "end" then - local biomesky = "#000000" - local biomefog = "#A080A0" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - local t = "mcl_playerplus_end_sky.png" - player:set_sky({ type = "skybox", - base_color = biomesky, - textures = {t,t,t,t,t,t}, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, 0.5) - elseif dim == "nether" then - local biomesky = "#6EB1FF" - local biomefog = "#330808" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - mcl_weather.set_sky_color(player, { - type = "regular", - sky_color = { - day_sky = biomefog, - day_horizon = biomefog, - dawn_sky = biomefog, - dawn_horizon = biomefog, - night_sky = biomefog, - night_horizon = biomefog, - indoors = biomefog, - fog_sun_tint = biomefog, - fog_moon_tint = biomefog, - fog_tint_type = "custom" - }, - clouds = false, - }) - player:set_sun({visible = false , sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - mcl_weather.skycolor.override_day_night_ratio(player, nil) - elseif dim == "void" then - player:set_sky({ type = "plain", - base_color = "#000000", - clouds = false, - }) - player:set_sun({visible = false, sunrise_visible = false}) - player:set_moon({visible = false}) - player:set_stars({visible = false}) - end + update(player) end end -- END function skycolor.update_sky_color(players) diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 4d92c2d43..a3155b13c 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -155,6 +155,7 @@ local function drink_milk_delayed(itemstack, player, pointed_thing) mcl_hunger.stop_poison(player) end mcl_potions._reset_effects(player) + mcl_weather.skycolor.update_player_sky_color(player) end -- Wrapper for handling mcl_hunger delayed eating diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index b59749d2a..b3aa232ba 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -492,7 +492,7 @@ mcl_potions.register_effect({ end, on_step = function(dtime, object, factor, duration) if object:get_meta():get_int("night_vision") ~= 1 then - local flash = EF.darkness[object].flash + local flash = EF.darkness[object].flash or 0 if flash < 0.2 then EF.darkness[object].flashdir = true elseif flash > 0.6 then EF.darkness[object].flashdir = false end flash = EF.darkness[object].flashdir and (flash + dtime) or (flash - dtime) From 820848fb2ee87f7d5717e8d0903d04acc8b2dd82 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:07:32 -0500 Subject: [PATCH 033/273] Address review comments --- mods/ENVIRONMENT/mcl_weather/mod.conf | 2 +- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 329 +++--------------- .../mcl_weather/skycolor/dimensions.lua | 190 ++++++++++ .../mcl_weather/skycolor/effects.lua | 57 +++ .../mcl_weather/skycolor/water.lua | 36 ++ 5 files changed, 323 insertions(+), 291 deletions(-) create mode 100644 mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua create mode 100644 mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua create mode 100644 mods/ENVIRONMENT/mcl_weather/skycolor/water.lua diff --git a/mods/ENVIRONMENT/mcl_weather/mod.conf b/mods/ENVIRONMENT/mcl_weather/mod.conf index 4f1102b7a..52c4ae7aa 100644 --- a/mods/ENVIRONMENT/mcl_weather/mod.conf +++ b/mods/ENVIRONMENT/mcl_weather/mod.conf @@ -1,5 +1,5 @@ name = mcl_weather author = xeranas description = Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience -depends = mcl_init, mcl_worlds +depends = mcl_init, mcl_worlds, mcl_playerinfo optional_depends = lightning diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 5e1214e8c..fcafe531c 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,16 +1,16 @@ -- Constants +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) +local mod = mcl_weather local NIGHT_VISION_RATIO = 0.45 -local MINIMUM_LIGHT_LEVEL = 0.2 -local DEFAULT_WATER_COLOR = "#3F76E4" -- Module state local mods_loaded = false -local water_color = DEFAULT_WATER_COLOR local mg_name = minetest.get_mapgen_setting("mg_name") function mcl_weather.set_sky_box_clear(player, sky, fog) local pos = player:get_pos() - if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end + if minetest.get_item_group( mcl_playerinfo[player:get_player_name()].node_head, "water") ~= 0 then return end local sc = { day_sky = "#7BA4FF", day_horizon = "#C0D8FF", @@ -48,24 +48,6 @@ function mcl_weather.set_sky_color(player, def) }) end --- Function to work out light modifier at different times --- Noon is brightest, midnight is darkest, 0600 and 18000 is in the middle of this -local function get_light_modifier(time) - -- 0.1 = 0.2 - -- 0.4 = 0.8 - -- 0.5 = 1 - -- 0.6 = 0.8 - -- 0.9 = 0.2 - - local light_multiplier = time * 2 - if time > 0.5 then - light_multiplier = 2 * (1 - time) - else - light_multiplier = time / 0.5 - end - return light_multiplier -end - local skycolor = { -- Should be activated before do any effect. active = true, @@ -94,7 +76,7 @@ local skycolor = { mcl_weather.skycolor = skycolor local skycolor_utils = skycolor.utils --- To layer to colors table +-- Add layer to colors table function skycolor.add_layer(layer_name, layer_color, instant_update) mcl_weather.skycolor.colors[layer_name] = layer_color table.insert(mcl_weather.skycolor.layer_names, layer_name) @@ -129,269 +111,21 @@ function skycolor.override_day_night_ratio(player, ratio) player._skycolor_day_night_ratio = nil end +local skycolor_filters = {} +skycolor.filters = skycolor_filters +dofile(modpath.."/skycolor/water.lua") +dofile(modpath.."/skycolor/dimensions.lua") +dofile(modpath.."/skycolor/effects.lua") - - - -function water_sky(player, sky_data) - local pos = player:get_pos() - local water_color = DEFAULT_WATER_COLOR - - local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name - if minetest.get_item_group(checkname, "water") == 0 then return end - - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then water_color = biome._mcl_waterfogcolor end - if not biome then water_color = "#3F76E4" end - - if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end - - sky_data.sky = { type = "regular", - sky_color = { - day_sky = water_color, - day_horizon = water_color, - dawn_sky = water_color, - dawn_horizon = water_color, - night_sky = water_color, - night_horizon = water_color, - indoors = water_color, - fog_sun_tint = water_color, - fog_moon_tint = water_color, - fog_tint_type = "custom" - }, - clouds = false, - } -end - - - - - -local dimension_handlers = {} -function dimension_handlers.overworld(player, sky_data) - local pos = player:get_pos() - local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - - local biomesky - local biomefog - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - if (mcl_weather.state == "none") then - -- Clear weather - mcl_weather.set_sky_box_clear(player,biomesky,biomefog) - sky_data.sun = {visible = true, sunrise_visible = true} - sky_data.moon = {visible = true} - sky_data.stars = {visible = true} - elseif not has_weather then - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - sky_data.sky = { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - } - sky_data.sun = {visible = false, sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} - elseif has_weather then - -- Weather skies - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - sky_data.sky = { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - } - sky_data.sun = {visible = false, sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} - - local light_factor = mcl_weather.get_current_light_factor() - if mcl_weather.skycolor.current_layer_name() == "lightning" then - sky_data.day_night_ratio = 1 - elseif light_factor then - local time = minetest.get_timeofday() - local light_multiplier = get_light_modifier(time) - local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) - sky_data.day_night_ratio = new_light - end - end -end -dimension_handlers["end"] = function(player, sky_data) - local biomesky = "#000000" - local biomefog = "#A080A0" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor - biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - local t = "mcl_playerplus_end_sky.png" - sky_data.sky = { type = "skybox", - base_color = biomesky, - textures = {t,t,t,t,t,t}, - clouds = false, - } - sky_data.sun = {visible = false , sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} - sky_data.day_night_ratio = 0.5 -end -function dimension_handlers.nether(player, sky_data) - local biomesky = "#6EB1FF" - local biomefog = "#330808" - if mg_name ~= "v6" and mg_name ~= "singlenode" then - local biome_index = minetest.get_biome_data(player:get_pos()).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] - if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) - biomesky = biome._mcl_skycolor -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. The fog colour is used for both sky and fog. - biomefog = biome._mcl_fogcolor - else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) - end - end - sky_data.sky = { - type = "regular", - sky_color = { - day_sky = biomefog, - day_horizon = biomefog, - dawn_sky = biomefog, - dawn_horizon = biomefog, - night_sky = biomefog, - night_horizon = biomefog, - indoors = biomefog, - fog_sun_tint = biomefog, - fog_moon_tint = biomefog, - fog_tint_type = "custom" - }, - clouds = false, - } - sky_data.sun = {visible = false , sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} -end -function dimension_handlers.void(player, sky_data) - sky_data.sky = { type = "plain", - base_color = "#000000", - clouds = false, - } - sky_data.sun = {visible = false, sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} -end - -function dimension(player, sky_data) - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - - local handler = dimension_handlers[dim] - if handler then return handler(player, sky_data) end -end - - - - - -local effects_handlers = {} -function effects_handlers.darkness(player, meta, effect, sky_data) - -- No darkness effect if visited by shepherd - if meta:get_int("mcl_shepherd:special") == 1 then return end - - -- High stars - sky_data.stars = {visible = false} - - -- Minor visibility if the player has the night vision effect - if mcl_potions.has_effect(player, "night_vision") then - sky_data.day_night_ratio = 0.1 - else - sky_data.day_night_ratio = 0 - end -end -local DIM_ALLOW_NIGHT_VISION = { - overworld = true, - void = true, -} -function effects_handlers.night_vision(player, meta, effect, sky_data) - -- Apply night vision only for dark sky - if not (minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none") then return end - - -- Only some dimensions allow night vision - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - if not DIM_ALLOW_NIGHT_VISION[dim] then return end - - -- Apply night vision - sky_data.day_night_ratio = math.max(sky_data.day_night_ratio or 0, NIGHT_VISION_RATIO) -end -local has_mcl_potions = false -local function effects(player, sky_data) - if not has_mcl_potions then - if not minetest.get_modpath("mcl_potions") then return end - has_mcl_potions = true - end - - local meta = player:get_meta() - for name,effect in pairs(mcl_potions.registered_effects) do - local effect_data = mcl_potions.get_effect(player, name) - if effect_data then - local hook = effect.mcl_weather_skycolor or effects_handlers[name] - if hook then hook(player, meta, effect_data, sky_data) end - end - end - - -- Handle night vision for shepheard - if meta:get_int("mcl_shepherd:special") == 1 then - return effects_handlers.night_vision(player, meta, {}, sky_data) - end -end - - - - +local water_sky = skycolor.water_sky function skycolor.update_player_sky_color(player) local sky_data = { day_night_ratio = player._skycolor_day_night_ratio } - water_sky(player, sky_data) - dimension(player, sky_data) - effects(player, sky_data) + for i = 1,#skycolor_filters do + skycolor_filters[i](player, sky_data) + end if sky_data.sky then player:set_sky(sky_data.sky) end if sky_data.sun then player:set_sun(sky_data.sun) end @@ -423,17 +157,32 @@ function skycolor.get_sky_layer_color(timeofday) end function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) - local max_index = #colors - 1 - local val = (current_val-minval) / (maxval-minval) * max_index + 1.0 - local index1 = math.floor(val) - local index2 = math.min(math.floor(val)+1, max_index + 1) - local f = val - index1 - local c1 = colors[index1] - local c2 = colors[index2] - return {r=math.floor(c1.r + f*(c2.r - c1.r)), g=math.floor(c1.g + f*(c2.g-c1.g)), b=math.floor(c1.b + f*(c2.b - c1.b))} + -- Clamp current_val to valid range + current_val = math.min(minval, current_val) + current_val = math.max(maxval, current_val) + + -- Rescale current_val from a number between minval and maxval to a number between 1 and #colors + local scaled_value = (current_val - minval) / (maxval - minval) * (#colors - 1) + 1.0 + + -- Get the first color's values + local index1 = math.floor(scaled_value) + local color1 = colors[index1] + local frac1 = scaled_value - index1 + + -- Get the second color's values + local index2 = math.min(index1 + 1, #colors) -- clamp to maximum color index (will occur if index1 == #colors) + local frac2 = 1.0 - fraction1 + local color2 = colors[index2] + + -- Interpolate between color1 and color2 + return { + r = math.floor(frac1 * color1.r + frac2 * color2.r), + g = math.floor(frac1 * color1.g + frac2 * color2.g), + b = math.floor(frac1 * color1.b + frac2 * color2.b), + } end --- Simply getter. Ether returns user given players list or get all connected players if none provided +-- Simple getter. Either returns user given players list or get all connected players if none provided function skycolor_utils.get_players(players) if players == nil or #players == 0 then if mods_loaded then @@ -445,7 +194,7 @@ function skycolor_utils.get_players(players) return players end --- Returns first player sky color. I assume that all players are in same color layout. +-- Returns the sky color of the first player, which is done assuming that all players are in same color layout. function skycolor_utils.get_current_bg_color() local players = mcl_weather.skycolor.utils.get_players(nil) if players[1] then diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua new file mode 100644 index 000000000..6b481badc --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -0,0 +1,190 @@ +local MINIMUM_LIGHT_LEVEL = 0.2 +local VALID_SNOW_WEATHER_STATES = { snow = true, rain = true, thunder = true } +local VALID_RAIN_WEATHER_STATES = { rain = true, thunder = true } + +local dimension_handlers = {} +mcl_weather.skycolor.dimension_handlers = dimension_handlers + +-- Function to work out light modifier at different times +-- Noon is brightest, midnight is darkest, 0600 and 18000 is in the middle of this +local function get_light_modifier(time) + -- 0.1 = 0.2 + -- 0.4 = 0.8 + -- 0.5 = 1 + -- 0.6 = 0.8 + -- 0.9 = 0.2 + + local light_multiplier = time * 2 + if time > 0.5 then + light_multiplier = 2 * (1 - time) + else + light_multiplier = time / 0.5 + end + return light_multiplier +end + +function dimension_handlers.overworld(player, sky_data) + local pos = player:get_pos() + + local biomesky + local biomefog + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + else + --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) + end + end + + if mcl_weather.state == "none" then + -- Clear weather + mcl_weather.set_sky_box_clear(player,biomesky,biomefog) + sky_data.sun = {visible = true, sunrise_visible = true} + sky_data.moon = {visible = true} + sky_data.stars = {visible = true} + return + end + + -- Check if we currently have weather that affects the sky color + local has_weather = mcl_worlds.has_weather(pos) and ( + mcl_weather.has_snow(pos) and VALID_SNOW_WEATHER_STATES[mcl_weather.state] or + mcl_weather.has_rain(pos) and VALID_RAIN_WEATHER_STATES[mcl_weather.state] + ) + if has_weather then + -- Weather skies + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + + local light_factor = mcl_weather.get_current_light_factor() + if mcl_weather.skycolor.current_layer_name() == "lightning" then + sky_data.day_night_ratio = 1 + elseif light_factor then + local time = minetest.get_timeofday() + local light_multiplier = get_light_modifier(time) + local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) + sky_data.day_night_ratio = new_light + end + return + end + + -- No weather that affects the sky color, use default values + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +-- This can't be function dimension_handlers.end() due to lua syntax +dimension_handlers["end"] = function(player, sky_data) + local biomesky = "#000000" + local biomefog = "#A080A0" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor -- The End biomes seemingly don't use the fog colour, despite having this value according to the wiki. The sky colour is seemingly used for both sky and fog? + end + end + local t = "mcl_playerplus_end_sky.png" + sky_data.sky = { type = "skybox", + base_color = biomesky, + textures = {t,t,t,t,t,t}, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} + sky_data.day_night_ratio = 0.5 +end + +function dimension_handlers.nether(player, sky_data) + local biomesky = "#6EB1FF" + local biomefog = "#330808" + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then + -- The Nether biomes seemingly don't use the sky colour, despite having this value according to the wiki. + -- The fog colour is used for both sky and fog. + biomesky = biome._mcl_skycolor + biomefog = biome._mcl_fogcolor + end + end + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = biomefog, + day_horizon = biomefog, + dawn_sky = biomefog, + dawn_horizon = biomefog, + night_sky = biomefog, + night_horizon = biomefog, + indoors = biomefog, + fog_sun_tint = biomefog, + fog_moon_tint = biomefog, + fog_tint_type = "custom" + }, + clouds = false, + } + sky_data.sun = {visible = false , sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +function dimension_handlers.void(player, sky_data) + sky_data.sky = { type = "plain", + base_color = "#000000", + clouds = false, + } + sky_data.sun = {visible = false, sunrise_visible = false} + sky_data.moon = {visible = false} + sky_data.stars = {visible = false} +end + +local function dimension(player, sky_data) + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + + local handler = dimension_handlers[dim] + if handler then return handler(player, sky_data) end +end +table.insert(mcl_weather.skycolor.filters, dimension) + diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua new file mode 100644 index 000000000..c0a349410 --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -0,0 +1,57 @@ +local DIM_ALLOW_NIGHT_VISION = { + overworld = true, + void = true, +} + +local effects_handlers = {} +local has_mcl_potions = false + +function effects_handlers.darkness(player, meta, effect, sky_data) + -- No darkness effect if visited by shepherd + if meta:get_int("mcl_shepherd:special") == 1 then return end + + -- High stars + sky_data.stars = {visible = false} + + -- Minor visibility if the player has the night vision effect + if mcl_potions.has_effect(player, "night_vision") then + sky_data.day_night_ratio = 0.1 + else + sky_data.day_night_ratio = 0 + end +end +function effects_handlers.night_vision(player, meta, effect, sky_data) + -- Apply night vision only for dark sky + if not (minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none") then return end + + -- Only some dimensions allow night vision + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + if not DIM_ALLOW_NIGHT_VISION[dim] then return end + + -- Apply night vision + sky_data.day_night_ratio = math.max(sky_data.day_night_ratio or 0, NIGHT_VISION_RATIO) +end + +local function effects(player, sky_data) + if not has_mcl_potions then + if not minetest.get_modpath("mcl_potions") then return end + has_mcl_potions = true + end + + local meta = player:get_meta() + for name,effect in pairs(mcl_potions.registered_effects) do + local effect_data = mcl_potions.get_effect(player, name) + if effect_data then + local hook = effect.mcl_weather_skycolor or effects_handlers[name] + if hook then hook(player, meta, effect_data, sky_data) end + end + end + + -- Handle night vision for shepherd + if meta:get_int("mcl_shepherd:special") == 1 then + return effects_handlers.night_vision(player, meta, {}, sky_data) + end +end +table.insert(mcl_weather.skycolor.filters, effects) + diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua new file mode 100644 index 000000000..4dd7120be --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -0,0 +1,36 @@ + +local DEFAULT_WATER_COLOR = "#3F76E4" + +local function water_sky(player, sky_data) + local pos = player:get_pos() + local water_color = DEFAULT_WATER_COLOR + + local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name + if minetest.get_item_group(checkname, "water") == 0 then return end + + local biome_index = minetest.get_biome_data(player:get_pos()).biome + local biome_name = minetest.get_biome_name(biome_index) + local biome = minetest.registered_biomes[biome_name] + if biome then water_color = biome._mcl_waterfogcolor end + if not biome then water_color = DEFAULT_WATER_COLOR end + + if checkname == "mclx_core:river_water_source" or checkname == "mclx_core:river_water_flowing" then water_color = "#0084FF" end + + sky_data.sky = { type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + indoors = water_color, + fog_sun_tint = water_color, + fog_moon_tint = water_color, + fog_tint_type = "custom" + }, + clouds = false, + } +end +table.insert(mcl_weather.skycolor.filters, water_sky) + From 24ff7347b22c15ae152431797f7a222ae23ed205 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:12:04 -0500 Subject: [PATCH 034/273] Further cleanup --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index fcafe531c..571d9480f 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -9,8 +9,10 @@ local mods_loaded = false local mg_name = minetest.get_mapgen_setting("mg_name") function mcl_weather.set_sky_box_clear(player, sky, fog) - local pos = player:get_pos() - if minetest.get_item_group( mcl_playerinfo[player:get_player_name()].node_head, "water") ~= 0 then return end + -- Make sure the player's head isn't in water before changing the skybox + local node_head = mcl_playerinfo[player:get_player_name()].node_head + if minetest.get_item_group(node_head, "water") ~= 0 then return end + local sc = { day_sky = "#7BA4FF", day_horizon = "#C0D8FF", @@ -39,8 +41,10 @@ function mcl_weather.set_sky_box_clear(player, sky, fog) end function mcl_weather.set_sky_color(player, def) - local pos = player:get_pos() - if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1.5, 0)).name, "water") ~= 0 then return end + -- Make sure the player's head isn't in water before changing the skybox + local node_head = mcl_playerinfo[player:get_player_name()].node_head + if minetest.get_item_group(node_head, "water") ~= 0 then return end + player:set_sky({ type = def.type, sky_color = def.sky_color, From 7811e2361191a0c30d4961b3251b71269d167c77 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:16:04 -0500 Subject: [PATCH 035/273] Convert to use mcl_playerinfo --- mods/ENVIRONMENT/mcl_weather/skycolor/water.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua index 4dd7120be..c1e9a5927 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -5,7 +5,7 @@ local function water_sky(player, sky_data) local pos = player:get_pos() local water_color = DEFAULT_WATER_COLOR - local checkname = minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name + local checkname = mcl_playerinfo[name].node_head if minetest.get_item_group(checkname, "water") == 0 then return end local biome_index = minetest.get_biome_data(player:get_pos()).biome From cf4b1dbd1d36fafea00e0159b7dc98a57ba1a90a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:20:38 -0500 Subject: [PATCH 036/273] Remove END function comment --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 571d9480f..cf0c3f70e 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -146,7 +146,7 @@ function skycolor.update_sky_color(players) for _, player in ipairs(players) do update(player) end -end -- END function skycolor.update_sky_color(players) +end -- Returns current layer color in {r, g, b} format function skycolor.get_sky_layer_color(timeofday) From 207c86b813520c6a5e34eb3887504c1bc7c89ed1 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:36:19 -0500 Subject: [PATCH 037/273] Fix crash and rearrange code --- mods/ENVIRONMENT/mcl_weather/skycolor/water.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua index c1e9a5927..fd6fc12e2 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -2,13 +2,13 @@ local DEFAULT_WATER_COLOR = "#3F76E4" local function water_sky(player, sky_data) - local pos = player:get_pos() local water_color = DEFAULT_WATER_COLOR - local checkname = mcl_playerinfo[name].node_head + local checkname = mcl_playerinfo[player:get_player_name()].node_head if minetest.get_item_group(checkname, "water") == 0 then return end - local biome_index = minetest.get_biome_data(player:get_pos()).biome + local pos = player:get_pos() + local biome_index = minetest.get_biome_data(pos).biome local biome_name = minetest.get_biome_name(biome_index) local biome = minetest.registered_biomes[biome_name] if biome then water_color = biome._mcl_waterfogcolor end From 03faa7764da53494b956def99e4624e1f8312405 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 12 Jun 2024 20:37:11 -0500 Subject: [PATCH 038/273] Fix variable name (caused crash) --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index cf0c3f70e..3a0d8af41 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -175,7 +175,7 @@ function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) -- Get the second color's values local index2 = math.min(index1 + 1, #colors) -- clamp to maximum color index (will occur if index1 == #colors) - local frac2 = 1.0 - fraction1 + local frac2 = 1.0 - frac1 local color2 = colors[index2] -- Interpolate between color1 and color2 From d34c804ebfa3d6cfaed09c25cc44ac6d7e9d886b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 13 Jun 2024 05:56:10 -0500 Subject: [PATCH 039/273] Remove local mod = mcl_weather and replace accesses to variables thru mcl_weather with local variable equivalents --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 55 +++++++++++------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 3a0d8af41..b4626b77b 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,7 +1,6 @@ -- Constants local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) -local mod = mcl_weather local NIGHT_VISION_RATIO = 0.45 -- Module state @@ -82,27 +81,27 @@ local skycolor_utils = skycolor.utils -- Add layer to colors table function skycolor.add_layer(layer_name, layer_color, instant_update) - mcl_weather.skycolor.colors[layer_name] = layer_color - table.insert(mcl_weather.skycolor.layer_names, layer_name) - mcl_weather.skycolor.force_update = true + skycolor.colors[layer_name] = layer_color + table.insert(skycolor.layer_names, layer_name) + skycolor.force_update = true end function skycolor.current_layer_name() - return mcl_weather.skycolor.layer_names[#mcl_weather.skycolor.layer_names] + return skycolor.layer_names[#skycolor.layer_names] end -- Retrieve layer from colors table function skycolor.retrieve_layer() - local last_layer = mcl_weather.skycolor.current_layer_name() - return mcl_weather.skycolor.colors[last_layer] + local last_layer = skycolor.current_layer_name() + return skycolor.colors[last_layer] end -- Remove layer from colors table function skycolor.remove_layer(layer_name) - for k, name in pairs(mcl_weather.skycolor.layer_names) do + for k, name in pairs(skycolor.layer_names) do if name == layer_name then - table.remove(mcl_weather.skycolor.layer_names, k) - mcl_weather.skycolor.force_update = true + table.remove(skycolor.layer_names, k) + skycolor.force_update = true return end end @@ -141,7 +140,7 @@ end -- Update sky color. If players not specified update sky for all players. function skycolor.update_sky_color(players) -- Override day/night ratio as well - players = mcl_weather.skycolor.utils.get_players(players) + players = skycolor_utils.get_players(players) local update = skycolor.update_player_sky_color for _, player in ipairs(players) do update(player) @@ -150,14 +149,16 @@ end -- Returns current layer color in {r, g, b} format function skycolor.get_sky_layer_color(timeofday) - if #mcl_weather.skycolor.layer_names == 0 then + if #skycolor.layer_names == 0 then return nil end - -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * mcl_weather.skycolor.max_val. - local rounded_time = math.floor(timeofday * mcl_weather.skycolor.max_val) - local color = mcl_weather.skycolor.utils.convert_to_rgb(mcl_weather.skycolor.min_val, mcl_weather.skycolor.max_val, rounded_time, mcl_weather.skycolor.retrieve_layer()) - return color + -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * skycolor.max_val + local rounded_time = math.floor(timeofday * skycolor.max_val) + return skycolor_utils.convert_to_rgb( + skycolor.min_val, skycolor.max_val, + rounded_time, skycolor.retrieve_layer() + ) end function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) @@ -200,7 +201,7 @@ end -- Returns the sky color of the first player, which is done assuming that all players are in same color layout. function skycolor_utils.get_current_bg_color() - local players = mcl_weather.skycolor.utils.get_players(nil) + local players = skycolor_utils.get_players(nil) if players[1] then return players[1]:get_sky(true).sky_color end @@ -209,33 +210,31 @@ end local timer = 0 minetest.register_globalstep(function(dtime) - if mcl_weather.skycolor.active ~= true or #minetest.get_connected_players() == 0 then + if skycolor.active ~= true or #minetest.get_connected_players() == 0 then return end - if mcl_weather.skycolor.force_update then - mcl_weather.skycolor.update_sky_color() - mcl_weather.skycolor.force_update = false + if skycolor.force_update then + skycolor.update_sky_color() + skycolor.force_update = false return end -- regular updates based on iterval timer = timer + dtime; - if timer >= mcl_weather.skycolor.update_interval then - mcl_weather.skycolor.update_sky_color() + if timer >= skycolor.update_interval then + skycolor.update_sky_color() timer = 0 end - end) local function initsky(player) - if player.set_lighting then player:set_lighting({ shadows = { intensity = tonumber(minetest.settings:get("mcl_default_shadow_intensity") or 0.33) } }) end - if (mcl_weather.skycolor.active) then - mcl_weather.skycolor.force_update = true + if (skycolor.active) then + skycolor.force_update = true end player:set_clouds(mcl_worlds:get_cloud_parameters() or {height=mcl_worlds.layer_to_y(127), speed={x=-2, z=0}, thickness=4, color="#FFF0FEF"}) @@ -245,7 +244,7 @@ minetest.register_on_joinplayer(initsky) minetest.register_on_respawnplayer(initsky) mcl_worlds.register_on_dimension_change(function(player) - mcl_weather.skycolor.update_sky_color({player}) + skycolor.update_sky_color({player}) end) minetest.register_on_mods_loaded(function() From 3b01fe20baa091dc3cda0a21b12073ce7a82a774 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 13 Jun 2024 06:10:03 -0500 Subject: [PATCH 040/273] Remove debug commented out logging, remove extra zero in 24-hour time --- mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 6b481badc..7f9c084c6 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -6,7 +6,7 @@ local dimension_handlers = {} mcl_weather.skycolor.dimension_handlers = dimension_handlers -- Function to work out light modifier at different times --- Noon is brightest, midnight is darkest, 0600 and 18000 is in the middle of this +-- Noon is brightest, midnight is darkest, 0600 and 1800 is in the middle of this local function get_light_modifier(time) -- 0.1 = 0.2 -- 0.4 = 0.8 @@ -33,11 +33,9 @@ function dimension_handlers.overworld(player, sky_data) local biome_name = minetest.get_biome_name(biome_index) local biome = minetest.registered_biomes[biome_name] if biome then - --minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name)) biomesky = biome._mcl_skycolor biomefog = biome._mcl_fogcolor else - --minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name)) end end From ef58a9809af1300b8f5c845bc39fa93eb8847ba3 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 13 Jun 2024 06:43:31 -0500 Subject: [PATCH 041/273] Remove empty else block, fix up mg_name and add mapgen check to water.lua --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 1 - mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua | 2 +- mods/ENVIRONMENT/mcl_weather/skycolor/water.lua | 10 +++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index b4626b77b..1e6e3198b 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -5,7 +5,6 @@ local NIGHT_VISION_RATIO = 0.45 -- Module state local mods_loaded = false -local mg_name = minetest.get_mapgen_setting("mg_name") function mcl_weather.set_sky_box_clear(player, sky, fog) -- Make sure the player's head isn't in water before changing the skybox diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 7f9c084c6..16ae0a1d2 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -1,6 +1,7 @@ local MINIMUM_LIGHT_LEVEL = 0.2 local VALID_SNOW_WEATHER_STATES = { snow = true, rain = true, thunder = true } local VALID_RAIN_WEATHER_STATES = { rain = true, thunder = true } +local mg_name = minetest.get_mapgen_setting("mg_name") local dimension_handlers = {} mcl_weather.skycolor.dimension_handlers = dimension_handlers @@ -35,7 +36,6 @@ function dimension_handlers.overworld(player, sky_data) if biome then biomesky = biome._mcl_skycolor biomefog = biome._mcl_fogcolor - else end end diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua index fd6fc12e2..03b1115ce 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -1,5 +1,6 @@ local DEFAULT_WATER_COLOR = "#3F76E4" +local mg_name = minetest.get_mapgen_setting("mg_name") local function water_sky(player, sky_data) local water_color = DEFAULT_WATER_COLOR @@ -8,9 +9,12 @@ local function water_sky(player, sky_data) if minetest.get_item_group(checkname, "water") == 0 then return end local pos = player:get_pos() - local biome_index = minetest.get_biome_data(pos).biome - local biome_name = minetest.get_biome_name(biome_index) - local biome = minetest.registered_biomes[biome_name] + local biome = nil + if mg_name ~= "v6" and mg_name ~= "singlenode" then + local biome_index = minetest.get_biome_data(pos).biome + local biome_name = minetest.get_biome_name(biome_index) + biome = minetest.registered_biomes[biome_name] + end if biome then water_color = biome._mcl_waterfogcolor end if not biome then water_color = DEFAULT_WATER_COLOR end From cd213b75f74bb31a0f89a6cb8d0090f4991790b8 Mon Sep 17 00:00:00 2001 From: Wbjitscool Date: Tue, 14 May 2024 07:17:04 +0000 Subject: [PATCH 042/273] Update mods/ENVIRONMENT/mcl_weather/skycolor.lua adds in sunray shader support for Minetest version 5.9.0 --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 1e6e3198b..69b9f5c97 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -229,11 +229,22 @@ end) local function initsky(player) if player.set_lighting then - player:set_lighting({ shadows = { intensity = tonumber(minetest.settings:get("mcl_default_shadow_intensity") or 0.33) } }) + player:set_lighting({ + shadows = { intensity = 0.33 }, + volumetric_light = { strength = 0.45 }, + exposure = { + luminance_min = -3.5, + luminance_max = -2.5, + exposure_correction = 0.35, + speed_dark_bright = 1500, + speed_bright_dark = 700, + }, + saturation = 1.1, + }) end if (skycolor.active) then - skycolor.force_update = true + mcl_weather.skycolor.force_update = true end player:set_clouds(mcl_worlds:get_cloud_parameters() or {height=mcl_worlds.layer_to_y(127), speed={x=-2, z=0}, thickness=4, color="#FFF0FEF"}) From cb097d9bcda33e1b7eb9db94b6904141263a8dfc Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 06:53:53 -0500 Subject: [PATCH 043/273] Add minimum time between skycolor updates (default is 250ms, tracked per player) --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 69b9f5c97..bca0d8234 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -3,6 +3,9 @@ local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) local NIGHT_VISION_RATIO = 0.45 +-- Settings +local minimum_update_interval = { 250e3 } + -- Module state local mods_loaded = false @@ -119,8 +122,29 @@ dofile(modpath.."/skycolor/water.lua") dofile(modpath.."/skycolor/dimensions.lua") dofile(modpath.."/skycolor/effects.lua") +local function get_skycolor_info(player) + local player_name = player:get_player_name() + + local info = mcl_playerinfo[player_name] or {} + + local skycolor_data = info.skycolor + if not skycolor_data then + skycolor_data = {} + info.skycolor = skycolor_data + end + + return skycolor_data +end + local water_sky = skycolor.water_sky function skycolor.update_player_sky_color(player) + -- Don't update more than once every 250 milliseconds + local skycolor_data = get_skycolor_info(player) + local last_update = skycolor_data.last_update or 0 + local now_us = minetest.get_us_time() + if (now_us - last_update) < minimum_update_interval[1] then return end + skycolor_data.last_update = now_us + local sky_data = { day_night_ratio = player._skycolor_day_night_ratio } From 0e1a2cbc1e1d02df545f645f073e1a351d4545d1 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 06:54:44 -0500 Subject: [PATCH 044/273] Correct conditions for water-air transition forced skycolor update --- mods/PLAYER/mcl_playerplus/init.lua | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index ad1143c9d..b4fa23945 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -407,13 +407,30 @@ minetest.register_globalstep(function(dtime) set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0)) end - local underwater - if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and underwater ~= true then - mcl_weather.skycolor.update_sky_color() - local underwater = true - elseif get_item_group(mcl_playerinfo[name].node_head, "water") == 0 and underwater == true then - mcl_weather.skycolor.update_sky_color() - local underwater = false + local playerinfo = mcl_playerinfo[name] or {} + local plusinfo = playerinfo.mcl_playerplus + if not plusinfo then + plusinfo = {} + playerinfo.mcl_playerplus = plusinfo + end + + -- Only process if node_head changed + if plusinfo.old_node_head ~= playerinfo.node_head then + local node_head = playerinfo.node_head or "" + local old_node_head = plusinfo.old_node_head or "" + plusinfo.old_node_head = playerinfo.node_head + + minetest.log(dump({ + node_head = node_head, + old_node_head = old_node_head, + new_group = get_item_group(node_head, "water"), + old_group = get_item_group(old_node_head, "water"), + })) + + -- Update skycolor if moving in or out of water + if (get_item_group(node_head, "water") == 0) ~= (get_item_group(old_node_head, "water") == 0) then + mcl_weather.skycolor.update_sky_color() + end end elytra.last_yaw = player:get_look_horizontal() From dc074ff555a9f1e9b0d78f3d87de9856b46dbdc9 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 08:22:20 -0500 Subject: [PATCH 045/273] Remove debug logging --- mods/PLAYER/mcl_playerplus/init.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index b4fa23945..709d1d0fb 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -420,13 +420,6 @@ minetest.register_globalstep(function(dtime) local old_node_head = plusinfo.old_node_head or "" plusinfo.old_node_head = playerinfo.node_head - minetest.log(dump({ - node_head = node_head, - old_node_head = old_node_head, - new_group = get_item_group(node_head, "water"), - old_group = get_item_group(old_node_head, "water"), - })) - -- Update skycolor if moving in or out of water if (get_item_group(node_head, "water") == 0) ~= (get_item_group(old_node_head, "water") == 0) then mcl_weather.skycolor.update_sky_color() From 3667feddd31eee7cf4800379f5f0d8e9e157ef7a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 08:31:56 -0500 Subject: [PATCH 046/273] Address review comments --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 ++ mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index bca0d8234..9beb82b64 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -73,6 +73,8 @@ local skycolor = { -- number of colors while constructing gradient of user given colors max_val = 1000, + NIGHT_VISION_RATIO = NIGHT_VISION_RATIO, + -- Table for tracking layer order layer_names = {}, diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua index c0a349410..9e7680ba1 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -3,8 +3,9 @@ local DIM_ALLOW_NIGHT_VISION = { void = true, } +local NIGHT_VISION_RATIO = mcl_weather.skycolor.NIGHT_VISION_RATIO local effects_handlers = {} -local has_mcl_potions = false +local has_mcl_potions = not not minetest.get_modpath("mcl_potions") -- Coerce to boolean with "not not" function effects_handlers.darkness(player, meta, effect, sky_data) -- No darkness effect if visited by shepherd @@ -34,10 +35,7 @@ function effects_handlers.night_vision(player, meta, effect, sky_data) end local function effects(player, sky_data) - if not has_mcl_potions then - if not minetest.get_modpath("mcl_potions") then return end - has_mcl_potions = true - end + if not has_mcl_potions then return end local meta = player:get_meta() for name,effect in pairs(mcl_potions.registered_effects) do From 18266137b2654b0dcf3a7f2788a2bd659ef7ab0b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 08:32:21 -0500 Subject: [PATCH 047/273] Make sure clouds don't disappear when entering water --- mods/ENVIRONMENT/mcl_weather/skycolor/water.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua index 03b1115ce..ec14d8844 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/water.lua @@ -33,7 +33,7 @@ local function water_sky(player, sky_data) fog_moon_tint = water_color, fog_tint_type = "custom" }, - clouds = false, + clouds = true, } end table.insert(mcl_weather.skycolor.filters, water_sky) From 37ff699a238cd1c7053428247144516323508a6e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 08:33:57 -0500 Subject: [PATCH 048/273] Add line break --- mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua index 9e7680ba1..c3dd32fc7 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -21,6 +21,7 @@ function effects_handlers.darkness(player, meta, effect, sky_data) sky_data.day_night_ratio = 0 end end + function effects_handlers.night_vision(player, meta, effect, sky_data) -- Apply night vision only for dark sky if not (minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none") then return end From 21a88be2b2a693c662c3784a9c935a52aba59497 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 19 Jun 2024 08:49:26 -0500 Subject: [PATCH 049/273] Remove boolean coersion --- mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua index c3dd32fc7..c8b4a32af 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -5,7 +5,7 @@ local DIM_ALLOW_NIGHT_VISION = { local NIGHT_VISION_RATIO = mcl_weather.skycolor.NIGHT_VISION_RATIO local effects_handlers = {} -local has_mcl_potions = not not minetest.get_modpath("mcl_potions") -- Coerce to boolean with "not not" +local has_mcl_potions = minetest.get_modpath("mcl_potions") function effects_handlers.darkness(player, meta, effect, sky_data) -- No darkness effect if visited by shepherd From 87a48270f509623887f67d69fa3e5b3ca45d4a91 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 21 Jun 2024 19:47:33 -0500 Subject: [PATCH 050/273] Add mcl_util.to_bool --- mods/CORE/mcl_util/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index b6fd71673..783f5031b 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1103,3 +1103,8 @@ function mcl_util.is_it_christmas() return false end end + +function mcl_util.to_bool(val) + if not val then return false end + return true +end From e407e2e290e5e4c84613e017d8de2a1943910912 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 21 Jun 2024 19:47:58 -0500 Subject: [PATCH 051/273] Force has_mcl_potions to boolean --- mods/ENVIRONMENT/mcl_weather/mod.conf | 2 +- mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/mod.conf b/mods/ENVIRONMENT/mcl_weather/mod.conf index 52c4ae7aa..ee6f03407 100644 --- a/mods/ENVIRONMENT/mcl_weather/mod.conf +++ b/mods/ENVIRONMENT/mcl_weather/mod.conf @@ -1,5 +1,5 @@ name = mcl_weather author = xeranas description = Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience -depends = mcl_init, mcl_worlds, mcl_playerinfo +depends = mcl_init, mcl_worlds, mcl_playerinfo, mcl_util optional_depends = lightning diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua index c8b4a32af..d905d8f31 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -5,7 +5,7 @@ local DIM_ALLOW_NIGHT_VISION = { local NIGHT_VISION_RATIO = mcl_weather.skycolor.NIGHT_VISION_RATIO local effects_handlers = {} -local has_mcl_potions = minetest.get_modpath("mcl_potions") +local has_mcl_potions = mcl_util.to_bool(minetest.get_modpath("mcl_potions")) function effects_handlers.darkness(player, meta, effect, sky_data) -- No darkness effect if visited by shepherd From 09307292bce5145a8eec8837de636a448c9f0672 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 26 Jun 2024 19:51:33 -0500 Subject: [PATCH 052/273] Make sure overworld always gets a sky update regardless of weather, add assert to enforce sky color gets set every update --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 4 +- .../mcl_weather/skycolor/dimensions.lua | 44 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 9beb82b64..19cec9eac 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -155,7 +155,9 @@ function skycolor.update_player_sky_color(player) skycolor_filters[i](player, sky_data) end - if sky_data.sky then player:set_sky(sky_data.sky) end + assert(sky_data.sky) + player:set_sky(sky_data.sky) + if sky_data.sun then player:set_sun(sky_data.sun) end if sky_data.moon then player:set_moon(sky_data.moon) end if sky_data.stars then player:set_stars(sky_data.stars) end diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 16ae0a1d2..fcf85a7e0 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -39,12 +39,29 @@ function dimension_handlers.overworld(player, sky_data) end end + -- Use overworld defaults + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) + local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) + local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) + sky_data.sky = { + type = "regular", + sky_color = { + day_sky = day_color, + day_horizon = day_color, + dawn_sky = dawn_color, + dawn_horizon = dawn_color, + night_sky = night_color, + night_horizon = night_color, + }, + clouds = true, + } + sky_data.sun = {visible = true, sunrise_visible = true} + sky_data.moon = {visible = true} + sky_data.stars = {visible = true} + if mcl_weather.state == "none" then -- Clear weather mcl_weather.set_sky_box_clear(player,biomesky,biomefog) - sky_data.sun = {visible = true, sunrise_visible = true} - sky_data.moon = {visible = true} - sky_data.stars = {visible = true} return end @@ -83,28 +100,7 @@ function dimension_handlers.overworld(player, sky_data) local new_light = math.max(light_factor * light_multiplier, MINIMUM_LIGHT_LEVEL) sky_data.day_night_ratio = new_light end - return end - - -- No weather that affects the sky color, use default values - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) - local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) - local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - sky_data.sky = { - type = "regular", - sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, - }, - clouds = true, - } - sky_data.sun = {visible = false, sunrise_visible = false} - sky_data.moon = {visible = false} - sky_data.stars = {visible = false} end -- This can't be function dimension_handlers.end() due to lua syntax From aea9e6d182fee283d7aee612c03c510f2d2f45ba Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 18 Aug 2024 19:32:03 -0500 Subject: [PATCH 053/273] Update comment according to https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4338#issuecomment-82713 --- mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua index d905d8f31..ce90bb13a 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/effects.lua @@ -8,7 +8,7 @@ local effects_handlers = {} local has_mcl_potions = mcl_util.to_bool(minetest.get_modpath("mcl_potions")) function effects_handlers.darkness(player, meta, effect, sky_data) - -- No darkness effect if visited by shepherd + -- No darkness effect if is a visited shepherd if meta:get_int("mcl_shepherd:special") == 1 then return end -- High stars From b141f7c0a4dbd93472daf7988c0387b6181ae4d2 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 4 Aug 2024 07:39:05 -0300 Subject: [PATCH 054/273] new special field to solve drop bug --- mods/ENTITIES/mcl_item_entity/init.lua | 7 +++++++ mods/ITEMS/mcl_farming/beetroot.lua | 1 + mods/ITEMS/mcl_farming/wheat.lua | 1 + 3 files changed, 9 insertions(+) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f23d7af42..73a8a7870 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -321,6 +321,7 @@ function minetest.handle_node_drops(pos, drops, digger) if tool and nodedef._mcl_fortune_drop and enchantments.fortune then local fortune_level = enchantments.fortune local fortune_drop = nodedef._mcl_fortune_drop + local simple_drop = nodedef._mcl_fortune_drop.drop_without_fortune if fortune_drop.discrete_uniform_distribution then local min_count = fortune_drop.min_count local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) @@ -336,6 +337,12 @@ function minetest.handle_node_drops(pos, drops, digger) local drop = get_fortune_drops(fortune_drop, fortune_level) drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) end + + if simple_drop then + for _, item in ipairs(simple_drop) do + table.insert(drops, item) + end + end end if digger and mcl_experience.throw_xp and not silk_touch_drop then diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index f32b2bf8e..962fb100e 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -119,6 +119,7 @@ minetest.register_node("mcl_farming:beetroot", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:beetroot_seeds"}, + drop_without_fortune = {"mcl_farming:beetroot_item"}, min_count = 1, max_count = 3, cap = 5, diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 676cc1301..051c5a8d6 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -92,6 +92,7 @@ minetest.register_node("mcl_farming:wheat", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:wheat_seeds"}, + drop_without_fortune = {"mcl_farming:wheat_item"}, min_count = 1, max_count = 6, cap = 7 From 95653a067634306533aa381631adcbc549c85773 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 4 Aug 2024 09:59:27 -0300 Subject: [PATCH 055/273] ipairs to pairs --- mods/ENTITIES/mcl_item_entity/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 73a8a7870..c56102254 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -339,7 +339,7 @@ function minetest.handle_node_drops(pos, drops, digger) end if simple_drop then - for _, item in ipairs(simple_drop) do + for _, item in pairs(simple_drop) do table.insert(drops, item) end end From 7e832dc641536c34d50a8f3a8c6a9abd495b8bb2 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 28 Aug 2024 06:17:53 -0500 Subject: [PATCH 056/273] Fix adding water bottles and emptying full cauldrons --- mods/ITEMS/mcl_buckets/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 6aebbc759..3783d65d7 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -209,7 +209,7 @@ local function on_place_bucket_empty(itemstack, user, pointed_thing) -- Call on_rightclick if the pointed node defines it local new_stack = mcl_util.call_on_rightclick(itemstack, user, pointed_thing) - if new_stack then + if new_stack and new_stack ~= itemstack then return new_stack end diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 446f6ef16..7926cbe36 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -226,10 +226,9 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end local cauldron = nil @@ -239,11 +238,10 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") end - if cauldron then - set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) + return set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) elseif node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then - set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") + return set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") end end From 5b039f1855ef32d5b616fe20b157b5a6a432343c Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 28 Aug 2024 06:30:12 -0500 Subject: [PATCH 057/273] Fix getting water back into bottle --- mods/ITEMS/mcl_potions/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 7926cbe36..3d00d2801 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -61,10 +61,9 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end -- Try to fill glass bottle with water From d2b96b6142748c57ef3df44443432ae41ee20e23 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 30 Aug 2024 18:20:38 +0200 Subject: [PATCH 058/273] Queue is not used anywhere (#4608) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dead code. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4608 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_structures/api.lua | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index cf47b4e30..02f96a1b3 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,6 +1,5 @@ mcl_structures.registered_structures = {} -local place_queue = {} local disabled_structures = minetest.settings:get("mcl_disabled_structures") if disabled_structures then disabled_structures = disabled_structures:split(",") else disabled_structures = {} end @@ -216,17 +215,6 @@ local function foundation(ground_p1,ground_p2,pos,sidelen) minetest.bulk_set_node(stone,{name=node_stone}) end -local function process_queue() - if #place_queue < 1 then return end - local s = table.remove(place_queue) - mcl_structures.place_schematic(s.pos, s.file, s.rot, nil, true, "place_center_x,place_center_z",function(s) - if s.after_place then - s.after_place(s.pos,s.def,s.pr) - end - end,s.pr) - minetest.after(0.5,process_queue) -end - function mcl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water) n = n or 1 local sp = {} From 8fd736e0fd178729e2ba9e4ce2476eed6c6b5d96 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 30 Aug 2024 18:22:05 +0200 Subject: [PATCH 059/273] Improve cactus drops and spawning (#4581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - breaking cactus will drop randomly in x=-0.75..+0.75, z=-0.75..+0.75 - breaking cactus will have an initial velocity in this direction - if a larger cactus break, they break into the same direction - cactus growth rate reduced 4x, to debuff farm efficiency (will need a larger rebalancing) - cactus only spawns when there is air surrounding it and above, so it does not immediately break - slightly increase the frequency of cactus to counter this The first changes make cactus farms possible. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4581 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_core/functions.lua | 33 +++++++++++++++++++------------ mods/MAPGEN/mcl_biomes/init.lua | 7 +++++-- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 64d3e2197..84a88b529 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -191,12 +191,16 @@ minetest.register_abm({ nodenames = {"mcl_core:cactus"}, neighbors = {"group:sand"}, interval = 25, - chance = 10, + chance = 40, action = function(pos) mcl_core.grow_cactus(pos) end, }) +local function is_walkable(pos) + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + return ndef and ndef.walkable +end minetest.register_abm({ label = "Cactus mechanisms", nodenames = {"mcl_core:cactus"}, @@ -209,18 +213,21 @@ minetest.register_abm({ object:remove() end end - local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } } - for _, p in pairs(posses) do - local ndef = minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name] - if ndef and ndef.walkable then - local posy = pos.y - while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do - local pos = vector.new(pos.x, posy, pos.z) - minetest.dig_node(pos) - -- minetest.add_item(vector.offset(pos, math.random(-0.5, 0.5), 0, math.random(-0.5, 0.5)), "mcl_core:cactus") - posy = posy + 1 - end - break + if is_walkable(vector.offset(pos, 1, 0, 0)) + or is_walkable(vector.offset(pos, -1, 0, 0)) + or is_walkable(vector.offset(pos, 0, 0, 1)) + or is_walkable(vector.offset(pos, 0, 0, -1)) then + local lpos = vector.copy(pos) + local dx, dy + while true do + local node = minetest.get_node(lpos) + if not node or node.name ~= "mcl_core:cactus" then break end + minetest.dig_node(lpos) + dx = dx or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 + dy = dy or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 + local obj = minetest.add_item(vector.offset(lpos, dx, 0.25, dy), "mcl_core:cactus") + obj:set_velocity(vector.new(dx, 1, dy)) + lpos.y = lpos.y + 1 end end end, diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 2cde3fc2a..8f4d4076a 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -4656,9 +4656,9 @@ local function register_decorations() place_on = {"group:sand"}, sidelen = 16, noise_params = { - offset = -0.012, + offset = -0.01, scale = 0.024, - spread = {x = 100, y = 100, z = 100}, + spread = vector.new(100, 100, 100), seed = 257, octaves = 3, persist = 0.6 @@ -4672,6 +4672,9 @@ local function register_decorations() "MesaPlateauFM", "MesaPlateauFM_sandlevel"}, height = 1, height_max = 3, + spawn_by = "air", + check_offset = 1, + num_spawn_by = 16 }) -- Sugar canes From 411cb2b9b913ce7e9afaa91ae51f0b2d9da16430 Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Fri, 30 Jun 2023 14:32:34 +0000 Subject: [PATCH 060/273] Correct the names of pumpins and carved pumpkins. Slightly update their descriptions. --- mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr | 12 ++++++------ mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr | 12 ++++++------ mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/template.txt | 8 ++++---- mods/ITEMS/mcl_farming/pumpkin.lua | 10 +++++----- 9 files changed, 46 insertions(+), 46 deletions(-) diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr index 54b356306..069046169 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Junger Kürbisstängel (@1. Stufe) Mature Pumpkin Stem=Ausgewachsener Kürbisstängel A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Ein ausgewachsener Kürbisstängel versucht, auf einem seiner vier benachbarten Blöcke einen Kürbis wachsen zu lassen. Ein Kürbis kann nur auf Ackerboden, Erde oder einem Grasblock wachsen. Wenn sich ein Kürbis neben einem Kürbisstängel befindet, verbiegt sich der Kürbisstängel und verbindet sich mit dem Kürbis. Solange der Stängel verbunden ist, kann aus ihm kein neuer Kürbis wachsen. Wenn alle Kürbisse um den Kürbisstängel entfernt wurden, verliert er die Verbindung und aus ihm kann ein weiterer Kürbis wachsen. -Faceless Pumpkin=Gesichtsloser Kürbis -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Ein gesichtsloser Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um Kürbissamen zu erhalten. -Pumpkin=Kürbis -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Einen Kürbis kann zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Kürbisse wachsen aus Kürbisstängeln, welche wiederum aus Kürbissamen wachsen. +Pumpkin=Gesichtsloser Kürbis +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Ein gesichtsloser Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um Kürbissamen zu erhalten. +Carved Pumpkin=Kürbis +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Einen Kürbis kann zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Kürbisse wachsen aus Kürbisstängeln, welche wiederum aus Kürbissamen wachsen. Jack o'Lantern=Kürbislaterne A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Eine Kürbislaterne ist eine traditionelle Dekoration für Halloween. Sie leuchtet hell. Pumpkin Pie=Kürbiskuchen @@ -89,11 +89,11 @@ Cookie=Keks Bread=Brot Hay Bale=Heuballen Hay bales are decorative blocks made from wheat.=Heuballen sind dekorative Blöcke, die aus Weizen gemacht sind. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Um ein Gesicht in den Kürbis zu schnitzen, benutzen Sie die Schere an der Seite, die Sie schnitzen wollen. +To carve a pumpkin, use the shears on the side you want the face to appear.=Um ein Gesicht in den Kürbis zu schnitzen, benutzen Sie die Schere an der Seite, die Sie schnitzen wollen. Use the “Place” key on an animal to try to feed it wheat.=Benutzen Sie die „Platzieren“-Taste auf einem Tier, um zu versuchen, es zu füttern. Grows on farmland=Wächst auf Ackerboden Turns block into farmland=Macht Block zu Ackerboden 60% chance of poisoning=60% Vergiftungswahrscheinlichkeit Surface for crops=Boden für Nutzpflanzen Can become wet=Kann nass werden -Uses: @1=Verwendungen: @1 +Uses: @1=Verwendungen: @1 \ No newline at end of file diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr index 8366e8252..40d9deb1f 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.es.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Tallo de calabaza prematuro (Etapa @1) Mature Pumpkin Stem=Tallo maduro de calabaza A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Un tallo maduro de calabaza intenta cultivar una calabaza en uno de sus cuatro bloques adyacentes. Una calabaza solo puede crecer sobre tierras de cultivo, tierra o un bloque de hierba. Cuando una calabaza está al lado de un tallo de calabaza, el tallo de la calabaza se dobla inmediatamente y se conecta a la calabaza. Un tallo de calabaza conectado no puede cultivar otra calabaza. Tan pronto como se hayan eliminado todas las calabazas alrededor del tallo, pierde la conexión y está lista para cultivar otra calabaza. -Faceless Pumpkin=Calabaza sin rostro -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Una calabaza sin rostro es un bloque decorativo. Se puede tallar con tijeras para obtener semillas de calabaza. -Pumpkin=Calabaza -A pumpkin can be worn as a helmet for fun, but it doesn't offer any protection. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Una calabaza se puede usar como casco por diversión, pero no ofrece ninguna protección. Las calabazas crecen de tallos de calabaza, que a su vez crecen de semillas de calabaza. +Pumpkin=Calabaza sin rostro +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Una calabaza sin rostro es un bloque decorativo. Se puede tallar con tijeras para obtener semillas de calabaza. +Carved Pumpkin=Calabaza +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Una calabaza se puede usar como casco por diversión, pero no ofrece ninguna protección. Las calabazas crecen de tallos de calabaza, que a su vez crecen de semillas de calabaza. Jack o'Lantern=Calabaza de Halloween A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=La calabaza de Halloween es una decoración tradicional de Halloween hecha de una calabaza. Brilla intensamente. Pumpkin Pie=Tarta de calabaza @@ -89,5 +89,5 @@ Cookie=Galleta Bread=Pan Hay Bale=Fardo de heno Hay bales are decorative blocks made from wheat.=Las balas de heno son bloques decorativos hechos de trigo. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Para tallar una cara en la calabaza, use las tijeras en el lado que desea tallar. +To carve a pumpkin, use the shears on the side you want the face to appear.=Para tallar una cara en la calabaza, use las tijeras en el lado que desea tallar. Use the “Place” key on an animal to try to feed it wheat.=Use la tecla "Colocar" en un animal para tratar de alimentarlo con trigo. diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr index f7746b6ad..dd6170d98 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.fr.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Tige de citrouille prématurée (étape @1) Mature Pumpkin Stem=Tige de citrouille mature A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Une tige de citrouille mature tente de faire pousser une citrouille dans l'un de ses quatre blocs adjacents. Une citrouille ne peut pousser que sur des terres agricoles, de la terre ou un bloc d'herbe. Lorsqu'une citrouille est à côté d'une tige de citrouille, la tige de citrouille se plie immédiatement et se connecte à la citrouille. Une tige de citrouille connectée ne peut pas faire pousser une autre citrouille. Dès que toutes les citrouilles autour de la tige ont été retirées, elle perd la connexion et est prête à faire pousser une autre citrouille. -Faceless Pumpkin=Citrouille sans visage -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Une citrouille sans visage est un bloc décoratif. Il peut être sculpté avec une cisaille pour obtenir des graines de citrouille. -Pumpkin=Citrouille -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Une citrouille peut être portée comme un casque. Les citrouilles poussent à partir de tiges de citrouille, qui à leur tour poussent à partir de graines de citrouille. +Pumpkin=Citrouille sans visage +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Une citrouille sans visage est un bloc décoratif. Il peut être sculpté avec une cisaille pour obtenir des graines de citrouille. +Carved Pumpkin=Citrouille +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Une citrouille peut être portée comme un casque. Les citrouilles poussent à partir de tiges de citrouille, qui à leur tour poussent à partir de graines de citrouille. Jack o'Lantern=Citrouille-lanterne A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Une citrouille-lanterne est une décoration traditionnelle d'Halloween à base de citrouille. Elle brille de mille feux. Pumpkin Pie=Tarte à la citrouille @@ -93,10 +93,10 @@ Cookie=Cookie Bread=Pain Hay Bale=Balle de foin Hay bales are decorative blocks made from wheat.=Les balles de foin sont des blocs décoratifs en blé. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Pour sculpter un visage dans la citrouille, utilisez les cisailles du côté que vous souhaitez sculpter. +To carve a pumpkin, use the shears on the side you want the face to appear.=Pour sculpter un visage dans la citrouille, utilisez les cisailles du côté que vous souhaitez sculpter. Use the “Place” key on an animal to try to feed it wheat.=Utilisez la touche "Placer" sur un animal pour essayer de le nourrir de blé. Grows on farmland=Pousse sur les terres agricoles -Turns block into farmland=Transforme un bloc en terre agricole +Turns block into farmland=Transforme un bloc en terres agricoles 60% chance of poisoning=60% de chances d'empoisonnement Surface for crops=Surface pour les cultures Can become wet=Peut devenir humide diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr index d50c49911..78b0334a7 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.ja.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=未成熟なカボチャの茎(@1段階目) Mature Pumpkin Stem=成熟したカボチャの茎 A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=成熟したカボチャの茎は、隣接する4つのブロックのいずれかでカボチャを実らせようとします。実るのは、耕地、土、草原の上だけです。カボチャの茎の隣にカボチャがあると、茎はすぐに曲がってカボチャにつながります。つながっている間は、他のカボチャを実らせられません。茎の周りのカボチャをすべて取り除くと、接続が切れて次のカボチャが実るようになります。 -Faceless Pumpkin=顔のないカボチャ -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=顔のないカボチャは装飾ブロックです。これをハサミで彫ると、カボチャの種が得られます。 -Pumpkin=カボチャ -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=カボチャは、カボチャの種から育つ茎を経て実ります。ハサミで彫るとヘルメットとして被る事もできます。 +Pumpkin=顔のないカボチャ +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=顔のないカボチャは装飾ブロックです。これをハサミで彫ると、カボチャの種が得られます。 +Carved Pumpkin=カボチャ +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=カボチャは、カボチャの種から育つ茎を経て実ります。ハサミで彫るとヘルメットとして被る事もできます。 Jack o'Lantern=ジャック・オー・ランタン A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=ジャック・オー・ランタンとは、カボチャから作られるハロウィンの伝統的な飾りです。明るく光ります。 Pumpkin Pie=パンプキンパイ @@ -89,7 +89,7 @@ Cookie=クッキー Bread=パン Hay Bale=干草の俵 Hay bales are decorative blocks made from wheat.=干草の俵とは、小麦から作られた装飾ブロックのことです。 -To carve a face into the pumpkin, use the shears on the side you want to carve.=カボチャに顔を彫るには、彫りたい方の面にハサミを使います。 +To carve a pumpkin, use the shears on the side you want the face to appear.=カボチャに顔を彫るには、彫りたい方の面にハサミを使います。 Use the “Place” key on an animal to try to feed it wheat.=動物に「配置」キーを使って、小麦を与えてみましょう。 Grows on farmland=耕地に生育 Turns block into farmland=ブロックを耕地にする diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr index 3f8d0fc6c..007db800c 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Niedojrzała łodyga dyni (etap @1) Mature Pumpkin Stem=Dojrzała łodyga dyni A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Dojrzała łodyga dyni próbuje postawić dynię na jednym z czterech sąsiadujących bloków. Dynia może wyrosnąć tylko na polu uprawnym, ziemi lub bloku trawy. Gdy dynia jest obok łodygi dyni, ugina się ona i łączy z dynią. Z połączonej łodygi dyni nie może wyrosnąć kolejna dynia. Jak tylko wszystkie pobliskie dynie są usunięte, traci ona połączenie i może z niej wyrosnąć następna dynia. -Faceless Pumpkin=Dynia bez twarzy -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Dynia bez twarzy jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać nasiona dyni. -Pumpkin=Dynia -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Dynia może być noszona jak hełm. Dynie rosną z łodygi dyni, która z kolei rośnie z nasion dyni. +Pumpkin=Dynia bez twarzy +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Dynia bez twarzy jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać nasiona dyni. +Carved Pumpkin=Dynia +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Dynia może być noszona jak hełm. Dynie rosną z łodygi dyni, która z kolei rośnie z nasion dyni. Jack o'Lantern=Świecąca dynia A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Świecąca dynia jest tradycyjną dekoracją Halloween wykonaną z dyni, która jasno świeci. Pumpkin Pie=Ciasto z dyni @@ -90,7 +90,7 @@ Cookie=Ciastko Bread=Chleb Hay Bale=Bela siana Hay bales are decorative blocks made from wheat.=Bele siana są blokami dekoracyjnymi wytwarzanymi ze zboża. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Aby wyrzeźbić twarz w dyni, użyj nożyc na boku w którym chcesz wyrzeźbić. +To carve a pumpkin, use the shears on the side you want the face to appear.=Aby wyrzeźbić twarz w dyni, użyj nożyc na boku w którym chcesz wyrzeźbić. Use the “Place” key on an animal to try to feed it wheat.=Użyj przycisku "Umieść" na zwierzęciu, aby spróbować je nakarmić. Grows on farmland=Rośnie na polu uprawnym Turns block into farmland=Zamienia blok w pole uprawne diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr index 467761f0e..3ec6644b8 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.ru.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Молодой стебель тыквы (стадия @1) Mature Pumpkin Stem=Созревший тыквенный стебель A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Зрелый стебель тыквы пытается вырастить тыкву на одном из четырех соседних блоков. Тыква может расти только на грядках, грязи или на травяном блоке. Когда тыква находится рядом со стеблем, он сразу же изгибается и соединяется с ней. При этом стебель не может выращивать другую тыкву. И только когда все тыквы вокруг стебля убраны, он будет готов вырастить другую тыкву. -Faceless Pumpkin=Тыква -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=Тыква это декоративный блок. Её можно разрезать ножницами для получения семян тыквы. -Pumpkin=Вырезанная тыква -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=Вырезанную тыкву можно носить как шлем. Тыквы растут из тыквенных стеблей, которые растут из семян тыквы. +Pumpkin=Тыква +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Тыква это декоративный блок. Её можно разрезать ножницами для получения семян тыквы. +Carved Pumpkin=Вырезанная тыква +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Вырезанную тыкву можно носить как шлем. Тыквы растут из тыквенных стеблей, которые растут из семян тыквы. Jack o'Lantern=Светильник Джека A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Светильник Джека это традиционное украшение на Хеллоуин, изготавливаемое из тыквы. Он ярко светит. Pumpkin Pie=Тыквенный пирог @@ -93,7 +93,7 @@ Cookie=Печенье Bread=Хлеб Hay Bale=Сноп сена Hay bales are decorative blocks made from wheat.=Сноп сена - декоративный блок сделанный из пшеницы. -To carve a face into the pumpkin, use the shears on the side you want to carve.=Чтобы вырезать лицо на тыкве примените ножницы к выбранной стороне тыквы. +To carve a pumpkin, use the shears on the side you want the face to appear.=Чтобы вырезать лицо на тыкве примените ножницы к выбранной стороне тыквы. Use the “Place” key on an animal to try to feed it wheat.=Нажмите клавишу [Использовать] на животном, чтобы попытаться покормить его пшеницей. Grows on farmland=Прорастает на грядке Turns block into farmland=Делает из блока грядку diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr index 7017f7852..f8e79f98b 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.zh_TW.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=成長中的南瓜莖(第@1階段) Mature Pumpkin Stem=成熟的南瓜莖 A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=一個成熟的南瓜莖試圖在其四個相鄰的區塊之一長出一個南瓜。南瓜只能生長在農田、泥土或草塊的上面。當南瓜挨著南瓜莖時,南瓜莖會立即彎曲並連接到該南瓜上。連接的南瓜莖不能再長出另一個南瓜。只要南瓜莖周圍的所有南瓜都被移走,它就失去了連接,可以再長出一個南瓜。 -Faceless Pumpkin=南瓜 -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.=南瓜是一種裝飾方塊。它可以用剪刀進行雕刻,以獲得南瓜種子。 -Pumpkin=雕刻過的南瓜 -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.=南瓜可以作為頭盔佩戴。南瓜由南瓜莖生長,而南瓜莖又由南瓜種子生長。 +Pumpkin=南瓜 +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=南瓜是一種裝飾方塊。它可以用剪刀進行雕刻,以獲得南瓜種子。 +Carved Pumpkin=雕刻過的南瓜 +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=南瓜可以作為頭盔佩戴。南瓜由南瓜莖生長,而南瓜莖又由南瓜種子生長。 Jack o'Lantern=南瓜燈 A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=南瓜燈是由南瓜製成的傳統萬聖節裝飾。它發出明亮的光芒。 Pumpkin Pie=南瓜派 @@ -89,7 +89,7 @@ Cookie=餅乾 Bread=面包 Hay Bale=乾草捆 Hay bales are decorative blocks made from wheat.=乾草捆是用小麥製成的裝飾方塊。 -To carve a face into the pumpkin, use the shears on the side you want to carve.=要在南瓜上雕刻,請將剪刀放在你要雕刻的一側。 +To carve a pumpkin, use the shears on the side you want the face to appear.=要在南瓜上雕刻,請將剪刀放在你要雕刻的一側。 Use the “Place” key on an animal to try to feed it wheat.=在動物身上使用「放置」鍵以嘗試給它餵食小麥。 Grows on farmland=在農田上生長 Turns block into farmland=把方塊變成農田 diff --git a/mods/ITEMS/mcl_farming/locale/template.txt b/mods/ITEMS/mcl_farming/locale/template.txt index bc81acce1..b14d8f644 100644 --- a/mods/ITEMS/mcl_farming/locale/template.txt +++ b/mods/ITEMS/mcl_farming/locale/template.txt @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)= Mature Pumpkin Stem= A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.= -Faceless Pumpkin= -A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds.= Pumpkin= -A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.= +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.= +Carved Pumpkin= +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.= Jack o'Lantern= A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.= Pumpkin Pie= @@ -93,7 +93,7 @@ Cookie= Bread= Hay Bale= Hay bales are decorative blocks made from wheat.= -To carve a face into the pumpkin, use the shears on the side you want to carve.= +To carve a pumpkin, use the shears on the side you want the face to appear.= Use the “Place” key on an animal to try to feed it wheat.= Grows on farmland= Turns block into farmland= diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index fe437f5cf..5bcf5e8a3 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -93,9 +93,9 @@ local stem_def = { -- Template for pumpkin local pumpkin_base_def = { - description = S("Faceless Pumpkin"), - _doc_items_longdesc = S("A faceless pumpkin is a decorative block. It can be carved with shears to obtain pumpkin seeds."), - _doc_items_usagehelp = S("To carve a face into the pumpkin, use the shears on the side you want to carve."), + description = S("Pumpkin"), + _doc_items_longdesc = S("A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds."), + _doc_items_usagehelp = S("To carve a pumpkin, use the shears on the side you want the face to appear."), stack_max = 64, paramtype2 = "facedir", tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"}, @@ -110,8 +110,8 @@ local pumpkin_base_def = { } local pumpkin_face_base_def = table.copy(pumpkin_base_def) -pumpkin_face_base_def.description = S("Pumpkin") -pumpkin_face_base_def._doc_items_longdesc = S("A pumpkin can be worn as a helmet. Pumpkins grow from pumpkin stems, which in turn grow from pumpkin seeds.") +pumpkin_face_base_def.description = S("Carved Pumpkin") +pumpkin_face_base_def._doc_items_longdesc = S("A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.") pumpkin_face_base_def._doc_items_usagehelp = nil pumpkin_face_base_def.tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"} pumpkin_face_base_def.groups.armor=1 From 508811d3b3e5edac7423ee08b2a83a4183724352 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 30 Jul 2024 23:42:14 +0200 Subject: [PATCH 061/273] Fixed Polish and German translations --- mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr | 10 +++++----- mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr index 069046169..959585964 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.de.tr @@ -63,10 +63,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Junger Kürbisstängel (@1. Stufe) Mature Pumpkin Stem=Ausgewachsener Kürbisstängel A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Ein ausgewachsener Kürbisstängel versucht, auf einem seiner vier benachbarten Blöcke einen Kürbis wachsen zu lassen. Ein Kürbis kann nur auf Ackerboden, Erde oder einem Grasblock wachsen. Wenn sich ein Kürbis neben einem Kürbisstängel befindet, verbiegt sich der Kürbisstängel und verbindet sich mit dem Kürbis. Solange der Stängel verbunden ist, kann aus ihm kein neuer Kürbis wachsen. Wenn alle Kürbisse um den Kürbisstängel entfernt wurden, verliert er die Verbindung und aus ihm kann ein weiterer Kürbis wachsen. -Pumpkin=Gesichtsloser Kürbis -A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Ein gesichtsloser Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um Kürbissamen zu erhalten. -Carved Pumpkin=Kürbis -A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Einen Kürbis kann zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Kürbisse wachsen aus Kürbisstängeln, welche wiederum aus Kürbissamen wachsen. +Pumpkin=Kürbis +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Ein Kürbis ist ein dekorativer Block. Mit einer Schere kann man in ihm ein Muster schnitzen, um einen Geschnitzter Kürbis und Kürbissamen zu erhalten. +Carved Pumpkin=Geschnitzter Kürbis +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Ein Geschnitzter Kürbis ist ein dekorativer Block, der kann benützt werden, um Schnee- oder Eisengolem zu beschwören, oder zum Spaß als Helm getragen werden, aber er bietet keinen Schutz. Man erhaltet diesen Block, indem man einen Kürbis schnitzt. Jack o'Lantern=Kürbislaterne A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Eine Kürbislaterne ist eine traditionelle Dekoration für Halloween. Sie leuchtet hell. Pumpkin Pie=Kürbiskuchen @@ -96,4 +96,4 @@ Turns block into farmland=Macht Block zu Ackerboden 60% chance of poisoning=60% Vergiftungswahrscheinlichkeit Surface for crops=Boden für Nutzpflanzen Can become wet=Kann nass werden -Uses: @1=Verwendungen: @1 \ No newline at end of file +Uses: @1=Verwendungen: @1 diff --git a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr index 007db800c..3461a2d8f 100644 --- a/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr +++ b/mods/ITEMS/mcl_farming/locale/mcl_farming.pl.tr @@ -64,10 +64,10 @@ Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is Premature Pumpkin Stem (Stage @1)=Niedojrzała łodyga dyni (etap @1) Mature Pumpkin Stem=Dojrzała łodyga dyni A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.=Dojrzała łodyga dyni próbuje postawić dynię na jednym z czterech sąsiadujących bloków. Dynia może wyrosnąć tylko na polu uprawnym, ziemi lub bloku trawy. Gdy dynia jest obok łodygi dyni, ugina się ona i łączy z dynią. Z połączonej łodygi dyni nie może wyrosnąć kolejna dynia. Jak tylko wszystkie pobliskie dynie są usunięte, traci ona połączenie i może z niej wyrosnąć następna dynia. -Pumpkin=Dynia bez twarzy -A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Dynia bez twarzy jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać nasiona dyni. -Carved Pumpkin=Dynia -A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Dynia może być noszona jak hełm. Dynie rosną z łodygi dyni, która z kolei rośnie z nasion dyni. +Pumpkin=Dynia +A pumpkin is a decorative block. It can be carved with shears to obtain a carved pumpkin and pumpkin seeds.=Dynia jest blokiem dekoracyjnym. Może być pokrojona nożycami aby otrzymać wydrążoną dynię i nasiona dyni. +Carved Pumpkin=Wydrążona dynia +A carved pumpkin is a decorative block that can be used to summon snow and iron golems. It can also be worn as a helmet. It is made from shearing a pumpkin.=Wydrążona dynia jest blokiem dekoracyjnym, który może być użyty do przywołania śnieżnych i żelaznych golemów. Może być też noszona jak hełm. Jest otrzymywana poprzez wydrążenie zwykłej dyni nożycami. Jack o'Lantern=Świecąca dynia A jack o'lantern is a traditional Halloween decoration made from a pumpkin. It glows brightly.=Świecąca dynia jest tradycyjną dekoracją Halloween wykonaną z dyni, która jasno świeci. Pumpkin Pie=Ciasto z dyni From 12214c5bd668b6cc5a5208b95d83c9640e174f07 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 31 Aug 2024 10:16:43 +0200 Subject: [PATCH 062/273] Allow salmon, tropical fish, witch huts in rivers (#4605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As witch huts use flag "liquid_surface", place_on only can be water. If we want on-shore witch huts, this needs to be solved differently. Also, probably no witch huts in deep ocean swamp water? Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4605 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mobs_mc/salmon.lua | 2 +- mods/ENTITIES/mobs_mc/tropical_fish.lua | 2 +- mods/MAPGEN/mcl_structures/witch_hut.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/salmon.lua b/mods/ENTITIES/mobs_mc/salmon.lua index 47a1a5028..c029c0b03 100644 --- a/mods/ENTITIES/mobs_mc/salmon.lua +++ b/mods/ENTITIES/mobs_mc/salmon.lua @@ -52,7 +52,7 @@ local salmon = { makes_footstep_sound = false, swim = true, fly = true, - fly_in = "mcl_core:water_source", + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, jump = false, view_range = 16, diff --git a/mods/ENTITIES/mobs_mc/tropical_fish.lua b/mods/ENTITIES/mobs_mc/tropical_fish.lua index 6f0c4b43b..47f5b787a 100644 --- a/mods/ENTITIES/mobs_mc/tropical_fish.lua +++ b/mods/ENTITIES/mobs_mc/tropical_fish.lua @@ -97,7 +97,7 @@ local tropical_fish = { makes_footstep_sound = false, swim = true, fly = true, - fly_in = "mcl_core:water_source", + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, jump = false, view_range = 16, diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 5ac23b144..ed888db95 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -40,7 +40,7 @@ local function hut_placement_callback(pos,def,pr) end mcl_structures.register_structure("witch_hut",{ - place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, + place_on = {"mcl_core:water_source","mclx_core:river_water_source"}, fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 8, From 573269afab774756530d57393e5884be58c40a54 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 31 Aug 2024 10:18:12 +0200 Subject: [PATCH 063/273] Bug fix in tooltips for unknown items (#4610) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4610 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/HELP/tt/init.lua | 32 +++++++------------------------- mods/HELP/tt/snippets.lua | 4 +--- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/mods/HELP/tt/init.lua b/mods/HELP/tt/init.lua index 8cc893d47..eba65c22a 100644 --- a/mods/HELP/tt/init.lua +++ b/mods/HELP/tt/init.lua @@ -20,23 +20,12 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/snippets.lua") -- Apply item description updates local function apply_snippets(desc, itemstring, toolcaps, itemstack) - local first = true -- Apply snippets for s=1, #tt.registered_snippets do local str, snippet_color = tt.registered_snippets[s](itemstring, toolcaps, itemstack) - if snippet_color == nil then - snippet_color = tt.COLOR_DEFAULT - end if str then - if first then - first = false - end - desc = desc .. "\n" - if snippet_color then - desc = desc .. minetest.colorize(snippet_color, str) - else - desc = desc .. str - end + if snippet_color == nil then snippet_color = tt.COLOR_DEFAULT end + desc = desc .. "\n" .. (snippet_color and minetest.colorize(snippet_color, str) or str) end end return desc @@ -67,10 +56,7 @@ function tt.reload_itemstack_description(itemstack) if def and def._mcl_generate_description then def._mcl_generate_description(itemstack) elseif should_change(itemstring, def) then - local toolcaps - if def.tool_capabilities then - toolcaps = itemstack:get_tool_capabilities() - end + local toolcaps = def.tool_capabilities and itemstack:get_tool_capabilities() local orig_desc = def._tt_original_description or def.description if meta:get_string("name") ~= "" then orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name")) @@ -78,17 +64,13 @@ function tt.reload_itemstack_description(itemstack) local potency = meta:get_int("mcl_potions:potion_potent") local plus = meta:get_int("mcl_potions:potion_plus") if potency > 0 then - local sym_potency = mcl_util.to_roman(potency+1) - orig_desc = orig_desc.. " ".. sym_potency + orig_desc = orig_desc .. " " .. mcl_util.to_roman(potency+1) end if plus > 0 then - local sym_plus = " " - local i = plus - while i>0 do - i = i - 1 - sym_plus = sym_plus.. "+" + orig_desc = orig_desc .. " " + for i = 1, plus do + orig_desc = orig_desc .. "+" end - orig_desc = orig_desc.. sym_plus end end local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack) diff --git a/mods/HELP/tt/snippets.lua b/mods/HELP/tt/snippets.lua index 694b22513..69956385e 100644 --- a/mods/HELP/tt/snippets.lua +++ b/mods/HELP/tt/snippets.lua @@ -3,9 +3,7 @@ -- Custom text (_tt_help) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] - if def._tt_help then - return def._tt_help - end + return def and def._tt_help or nil end) From 3193bb5d93a9faeaf0e09f54780e1cad4f2c5c6b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 7 Jun 2024 21:13:54 -0500 Subject: [PATCH 064/273] Start installing the German translations from #4333 --- mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr | 2 ++ mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr | 1 + mods/ITEMS/mcl_flowers/locale/template.txt | 2 ++ mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr | 2 ++ mods/ITEMS/mcl_shepherd/locale/template.txt | 2 ++ 5 files changed, 9 insertions(+) create mode 100644 mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr create mode 100644 mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr create mode 100644 mods/ITEMS/mcl_shepherd/locale/template.txt diff --git a/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr b/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr new file mode 100644 index 000000000..f71e512fd --- /dev/null +++ b/mods/ITEMS/mcl_campfires/locale/mcl_campfires.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_campfires +Campfire=Lagerfeuer diff --git a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr index 0e1262e3c..1d70f5d55 100644 --- a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr +++ b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr @@ -15,6 +15,7 @@ Tall Grass=Hohes Gras Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.=Hohes Gras ist eine kleine Pflanze, die oft auf Wiesenflächen wächst. Es kann für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich hohes Gras zu doppelhohem Gras verwandeln. Fern=Farn Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.=Farne sind kleine Pflanzen, die oft in Dschungeln und Taigas vorkommen. Sie können für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich ein Farn zu einem großen Farn, der zwei Blöcke hoch ist, verwandeln. +Clover=Kleeblatt (Top Part)=(Oberseite) Peony=Pfingstrose A peony is a large plant which occupies two blocks. It is mainly used in dye production.=Eine Pfingstrose ist eine große Pflanze, die zwei Blöcke hoch ist. Sie wird hauptsächlich für die Farbenproduktion gebraucht. diff --git a/mods/ITEMS/mcl_flowers/locale/template.txt b/mods/ITEMS/mcl_flowers/locale/template.txt index 0d84093de..2fb04492d 100644 --- a/mods/ITEMS/mcl_flowers/locale/template.txt +++ b/mods/ITEMS/mcl_flowers/locale/template.txt @@ -18,6 +18,8 @@ Tall Grass= Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.= Fern= Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.= +Clover= +Clovers are small plants which occur naturally in plains and other temperate biomes. They can be picked up and planted again.= (Top Part)= Peony= A peony is a large plant which occupies two blocks. It is mainly used in dye production.= diff --git a/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr b/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr new file mode 100644 index 000000000..60158fcc9 --- /dev/null +++ b/mods/ITEMS/mcl_shepherd/locale/mcl_shepherd.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_shepherd +Shepherd Staff=Hirtenstab diff --git a/mods/ITEMS/mcl_shepherd/locale/template.txt b/mods/ITEMS/mcl_shepherd/locale/template.txt new file mode 100644 index 000000000..5df8b7df0 --- /dev/null +++ b/mods/ITEMS/mcl_shepherd/locale/template.txt @@ -0,0 +1,2 @@ +# textdomain: mcl_shepherd +Shepherd Staff= From ec56e4ec1b9b77beb3511a19b5eab3658174243e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 7 Jun 2024 21:28:53 -0500 Subject: [PATCH 065/273] Enter more translations --- mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr | 4 ++-- mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr | 2 ++ mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr | 2 ++ .../mcl_fletching_table/locale/mcl_fletching_table.de.tr | 2 ++ mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr | 1 + mods/ITEMS/mcl_flowers/locale/template.txt | 1 + mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr | 4 ++++ mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr | 3 +++ mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr | 4 ++++ mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr | 3 +++ mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr | 2 ++ mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr | 4 ++++ 12 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr create mode 100644 mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr create mode 100644 mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr create mode 100644 mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr create mode 100644 mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr create mode 100644 mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr create mode 100644 mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr create mode 100644 mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr create mode 100644 mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr diff --git a/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr b/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr index e1fa1b603..c5ccb803f 100644 --- a/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr +++ b/mods/ITEMS/mcl_barrels/locale/mcl_barrels.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_barrels -Barrel= +Barrel=Fass Barrels are containers which provide 27 inventory slots.= To access its inventory, rightclick it. When broken, the items will drop out.= -27 inventory slots= \ No newline at end of file +27 inventory slots= diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr new file mode 100644 index 000000000..b3c6e3a00 --- /dev/null +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_cherry_blossom +Cherry Sapling=Kirschbaumsetzling diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr new file mode 100644 index 000000000..cd5c20e0c --- /dev/null +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_composters +Composter=Komposter diff --git a/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr b/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr new file mode 100644 index 000000000..b792fece0 --- /dev/null +++ b/mods/ITEMS/mcl_fletching_table/locale/mcl_fletching_table.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_fletching_table +Fletching Table=Bognertisch diff --git a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr index 1d70f5d55..93d2ad1bf 100644 --- a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr +++ b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr @@ -16,6 +16,7 @@ Tall grass is a small plant which often occurs on the surface of grasslands. It Fern=Farn Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.=Farne sind kleine Pflanzen, die oft in Dschungeln und Taigas vorkommen. Sie können für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich ein Farn zu einem großen Farn, der zwei Blöcke hoch ist, verwandeln. Clover=Kleeblatt +Four-leaf Clover=vierblättriges Kleeblatt (Top Part)=(Oberseite) Peony=Pfingstrose A peony is a large plant which occupies two blocks. It is mainly used in dye production.=Eine Pfingstrose ist eine große Pflanze, die zwei Blöcke hoch ist. Sie wird hauptsächlich für die Farbenproduktion gebraucht. diff --git a/mods/ITEMS/mcl_flowers/locale/template.txt b/mods/ITEMS/mcl_flowers/locale/template.txt index 2fb04492d..935124446 100644 --- a/mods/ITEMS/mcl_flowers/locale/template.txt +++ b/mods/ITEMS/mcl_flowers/locale/template.txt @@ -20,6 +20,7 @@ Fern= Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.= Clover= Clovers are small plants which occur naturally in plains and other temperate biomes. They can be picked up and planted again.= +Four-leaf Clover= (Top Part)= Peony= A peony is a large plant which occupies two blocks. It is mainly used in dye production.= diff --git a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr new file mode 100644 index 000000000..86a8554ad --- /dev/null +++ b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_lanterns +Lantern=Laterne +Chain=Kette + diff --git a/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr new file mode 100644 index 000000000..6fbf56f45 --- /dev/null +++ b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_loom +Loom=Webstuhl + diff --git a/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr new file mode 100644 index 000000000..1ab069d2f --- /dev/null +++ b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_raw_ores +Raw Iron=Roheisen +Block of Raw Iron=Roheisenblock + diff --git a/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr new file mode 100644 index 000000000..25e5cd2ce --- /dev/null +++ b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_smithing_table +Smithing table=Schmiedetisch + diff --git a/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr b/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr new file mode 100644 index 000000000..77b4ccc6e --- /dev/null +++ b/mods/ITEMS/mcl_smoker/locale/mcl_smoker.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_smoker +Smoker=Räucherofen diff --git a/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr new file mode 100644 index 000000000..8aa07ffca --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_hollow_logs +Hollow Birch Log=Hohler Birkenstamm +Hollow Dark Oak Log=Hohler Schwarzeichenstamm +Hollow Spruce Log=Hohler Fichtenstamm From 7aa8a4dd11155887f0836ff856dc0c7a7712dcdf Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 8 Jun 2024 05:57:11 -0500 Subject: [PATCH 066/273] Last of the translations provided that have existing translation code for translating strings --- mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr | 2 +- mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr | 4 ++-- mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr | 2 +- mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr index cc2290e1e..c693dc198 100644 --- a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr +++ b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr @@ -3,7 +3,7 @@ A block of copper is mostly a decorative block.=Ein Kupferblock wird meistens al A block used for compact raw copper storage.=Ein Block für die kompakte Lagerung von Rohkupfer. Block of Copper=Kupferblock Block of Raw Copper=Rohkupferblock -Copper Ingot=Kupfer Barren +Copper Ingot=Kupferbarren Copper Ore=Kupfererz Cut copper is a decorative block.=Ein Geschnittener Kupferblock ist ein dekorativer Block. Cut Copper=Geschnittener Kupferblock diff --git a/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr b/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr index b80c186c1..bbdc847a3 100644 --- a/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr +++ b/mods/ITEMS/mcl_fishing/locale/mcl_fishing.de.tr @@ -4,11 +4,11 @@ Fishing rods can be used to catch fish.=Mit Angeln fängt man Fische. Rightclick to launch the bobber. When it sinks right-click again to reel in an item. Who knows what you're going to catch?=Rechtsklicken, um den Schwimmer auszuwerfen. Wenn er sinkt, erneut rechtsklicken, um etwas zu fangen. Wer weiß, was Sie fangen werden? Raw Fish=Roher Fisch Raw fish is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.=Rohen Fisch kann man mit Angeln fangen. Er ist ein Lebensmittel, den man sicher verzehren kann. Er kann gekocht werden, um seinen Nährwert zu erhöhen. -Cooked Fish=Gekochter Fisch +Cooked Fish=Gebratener Fisch Mmh, fish! This is a healthy food item.=Mhh, Fisch! Ein gesundes Lebensmittel. Raw Salmon=Roher Lachs Raw salmon is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.=Rohen Lachs erhält man beim Angeln. Er ist ein Lebensmittel, das sicher verzehrt werden kann. -Cooked Salmon=Gekochter Lachs +Cooked Salmon=Gebratener Lachs This is a healthy food item which can be eaten.=Ein gesundes essbares Lebensmittel. Clownfish=Clownfisch Clownfish may be obtained by fishing (and luck) and is a food item which can be eaten safely.=Einen Clownfisch kann man beim Angeln mit etwas Glück fangen. Er ist ein Lebensmittel, das sicher verzehrt werden kann. diff --git a/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr b/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr index b9bf40e1a..bb76515ea 100644 --- a/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr +++ b/mods/ITEMS/mcl_itemframes/locale/mcl_itemframes.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_itemframes -Item Frame=Artikel Rahmen +Item Frame=Gegenstandsrahmen Item frames are decorative blocks in which items can be placed.=Artikelrahmen sind dekorative Blöcke, in denen Artikel platziert werden können. Just place any item on the item frame. Use the item frame again to retrieve the item.=Platzieren Sie einfach einen beliebigen Gegenstand auf dem Gegenstandsrahmen. Verwenden Sie den Artikelrahmen erneut, um den Artikel abzurufen. Can hold an item.=Kann einen Gegenstand halten. diff --git a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr index 323e90364..5e1b0ced1 100644 --- a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr +++ b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr @@ -8,7 +8,7 @@ Maximum lines: 4=Maximale Zeilen: 4 Done=Fertig Can be written=Kann beschriftet werden Oak Sign=Eichezeichen -Birch Sign=Birke Zeichen +Birch Sign=Birkenschild Spruce Sign=Fichtenzeichen Dark Oak Sign=Dunkles Eichenschild Jungle Sign=Dschungelzeichen From 7fc7758b6276a72ec3439ce35e41b60229704019 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 8 Jun 2024 06:04:16 -0500 Subject: [PATCH 067/273] Add translation support to mcl_compressed_blocks --- .../locale/mcl_compressed_blocks.de.tr | 4 +++ .../mcl_compressed_blocks/locale/template.txt | 17 +++++++++ mods/ITEMS/mcl_compressed_blocks/nodes.lua | 35 ++++++++++--------- 3 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr create mode 100644 mods/ITEMS/mcl_compressed_blocks/locale/template.txt diff --git a/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr new file mode 100644 index 000000000..be2166bbc --- /dev/null +++ b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_compressed_blocks +Compressed Cobblestone=Verdichtetes Kopfsteinpflaster +Double Compressed Cobblestone=Doppelt verdichtetes Kopfsteinpflaster + diff --git a/mods/ITEMS/mcl_compressed_blocks/locale/template.txt b/mods/ITEMS/mcl_compressed_blocks/locale/template.txt new file mode 100644 index 000000000..0fe61dcc4 --- /dev/null +++ b/mods/ITEMS/mcl_compressed_blocks/locale/template.txt @@ -0,0 +1,17 @@ +# textdomain: mcl_compressed_blocks +Compressed Cobblestone= +Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories.= +Double Compressed Cobblestone= +Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories.= +Triple Compressed Cobblestone= +Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories.= +Quadruple Compressed Cobblestone= +Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories.= +Quintuple Compressed Cobblestone= +Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories.= +Sextuple Compressed Cobblestone= +Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories.= +Septuple Compressed Cobblestone= +Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories.= +Octuple Compressed Cobblestone= +Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories.= diff --git a/mods/ITEMS/mcl_compressed_blocks/nodes.lua b/mods/ITEMS/mcl_compressed_blocks/nodes.lua index 32c47bfd4..15a893752 100644 --- a/mods/ITEMS/mcl_compressed_blocks/nodes.lua +++ b/mods/ITEMS/mcl_compressed_blocks/nodes.lua @@ -1,7 +1,10 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) + --Compressed Cobblestone minetest.register_node("mcl_compressed_blocks:compressed_cobblestone", { - description = "Compressed Cobblestone", - _doc_items_longdesc = ("Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories."), + description = S("Compressed Cobblestone"), + _doc_items_longdesc = S("Compressed Cobblestone is a decorative block made from 9 Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_compressed_cobblestone.png"}, is_ground_content = true, @@ -14,8 +17,8 @@ minetest.register_node("mcl_compressed_blocks:compressed_cobblestone", { --Double Compressed Cobble minetest.register_node("mcl_compressed_blocks:double_compressed_cobblestone", { - description = "Double Compressed Cobblestone", - _doc_items_longdesc = ("Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Double Compressed Cobblestone"), + _doc_items_longdesc = S("Double Compressed Cobblestone is a decorative block made from 9 Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_double_compressed_cobblestone.png"}, is_ground_content = true, @@ -28,8 +31,8 @@ minetest.register_node("mcl_compressed_blocks:double_compressed_cobblestone", { --Triple Compressed Cobble minetest.register_node("mcl_compressed_blocks:triple_compressed_cobblestone", { - description = "Triple Compressed Cobblestone", - _doc_items_longdesc = ("Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Triple Compressed Cobblestone"), + _doc_items_longdesc = S("Triple Compressed Cobblestone is a decorative block made from 9 Double Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_triple_compressed_cobblestone.png"}, is_ground_content = true, @@ -42,8 +45,8 @@ minetest.register_node("mcl_compressed_blocks:triple_compressed_cobblestone", { --Quadruple Compressed Cobble minetest.register_node("mcl_compressed_blocks:quadruple_compressed_cobblestone", { - description = "Quadruple Compressed Cobblestone", - _doc_items_longdesc = ("Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Quadruple Compressed Cobblestone"), + _doc_items_longdesc = S("Quadruple Compressed Cobblestone is a decorative block made from 9 Triple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_quadruple_compressed_cobblestone.png"}, is_ground_content = true, @@ -56,8 +59,8 @@ minetest.register_node("mcl_compressed_blocks:quadruple_compressed_cobblestone", --Quintuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:quintuple_compressed_cobblestone", { - description = "Quintuple Compressed Cobblestone", - _doc_items_longdesc = ("Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Quintuple Compressed Cobblestone"), + _doc_items_longdesc = S("Quintuple Compressed Cobblestone is a decorative block made from 9 Quadruple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_quintuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -70,8 +73,8 @@ minetest.register_node("mcl_compressed_blocks:quintuple_compressed_cobblestone", --Sextuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:sextuple_compressed_cobblestone", { - description = "Sextuple Compressed Cobblestone", - _doc_items_longdesc = ("Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Sextuple Compressed Cobblestone"), + _doc_items_longdesc = S("Sextuple Compressed Cobblestone is a decorative block made from 9 Quintuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_sextuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -84,8 +87,8 @@ minetest.register_node("mcl_compressed_blocks:sextuple_compressed_cobblestone", --Septuple Compressed Cobble minetest.register_node("mcl_compressed_blocks:septuple_compressed_cobblestone", { - description = "Septuple Compressed Cobblestone", - _doc_items_longdesc = ("Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Septuple Compressed Cobblestone"), + _doc_items_longdesc = S("Septuple Compressed Cobblestone is a decorative block made from 9 Sextuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_septuple_compressed_cobblestone.png"}, is_ground_content = true, @@ -98,8 +101,8 @@ minetest.register_node("mcl_compressed_blocks:septuple_compressed_cobblestone", --Ocutple Compressed Cobble minetest.register_node("mcl_compressed_blocks:octuple_compressed_cobblestone", { - description = "Octuple Compressed Cobblestone", - _doc_items_longdesc = ("Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories."), + description = S("Octuple Compressed Cobblestone"), + _doc_items_longdesc = S("Octuple Compressed Cobblestone is a decorative block made from 9 Septuple Compressed Cobblestone. It is useful for saving space in your inventories."), _doc_items_hidden = false, tiles = {"mcl_compressed_blocks_octuple_compressed_cobblestone.png"}, is_ground_content = true, From 66a6d213baa9f7aef2df5cf61e4fedd5726cb62e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 25 Jun 2024 20:00:54 -0500 Subject: [PATCH 068/273] Add more German translations from Laudrin --- mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr | 28 ++----------------- mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr | 5 ++++ mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr | 2 ++ 3 files changed, 10 insertions(+), 25 deletions(-) create mode 100644 mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr create mode 100644 mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index cd2e9a479..355417d0d 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -1,26 +1,4 @@ # textdomain: mcl_armor -This is a piece of equippable armor which reduces the amount of damage you receive.=Dies ist ein Teil einer tragbaren Rüstung, die die Menge an Schaden, den Sie erleiden, reduziert. -To equip it, put it on the corresponding armor slot in your inventory menu.=Um es zu tragen, legen Sie es in den passenden Rüstungsplatz in Ihrem Inventarmenü. -Leather Cap=Lederkappe -Iron Helmet=Eisenhelm -Golden Helmet=Goldhelm -Diamond Helmet=Diamanthelm -Chain Helmet=Kettenhelm -Leather Tunic=Ledertunika -Iron Chestplate=Eisenbrustpanzer -Golden Chestplate=Goldbrustpanzer -Diamond Chestplate=Diamantbrustpanzer -Chain Chestplate=Kettenbrustpanzer -Leather Pants=Lederhose -Iron Leggings=Eisenbeinlinge -Golden Leggings=Goldbeinlinge -Diamond Leggings=Diamantbeinlinge -Chain Leggings=Kettenbeinlinge -Leather Boots=Lederstiefel -Iron Boots=Eisenstiefel -Golden Boots=Goldstiefel -Diamond Boots=Diamantstiefel -Chain Boots=Kettenstiefel - - -Smithing Template '@1'=Schmiedevorlage '@1' \ No newline at end of file +Blast Protection=Explosionsschutz +Projectile Protection=Projektilschutz +Smithing Template '@1'=Schmiedevorlage '@1' diff --git a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr new file mode 100644 index 000000000..faa99e446 --- /dev/null +++ b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bamboo + +Bamboo Plank=Bambusplanken +Bamboo Plank Slab=Bambusplatte +Bamboo Sign=Bambusschild diff --git a/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr b/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr new file mode 100644 index 000000000..1f03cae0f --- /dev/null +++ b/mods/ITEMS/mcl_bells/locale/mcl_bells.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_bells +Bell=Dorfglocke From 8861ad935bfdbbbb15844374f381ba73c13b3778 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 25 Jun 2024 20:10:53 -0500 Subject: [PATCH 069/273] More translations entered --- .../locale/mcl_experience.de.tr | 1 + mods/ITEMS/mcl_core/locale/mcl_core.de.tr | 1 + .../mcl_mobitems/locale/mcl_mobitems.de.tr | 103 +----------------- 3 files changed, 3 insertions(+), 102 deletions(-) diff --git a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr index 351cf1911..0db7165eb 100644 --- a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr +++ b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr @@ -5,3 +5,4 @@ Error: Too many parameters!=Fehler: Zu viele Parameter! Error: Incorrect value of XP=Fehler: Ungültiger EP-Wert Error: Player not found=Fehler: Spieler nicht gefunden Added @1 XP to @2, total: @3, experience level: @4=@1 EP an @2 gegeben, gesamt: @3, Erfahrungsstufe: @4 +Bottle o' Enchanting=Zauberfläschchen diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index 3be982bbb..b7364624e 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -285,3 +285,4 @@ Slows down movement=Verlangsamt die Fortbewegung Grows on sand or dirt next to water=Wächst auf Sand oder Erde neben Wasser Stackable=Stapelbar Needs soil and water to grow=Braucht Nährboden und Wasser zum wachsen +Enchanted Golden Apple=Verzauberter goldener Apfel diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr index c1278ad36..aeb85d4e7 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr @@ -1,105 +1,4 @@ # textdomain: mcl_mobitems -Rotten Flesh=Gammelfleisch -80% chance of food poisoning=80% Wahrscheinlichkeit von Lebensmittelvergiftung -Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while.=Igitt! Dieses Stück Fleisch hat wohl bessere Tage gesehen. Wenn Sie es essen, werden Sie sofort vergiftet und erleiden einen Schaden von 4 Trefferpunkten. Aber gezähmte Wölfe können es problemlos fressen. +Crystalline Drop=Kristallträne -Raw Mutton=Rohes Hammelfleisch - -Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value.=Rohes Hammelfleisch ist das Fleisch eines Schafes und ein Lebensmittel, welches bedenkenlos verzehrt werden kann. Es kann gebraten werden, um seinen Nährwert deutlich zu erhöhen. - -Cooked Mutton=Gebratenes Hammelfleisch -Cooked mutton is the cooked flesh from a sheep and is used as food.=Gebratenes Hammelfleisch ist das gebratene Fleisch eines Schafs und dient als Lebensmittel. -Raw Beef=Rohes Rindfleisch - -Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value.=Rohes Rindfleisch ist das Fleisch von Kühen und kann problemlos gegessen werden. Es kann gegart werden, um den Nährwert deutlich zu erhöhen. - -Steak=Steak -Steak is cooked beef from cows and can be eaten.=Steak ist gebratenes Rindfleisch und kann gegessen werden. -Raw Chicken=Rohes Hühnchen -30% chance of food poisoning=30% Wahrscheinlichkeit von Lebensmittelvergiftung - -Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value.=Rohes Hühnchen ist ein Lebensmittel, das nicht sicher für den Verzehr ist. Sie können es essen, um ein paar Hungerpunkte zu erhalten, aber mit einer Wahrscheinlichkeit von 30% erleiden Sie eine Lebensmittelvergiftung, die Ihre Hungerrate für eine Weile erhöht. Braten Sie ein rohes Hühnchen, um es sicher zuzubereiten und den Nährwert zu erhöhen. - -Cooked Chicken=Gebratenes Hühnchen -A cooked chicken is a healthy food item which can be eaten.=Ein gebratenes Hühnchen ist ein gesundes essbares Lebensmittel. -Raw Porkchop=Rohes Schweinefleisch - -A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. Man kann es braten, um seinen Nährwert stark zu erhöhen. - -Cooked Porkchop=Gebratenes Schweinefleisch -Cooked porkchop is the cooked flesh of a pig and is used as food.=Ein gebratenes Stück Schweinefleisch ist ein gutes Lebensmittel. -Raw Rabbit=Rohes Kaninchen - -Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value.=Rohes Kaninchenfleisch ist ein Lebensmittel, welches bedenkenlos verzehrt werden kann. Es kann gebraten werden, um seinen Nährwert zu erhöhen. - -Cooked Rabbit=Gebratenes Kaninchen -This is a food item which can be eaten.=Dies ist ein essbares Lebensmittel. -Milk=Milch -Removes all status effects=Entfernt alle Statuseffekte - -Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points.=Milch ist sehr erfrischend. Milch erhält man, indem man einen Eimer an einer Kuh benutzt. Wenn die Milch getrunken wird, werden alle Statuseffekte entfernt, aber es werden keine Hungerpunkte wiederhergestellt. - -Use the placement key to drink the milk.=Platzierungstaste benutzen, um Milch zu trinken. -Spider Eye=Spinnenauge -Poisonous=Giftig - -Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly.=Spinnenaugen werden hauptsächlich in der Fertigung benutzt. Wenn Sie wirklich verzweifelt sind, können sie es essen, aber das wird Sie kurz vergiften. - -Bone=Knochen - -Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient.=Knochen können benutzt werden, um Wölfe zu zähmen, damit sie einen beschützen. Sie außerdem nützlich in der Fertigung. - -Wield the bone near wolves to attract them. Use the “Place” key on the wolf to give it a bone and tame it. You can then give commands to the tamed wolf by using the “Place” key on it.=Halten Sie den Knochen in der Nähe von Wölfen, um sie anzulocken. Benutzen Sie die „Platzieren“-Taste auf dem Wolf, um ihm den Knochen zu geben und ihn zu zähmen. Sie können dem gezähmten Wolf Befehle erteilen, indem Sie die „Platzieren“-Taste auf ihm benutzen. - -Squid Ink Sac=Tintenbeutel -This item is dropped by dead squids. Squid ink can be used to as an ingredient to craft book and quill or black dye.=Dieser Gegenstand wird von toten Tintenfischen abgeworfen. Tintenbeutel können benutzt werden, um Buch und Feder oder schwarzen Farbstoff zu fertigen. - -String=Faden -Strings are used in crafting.=Fäden sind nützlich in der Fertigung. -Blaze Rod=Lohenrute -This is a crafting component dropped from dead blazes.=Dies ist eine Fertigungskomponente, die von toten Lohen abgeworfen wird. -Blaze Powder=Lohenstaub -This item is mainly used for crafting.=Dieser Gegenstand wird hauptsächlich in der Fertigung benutzt. -Magma Cream=Magmacreme -Magma cream is a crafting component.=Magmacreme ist eine Fertigungskomponente. -Ghast Tear=Ghast-Träne -Place this item in an item frame as decoration.=Platzieren Sie diesen Gegenstand in einem Rahmen als Deko. -Nether Star=Nether-Stern - -A nether star is dropped when the Wither dies. Place it in an item frame to show the world how hardcore you are! Or just as decoration.=Ein Netherstern wird abgeworfen, wenn der Wither stirbt. Platzieren Sie ihn in einen Rahmen, um der Welt zu zeigen, wie großartig Sie sind! - -Leather=Leder -Leather is a versatile crafting component.=Leder ist eine vielseitige Fertigungskomponente. -Feather=Feder -Feathers are used in crafting and are dropped from chickens.=Federn werden in der Fertigung benutzt und werden von Hühnern abgeworfen. -Rabbit Hide=Kaninchenfell -Rabbit hide is used to create leather.=Kaninchenfell wird zur Herstellung von Leder benutzt. -Rabbit's Foot=Hasenpfote -Must be your lucky day! Place this item in an item frame for decoration.=Muss wohl Ihr Glückstag sein! Platzieren Sie diesen Gegenstand in einen Rahmen zur Dekoration. -Saddle=Sattel -Can be placed on animals to ride them=Kann auf Tieren platziert werden, um sie zu reiten -Saddles can be put on some animals in order to mount them.=Sattel können auf einigen Tieren platziert werden, um sich aufzusatteln. - -Use the placement key with the saddle in your hand to try to put on the saddle. Saddles fit on horses, mules, donkeys and pigs. Horses, mules and donkeys need to be tamed first, otherwise they'll reject the saddle. Saddled animals can be mounted by using the placement key on them again.=Platzierungstaste benutzen, während man den Sattel in der Hand hält, um zu versuchen, den Sattel anzulegen. Sattel passen auf Pferde, Maultiere, Esel und Schweine. Pferde, Maultiere und Esel müssen zuerst gezähmt werden, sonst werden sie den Sattel abweisen. Mit der Platzierungstaste kann man aufsatteln. - -Rabbit Stew=Kaninchenragout -Rabbit stew is a very nutricious food item.=Kaninchenragout ist ein sehr nahrhaftes Lebensmittel. -Shulker Shell=Schulkerschale -Shulker shells are used in crafting. They are dropped from dead shulkers.=Schulkerschalen werden für die Fertigung verwendet. Sie werden von toten Schulkern fallen gelassen. -Slimeball=Schleimkugel -Slimeballs are used in crafting. They are dropped from slimes.=Schleimkugeln werden in der Fertigung verwendet. Sie werden von Schleimen fallen gelassen. -Gunpowder=Schießpulver -Carrot on a Stick=Karottenrute -Lets you ride a saddled pig=Um auf gesattelten Schweinen zu reiten -A carrot on a stick can be used on saddled pigs to ride them.=Eine Karottenrute kann auf gesattelten Schweinen angewendet werden, um sie zu reiten. - -Place it on a saddled pig to mount it. You can now ride the pig like a horse. Pigs will also walk towards you when you just wield the carrot on a stick.=Platzieren Sie sie auf einem Schwein mit Sattel, um sich aufzusatteln. Sie können nun das Schwein wie ein Pferd reiten. Schweine werden auch auf Sie zugehen, wenn Sie einfach nur die Karottenrute halten. - -Iron Horse Armor=Eisenpferderüstung -Iron horse armor can be worn by horses to increase their protection from harm a bit.=Eine Eisenpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden etwas zu erhöhen. -Golden Horse Armor=Goldpferderüstung -Golden horse armor can be worn by horses to increase their protection from harm.=Eine Goldpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden zu erhöhen. -Diamond Horse Armor=Diamantpferderüstung -Diamond horse armor can be worn by horses to greatly increase their protection from harm.=Eine Diamantpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden beträchtlich zu erhöhen. -Place it on a horse to put on the horse armor. Donkeys and mules can't wear horse armor.=Platzieren Sie es auf einem Pferd, um die Pferderüstung aufzusetzen. Esel und Maultiere können keine Pferderüstung tragen. From 6b13612318d04ef9f702df10e5a504c60787c5d8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 28 Jun 2024 04:14:40 -0500 Subject: [PATCH 070/273] Fix typo in translated string --- mods/ITEMS/mcl_stairs/register.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index 7c0935a3c..e254d4977 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -266,20 +266,20 @@ mcl_stairs.register_slab("prismarine", "mcl_ocean:prismarine", mcl_stairs.register_stair("prismarine_brick", "mcl_ocean:prismarine_brick", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_bricks.png"}, - S("prismarine Brick Stairs"), + S("Prismarine Brick Stairs"), mcl_sounds.node_sound_stone_defaults(), 6, 1.5, nil) mcl_stairs.register_slab("prismarine_brick", "mcl_ocean:prismarine_brick", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_bricks.png"}, - S("prismarine Brick Slab"), + S("Prismarine Brick Slab"), mcl_sounds.node_sound_stone_defaults(), 6, 2, S("Double prismarine_brick Slab")) mcl_stairs.register_stair("prismarine_dark", "mcl_ocean:prismarine_dark", {pickaxey=1, material_stone=1}, {"mcl_ocean_prismarine_dark.png"}, - S("prismarine Brick Stairs"), + S("Prismarine Brick Stairs"), mcl_sounds.node_sound_stone_defaults(), 6, 1.5, nil) mcl_stairs.register_slab("prismarine_dark", "mcl_ocean:prismarine_dark", From 576662d719b667646d0169415af58f6e4ac09413 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 28 Jun 2024 04:23:39 -0500 Subject: [PATCH 071/273] Add Spectre Membrane to localization template --- mods/ITEMS/mcl_mobitems/locale/template.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_mobitems/locale/template.txt b/mods/ITEMS/mcl_mobitems/locale/template.txt index dd97fa0dd..2c02ac3ee 100644 --- a/mods/ITEMS/mcl_mobitems/locale/template.txt +++ b/mods/ITEMS/mcl_mobitems/locale/template.txt @@ -57,6 +57,8 @@ This item is dropped by dead squids. Squid ink can be used to as an ingredient String= Strings are used in crafting.= +Spectre Membrane= +This is a crafting component dropped from dead spectres.= Blaze Rod= This is a crafting component dropped from dead blazes.= Blaze Powder= From df42751ae6b4b33d4fe7c1e2a30a041f0d6702d9 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 28 Jun 2024 04:24:14 -0500 Subject: [PATCH 072/273] Add last of this latest round of new German translations provided by Laudrin --- mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr | 1 + mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr | 1 + mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr | 1 + mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr | 1 + mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr | 2 +- mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index 355417d0d..7510f4aed 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -1,4 +1,5 @@ # textdomain: mcl_armor Blast Protection=Explosionsschutz Projectile Protection=Projektilschutz +Thorns=Dornen Smithing Template '@1'=Schmiedevorlage '@1' diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 480094dbd..b8bbb583c 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -2,6 +2,7 @@ Warped Fungus Mushroom=Wirrpilz Twisting Vines=Zwirbelranken +Weeping Vines=Trauerranken Nether Sprouts=Nethersprossen Warped Roots=Wirrwurzeln Warped Wart Block=Wirrwarzenblock diff --git a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr index 86a8554ad..9eee14fbc 100644 --- a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr +++ b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr @@ -1,4 +1,5 @@ # textdomain: mcl_lanterns Lantern=Laterne +Soul Lantern=Seelenlaterne Chain=Kette diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr index aeb85d4e7..cc4ed3d6a 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr @@ -1,4 +1,5 @@ # textdomain: mcl_mobitems Crystalline Drop=Kristallträne +Spectre Membrane=Geistermembrane diff --git a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr index f81f381e2..54522c2b1 100644 --- a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr +++ b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr @@ -3,7 +3,7 @@ Glowstone=Leuchtstein Glowstone is a naturally-glowing block which is home to the Nether.=Leuchtstein ist ein Block aus dem Nether. Er leuchtet von Natur aus hell. Nether Quartz Ore=Nether-Quarzerz Nether quartz ore is an ore containing nether quartz. It is commonly found around netherrack in the Nether.=Nether-Quarzerz ist ein Erz, das Nethererz enthält. Es wird oft zwischen Netherrack im Nether gefunden. -Netherrack=Netherrack +Netherrack=Nethergestein Netherrack is a stone-like block home to the Nether. Starting a fire on this block will create an eternal fire.=Netherrack ist ein gesteinsartiger Block aus dem Nether. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. Magma Block=Magmablock Magma blocks are hot solid blocks which hurt anyone standing on it, unless they have fire resistance. Starting a fire on this block will create an eternal fire.=Magmablöcke sind heiße feste Blöcke, die jeden, der auf ihm steht, verletzen, es sei denn, sie sind gegen Feuer immun. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. diff --git a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr index 5e1b0ced1..ec5c4b577 100644 --- a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr +++ b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr @@ -11,7 +11,7 @@ Oak Sign=Eichezeichen Birch Sign=Birkenschild Spruce Sign=Fichtenzeichen Dark Oak Sign=Dunkles Eichenschild -Jungle Sign=Dschungelzeichen +Jungle Sign=Dschungelholzschild Acacia Sign=Akazienzeichen Mangrove Sign=Mangroven-Zeichen Warped Hyphae Sign=Verzerrtes Hyphen-Zeichen From e9632b5317bce04af0acad3d37e4ba469e8cf1bd Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 8 Jul 2024 05:41:55 -0500 Subject: [PATCH 073/273] Start adding next round of German translations --- .../ENTITIES/mcl_boats/locale/mcl_boats.de.tr | 33 ++++++++++----- mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr | 41 +++++++++++++++++++ 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr index c1864a871..ebfe24088 100644 --- a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr +++ b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr @@ -1,12 +1,23 @@ # textdomain: mcl_boats -Acacia Boat=Akazienboot -Birch Boat=Birkenboot -Boat=Boot -Boats are used to travel on the surface of water.=Boote werden benutzt, um sich auf der Wasseroberfläche zu bewegen. -Dark Oak Boat=Schwarzeichenboot -Jungle Boat=Dschungelboot -Oak Boat=Eichenboot -Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Rechtsklicken Sie auf eine Wasserquelle, um das Boot zu platzieren. Rechtsklicken Sie auf das Boot, um es zu betreten. Mit [Links] und [Rechts] lenken, mit [Vorwärts] und [Rückwärts] Geschwindigkeit regeln oder rückwärts fahren. Nutzen sie [Schleichen], um das Boot zu verlassen, schlagen Sie das Boot, um es als Gegenstand fallen zu lassen. -Spruce Boat=Fichtenboot -Water vehicle=Wasserfahrzeug -Sneak to dismount=Zum Aussteigen schleichen +Acacia Boat= +Birch Boat= +Boat= +Boats are used to travel on the surface of water.= +Dark Oak Boat= +Jungle Boat= +Oak Boat= +Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.= +Spruce Boat= +Water vehicle= +Sneak to dismount= +Obsidian Boat=Obsidianboot +Mangrove Boat= +Cherry Boat=Kirschholzboot +Oak Chest Boat=Eichentruhenboot +Spruce Chest Boat= +Birch Chest Boat=Birkentruhenboot +Jungle Chest Boat=Dschungeltruhenboot +Acacia Chest Boat= +Dark Oak Chest Boat= +Mangrove Chest Boat= +Cherry Chest Boat= diff --git a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr index faa99e446..f5719f1b0 100644 --- a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr +++ b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr @@ -1,5 +1,46 @@ # textdomain: mcl_bamboo +### bamboo_base.lua ### + +Bamboo=Bambus +Bamboo Mosaic Plank=Bambusmosaikplanken Bamboo Plank=Bambusplanken +Stripped Bamboo Block= +Bamboo Block=Bambusblock + +### bamboo_items.lua ### + +A bamboo button is a redstone component made out of bamboo which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.= + +A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.= + +Bamboo=Bambus +Bamboo Button=Bambustür +Bamboo Door= +Bamboo Fence=Bambuszaun +Bamboo Fence Gate=Bambuszauntor +Bamboo Mosaic Slab= +Bamboo Mosaic Stair= Bamboo Plank Slab=Bambusplatte +Bamboo Plank Stair= +Bamboo Pressure Plate=Bambusdruckplatte Bamboo Sign=Bambusschild +Bamboo Slab= +Bamboo Stair= +Bamboo Trapdoor=Bambusfalltür +Double Bamboo Mosaic Slab= +Double Bamboo Plank Slab= +Double Bamboo Slab= +Double Stripped Bamboo Slab= +Scaffolding= +Scaffolding (horizontal)= +Scaffolding block used to climb up or out across areas.= +Stripped Bamboo Slab= +Stripped Bamboo Stair= + +To open or close the trapdoor, rightclick it or send a redstone signal to it.= + +Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.= + +Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.= +To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.= From 2b44abbcebe91fc165c75ecc3ded9501471b7805 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 8 Jul 2024 05:48:21 -0500 Subject: [PATCH 074/273] More translations --- mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr | 5 +++++ mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr | 6 ++++++ .../mcl_blast_furnace/locale/mcl_blast_furnace.de.tr | 11 +++++++++++ mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr | 3 +++ 4 files changed, 25 insertions(+) create mode 100644 mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr create mode 100644 mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr diff --git a/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr b/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr new file mode 100644 index 000000000..b01ce52b5 --- /dev/null +++ b/mods/ITEMS/mcl_beehives/locale/mcl_beehives.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_beehives +Beehive=Bienenstock +Artificial bee nest.= +Bee Nest= +A naturally generating block that houses bees and a tasty treat...if you can get it.= diff --git a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr index 80cb8384d..f6cf778a0 100644 --- a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr +++ b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr @@ -15,12 +15,18 @@ Chiseled Polished Blackstone Stair=Gemeißelte Polierte Schwarzstein Treppe Polished Blackstone Brick Stair=Polierte Schwarzsteinziegel Treppe Quartz Bricks=Quartz Ziegel Soul Torch=Seelenfakel +Torches are light sources which can be placed at the side or on the top of most blocks.= Soul Lantern=Seelenlaterne Soul Soil=Seelenerde Eternal Soul Fire=Seelenfeuer Gilded Blackstone=Vergoldeter Schwarzstein Nether Gold Ore=Nethergolderz Smooth Basalt=Glatter Basalt +Blackstone Wall=Schwarzsteinmauer +Double Blackstone Slab= +Polished Double Blackstone Slab= +Double Chiseled Polished Blackstone Slab= +Double Polished Blackstone Brick Slab= @1 has been cooked crisp.=@1 wurde knusprig gebraten. @1 felt the burn.=@1 ist völlig verbrannt. diff --git a/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr b/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr new file mode 100644 index 000000000..7d030c158 --- /dev/null +++ b/mods/ITEMS/mcl_blast_furnace/locale/mcl_blast_furnace.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_blast_furnace +Inventory= +Blast Furnace=Schmelzofen +Smelts ores faster than furnace= +Use the recipe book to see what ores you can smelt, what you can use as fuel and how long it will burn.= +Use the blast furnace to open the furnace menu.= +Place a furnace fuel in the lower slot and the source material in the upper slot.= +The blast furnace will slowly use its fuel to smelt the item.= +The result will be placed into the output slot at the right side.= +Blast Furnaces smelt several items, mainly ores and armor, using a furnace fuel, but twice as fast as a normal furnace.= +Active Blast Furnace= diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr index c3b426810..7c12f414d 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr @@ -13,3 +13,6 @@ Ammunition=Munition Damage from bow: 1-10=Schaden vom Bogen: 1-10 Damage from dispenser: 3=Schaden vom Werfer: 3 Launches arrows=Verschießt Pfeile +Crossbow=Armbrust +Crossbows are ranged weapons to shoot arrows at your foes.= +To use the crossbow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to load an arrow into the chamber, then to shoot press left mouse.= From adf64e81cd44cc8671dd7f9a6cb2a6cd0d3fedd3 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 16 Jul 2024 14:21:21 -0500 Subject: [PATCH 075/273] Allow translating trim names, add some German translations of trims --- mods/ITEMS/mcl_armor/init.lua | 20 ++++++++++-- mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr | 34 +++++++++++++++++++++ mods/ITEMS/mcl_armor/locale/template.txt | 12 ++++++++ mods/ITEMS/mcl_armor/trims.lua | 4 +-- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_armor/init.lua b/mods/ITEMS/mcl_armor/init.lua index 8f592d3ac..6597e24df 100644 --- a/mods/ITEMS/mcl_armor/init.lua +++ b/mods/ITEMS/mcl_armor/init.lua @@ -58,10 +58,24 @@ mcl_armor = { }, player_view_range_factors = {}, trims = { - core_textures = {}, - blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, + core_textures = {}, + blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire","silence","wayfinder"}, - colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}, + translations = { + sentry = S("sentry"), + dune = S("dune"), + coast = S("coast"), + wild = S("wild"), + ward = S("ward"), + vex = S("vex"), + rib = S("rib"), + snout = S("snout"), + eye = S("eye"), + spire = S("spire"), + silence = S("silence"), + wayfinder = S("wayfinder"), + }, + colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}, }, } diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index 7510f4aed..02224bef9 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -2,4 +2,38 @@ Blast Protection=Explosionsschutz Projectile Protection=Projektilschutz Thorns=Dornen +This is a piece of equippable armor which reduces the amount of damage you receive.=Dies ist ein Teil einer tragbaren Rüstung, die die Menge an Schaden, den Sie erleiden, reduziert. +To equip it, put it on the corresponding armor slot in your inventory menu.=Um es zu tragen, legen Sie es in den passenden Rüstungsplatz in Ihrem Inventarmenü. +sentry= +dune= +coast=Küste +wild= +ward=Bezirk +vex= +rib= +snout= +eye=Auge +spire= +silence= +wayfinder=Pfadfinder +Leather Cap=Lederkappe +Iron Helmet=Eisenhelm +Golden Helmet=Goldhelm +Diamond Helmet=Diamanthelm +Chain Helmet=Kettenhelm +Leather Tunic=Ledertunika +Iron Chestplate=Eisenbrustpanzer +Golden Chestplate=Goldbrustpanzer +Diamond Chestplate=Diamantbrustpanzer +Chain Chestplate=Kettenbrustpanzer +Leather Pants=Lederhose +Iron Leggings=Eisenbeinlinge +Golden Leggings=Goldbeinlinge +Diamond Leggings=Diamantbeinlinge +Chain Leggings=Kettenbeinlinge +Leather Boots=Lederstiefel +Iron Boots=Eisenstiefel +Golden Boots=Goldstiefel +Diamond Boots=Diamantstiefel +Chain Boots=Kettenstiefel Smithing Template '@1'=Schmiedevorlage '@1' diff --git a/mods/ITEMS/mcl_armor/locale/template.txt b/mods/ITEMS/mcl_armor/locale/template.txt index 29d98f6b9..50d99dec6 100644 --- a/mods/ITEMS/mcl_armor/locale/template.txt +++ b/mods/ITEMS/mcl_armor/locale/template.txt @@ -1,6 +1,18 @@ # textdomain: mcl_armor This is a piece of equippable armor which reduces the amount of damage you receive.= To equip it, put it on the corresponding armor slot in your inventory menu.= +sentry= +dune= +coast= +wild= +ward= +vex= +rib= +snout= +eye= +spire= +silence= +wayfinder= Leather Cap= Iron Helmet= Golden Helmet= diff --git a/mods/ITEMS/mcl_armor/trims.lua b/mods/ITEMS/mcl_armor/trims.lua index 76d37deb0..2e09779bf 100644 --- a/mods/ITEMS/mcl_armor/trims.lua +++ b/mods/ITEMS/mcl_armor/trims.lua @@ -3,7 +3,7 @@ local S = minetest.get_translator(minetest.get_current_modna for _, template_name in pairs(mcl_armor.trims.overlays) do minetest.register_craftitem(mod_registername .. template_name, { - description = S("Smithing Template '@1'", template_name), + description = S("Smithing Template '@1'", mcl_armor.trims.translations[template_name]), inventory_image = template_name .. "_armor_trim_smithing_template.png", }) @@ -61,4 +61,4 @@ minetest.register_craft({ {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, } -}) \ No newline at end of file +}) From 55b5dee827b767e7f38552c89330b270269c470e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 19 Jul 2024 13:03:28 -0500 Subject: [PATCH 076/273] Convert spaces to tabs --- mods/ITEMS/mcl_armor/trims.lua | 86 +++++++++++++++++----------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/mods/ITEMS/mcl_armor/trims.lua b/mods/ITEMS/mcl_armor/trims.lua index 2e09779bf..eec48d148 100644 --- a/mods/ITEMS/mcl_armor/trims.lua +++ b/mods/ITEMS/mcl_armor/trims.lua @@ -2,63 +2,63 @@ local mod_registername = minetest.get_current_modname() .. ":" local S = minetest.get_translator(minetest.get_current_modname()) for _, template_name in pairs(mcl_armor.trims.overlays) do - minetest.register_craftitem(mod_registername .. template_name, { - description = S("Smithing Template '@1'", mcl_armor.trims.translations[template_name]), - inventory_image = template_name .. "_armor_trim_smithing_template.png", - }) - - minetest.register_craft({ - output = mod_registername .. template_name .. " 2", - recipe = { - {"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } - }) + minetest.register_craftitem(mod_registername .. template_name, { + description = S("Smithing Template '@1'", mcl_armor.trims.translations[template_name]), + inventory_image = template_name .. "_armor_trim_smithing_template.png", + }) + + minetest.register_craft({ + output = mod_registername .. template_name .. " 2", + recipe = { + {"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } + }) end --temp craft recipies, missing structures minetest.register_craft({ - output = mod_registername .. "eye", - recipe = { - {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "eye", + recipe = { + {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "ward", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "ward", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "snout", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "snout", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "silence", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond", mod_registername.."ward","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "silence", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", mod_registername.."ward","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) minetest.register_craft({ - output = mod_registername .. "wayfinder", - recipe = { - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, - {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, - } + output = mod_registername .. "wayfinder", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) From a44d8f43db5466296bd694b46061e695fdabfbc3 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 19 Jul 2024 13:05:26 -0500 Subject: [PATCH 077/273] Add missing trim in translation list --- mods/ITEMS/mcl_armor/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_armor/init.lua b/mods/ITEMS/mcl_armor/init.lua index 6597e24df..ac66c1648 100644 --- a/mods/ITEMS/mcl_armor/init.lua +++ b/mods/ITEMS/mcl_armor/init.lua @@ -66,6 +66,7 @@ mcl_armor = { dune = S("dune"), coast = S("coast"), wild = S("wild"), + tide = S("tide"), ward = S("ward"), vex = S("vex"), rib = S("rib"), From 45b8d36f73fd4d6f5c15c8124d0afbfee6b9455e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 04:28:02 -0500 Subject: [PATCH 078/273] Add german translations for cherry tree blocks --- .../locale/mcl_cherry_blossom.de.tr | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr index b3c6e3a00..562c4a62c 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr @@ -1,2 +1,24 @@ # textdomain: mcl_cherry_blossom +Cherry Log=Kirschbaumsetzling +The trunk of a cherry blossom tree.= +Stripped Cherry Log= +The stripped trunk of a cherry blossom tree.= +Cherry Bark=Kirschbaumsetzling +This is a decorative block surrounded by the bark of a tree trunk.= +Stripped Cherry Wood= +The stripped wood of a cherry blossom tree.= +Cherry Wood Planks=Kirschbaumsetzling +Cherry Leaves= +Cherry blossom leaves are grown from cherry blossom trees.= Cherry Sapling=Kirschbaumsetzling +Cherry blossom sapling can be planted to grow cherry trees.= +Cherry Door=Kirschtür +Cherry Trapdoor=Kirschfalltür +Cherry Stairs=Kirschtreppe +Cherry Slab=Kirschplatte +Double Cherry Slab= +Cherry Sign=Kirschschild +Cherry Fence=Kirschzaun +Cherry Gate=Kirschzauntor +Cherry Pressure Plate=Kirschbaumsetzling +Cherry Button=Kirschknopf From 63036c8d41a36bfd6e76141d059d556de889ce0b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 04:37:09 -0500 Subject: [PATCH 079/273] Update german translation for crimson/warped nodes --- .../mcl_crimson/locale/mcl_crimson.de.tr | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index b8bbb583c..443937ad4 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -1,6 +1,7 @@ # textdomain: mcl_crimson Warped Fungus Mushroom=Wirrpilz +Warped fungus is a mushroom found in the nether's warped forest.= Twisting Vines=Zwirbelranken Weeping Vines=Trauerranken Nether Sprouts=Nethersprossen @@ -8,18 +9,45 @@ Warped Roots=Wirrwurzeln Warped Wart Block=Wirrwarzenblock Shroomlight=Pilzlicht Warped Hyphae=Wirrhyphe +The stem of a warped hyphae= +Warped Hyphae Bark= +This is a decorative block surrounded by the bark of an hyphae.= +Stripped Warped Hyphae= +The stripped hyphae of a warped fungus= +Stripped Warped Hyphae Bark= +The stripped hyphae bark of a warped fungus= Warped Nylium=Wirr-Nezel Warped Checknode - only to check!=Wirr Checkblock - Nur zum checken! Warped Hyphae Wood=Wirrhyphen Holz Warped Stair=Wirrtreppe Warped Slab=Wirrstufe -Double Warped Slab=Doppelte Wirrstufe -Crimson Fungus Mushroom=Karmesinpilz +Crimson Fungus=Karmesinpilz +Crimson fungus is a mushroom found in the nether's crimson forest.= Crimson Roots=Karmesinwurzeln Crimson Hyphae=Karmesinhyphe +The stem of a crimson hyphae= +Crimson Hyphae Bark= +Stripped Crimson Hyphae= +The stripped stem of a crimson hyphae= +Stripped Crimson Hyphae Bark= +The stripped wood of a crimson hyphae= Crimson Hyphae Wood=Karmesinhyphenholz Crimson Stair=Karmesintreppe Crimson Slab=Karmesinstufe Double Crimson Slab=Doppelte Karmesinstufe Crimson Nylium=Karmesin-Nezel +Crimson Door= +Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.= +To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.= +Crimson Trapdoor= +Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.= +To open or close the trapdoor, rightclick it or send a redstone signal to it.= +Crimson Fence= +Crimson Fence Gate= Crimson Checknode - only to check!=Karmesin Checkblock - Nur zum checken! +Warped Door= +Warped Trapdoor= +Warped Fence= +Warped Fence Gate= + +Double Warped Slab=Doppelte Wirrstufe From 07bebe6c462593e402f2cfe1e41897850e68337b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 04:41:57 -0500 Subject: [PATCH 080/273] Add the new german translations for crimson/warped --- .../mcl_crimson/locale/mcl_crimson.de.tr | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 443937ad4..4c13eeed7 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -10,7 +10,7 @@ Warped Wart Block=Wirrwarzenblock Shroomlight=Pilzlicht Warped Hyphae=Wirrhyphe The stem of a warped hyphae= -Warped Hyphae Bark= +Warped Hyphae Bark=Wirrhypenrinde This is a decorative block surrounded by the bark of an hyphae.= Stripped Warped Hyphae= The stripped hyphae of a warped fungus= @@ -26,7 +26,7 @@ Crimson fungus is a mushroom found in the nether's crimson forest.= Crimson Roots=Karmesinwurzeln Crimson Hyphae=Karmesinhyphe The stem of a crimson hyphae= -Crimson Hyphae Bark= +Crimson Hyphae Bark=Karmesinhypenrinde Stripped Crimson Hyphae= The stripped stem of a crimson hyphae= Stripped Crimson Hyphae Bark= @@ -36,18 +36,18 @@ Crimson Stair=Karmesintreppe Crimson Slab=Karmesinstufe Double Crimson Slab=Doppelte Karmesinstufe Crimson Nylium=Karmesin-Nezel -Crimson Door= +Crimson Door=Karmesintür Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.= To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.= -Crimson Trapdoor= +Crimson Trapdoor=Karmesinfalltür Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.= To open or close the trapdoor, rightclick it or send a redstone signal to it.= -Crimson Fence= -Crimson Fence Gate= +Crimson Fence=Karmesinzaun +Crimson Fence Gate=Karmesinzauntor Crimson Checknode - only to check!=Karmesin Checkblock - Nur zum checken! -Warped Door= -Warped Trapdoor= -Warped Fence= -Warped Fence Gate= +Warped Door=Wirrholztür +Warped Trapdoor=Wirrfalltür +Warped Fence=Wirrzaun +Warped Fence Gate=Wirrzauntor Double Warped Slab=Doppelte Wirrstufe From 37d6ba392ce631ce580937579a3fff3af2137a45 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 04:54:58 -0500 Subject: [PATCH 081/273] Add more german translations for bamboo nodes --- mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr index f5719f1b0..892fb7ecd 100644 --- a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr +++ b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr @@ -15,24 +15,24 @@ A bamboo button is a redstone component made out of bamboo which can be pushed t A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.= Bamboo=Bambus -Bamboo Button=Bambustür -Bamboo Door= +Bamboo Button=Bambusknopf +Bamboo Door=Bambustür Bamboo Fence=Bambuszaun Bamboo Fence Gate=Bambuszauntor Bamboo Mosaic Slab= -Bamboo Mosaic Stair= +Bamboo Mosaic Stair=Bambusplankenstufe Bamboo Plank Slab=Bambusplatte -Bamboo Plank Stair= +Bamboo Plank Stair=Bambusmosaikstufe Bamboo Pressure Plate=Bambusdruckplatte Bamboo Sign=Bambusschild -Bamboo Slab= -Bamboo Stair= +Bamboo Slab=Bambusplatte +Bamboo Stair=Bambusstufe Bamboo Trapdoor=Bambusfalltür Double Bamboo Mosaic Slab= Double Bamboo Plank Slab= Double Bamboo Slab= Double Stripped Bamboo Slab= -Scaffolding= +Scaffolding=Bambusdruckplatte Scaffolding (horizontal)= Scaffolding block used to climb up or out across areas.= Stripped Bamboo Slab= From 6935bc2a1817fd32c4c5ef250301d92182b7e6ca Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 04:58:52 -0500 Subject: [PATCH 082/273] Make mcl_copper.de.tr match template.txt --- mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr index c693dc198..44982a49b 100644 --- a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr +++ b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr @@ -2,36 +2,56 @@ A block of copper is mostly a decorative block.=Ein Kupferblock wird meistens als dekorativer Block verwendet. A block used for compact raw copper storage.=Ein Block für die kompakte Lagerung von Rohkupfer. Block of Copper=Kupferblock +Waxed Block of Copper= Block of Raw Copper=Rohkupferblock Copper Ingot=Kupferbarren Copper Ore=Kupfererz Cut copper is a decorative block.=Ein Geschnittener Kupferblock ist ein dekorativer Block. Cut Copper=Geschnittener Kupferblock +Waxed Cut Copper= Double Slab of Cut Copper=Doppelte Geschnittene Kupferstufe Double Slab of Exposed Cut Copper=Doppelte Angelaufene Geschnittene Kupferstufe Double Slab of Oxidized Cut Copper=Doppelte Oxidierte Geschnittene Kupferstufe Double Slab of Weathered Cut Copper=Doppelte Verwitterte Geschnittene Kupferstufe +Waxed Double Slab of Cut Copper= +Waxed Double Slab of Exposed Cut Copper= +Waxed Double Slab of Oxidized Cut Copper= +Waxed Double Slab of Weathered Cut Copper= Exposed copper is a decorative block.=Ein Angelaufener Kupferblock ist ein dekorativer Block. Exposed Copper=Angelaufener Kupferblock +Waxed Exposed Copper= Exposed cut copper is a decorative block.=Ein Angelaufener geschnittener Kupferblock ist ein dekorativer Block. Exposed Cut Copper=Angelaufener geschnittener Kupferblock +Waxed Exposed Cut Copper= Molten Raw Copper. It is used to craft blocks.=Geschmolzenes Rohkupfer. Es wird verwendet, um Blöcke herzustellen. Oxidized copper is a decorative block.=Ein Oxidierter Kupferblockist ist ein dekorativer Block. Oxidized Copper=Oxidierter Kupferblock +Waxed Oxidized Copper= Oxidized cut copper is a decorative block.=Ein Oxidierter geschnittener Kupferblock ist ein dekorativer Block. Oxidized Cut Copper=Oxidierter geschnittener Kupferblock +Waxed Oxidized Cut Copper= Raw Copper. Mine a Copper Ore to get it.=Bauen sie ein Kupfererz ab, um es zu erhalten. Raw Copper=Rohkupfer Slab of Cut Copper=Geschnittene Kupferstufe Slab of Exposed Cut Copper=Angelaufene Geschnittene Kupferstufe Slab of Oxidized Cut Copper=Oxidierte Geschnittene Kupferstufe Slab of Weathered Cut Copper=Verwitterte Geschnittene Kupferstufe +Waxed Slab of Cut Copper= +Waxed Slab of Exposed Cut Copper= +Waxed Slab of Oxidized Cut Copper= +Waxed Slab of Weathered Cut Copper= Some copper contained in stone, it is pretty common and can be found below sea level.=Stein, in dem etwas Kupfer enthalten ist. Es ist ziemlich häufig und kann unter dem Meeresspiegel gefunden werden. Stairs of Cut Copper=Geschnittene Kupfertreppe Stairs of Exposed Cut Copper=Angelaufene Geschnittene Kupfertreppe Stairs of Oxidized Cut Copper=Oxidierte Geschnittene Kupfertreppe Stairs of Weathered Cut Copper=Verwitterte Geschnittene Kupfertreppe +Waxed Stairs of Cut Copper= +Waxed Stairs of Exposed Cut Copper= +Waxed Stairs of Oxidized Cut Copper= +Waxed Stairs of Weathered Cut Copper= Weathered copper is a decorative block.=Ein Verwitterter Kupferblock ist ein dekorativer Block. Weathered Copper=Verwitterter Kupferblock +Waxed Weathered Copper= Weathered cut copper is a decorative block.=Ein Verwitterter geschnittener Kupferblock ist ein dekorativer Block. Weathered Cut Copper=Verwitterter geschnittener Kupferblock +Waxed Weathered Cut Copper= From be69fdef8d680c18cfe5df2a222422e22de1d781 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:00:09 -0500 Subject: [PATCH 083/273] Add new german translations for mcl_copper --- mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr index 44982a49b..3b28eb371 100644 --- a/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr +++ b/mods/ITEMS/mcl_copper/locale/mcl_copper.de.tr @@ -2,13 +2,13 @@ A block of copper is mostly a decorative block.=Ein Kupferblock wird meistens als dekorativer Block verwendet. A block used for compact raw copper storage.=Ein Block für die kompakte Lagerung von Rohkupfer. Block of Copper=Kupferblock -Waxed Block of Copper= +Waxed Block of Copper=Gewachster Kupferblock Block of Raw Copper=Rohkupferblock Copper Ingot=Kupferbarren Copper Ore=Kupfererz Cut copper is a decorative block.=Ein Geschnittener Kupferblock ist ein dekorativer Block. Cut Copper=Geschnittener Kupferblock -Waxed Cut Copper= +Waxed Cut Copper=Gewachster geschnittener Kupferblock Double Slab of Cut Copper=Doppelte Geschnittene Kupferstufe Double Slab of Exposed Cut Copper=Doppelte Angelaufene Geschnittene Kupferstufe Double Slab of Oxidized Cut Copper=Doppelte Oxidierte Geschnittene Kupferstufe From cf6ee14e13e58a0eb3fd7b8d049f15ef2f7409c0 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:04:04 -0500 Subject: [PATCH 084/273] Add more German translations to vl_hollow_logs --- .../vl_hollow_logs/locale/vl_hollow_logs.de.tr | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr index 8aa07ffca..83eec629f 100644 --- a/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr +++ b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.de.tr @@ -1,4 +1,22 @@ # textdomain: mcl_hollow_logs +Hollow Acacia Log=Ausgehöhlter Akazienstamm +Hollow Birch Log= +Hollow Cherry Log=Ausgehöhlter Kirschstamm Hollow Birch Log=Hohler Birkenstamm Hollow Dark Oak Log=Hohler Schwarzeichenstamm Hollow Spruce Log=Hohler Fichtenstamm +Hollow Oak Log= +Hollow Spruce Log= +Hollow Crimson Stem=Ausgehöhlter Karmesinholzstamm +Hollow Warped Stem=Ausgehöhlter Dschungelbaumstamm +Hollow Jungle Log=Ausgehöhlter Dschungelbaumstamm +Stripped Hollow Acacia Log= +Stripped Hollow Birch Log= +Stripped Hollow Cherry Log= +Stripped Hollow Dark Oak Log= +Stripped Hollow Jungle Log= +Stripped Hollow Mangrove Log= +Stripped Hollow Oak Log= +Stripped Hollow Spruce Log=Entrindeter ausgehöhlter Fichtenstamm +Stripped Hollow Crimson Stem= +Stripped Hollow Warped Stem= From 043dc4487c5610ad809d14042174a70033bc1b9d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:06:52 -0500 Subject: [PATCH 085/273] Add more German translations to mcl_raw_ores --- mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr index 1ab069d2f..9ebf1ce03 100644 --- a/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr +++ b/mods/ITEMS/mcl_raw_ores/locale/mcl_raw_ores.de.tr @@ -1,4 +1,9 @@ # textdomain: mcl_raw_ores Raw Iron=Roheisen +Raw Gold=Rohgold +Raw iron. Mine an iron ore to get it.= +Raw gold. Mine a gold ore to get it.= Block of Raw Iron=Roheisenblock - +Block of Raw Gold=Rohgoldblock +A block of raw iron is mostly a decorative block but also useful as a compact storage of raw iron.= +A block of raw gold is mostly a decorative block but also useful as a compact storage of raw gold.= From 140d9014a031a19cfee27a4b44526dfd6d9725d6 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:10:34 -0500 Subject: [PATCH 086/273] Add new German translations to mesecons_pressureplates --- .../locale/mesecons_pressureplates.de.tr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr index 6e5e761ef..7dc08d63b 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr @@ -6,11 +6,18 @@ Birch Pressure Plate=Birkendruckplatte Dark Oak Pressure Plate=Schwarzeichendruckplatte Spruce Pressure Plate=Fichtendruckplatte Jungle Pressure Plate=Dschungeldruckplatte +Mangrove Pressure Plate= +Crimson Pressure Plate=Karmesinholzdruckplatte +Warped Pressure Plate=Wirrholzdruckplatte A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Eine Holzdruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein beliebiges bewegliches Objekt (wie Gegenstände, Spieler und Mobs) auf ihm befindet. -Stone Pressure Plate=Steindruckplatte +Polished Blackstone Pressure Plate=Polierter Schwarzsteindruckplatte A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Eine Steindruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein Spieler oder Mob auf ihm befindet. Sie wird von nichts anderem ausgelöst. +Stone Pressure Plate=Steindruckplatte Provides redstone power when pushed=Gibt Redstoneenergie aus, wenn gedrückt Pushable by players, mobs and objects=Drückbar von Spielern, Mobs und Objekten +Pushable by players, mobs and objects= Pushable by players and mobs=Drückbar von Spielern und Mobs Pushable by players=Drückbar von Spielern Pushable by mobs=Drückbar von Mobs +Pushable by players= +Pushable by mobs= From 763902a877a76d703a0192caa9398810d047116b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:12:57 -0500 Subject: [PATCH 087/273] Add German translation for mcl_grindstone --- mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr diff --git a/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr b/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr new file mode 100644 index 000000000..5cadd1c6c --- /dev/null +++ b/mods/ITEMS/mcl_grindstone/locale/mcl_grindstone.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_grindstone +Inventory= +Repair & Disenchant= +Grindstone=Schleifstein +Used to disenchant/fix tools= +Grindstone disenchants tools and armour except for curses, and repairs two items of the same type it is also the weapon smith's work station.= +To use the grindstone, rightclick it, Two input slots (on the left) and a single output slot.= +To disenchant an item place enchanted item in one of the input slots and take the disenchanted item from the output.= +To repair a tool you need a tool of the same type and material, put both items in the input slot and the output slot will combine two items durabilities with 5% bonus.= +If both items have enchantments the player will get xp from both items from the disenchant.= +Curses cannot be removed and will be transfered to the new repaired item, if both items have a different curse the curses will be combined.= From 398eb3585880be338215c1a6013d302774ca905a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:16:54 -0500 Subject: [PATCH 088/273] Add German translations for mcl_honey --- mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr diff --git a/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr b/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr new file mode 100644 index 000000000..21132da07 --- /dev/null +++ b/mods/ITEMS/mcl_honey/locale/mcl_honey.de.tr @@ -0,0 +1,11 @@ +# textdomain: mcl_honey +Honeycomb= +Used to craft beehives and protect copper blocks from further oxidation.= +Use on copper blocks to prevent further oxidation.= +Honeycomb Block=Honigwabenblock +Honeycomb Block. Used as a decoration.= +Honey Bottle=Honigflasche +Honey Bottle is used to craft honey blocks and to restore hunger points.= +Drinking will restore 6 hunger points. Can also be used to craft honey blocks.= +Honey Block=Honigblock +Honey Block. Used as a decoration and in redstone. Is sticky on some sides.= From c65bd27ad8d2ac89dad45cfb4e4127b9152143c4 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:18:10 -0500 Subject: [PATCH 089/273] Add German translation for mcl_lightning_rods --- mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr diff --git a/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr b/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr new file mode 100644 index 000000000..1b09ffd9a --- /dev/null +++ b/mods/ITEMS/mcl_lightning_rods/locale/mcl_lightning_rods.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_lightning_rods +Lightning Rod=Blitzableiterstab +A block that attracts lightning= From 92d823deafc42833817b02d5479859b6efc62509 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:20:55 -0500 Subject: [PATCH 090/273] Add German translations for Netherite Scrap/Ingot --- mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr index 54522c2b1..2f2dbda04 100644 --- a/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr +++ b/mods/ITEMS/mcl_nether/locale/mcl_nether.de.tr @@ -7,6 +7,7 @@ Netherrack=Nethergestein Netherrack is a stone-like block home to the Nether. Starting a fire on this block will create an eternal fire.=Netherrack ist ein gesteinsartiger Block aus dem Nether. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. Magma Block=Magmablock Magma blocks are hot solid blocks which hurt anyone standing on it, unless they have fire resistance. Starting a fire on this block will create an eternal fire.=Magmablöcke sind heiße feste Blöcke, die jeden, der auf ihm steht, verletzen, es sei denn, sie sind gegen Feuer immun. Auf diesem Block wird ein Feuer immer ein ewiges Feuer sein. +@1 stood too long on a magma block.=@1 stand zu lange auf einem Magmablock. Soul Sand=Seelensand Soul sand is a block from the Nether. One can only slowly walk on soul sand. The slowing effect is amplified when the soul sand is on top of ice, packed ice or a slime block.=Seelensand ist ein Block aus dem Nether. Man kann auf ihm nur langsam gehen. Die Verlangsamung ist verstärkt, wenn sich der Seelensand auf Eis, Packeis oder einem Schleimblock befindet. Nether Brick Block=Netherziegelblock @@ -25,7 +26,6 @@ Nether Brick=Netherziegel Nether bricks are the main crafting ingredient for crafting nether brick blocks and nether fences.=Netherziegel werden hauptsächlich zur Fertigung von Netherziegelblöcken und Netherzäunen benutzt. Nether Lava Source=Netherlavaquelle Flowing Nether Lava=Fließende Netherlava -@1 stood too long on a magma block.=@1 stand zu lange auf einem Magmablock. Premature Nether Wart (Stage 1)=Junger Netherwurz (1. Stufe) A premature nether wart has just recently been planted on soul sand. Nether wart slowly grows on soul sand in 4 stages (the second and third stages look identical). Although nether wart is home to the Nether, it grows in any dimension.=Ein junger Netherwurz wurde erst kürzlich auf Seelensand gepflanzt. Netherwurz wächst langsam auf Seelensand in 4 Stufen (die 2. und 3. Stufe sehen identisch aus). Obwohl Netherwurz im Nether beheimatet ist, wächst er in jeder Dimension. Premature Nether Wart (Stage 2)=Junger Netherwurz (2. Stufe) @@ -38,3 +38,9 @@ Place this item on soul sand to plant it and watch it grow.=Platzieren Sie den G Burns your feet=Verbrennt Ihre Füße Grows on soul sand=Wächst auf Seelensand Reduces walking speed=Reduziert das Schritttempo +Netherite Scrap=Nethitschrott +Netherite Ingot=Netheritbarren +Ancient Debris= +Ancient debris can be found in the nether and is very very rare.= +Netherite Block= +Netherite block is very hard and can be made of 9 netherite ingots.= From 76b28a4fc5f9ebae7fcf179110f0424f5ab487f4 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:23:38 -0500 Subject: [PATCH 091/273] Add German translations to mesecons_button --- .../REDSTONE/mesecons_button/locale/mesecons_button.de.tr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr b/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr index 9b311b9a8..2a9181306 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_button/locale/mesecons_button.de.tr @@ -2,13 +2,19 @@ Use the button to push it.=Benutzen Sie den Knopf, um ihn zu drücken. Stone Button=Steinknopf A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=Ein Steinknopf ist eine Redstonekomponente aus Stein. Er kann gedrückt werden, um ein Redstonesignal zu senden. Im gedrückten Zustand versorgt er benachbarte Redstonekomponenten für 1 Sekunde mit Redstoneenergie. +Polished Blackstone Button=Polierter Schwarzsteinknopf +A polished blackstone button is a redstone component made out of polished blackstone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.= Oak Button=Eichenknopf Acacia Button=Akazienknopf Birch Button=Birkenknopf Dark Oak Button=Schwarzeichenknopf Spruce Button=Fichtenknopf Jungle Button=Dschungelknopf +Mangrove Button= +Crimson Button=Karmesinholzknopf +Warped Button=Wirrholzknopf A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=Ein Holzknopf ist eine Redstonekomponente aus Holz. Er kann gedrückt werden, um ein Redstonesignal zu senden. Im gedrückten Zustand versorgt er benachbarte Redstonekomponenten für 1,5 Sekunden mit Redstoneenergie. Holzknöpfe können auch von Pfeilen gedrückt werden. Provides redstone power when pushed=Gibt Redstoneenergie, wenn gedrückt Push duration: @1s=Druckdauer: @1s Pushable by arrow=Drückbar von Pfeilen +A button is a redstone component which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for @1 seconds.= From 157d72b593e98625875d364860b21dd7218f7890 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:24:43 -0500 Subject: [PATCH 092/273] Add German translation for mcl_spyglass --- mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr diff --git a/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr b/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr new file mode 100644 index 000000000..127225237 --- /dev/null +++ b/mods/ITEMS/mcl_spyglass/locale/mcl_spyglass.de.tr @@ -0,0 +1,3 @@ +# textdomain: mcl_spyglass +Spyglass=Fernrohr +A spyglass is an item that can be used for zooming in on specific locations.= From b072557a6ab75fbc0dc05fa09f9d0ed8aedb30ef Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:28:44 -0500 Subject: [PATCH 093/273] Add German translation for Suspicious Stew --- mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr diff --git a/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr b/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr new file mode 100644 index 000000000..afd4bb556 --- /dev/null +++ b/mods/ITEMS/mcl_sus_stew/locale/mcl_sus_stew.de.tr @@ -0,0 +1,2 @@ +# textdomain: mcl_sus_stew +Suspicious Stew=Ominöse Suppe From 161655e87c2e0693e7c6280f4293bbe87245f22a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 05:29:55 -0500 Subject: [PATCH 094/273] Add German translation for mcl_target --- mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr diff --git a/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr new file mode 100644 index 000000000..2f21f213f --- /dev/null +++ b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_target +Target=Zielblock +A target is a block that provides a temporary redstone charge when hit by a projectile.= +Throw a projectile on the target to activate it.= From 38585154cdd21096028798757315ff4566cad12f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 17:47:36 -0500 Subject: [PATCH 095/273] Make German translation of mcl_stairs match template.txt --- mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr index 8b53d8d13..9bc536f69 100644 --- a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr +++ b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr @@ -39,8 +39,8 @@ Double Diorite Slab=Doppeldioritplatte Cobblestone Stairs=Kopfsteinpflastertreppe Cobblestone Slab=Kopfsteinpflasterplatte Double Cobblestone Slab=Doppelkopfsteinpflasterplatte -Mossy Cobblestone Slab=Moosige Kopfsteinpflasterplatte Mossy Cobblestone Stairs=Moosige Kopfsteinpflastertreppe +Mossy Cobblestone Slab=Moosige Kopfsteinpflasterplatte Double Mossy Cobblestone Slab=Doppelte moosige Kopfsteinpflasterplatte Brick Stairs=Ziegeltreppe Brick Slab=Ziegelplatte @@ -99,3 +99,6 @@ Polished Diorite Stairs=Polierte Diorittreppe Mossy Stone Brick Stairs=Moosige Steinziegeltreppe Mossy Stone Brick Slab=Moosige Steinziegelplatte Double Mossy Stone Brick Slab=Doppelte moosige Steinziegelplatte +Mud Brick Stair= +Mud Brick Slab= +Double Mud Brick Slab= From 66a3fcb33cada2d8f50d19306190a2e95e5364e1 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 18:12:29 -0500 Subject: [PATCH 096/273] Add corrections to existing German translations --- .../mcl_blackstone/locale/mcl_blackstone.de.tr | 18 +++++++++--------- .../ITEMS/mcl_crimson/locale/mcl_crimson.de.tr | 8 ++++---- mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr | 6 +++--- mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr index f6cf778a0..3ef4f370e 100644 --- a/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr +++ b/mods/ITEMS/mcl_blackstone/locale/mcl_blackstone.de.tr @@ -5,15 +5,15 @@ Chiseled Polished Blackstone=Gemeißelter polierter Schwarzstein Polished Blackstone Bricks=Polierter Schwarzsteinziegel Basalt=Basalt Polished Basalt=Polierter Basalt -Blackstone Slab=Schwarzstein Stufe -Polished Blackstone Slab=Polierte Schwarzstein Stufe -Chiseled Polished Blackstone Slab=Gemeißelte Polierte Schwarzstein Stufe -Polished Blackstone Brick Slab=Polierte Schwarzsteinziegel Stufe -Blackstone Stair=Schwarzstein Treppe -Polished Blackstone Stair=Polierte Schwarzstein Treppe -Chiseled Polished Blackstone Stair=Gemeißelte Polierte Schwarzstein Treppe -Polished Blackstone Brick Stair=Polierte Schwarzsteinziegel Treppe -Quartz Bricks=Quartz Ziegel +Blackstone Slab=Schwarzsteinstufe +Polished Blackstone Slab=Polierte Schwarzsteinstufe +Chiseled Polished Blackstone Slab=Gemeißelte polierte Schwarzsteinstufe +Polished Blackstone Brick Slab=Polierte Schwarzsteinziegelstufe +Blackstone Stair=Schwarzsteintreppe +Polished Blackstone Stair=Polierte Schwarzsteintreppe +Chiseled Polished Blackstone Stair=Gemeißelte polierte Schwarzsteintreppe +Polished Blackstone Brick Stair=Polierte Schwarzsteinziegeltreppe +Quartz Bricks=Quarzziegel Soul Torch=Seelenfakel Torches are light sources which can be placed at the side or on the top of most blocks.= Soul Lantern=Seelenlaterne diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 4c13eeed7..ca0b5267d 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -18,9 +18,9 @@ Stripped Warped Hyphae Bark= The stripped hyphae bark of a warped fungus= Warped Nylium=Wirr-Nezel Warped Checknode - only to check!=Wirr Checkblock - Nur zum checken! -Warped Hyphae Wood=Wirrhyphen Holz -Warped Stair=Wirrtreppe -Warped Slab=Wirrstufe +Warped Hyphae Wood=Wirrhypenholz +Warped Stair=Wirrholztreppe +Warped Slab=Wirrholzstufe Crimson Fungus=Karmesinpilz Crimson fungus is a mushroom found in the nether's crimson forest.= Crimson Roots=Karmesinwurzeln @@ -50,4 +50,4 @@ Warped Trapdoor=Wirrfalltür Warped Fence=Wirrzaun Warped Fence Gate=Wirrzauntor -Double Warped Slab=Doppelte Wirrstufe +Double Warped Slab=Doppelte Wirrholzstufe diff --git a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr index ec5c4b577..63733f275 100644 --- a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr +++ b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr @@ -1,5 +1,5 @@ # textdomain: mcl_signs -Sign=Zeichen / Schild +Sign=Schild Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them.=Schilder können beschrieben werden und kommen in zwei Varianten: Wandschild und stehendes Schild. Sie können auf und an den Seiten von anderen Blöclen platziert werden, aber nicht unter ihnen. After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow.=Nachdem das Schild platziert wurde, kann man etwas darauf schreiben. 4 Zeilen mit je 15 Zeichen pro Zeile sind verfügbar, alles darüber geht verloren. Es werden nicht alle Zeichen unterstützt. Der Text kann nicht geändert werden, sobald er geschrieben wurde; man muss das Schild erneut platzieren. Kann gefärbt und zum Leuchten gebracht werden. Enter sign text:=Schildtext eingeben: @@ -14,5 +14,5 @@ Dark Oak Sign=Dunkles Eichenschild Jungle Sign=Dschungelholzschild Acacia Sign=Akazienzeichen Mangrove Sign=Mangroven-Zeichen -Warped Hyphae Sign=Verzerrtes Hyphen-Zeichen -Crimson Hyphae Sign=Hochrotes Hyphen-Zeichen +Warped Hyphae Sign=Wirrhyphenschild +Crimson Hyphae Sign=Karmesinhyphenschild diff --git a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr index 9bc536f69..bb6414604 100644 --- a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr +++ b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr @@ -4,10 +4,10 @@ Double @1=@1 (doppelt) Slabs are half as high as their full block counterparts and occupy either the lower or upper part of a block, depending on how it was placed. Slabs can be easily stepped on without needing to jump. When a slab is placed on another slab of the same type, a double slab is created.=Eine Platte ist halb so hoch wie ihr Vollblock-Gegenstück und belegt entweder den unteren oder unteren Teil eines Blocks, je nach dem, wie er platziert wurde. Platten können leicht betreten werden, ohne springen zu müssen. Wird eine Platte auf einer anderen gleichen Platte platziert, ergibt das eine Doppelplatte. Upper @1=@1 (oben) Double slabs are full blocks which are created by placing two slabs of the same kind on each other.=Doppelplatten sind ganze Blöcke, die entstehen, wenn zwei gleiche Platten aufeinander gestapelt werden. -Oak Wood Stairs=Eichenholztreppe +Oak Wood Stairs=Eichentreppe Oak Wood Slab=Eichenholzplatte Double Oak Wood Slab=Doppeleichenholzplatte -Jungle Wood Stairs=Dschungelholztreppe +Jungle Wood Stairs=Dschungeltreppe Jungle Wood Slab=Dschungelholzplatte Double Jungle Wood Slab=Doppeldschungelholzplatte Acacia Wood Stairs=Akazienholztreppe @@ -69,8 +69,8 @@ Double Smooth Quartz Slab=Doppelte glatte Quarzplatte Nether Brick Stairs=Netherziegeltreppe Nether Brick Slab=Netherziegelplatte Double Nether Brick Slab=Doppelte Netherziegelplatte -Red Nether Brick Stairs=Rote Netherbricktreppe -Red Nether Brick Slab=Rote Netherbrickplatte +Red Nether Brick Stairs=Rote Netherziegeltreppe +Red Nether Brick Slab=Rote Netherziegelplatte Double Red Nether Brick Slab=Doppelte rote Netherbricktreppe End Stone Brick Stairs=Endsteinziegeltreppe End Stone Brick Slab=Endsteinziegelplatte From 485bce3df645681865744b62e00cea83e8bbe431 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 20 Jul 2024 18:16:31 -0500 Subject: [PATCH 097/273] Add German translations of for part of the item descriptions --- mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index ca0b5267d..1aa06a9ba 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -1,7 +1,7 @@ # textdomain: mcl_crimson Warped Fungus Mushroom=Wirrpilz -Warped fungus is a mushroom found in the nether's warped forest.= +Warped fungus is a mushroom found in the nether's warped forest.=Wirrpilze wachsen im Wirrwald des Nethers. Twisting Vines=Zwirbelranken Weeping Vines=Trauerranken Nether Sprouts=Nethersprossen @@ -22,7 +22,7 @@ Warped Hyphae Wood=Wirrhypenholz Warped Stair=Wirrholztreppe Warped Slab=Wirrholzstufe Crimson Fungus=Karmesinpilz -Crimson fungus is a mushroom found in the nether's crimson forest.= +Crimson fungus is a mushroom found in the nether's crimson forest.=Karmesinpilze wachsen im Karmesinwald des Nethers. Crimson Roots=Karmesinwurzeln Crimson Hyphae=Karmesinhyphe The stem of a crimson hyphae= @@ -37,11 +37,11 @@ Crimson Slab=Karmesinstufe Double Crimson Slab=Doppelte Karmesinstufe Crimson Nylium=Karmesin-Nezel Crimson Door=Karmesintür -Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.= -To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.= +Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.=Holztüren sind zwei Block hohe Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. +To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.=m eine Holztür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an die untere Hälfte an. Crimson Trapdoor=Karmesinfalltür -Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.= -To open or close the trapdoor, rightclick it or send a redstone signal to it.= +Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.=Falltüren aus Holz sind horizontale Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. Sie nehmen die obere oder untere Hälfte eines Blocks ein, je nachdem wo sie platziert wurden. Geöffnete Falltüren können wie Leitern beklettert werden. +To open or close the trapdoor, rightclick it or send a redstone signal to it.=Um eine Falltür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an. Crimson Fence=Karmesinzaun Crimson Fence Gate=Karmesinzauntor Crimson Checknode - only to check!=Karmesin Checkblock - Nur zum checken! From 15003b1c55054793e62f26adf3118c323193f9e5 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 6 Aug 2024 07:00:17 -0500 Subject: [PATCH 098/273] Fix orange->orange(r/s) where needed, synchronize mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr with template.txt --- mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr | 4 ++-- .../locale/mcl_colorblocks.de.tr | 22 +++++++++++++++++-- mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr index 6771596a5..fae0cf9fe 100644 --- a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr +++ b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr @@ -15,7 +15,7 @@ Black Bed=Schwarzes Bett Yellow Bed=Gelbes Bett Green Bed=Grünes Bett Magenta Bed=Magenta Bett -Orange Bed=Orange Bett +Orange Bed=Oranges Bett Purple Bed=Violettes Bett Brown Bed=Braunes Bett Pink Bed=Rosa Bett @@ -47,4 +47,4 @@ You are missing the 'shout' privilege! It's required in order to talk in chat... You exceeded the maximum number of messages per 10 seconds!=Sie haben die maximale Anzahl an Chatnachrichten pro 10 Sekunden überschritten! Hey! Would you guys mind sleeping?=Hey, würdet Ihr bitte zu Bett gehen? Sorry, but you have to wait @1 seconds until you may use this button again!=Sie müssen leider noch @1 Sekunden warten, bevor sie diesen Knopf erneut benutzen können! -@1/@2 players currently in bed.=@1/@2 Spieler aktuell im Bett. \ No newline at end of file +@1/@2 players currently in bed.=@1/@2 Spieler aktuell im Bett. diff --git a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr index 359a2f7cb..e02688dac 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr +++ b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr @@ -1,76 +1,94 @@ # textdomain: mcl_colorblocks White Terracotta=Weiße Terrakotta White Glazed Terracotta=Weiße glasierte Terrakotta +White Glazed Terracotta Pillar= White Concrete Powder=Weißes Betonpulver White Concrete=Weißer Beton Grey Terracotta=Graue Terrakotta Grey Glazed Terracotta=Graue glasierte Terrakotta +Grey Glazed Terracotta Pillar= Grey Concrete Powder=Graues Betonpulver Grey Concrete=Grauer Beton Light Grey Terracotta=Hellgraue Terrakotta Light Grey Glazed Terracotta=Hellgraue glasierte Terrakotta +Light Grey Glazed Terracotta Pillar= Light Grey Concrete Powder=Hellgraues Betonpulver Light Grey Concrete=Hellgrauer Beton Black Terracotta=Schwarze Terrakotta Black Glazed Terracotta=Schwarze glasierte Terrakotta +Black Glazed Terracotta Pillar= Black Concrete Powder=Schwarzes Betonpulver Black Concrete=Schwarzer Beton Red Terracotta=Rote Terrakotta Red Glazed Terracotta=Rote glasierte Terrakotta +Red Glazed Terracotta Pillar= Red Concrete Powder=Rotes Betonpulver Red Concrete=Roter Beton Yellow Terracotta=Gelbe Terrakotta Yellow Glazed Terracotta=Gelbe glasierte Terrakotta +Yellow Glazed Terracotta Pillar= Yellow Concrete Powder=Gelbes Betonpulver Yellow Concrete=Gelber Beton Green Terracotta=Grüne Terrakotta Green Glazed Terracotta=Grüne glasierte Terrakotta +Green Glazed Terracotta Pillar= Green Concrete Powder=Grünes Betonpulver Green Concrete=Grüner Beton Cyan Terracotta=Türkise Terrakotta Cyan Glazed Terracotta=Türkise glasierte Terrakotta +Cyan Glazed Terracotta Pillar= Cyan Concrete Powder=Türkises Betonpulver Cyan Concrete=Türkiser Beton Blue Terracotta=Blaue Terrakotta Blue Glazed Terracotta=Blaue glasierte Terrakotta +Blue Glazed Terracotta Pillar= Blue Concrete Powder=Blaues Betonpulver Blue Concrete=Blauer Beton Magenta Terracotta=Magenta Terrakotta Magenta Glazed Terracotta=Magenta glasierte Terrakotta +Magenta Glazed Terracotta Pillar= Magenta Concrete Powder=Magenta Betonpulver Magenta Concrete=Magenta Beton Orange Terracotta=Orange Terrakotta Orange Glazed Terracotta=Orange glasierte Terrakotta -Orange Concrete Powder=Orange Betonpulver +Orange Glazed Terracotta Pillar=Orange glasierte Terrakottasäule +Orange Concrete Powder=Oranges Betonpulver Orange Concrete=Orange Beton Purple Terracotta=Violette Terrakotta Purple Glazed Terracotta=Violette glasierte Terrakotta -Purple Concrete Powder=Violettes Betonpulver +Purple Glazed Terracotta Pillar= +Purple Concrete Powder= Betonpulver Purple Concrete=Violetter Beton Brown Terracotta=Braune Terrakotta Brown Glazed Terracotta=Braune glasierte Terrakotta +Brown Glazed Terracotta Pillar= Brown Concrete Powder=Braunes Betonpulver Brown Concrete=Brauner Beton Pink Terracotta=Rosa Terrakotta Pink Glazed Terracotta=Rosa glasierte Terrakotta +Pink Glazed Terracotta Pillar= Pink Concrete Powder=Rosa Betonpulver Pink Concrete=Rosa Beton Lime Terracotta=Lindgrüne Terrakotta Lime Glazed Terracotta=Lindgrüne glasierte Terrakotta +Lime Glazed Terracotta Pillar= Lime Concrete Powder=Lindgrünes Betonpulver Lime Concrete=Lindgrüner Beton Light Blue Terracotta=Hellbaue Terrakotta Light Blue Glazed Terracotta=Hellblaue glasierte Terrakotta +Light Blue Glazed Terracotta Pillar= Light Blue Concrete Powder=Hellblaues Betonpulver Light Blue Concrete=Hellblauer Beton Terracotta is a basic building material. It comes in many different colors.=Terrakotta ist ein Baumaterial. Es gibt es in vielen verschiedenen Farben. Glazed terracotta is a decorative block with a complex pattern. It can be rotated by placing it in different directions.=Glasierte Terrakotta ist ein dekorativer Block mit einem komplexen Muster. Sie kann rotiert werden, indem man sie in verschiedene Richtungen platziert. +Glazed terracotta pillar is a decorative block with a complex pattern. It can be used with Glazed terracotta to make uneven patterns.= Concrete powder is used for creating concrete, but it can also be used as decoration itself. It comes in different colors. Concrete powder turns into concrete of the same color when it comes in contact with water.=Betonpulver wird benutzt, um Beton herzustellen, aber es kann auch selbst als Dekoration benutzt werden. Es kommt in verschiedenen Farben daher. Betonpulver verwandelt sich in Beton der selben Farbe, wenn es mit Wasser in Berührung kommt. Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.=Beton ist ein dekorativer Block, der in verschiedenen Farben daherkommt. Er hat eine besonders kräftige und klare Farbe. Terracotta=Terrakotta Terracotta is a basic building material which comes in many different colors. This particular block is uncolored.=Terrakotta ist ein Baumaterial, welches in vielen verschiedenen Farben vorkommt. Diese Variante ist ungefärbt. Colored Terracotta=Gefärbte Terrakotta Glazed Terracotta=Glasierte Terrakotta +Glazed Terracotta Pillar= Concrete Powder=Betonpulver Concrete=Beton Turns into concrete on water contact=Wird zu Beton bei Wasserkontakt diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr index affe4cb8a..92be50c17 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr @@ -11,7 +11,7 @@ Green Dye=Grüner Farbstoff Lime Dye=Lindgrüner Farbstoff Yellow Dye=Gelber Farbstoff Brown Dye=Brauner Farbstoff -Orange Dye=Orange Farbstoff +Orange Dye=Oranger Farbstoff Red Dye=Roter Farbstoff Magenta Dye=Magenta Farbstoff Pink Dye=Rosa Farbstoff From 757d6761b2eea045250bf779414a848857051fcb Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 6 Aug 2024 07:18:30 -0500 Subject: [PATCH 099/273] Add German translations for mcl_crimson, update template.txt --- .../mcl_crimson/locale/mcl_crimson.de.tr | 26 +++++++++---------- mods/ITEMS/mcl_crimson/locale/template.txt | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 1aa06a9ba..237138f0c 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -1,6 +1,6 @@ # textdomain: mcl_crimson -Warped Fungus Mushroom=Wirrpilz +Warped Fungus=Wirrpilz Warped fungus is a mushroom found in the nether's warped forest.=Wirrpilze wachsen im Wirrwald des Nethers. Twisting Vines=Zwirbelranken Weeping Vines=Trauerranken @@ -9,28 +9,28 @@ Warped Roots=Wirrwurzeln Warped Wart Block=Wirrwarzenblock Shroomlight=Pilzlicht Warped Hyphae=Wirrhyphe -The stem of a warped hyphae= +The stem of a warped hyphae=Der Stiel einer Wirrhyphe Warped Hyphae Bark=Wirrhypenrinde -This is a decorative block surrounded by the bark of an hyphae.= -Stripped Warped Hyphae= -The stripped hyphae of a warped fungus= -Stripped Warped Hyphae Bark= -The stripped hyphae bark of a warped fungus= +This is a decorative block surrounded by the bark of an hyphae.=Ein dekorativer Block, umgeben von der Rinde einer Hyphe +Stripped Warped Hyphae=Entrindete Wirrhyphe +The stripped hyphae of a warped fungus=Der entrindete Stiel eines Karmesinpilzes +Stripped Warped Hyphae Bark=Wirrhyphenrinde +The stripped hyphae bark of a warped fungus=Die abgelöste Hyphenrinde eines Wirrpilzes Warped Nylium=Wirr-Nezel Warped Checknode - only to check!=Wirr Checkblock - Nur zum checken! Warped Hyphae Wood=Wirrhypenholz Warped Stair=Wirrholztreppe Warped Slab=Wirrholzstufe +Double Warped Slab=Doppelte Wirrholzstufe Crimson Fungus=Karmesinpilz Crimson fungus is a mushroom found in the nether's crimson forest.=Karmesinpilze wachsen im Karmesinwald des Nethers. Crimson Roots=Karmesinwurzeln Crimson Hyphae=Karmesinhyphe -The stem of a crimson hyphae= +The stem of a crimson hyphae=Der Stiel einer Karmesinhyphe Crimson Hyphae Bark=Karmesinhypenrinde -Stripped Crimson Hyphae= -The stripped stem of a crimson hyphae= -Stripped Crimson Hyphae Bark= -The stripped wood of a crimson hyphae= +Stripped Crimson Hyphae=Entrindete Karmesinhyphe +The stripped stem of a crimson hyphae=Der entrindete Stiel eines Karmesinpilzes +Stripped Crimson Hyphae Bark=Karmesinhyphenrinde Crimson Hyphae Wood=Karmesinhyphenholz Crimson Stair=Karmesintreppe Crimson Slab=Karmesinstufe @@ -49,5 +49,3 @@ Warped Door=Wirrholztür Warped Trapdoor=Wirrfalltür Warped Fence=Wirrzaun Warped Fence Gate=Wirrzauntor - -Double Warped Slab=Doppelte Wirrholzstufe diff --git a/mods/ITEMS/mcl_crimson/locale/template.txt b/mods/ITEMS/mcl_crimson/locale/template.txt index f93b85577..80c37fa87 100644 --- a/mods/ITEMS/mcl_crimson/locale/template.txt +++ b/mods/ITEMS/mcl_crimson/locale/template.txt @@ -21,6 +21,7 @@ Warped Checknode - only to check!= Warped Hyphae Wood= Warped Stair= Warped Slab= +Double Warped Slab= Crimson Fungus= Crimson fungus is a mushroom found in the nether's crimson forest.= Crimson Roots= @@ -30,7 +31,6 @@ Crimson Hyphae Bark= Stripped Crimson Hyphae= The stripped stem of a crimson hyphae= Stripped Crimson Hyphae Bark= -The stripped wood of a crimson hyphae= Crimson Hyphae Wood= Crimson Stair= Crimson Slab= From 8a3ef9d4c8f3372dc0ee3a948b76111b24affab4 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 6 Aug 2024 18:32:40 -0500 Subject: [PATCH 100/273] Last three German translations for #4529 --- mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr | 2 +- mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr | 2 +- mods/ITEMS/mcl_core/locale/mcl_core.de.tr | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index 02224bef9..1761e486e 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -11,7 +11,7 @@ wild= ward=Bezirk vex= rib= -snout= +snout=Schnauzen eye=Auge spire= silence= diff --git a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr index e02688dac..7e5a487ad 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr +++ b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr @@ -56,7 +56,7 @@ Orange Concrete Powder=Oranges Betonpulver Orange Concrete=Orange Beton Purple Terracotta=Violette Terrakotta Purple Glazed Terracotta=Violette glasierte Terrakotta -Purple Glazed Terracotta Pillar= +Purple Glazed Terracotta Pillar=Violett glasierte Terrakottasäule Purple Concrete Powder= Betonpulver Purple Concrete=Violetter Beton Brown Terracotta=Braune Terrakotta diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index b7364624e..33c3fe3c4 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -286,3 +286,7 @@ Grows on sand or dirt next to water=Wächst auf Sand oder Erde neben Wasser Stackable=Stapelbar Needs soil and water to grow=Braucht Nährboden und Wasser zum wachsen Enchanted Golden Apple=Verzauberter goldener Apfel +Light= +Lights are invisible blocks. They are used to light up adventure maps and the like.= +When you hold a light in hand, you reveal all placed lights in a short distance around you.= +>>>>>>> 25a4fae2e (Last three German translations for #4529) From 0a83c73fe0a2265e20b7b6573e20fada83d78233 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 11 Aug 2024 07:18:50 -0500 Subject: [PATCH 101/273] Restore inadvertantly removed translations --- .../ENTITIES/mcl_boats/locale/mcl_boats.de.tr | 22 ++-- .../mcl_mobitems/locale/mcl_mobitems.de.tr | 121 +++++++++++++++++- mods/ITEMS/mcl_mobitems/locale/template.txt | 1 + 3 files changed, 132 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr index ebfe24088..08ad99e89 100644 --- a/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr +++ b/mods/ENTITIES/mcl_boats/locale/mcl_boats.de.tr @@ -1,15 +1,15 @@ # textdomain: mcl_boats -Acacia Boat= -Birch Boat= -Boat= -Boats are used to travel on the surface of water.= -Dark Oak Boat= -Jungle Boat= -Oak Boat= -Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.= -Spruce Boat= -Water vehicle= -Sneak to dismount= +Acacia Boat=Akazienboot +Birch Boat=Birkenboot +Boat=Boot +Boats are used to travel on the surface of water.=Boote werden benutzt, um sich auf der Wasseroberfläche zu bewegen. +Dark Oak Boat=Schwarzeichenboot +Jungle Boat=Dschungelboot +Oak Boat=Eichenboot +Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Rechtsklicken Sie auf eine Wasserquelle, um das Boot zu platzieren. Rechtsklicken Sie auf das Boot, um es zu betreten. Mit [Links] und [Rechts] lenken, mit [Vorwärts] und [Rückwärts] Geschwindigkeit regeln oder rückwärts fahren. Nutzen sie [Schleichen], um das Boot zu verlassen, schlagen Sie das Boot, um es als Gegenstand fallen zu lassen. +Spruce Boat=Fichtenboot +Water vehicle=Wasserfahrzeug +Sneak to dismount=Zum Aussteigen schleichen Obsidian Boat=Obsidianboot Mangrove Boat= Cherry Boat=Kirschholzboot diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr index cc4ed3d6a..366bfd80a 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr @@ -1,5 +1,124 @@ # textdomain: mcl_mobitems +Rotten Flesh=Gammelfleisch +80% chance of food poisoning=80% Wahrscheinlichkeit von Lebensmittelvergiftung -Crystalline Drop=Kristallträne +Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while.=Igitt! Dieses Stück Fleisch hat wohl bessere Tage gesehen. Wenn Sie es essen, werden Sie sofort vergiftet und erleiden einen Schaden von 4 Trefferpunkten. Aber gezähmte Wölfe können es problemlos fressen. + +Raw Mutton=Rohes Hammelfleisch + +Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value.=Rohes Hammelfleisch ist das Fleisch eines Schafes und ein Lebensmittel, welches bedenkenlos verzehrt werden kann. Es kann gebraten werden, um seinen Nährwert deutlich zu erhöhen. + +Cooked Mutton=Gebratenes Hammelfleisch +Cooked mutton is the cooked flesh from a sheep and is used as food.=Gebratenes Hammelfleisch ist das gebratene Fleisch eines Schafs und dient als Lebensmittel. +Raw Beef=Rohes Rindfleisch + +Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value.=Rohes Rindfleisch ist das Fleisch von Kühen und kann problemlos gegessen werden. Es kann gegart werden, um den Nährwert deutlich zu erhöhen. + +Steak=Steak +Steak is cooked beef from cows and can be eaten.=Steak ist gebratenes Rindfleisch und kann gegessen werden. +Raw Chicken=Rohes Hühnchen +30% chance of food poisoning=30% Wahrscheinlichkeit von Lebensmittelvergiftung + +Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value.=Rohes Hühnchen ist ein Lebensmittel, das nicht sicher für den Verzehr ist. Sie können es essen, um ein paar Hungerpunkte zu erhalten, aber mit einer Wahrscheinlichkeit von 30% erleiden Sie eine Lebensmittelvergiftung, die Ihre Hungerrate für eine Weile erhöht. Braten Sie ein rohes Hühnchen, um es sicher zuzubereiten und den Nährwert zu erhöhen. + +Cooked Chicken=Gebratenes Hühnchen +A cooked chicken is a healthy food item which can be eaten.=Ein gebratenes Hühnchen ist ein gesundes essbares Lebensmittel. +Raw Porkchop=Rohes Schweinefleisch + +A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. + +Cooked Porkchop=Gebratenes Schweinefleisch +Cooked porkchop is the cooked flesh of a pig and is used as food.=Ein gebratenes Stück Schweinefleisch ist ein gutes Lebensmittel. +Raw Rabbit=Rohes Kaninchen + +Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value.=Rohes Kaninchenfleisch ist ein Lebensmittel, welches bedenkenlos verzehrt werden kann. Es kann gebraten werden, um seinen Nährwert zu erhöhen. + +Cooked Rabbit=Gebratenes Kaninchen +This is a food item which can be eaten.=Dies ist ein essbares Lebensmittel. +Milk=Milch +Removes all status effects=Entfernt alle Statuseffekte + +Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points.=Milch ist sehr erfrischend. Milch erhält man, indem man einen Eimer an einer Kuh benutzt. Wenn die Milch getrunken wird, werden alle Statuseffekte entfernt, aber es werden keine Hungerpunkte wiederhergestellt. + +Use the placement key to drink the milk.=Platzierungstaste benutzen, um Milch zu trinken. +Spider Eye=Spinnenauge +Poisonous=Giftig + +Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly.=Spinnenaugen werden hauptsächlich in der Fertigung benutzt. Wenn Sie wirklich verzweifelt sind, können sie es essen, aber das wird Sie kurz vergiften. + +Bone=Knochen + +Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient.=Knochen können benutzt werden, um Wölfe zu zähmen, damit sie einen beschützen. Sie außerdem nützlich in der Fertigung. + +Wield the bone near wolves to attract them. Use the “Place” key on the wolf to give it a bone and tame it. You can then give commands to the tamed wolf by using the “Place” key on it.=Halten Sie den Knochen in der Nähe von Wölfen, um sie anzulocken. Benutzen Sie die „Platzieren“-Taste auf dem Wolf, um ihm den Knochen zu geben und ihn zu zähmen. Sie können dem gezähmten Wolf Befehle erteilen, indem Sie die „Platzieren“-Taste auf ihm benutzen. + +Squid Ink Sac=Tintenbeutel +This item is dropped by dead squids. Squid ink can be used to as an ingredient to craft book and quill or black dye.=Dieser Gegenstand wird von toten Tintenfischen abgeworfen. Tintenbeutel können benutzt werden, um Buch und Feder oder schwarzen Farbstoff zu fertigen. + +String=Faden +Strings are used in crafting.=Fäden sind nützlich in der Fertigung. Spectre Membrane=Geistermembrane +This is a crafting component dropped from dead spectres.= +Crystalline Drop=Kristallträne +Blaze Rod=Lohenrute +This is a crafting component dropped from dead blazes.=Dies ist eine Fertigungskomponente, die von toten Lohen abgeworfen wird. +Blaze Powder=Lohenstaub +This item is mainly used for crafting.=Dieser Gegenstand wird hauptsächlich in der Fertigung benutzt. +Magma Cream=Magmacreme +Magma cream is a crafting component.=Magmacreme ist eine Fertigungskomponente. +Ghast Tear=Ghast-Träne +Place this item in an item frame as decoration.=Platzieren Sie diesen Gegenstand in einem Rahmen als Deko. +Nether Star=Nether-Stern + +A nether star is dropped when the Wither dies. Place it in an item frame to show the world how hardcore you are! Or just as decoration.=Ein Netherstern wird abgeworfen, wenn der Wither stirbt. Platzieren Sie ihn in einen Rahmen, um der Welt zu zeigen, wie großartig Sie sind! + +Leather=Leder +Leather is a versatile crafting component.=Leder ist eine vielseitige Fertigungskomponente. +Feather=Feder +Feathers are used in crafting and are dropped from chickens.=Federn werden in der Fertigung benutzt und werden von Hühnern abgeworfen. +Rabbit Hide=Kaninchenfell +Rabbit hide is used to create leather.=Kaninchenfell wird zur Herstellung von Leder benutzt. +Rabbit's Foot=Hasenpfote +Must be your lucky day! Place this item in an item frame for decoration.=Muss wohl Ihr Glückstag sein! Platzieren Sie diesen Gegenstand in einen Rahmen zur Dekoration. +Saddle=Sattel +Can be placed on animals to ride them=Kann auf Tieren platziert werden, um sie zu reiten +Saddles can be put on some animals in order to mount them.=Sattel können auf einigen Tieren platziert werden, um sich aufzusatteln. + +Use the placement key with the saddle in your hand to try to put on the saddle. Saddles fit on horses, mules, donkeys and pigs. Horses, mules and donkeys need to be tamed first, otherwise they'll reject the saddle. Saddled animals can be mounted by using the placement key on them again.=Platzierungstaste benutzen, während man den Sattel in der Hand hält, um zu versuchen, den Sattel anzulegen. Sattel passen auf Pferde, Maultiere, Esel und Schweine. Pferde, Maultiere und Esel müssen zuerst gezähmt werden, sonst werden sie den Sattel abweisen. Mit der Platzierungstaste kann man aufsatteln. + +Rabbit Stew=Kaninchenragout +Rabbit stew is a very nutricious food item.=Kaninchenragout ist ein sehr nahrhaftes Lebensmittel. +Shulker Shell=Schulkerschale +Shulker shells are used in crafting. They are dropped from dead shulkers.=Schulkerschalen werden für die Fertigung verwendet. Sie werden von toten Schulkern fallen gelassen. +Slimeball=Schleimkugel +Slimeballs are used in crafting. They are dropped from slimes.=Schleimkugeln werden in der Fertigung verwendet. Sie werden von Schleimen fallen gelassen. +Gunpowder=Schießpulver +Carrot on a Stick=Karottenrute +Lets you ride a saddled pig=Um auf gesattelten Schweinen zu reiten +A carrot on a stick can be used on saddled pigs to ride them.=Eine Karottenrute kann auf gesattelten Schweinen angewendet werden, um sie zu reiten. + +Place it on a saddled pig to mount it. You can now ride the pig like a horse. Pigs will also walk towards you when you just wield the carrot on a stick.=Platzieren Sie sie auf einem Schwein mit Sattel, um sich aufzusatteln. Sie können nun das Schwein wie ein Pferd reiten. Schweine werden auch auf Sie zugehen, wenn Sie einfach nur die Karottenrute halten. + +Warped fungus on a Stick= +Lets you ride a strider= +A warped fungus on a stick can be used on saddled striders to ride them.= +Place it on a saddled strider to mount it. You can now ride the strider like a horse. Striders will also walk towards you when you just wield the fungus on a stick.= + +Nautilus Shell= +Used to craft a conduit= +The Nautilus Shell is used to craft a conduit. They can be obtained by fishing or killing a drowned that is wielding a shell.= +Heart of the Sea= +The Heart of the Sea is used to craft a conduit. They can be obtained by finding them in a buried treasure chest.= + +Iron Horse Armor=Eisenpferderüstung +Iron horse armor can be worn by horses to increase their protection from harm a bit.=Eine Eisenpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden etwas zu erhöhen. +Golden Horse Armor=Goldpferderüstung +Golden horse armor can be worn by horses to increase their protection from harm.=Eine Goldpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden zu erhöhen. +Diamond Horse Armor=Diamantpferderüstung +Diamond horse armor can be worn by horses to greatly increase their protection from harm.=Eine Diamantpferderüstung kann von Pferden getragen werden, um ihren Schutz vor Schaden beträchtlich zu erhöhen. +Place it on a horse to put on the horse armor. Donkeys and mules can't wear horse armor.=Platzieren Sie es auf einem Pferd, um die Pferderüstung aufzusetzen. Esel und Maultiere können keine Pferderüstung tragen. + +Glow Ink Sac= +Use it to craft the Glow Item Frame.= +Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame.= diff --git a/mods/ITEMS/mcl_mobitems/locale/template.txt b/mods/ITEMS/mcl_mobitems/locale/template.txt index 2c02ac3ee..7b1895f34 100644 --- a/mods/ITEMS/mcl_mobitems/locale/template.txt +++ b/mods/ITEMS/mcl_mobitems/locale/template.txt @@ -59,6 +59,7 @@ String= Strings are used in crafting.= Spectre Membrane= This is a crafting component dropped from dead spectres.= +Crystalline Drop= Blaze Rod= This is a crafting component dropped from dead blazes.= Blaze Powder= From 07431123178ea1a20f263e0732125bd645828ef5 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 11 Aug 2024 07:24:10 -0500 Subject: [PATCH 102/273] Remove extra line at end of file --- .../mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr | 1 - mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr | 1 - mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr | 1 - mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr | 1 - 4 files changed, 4 deletions(-) diff --git a/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr index be2166bbc..a734cc415 100644 --- a/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr +++ b/mods/ITEMS/mcl_compressed_blocks/locale/mcl_compressed_blocks.de.tr @@ -1,4 +1,3 @@ # textdomain: mcl_compressed_blocks Compressed Cobblestone=Verdichtetes Kopfsteinpflaster Double Compressed Cobblestone=Doppelt verdichtetes Kopfsteinpflaster - diff --git a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr index 9eee14fbc..099e7f33f 100644 --- a/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr +++ b/mods/ITEMS/mcl_lanterns/locale/mcl_lanterns.de.tr @@ -2,4 +2,3 @@ Lantern=Laterne Soul Lantern=Seelenlaterne Chain=Kette - diff --git a/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr index 6fbf56f45..20b64fa60 100644 --- a/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr +++ b/mods/ITEMS/mcl_loom/locale/mcl_loom.de.tr @@ -1,3 +1,2 @@ # textdomain: mcl_loom Loom=Webstuhl - diff --git a/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr index 25e5cd2ce..b3e9817e7 100644 --- a/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr +++ b/mods/ITEMS/mcl_smithing_table/locale/mcl_smithing_table.de.tr @@ -1,3 +1,2 @@ # textdomain: mcl_smithing_table Smithing table=Schmiedetisch - From bc00b8d11b67aaaad1f9024de00ac70a213267c6 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 11 Aug 2024 07:35:02 -0500 Subject: [PATCH 103/273] Finish restoring inadvertently removed translations --- mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr index 366bfd80a..1dab0d80b 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.de.tr @@ -25,7 +25,7 @@ Cooked Chicken=Gebratenes Hühnchen A cooked chicken is a healthy food item which can be eaten.=Ein gebratenes Hühnchen ist ein gesundes essbares Lebensmittel. Raw Porkchop=Rohes Schweinefleisch -A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. +A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.=Ein rohes Stück Schweinefleisch kann bedenkenlos gegessen werden. Man kann es braten, um seinen Nährwert stark zu erhöhen. Cooked Porkchop=Gebratenes Schweinefleisch Cooked porkchop is the cooked flesh of a pig and is used as food.=Ein gebratenes Stück Schweinefleisch ist ein gutes Lebensmittel. From 316d5bf19772c336ff9708ea45ca19d7b018846d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 11 Aug 2024 07:45:01 -0500 Subject: [PATCH 104/273] Address review comments on translations/grammar --- .../locale/mcl_experience.de.tr | 2 +- .../mcl_target/locale/mcl_target.de.tr | 2 +- .../locale/mesecons_pressureplates.de.tr | 2 +- mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr | 2 +- .../locale/mcl_cherry_blossom.de.tr | 20 +++++++++---------- .../locale/mcl_colorblocks.de.tr | 2 +- .../mcl_crimson/locale/mcl_crimson.de.tr | 14 ++++++------- .../mcl_flowers/locale/mcl_flowers.de.tr | 2 +- mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr | 6 +++--- mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr index 0db7165eb..e0e48d0ef 100644 --- a/mods/HUD/mcl_experience/locale/mcl_experience.de.tr +++ b/mods/HUD/mcl_experience/locale/mcl_experience.de.tr @@ -5,4 +5,4 @@ Error: Too many parameters!=Fehler: Zu viele Parameter! Error: Incorrect value of XP=Fehler: Ungültiger EP-Wert Error: Player not found=Fehler: Spieler nicht gefunden Added @1 XP to @2, total: @3, experience level: @4=@1 EP an @2 gegeben, gesamt: @3, Erfahrungsstufe: @4 -Bottle o' Enchanting=Zauberfläschchen +Bottle o' Enchanting=Erfahrungsfläschchen diff --git a/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr index 2f21f213f..90d81bde6 100644 --- a/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr +++ b/mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.de.tr @@ -1,4 +1,4 @@ # textdomain: mcl_target -Target=Zielblock +Target=Zielscheibe A target is a block that provides a temporary redstone charge when hit by a projectile.= Throw a projectile on the target to activate it.= diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr index 7dc08d63b..74a71f225 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/locale/mesecons_pressureplates.de.tr @@ -10,7 +10,7 @@ Mangrove Pressure Plate= Crimson Pressure Plate=Karmesinholzdruckplatte Warped Pressure Plate=Wirrholzdruckplatte A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Eine Holzdruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein beliebiges bewegliches Objekt (wie Gegenstände, Spieler und Mobs) auf ihm befindet. -Polished Blackstone Pressure Plate=Polierter Schwarzsteindruckplatte +Polished Blackstone Pressure Plate=Polierte Schwarzsteindruckplatte A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Eine Steindruckplatte ist eine Redstonekomponente, die ihre benachbarten Blöcke mit Redstoneenergie versorgt, solange sich ein Spieler oder Mob auf ihm befindet. Sie wird von nichts anderem ausgelöst. Stone Pressure Plate=Steindruckplatte Provides redstone power when pushed=Gibt Redstoneenergie aus, wenn gedrückt diff --git a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr index 1761e486e..991089204 100644 --- a/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr +++ b/mods/ITEMS/mcl_armor/locale/mcl_armor.de.tr @@ -11,7 +11,7 @@ wild= ward=Bezirk vex= rib= -snout=Schnauzen +snout=Schnauze eye=Auge spire= silence= diff --git a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr index 562c4a62c..6efe3a00a 100644 --- a/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr +++ b/mods/ITEMS/mcl_cherry_blossom/locale/mcl_cherry_blossom.de.tr @@ -12,13 +12,13 @@ Cherry Leaves= Cherry blossom leaves are grown from cherry blossom trees.= Cherry Sapling=Kirschbaumsetzling Cherry blossom sapling can be planted to grow cherry trees.= -Cherry Door=Kirschtür -Cherry Trapdoor=Kirschfalltür -Cherry Stairs=Kirschtreppe -Cherry Slab=Kirschplatte -Double Cherry Slab= -Cherry Sign=Kirschschild -Cherry Fence=Kirschzaun -Cherry Gate=Kirschzauntor -Cherry Pressure Plate=Kirschbaumsetzling -Cherry Button=Kirschknopf +Cherry Door=Kirschholztür +Cherry Trapdoor=Kirschholzfalltür +Cherry Stairs=Kirschholztreppe +Cherry Slab=Kirschholzstufe +Double Cherry Slab= Doppelte Kirschholzstufe +Cherry Sign=Kirschholzschild +Cherry Fence=Kirschholzzaun +Cherry Gate=Kirschholzzauntor +Cherry Pressure Plate=Kirschholzdruckplatte +Cherry Button=Kirschholzknopf diff --git a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr index 7e5a487ad..ac6fcba41 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr +++ b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr @@ -57,7 +57,7 @@ Orange Concrete=Orange Beton Purple Terracotta=Violette Terrakotta Purple Glazed Terracotta=Violette glasierte Terrakotta Purple Glazed Terracotta Pillar=Violett glasierte Terrakottasäule -Purple Concrete Powder= Betonpulver +Purple Concrete Powder=Violettes Betonpulver Purple Concrete=Violetter Beton Brown Terracotta=Braune Terrakotta Brown Glazed Terracotta=Braune glasierte Terrakotta diff --git a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr index 237138f0c..3265664ce 100644 --- a/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr +++ b/mods/ITEMS/mcl_crimson/locale/mcl_crimson.de.tr @@ -36,16 +36,16 @@ Crimson Stair=Karmesintreppe Crimson Slab=Karmesinstufe Double Crimson Slab=Doppelte Karmesinstufe Crimson Nylium=Karmesin-Nezel -Crimson Door=Karmesintür +Crimson Door=Karmesinholztür Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal.=Holztüren sind zwei Block hohe Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. To open or close a wooden door, rightclick it or supply its lower half with a redstone signal.=m eine Holztür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an die untere Hälfte an. -Crimson Trapdoor=Karmesinfalltür +Crimson Trapdoor=Karmesinholzfalltür Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder.=Falltüren aus Holz sind horizontale Barrieren, die sowohl von Hand geöffnet und geschlossen werden können, als auch per Redstone-Signal. Sie nehmen die obere oder untere Hälfte eines Blocks ein, je nachdem wo sie platziert wurden. Geöffnete Falltüren können wie Leitern beklettert werden. To open or close the trapdoor, rightclick it or send a redstone signal to it.=Um eine Falltür zu öffnen oder zu schließen, rechtsklicke auf sie oder lege ein Redstone-Signal an. -Crimson Fence=Karmesinzaun -Crimson Fence Gate=Karmesinzauntor +Crimson Fence=Karmesinholzzaun +Crimson Fence Gate=Karmesinholzzauntor Crimson Checknode - only to check!=Karmesin Checkblock - Nur zum checken! Warped Door=Wirrholztür -Warped Trapdoor=Wirrfalltür -Warped Fence=Wirrzaun -Warped Fence Gate=Wirrzauntor +Warped Trapdoor=Wirrholzfalltür +Warped Fence=Wirrholzzaun +Warped Fence Gate=Wirrholzzauntor diff --git a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr index 93d2ad1bf..e59698136 100644 --- a/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr +++ b/mods/ITEMS/mcl_flowers/locale/mcl_flowers.de.tr @@ -16,7 +16,7 @@ Tall grass is a small plant which often occurs on the surface of grasslands. It Fern=Farn Ferns are small plants which occur naturally in jungles and taigas. They can be harvested for wheat seeds. By using bone meal, a fern can be turned into a large fern which is two blocks high.=Farne sind kleine Pflanzen, die oft in Dschungeln und Taigas vorkommen. Sie können für Weizensamen abgeerntet werden. Mit Knochenmehl lässt sich ein Farn zu einem großen Farn, der zwei Blöcke hoch ist, verwandeln. Clover=Kleeblatt -Four-leaf Clover=vierblättriges Kleeblatt +Four-leaf Clover=Vierblättriges Kleeblatt (Top Part)=(Oberseite) Peony=Pfingstrose A peony is a large plant which occupies two blocks. It is mainly used in dye production.=Eine Pfingstrose ist eine große Pflanze, die zwei Blöcke hoch ist. Sie wird hauptsächlich für die Farbenproduktion gebraucht. diff --git a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr index 63733f275..775b4830e 100644 --- a/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr +++ b/mods/ITEMS/mcl_signs/locale/mcl_signs.de.tr @@ -8,11 +8,11 @@ Maximum lines: 4=Maximale Zeilen: 4 Done=Fertig Can be written=Kann beschriftet werden Oak Sign=Eichezeichen -Birch Sign=Birkenschild +Birch Sign=Birkenholzschild Spruce Sign=Fichtenzeichen Dark Oak Sign=Dunkles Eichenschild Jungle Sign=Dschungelholzschild Acacia Sign=Akazienzeichen Mangrove Sign=Mangroven-Zeichen -Warped Hyphae Sign=Wirrhyphenschild -Crimson Hyphae Sign=Karmesinhyphenschild +Warped Hyphae Sign=Wirrhyphenholzschild +Crimson Hyphae Sign=Karmesinhyphenholzschild diff --git a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr index bb6414604..3f68f1a92 100644 --- a/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr +++ b/mods/ITEMS/mcl_stairs/locale/mcl_stairs.de.tr @@ -4,10 +4,10 @@ Double @1=@1 (doppelt) Slabs are half as high as their full block counterparts and occupy either the lower or upper part of a block, depending on how it was placed. Slabs can be easily stepped on without needing to jump. When a slab is placed on another slab of the same type, a double slab is created.=Eine Platte ist halb so hoch wie ihr Vollblock-Gegenstück und belegt entweder den unteren oder unteren Teil eines Blocks, je nach dem, wie er platziert wurde. Platten können leicht betreten werden, ohne springen zu müssen. Wird eine Platte auf einer anderen gleichen Platte platziert, ergibt das eine Doppelplatte. Upper @1=@1 (oben) Double slabs are full blocks which are created by placing two slabs of the same kind on each other.=Doppelplatten sind ganze Blöcke, die entstehen, wenn zwei gleiche Platten aufeinander gestapelt werden. -Oak Wood Stairs=Eichentreppe +Oak Wood Stairs=Eichenholztreppe Oak Wood Slab=Eichenholzplatte Double Oak Wood Slab=Doppeleichenholzplatte -Jungle Wood Stairs=Dschungeltreppe +Jungle Wood Stairs=Dschungelholztreppe Jungle Wood Slab=Dschungelholzplatte Double Jungle Wood Slab=Doppeldschungelholzplatte Acacia Wood Stairs=Akazienholztreppe From 88be86ab4bea56efd0c0af59a357cb35777f6315 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 18 Aug 2024 19:59:05 -0500 Subject: [PATCH 105/273] Remove stray merge conflict marking, add two additional empty translations to match template.txt --- mods/ITEMS/mcl_core/locale/mcl_core.de.tr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index 33c3fe3c4..22c536edc 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -285,8 +285,9 @@ Slows down movement=Verlangsamt die Fortbewegung Grows on sand or dirt next to water=Wächst auf Sand oder Erde neben Wasser Stackable=Stapelbar Needs soil and water to grow=Braucht Nährboden und Wasser zum wachsen +Crying Obsidian= +Crying obsidian is a luminous obsidian that can generate as part of ruined portals.= Enchanted Golden Apple=Verzauberter goldener Apfel Light= Lights are invisible blocks. They are used to light up adventure maps and the like.= When you hold a light in hand, you reveal all placed lights in a short distance around you.= ->>>>>>> 25a4fae2e (Last three German translations for #4529) From 8e37f34b931b6bf626c05cbe85e2d3d2df9ab6cb Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 31 Aug 2024 09:57:34 -0500 Subject: [PATCH 106/273] Fix swapped translations --- mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr index 892fb7ecd..8ec98c73c 100644 --- a/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr +++ b/mods/ITEMS/mcl_bamboo/locale/mcl_bamboo.de.tr @@ -20,9 +20,9 @@ Bamboo Door=Bambustür Bamboo Fence=Bambuszaun Bamboo Fence Gate=Bambuszauntor Bamboo Mosaic Slab= -Bamboo Mosaic Stair=Bambusplankenstufe +Bamboo Mosaic Stair=Bambusmosaikstufe Bamboo Plank Slab=Bambusplatte -Bamboo Plank Stair=Bambusmosaikstufe +Bamboo Plank Stair=Bambusplankenstufe Bamboo Pressure Plate=Bambusdruckplatte Bamboo Sign=Bambusschild Bamboo Slab=Bambusplatte From 2dadfda76b819688ed2e60bdcb4986f2b632a073 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 31 Aug 2024 19:35:16 +0200 Subject: [PATCH 107/273] Drop old (and disabled by default) fallen logs. (#4618) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are better ones enabled in mods/MAPGEN/mcl_terrain_features/init.lua Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4618 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_biomes/init.lua | 166 -------------------------------- settingtypes.txt | 4 - 2 files changed, 170 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 8f4d4076a..9ac37eac5 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -19,8 +19,6 @@ local mg_seed = minetest.get_mapgen_setting("seed") -- Some mapgen settings local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" -local generate_fallen_logs = minetest.settings:get_bool("mcl_generate_fallen_logs", false) - local mod_mcl_structures = minetest.get_modpath("mcl_structures") local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mcl_mushrooms = minetest.get_modpath("mcl_mushrooms") @@ -4971,170 +4969,6 @@ local function register_decorations() register_doubletall_grass(-0.0005, -0.3, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"}) register_grass_decoration("tallgrass", -0.03, 1, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"}) - ----------------- - -- Fallen logs - -- These fallen logs are not really good yet. They must be longer and also have one upright block. - -- Note the decortion API does not like wide schematics, they are likely to overhang. - if generate_fallen_logs then - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow", "mcl_core:podzol", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"MegaTaiga", "MegaSpruceTaiga", "Taiga"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:sprucetree", param2 = 12, prob = 127}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 160}, - {name = "mcl_mushrooms:mushroom_red", prob = 160}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block", "mcl_core:podzol", "mcl_core:podzol_snow", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"ColdTaiga"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:sprucetree", param2 = 12, prob = 127}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "mcl_core:sprucetree", param2 = 12}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow"}, - sidelen = 16, - noise_params = { - offset = 0.0, - scale = -0.00008, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"BirchForest", "BirchForestM", }, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:birchtree", param2 = 12}, - {name = "mcl_core:birchtree", param2 = 12}, - {name = "mcl_core:birchtree", param2 = 12, prob = 127}, - {name = "mcl_mushrooms:mushroom_red", prob = 100}, - {name = "mcl_mushrooms:mushroom_brown", prob = 10}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, - sidelen = 80, - fill_ratio = 0.005, - biomes = {"Jungle", "JungleM"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:jungletree", param2 = 12}, - {name = "mcl_core:jungletree", param2 = 12}, - {name = "mcl_core:jungletree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 50}, - {name = "air", prob = 0}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - - minetest.register_decoration({ - deco_type = "schematic", - place_on = {"group:grass_block_no_snow"}, - sidelen = 16, - noise_params = { - offset = 0.00018, - scale = 0.00011, - spread = {x = 250, y = 250, z = 250}, - seed = 2, - octaves = 3, - persist = 0.66 - }, - biomes = {"Forest"}, - y_min = 1, - y_max = mcl_vars.mg_overworld_max, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "mcl_core:tree", param2 = 12, prob = 127}, - {name = "mcl_core:tree", param2 = 12}, - {name = "mcl_core:tree", param2 = 12}, - {name = "air", prob = 0}, - {name = "mcl_mushrooms:mushroom_brown", prob = 96}, - {name = "mcl_mushrooms:mushroom_red", prob = 96}, - }, - }, - flags = "place_center_x", - rotation = "random", - }) - end - -- Lily pad local lily_schem = { diff --git a/settingtypes.txt b/settingtypes.txt index 30a160427..975f02f29 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -256,10 +256,6 @@ mcl_buckets_use_select_box (Buckets use select box) bool false # See also: https://github.com/minetest/minetest/issues/95 mcl_translucent_ice (Translucent ice) bool false -# Whether to generate fallen logs in some biomes. -# They might not always look pretty and have strange overhangs. -mcl_generate_fallen_logs (Generate fallen logs) bool false - # If enabled, the “flat” map generator generates a Classic Superflat world: # Completely flat, 1 layer of grass blocks on top of 2 layers of dirt on # top of a final layer of bedrock. No caves, trees or plants. From ecfa42d51d2f9f7a5c5734de3b80c9174a193a9d Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 31 Aug 2024 19:36:18 +0200 Subject: [PATCH 108/273] Update railcorridors, enable chest minecarts (#4620) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minecart chests seem to work by now. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4620 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/tsm_railcorridors/LICENSE.txt | 9 +++ mods/MAPGEN/tsm_railcorridors/README.md | 4 +- mods/MAPGEN/tsm_railcorridors/gameconfig.lua | 38 +++++----- mods/MAPGEN/tsm_railcorridors/init.lua | 70 ++++++++----------- mods/MAPGEN/tsm_railcorridors/mod.conf | 1 + .../MAPGEN/tsm_railcorridors/settingtypes.txt | 4 +- 6 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 mods/MAPGEN/tsm_railcorridors/LICENSE.txt diff --git a/mods/MAPGEN/tsm_railcorridors/LICENSE.txt b/mods/MAPGEN/tsm_railcorridors/LICENSE.txt new file mode 100644 index 000000000..dbe77c028 --- /dev/null +++ b/mods/MAPGEN/tsm_railcorridors/LICENSE.txt @@ -0,0 +1,9 @@ +Copyright © 2023 Wuzzy, joz + +The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mods/MAPGEN/tsm_railcorridors/README.md b/mods/MAPGEN/tsm_railcorridors/README.md index 3b839573c..431122e1a 100644 --- a/mods/MAPGEN/tsm_railcorridors/README.md +++ b/mods/MAPGEN/tsm_railcorridors/README.md @@ -1,7 +1,7 @@ # Railway corridors [`tsm_railcorridors`] VoxeLibre adaption. NO TREASURER SUPPORT! -* Current version 0.14.0 +* Current version 0.14.5 Minetest mod for adding underground corridors with rails and wood constructions with a few treasure chests now and then. Optional support for the Treasurer mod is available for adding treasures from various mods. @@ -10,7 +10,7 @@ Cobwebs are added if the `mobs_monster` mod is found. Use the advanced settings to finetune the railway corridors. * Forum thread: https://forum.minetest.net/viewtopic.php?t=10339 -* License: MIT License. +* License: MIT License (see `LICENSE.txt`). ## Info for game makers Want to include this mod in a game, but you have problems with the dependencies? diff --git a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua index 4a27586a2..2e80c60c8 100644 --- a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua +++ b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua @@ -27,7 +27,7 @@ if mg_name == "v6" then } else -- This generates dark oak wood in mesa biomes and oak wood everywhere else. - function tsm_railcorridors.nodes.corridor_woods_function(pos, node) + function tsm_railcorridors.nodes.corridor_woods_function(_, node) if minetest.get_item_group(node.name, "hardened_clay") ~= 0 then return "mcl_core:darkwood", "mcl_fences:dark_oak_fence" else @@ -36,34 +36,36 @@ else end end +tsm_railcorridors.carts = { "mcl_minecarts:chest_minecart" } --- TODO: Use minecart with chest instead of normal minecart -tsm_railcorridors.carts = { "mcl_minecarts:minecart" } +-- This is called after a spawner has been placed by the game. +-- Use this to properly set up the metadata and stuff. +-- This is needed for games if they include mob spawners. +-- All spawners spawn cave spiders +function tsm_railcorridors.on_construct_spawner(pos) + mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7) +end -function tsm_railcorridors.on_construct_cart(pos, cart) - -- TODO: Fill cart with treasures - -- This is it? There's this giant hack announced in - -- the other file and I grep for the function and it's - -- a stub? :) - - -- The path here using some minetest.after hackery was - -- deactivated in init.lua - reactivate when this does - -- something the function is called RecheckCartHack. +-- This is called after a cart has been placed by the game. +-- Use this to properly set up entity metadata and stuff. +-- * pos: Position of cart +-- * cart: Cart entity +function tsm_railcorridors.on_construct_cart(_, cart, pr_carts) + local l = cart:get_luaentity() + local inv = mcl_entity_invs.load_inv(l,27) + local items = tsm_railcorridors.get_treasures(pr_carts) + mcl_loot.fill_inventory(inv, "main", items, pr_carts) + mcl_entity_invs.save_inv(l) end -- Fallback function. Returns a random treasure. This function is called for chests -- only if the Treasurer mod is not found. -- pr: A PseudoRandom object -function tsm_railcorridors.get_default_treasure(pr) +function tsm_railcorridors.get_default_treasure(_) -- UNUSED IN MINECLONE 2! end --- All spawners spawn cave spiders -function tsm_railcorridors.on_construct_spawner(pos) - mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7) -end - -- MineClone 2's treasure function. Gets all treasures for a single chest. -- Based on information from Minecraft Wiki. function tsm_railcorridors.get_treasures(pr) diff --git a/mods/MAPGEN/tsm_railcorridors/init.lua b/mods/MAPGEN/tsm_railcorridors/init.lua index d68c58aa3..66b4d779b 100644 --- a/mods/MAPGEN/tsm_railcorridors/init.lua +++ b/mods/MAPGEN/tsm_railcorridors/init.lua @@ -10,8 +10,7 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/gameconfig.lua") local setting -- Probability function --- TODO: Check if this is correct -local function P(float) +local P = function (float) return math.floor(32767 * float) end @@ -27,8 +26,8 @@ elseif setting then end -- Minimal and maximal value of path length (forks don't look up this value) -local way_min = 4; -local way_max = 7; +local way_min = 4 +local way_max = 7 setting = tonumber(minetest.settings:get("tsm_railcorridors_way_min")) if setting then way_min = setting @@ -74,7 +73,7 @@ if setting then end -- Probability for a rail corridor system to be damaged -local probability_damage = P(1.0) +local probability_damage = P(0.55) setting = tonumber(minetest.settings:get("tsm_railcorridors_probability_damage")) if setting then probability_damage = P(setting) @@ -83,14 +82,14 @@ end -- Enable cobwebs local place_cobwebs = true setting = minetest.settings:get_bool("tsm_railcorridors_place_cobwebs") -if setting then +if setting ~= nil then place_cobwebs = setting end -- Enable mob spawners local place_mob_spawners = true setting = minetest.settings:get_bool("tsm_railcorridors_place_mob_spawners") -if setting then +if setting ~= nil then place_mob_spawners = setting end @@ -153,17 +152,17 @@ local function SetNodeIfCanBuild(pos, node, check_above, can_replace_rail) if check_above then local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name local abovedef = minetest.registered_nodes[abovename] - if abovename == "unknown" or abovename == "ignore" or - (abovedef and abovedef.groups and abovedef.groups.attached_node) or + if (not abovedef) or abovename == "unknown" or abovename == "ignore" or + (abovedef.groups and abovedef.groups.attached_node) or -- This is done because cobwebs are often fake liquids - (abovedef and abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then + (abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then return false end end local name = minetest.get_node(pos).name local def = minetest.registered_nodes[name] - if name ~= "unknown" and name ~= "ignore" and - ((def and def.is_ground_content and def.liquidtype == "none") or + if name ~= "unknown" and name ~= "ignore" and def and + ((def.is_ground_content and def.liquidtype == "none") or name == tsm_railcorridors.nodes.cobweb or name == tsm_railcorridors.nodes.torch_wall or name == tsm_railcorridors.nodes.torch_floor or @@ -178,7 +177,7 @@ end -- Tries to place a rail, taking the damage chance into account local function PlaceRail(pos, damage_chance) - if damage_chance and damage_chance > 0 then + if damage_chance ~= nil and damage_chance > 0 then local x = pr:next(0,100) if x <= damage_chance then return false @@ -211,7 +210,7 @@ local function NeedsPlatform(pos) local falling = minetest.get_item_group(node.name, "falling_node") == 1 return -- Node can be replaced if ground content or rail - (node.name ~= "ignore" and node.name ~= "unknown" and nodedef and nodedef.is_ground_content) and + (nodedef and node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content) and -- Node needs platform if node below is not walkable. -- Unless 2 nodes below there is dirt: This is a special case for the starter cube. ((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or @@ -237,7 +236,7 @@ end local function Cube(p, radius, node, replace_air_only, wood, post) local y_top = p.y+radius local nodedef = minetest.registered_nodes[node.name] - local solid = nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none" + local solid = nodedef and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none" -- Check if all the nodes could be set local built_all = true @@ -253,7 +252,7 @@ local function Cube(p, radius, node, replace_air_only, wood, post) if yi == y_top then local topnode = minetest.get_node({x=xi,y=yi+1,z=zi}) local topdef = minetest.registered_nodes[topnode.name] - if minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef and topdef.liquidtype == "none" then + if topdef and minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef.liquidtype == "none" then ok = true end elseif column_last_attached and yi == column_last_attached - 1 then @@ -364,8 +363,7 @@ local function Platform(p, radius, node, node2) if not node2 then node2 = { name = tsm_railcorridors.nodes.dirt } end - local n1 = {} - local n2 = {} + local n1, n2 = {}, {} for zi = p.z-radius, p.z+radius do for xi = p.x-radius, p.x+radius do local np, np2 = NeedsPlatform({x=xi,y=p.y,z=zi}) @@ -394,33 +392,26 @@ local function PlaceChest(pos, param2) end end - -- This function checks if a cart has ACTUALLY been spawned. -- To be calld by minetest.after. -- This is a workaround thanks to the fact that minetest.add_entity is unreliable as fuck -- See: https://github.com/minetest/minetest/issues/4759 -- FIXME: Kill this horrible hack with fire as soon you can. - --- Why did anyone activate it in the first place? It doesn't --- have a function seeing as there are no chest minecarts yet. ---[[ local function RecheckCartHack(params) local pos = params[1] local cart_id = params[2] -- Find cart - for _, obj in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if obj and obj:get_luaentity().name == cart_id then + for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do + if obj ~= nil and obj:get_luaentity().name == cart_id then -- Cart found! We can now safely call the callback func. -- (calling it earlier has the danger of failing) minetest.log("info", "[tsm_railcorridors] Cart spawn succeeded: "..minetest.pos_to_string(pos)) - tsm_railcorridors.on_construct_cart(pos, obj) + tsm_railcorridors.on_construct_cart(pos, obj, pr_carts) return end end minetest.log("info", "[tsm_railcorridors] Cart spawn FAILED: "..minetest.pos_to_string(pos)) end ---]] - -- Try to place a cobweb. -- pos: Position of cobweb @@ -627,7 +618,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d if sign then segamount = 0-segamount end - local vek = {x=0,y=0,z=0}; + local vek = {x=0,y=0,z=0} local start = table.copy(waypoint) if axis == "x" then vek.x=segamount @@ -714,7 +705,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d end if (minetest.get_node({x=p.x,y=p.y-1,z=p.z}).name=="air" and minetest.get_node({x=p.x,y=p.y-3,z=p.z}).name~=tsm_railcorridors.nodes.rail) then - p.y = p.y - 1; + p.y = p.y - 1 if i == chestplace then chestplace = chestplace + 1 end @@ -840,7 +831,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da local s = sign local ud = false -- Up or down local udn = false -- Up or down is next - local udp -- Up or down was previous + local udp = false -- Up or down was previous local up = false -- true if going up local upp = false -- true if was going up previously for i=1,length do @@ -891,7 +882,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da wp, no_spawner = create_corridor_section(wp,a,s, ud, udn, udp, up, wood, post, first_or_final, damage, no_spawner) if wp == false then return end -- Fork in the road? If so, starts 2-3 new corridor lines and terminates the current one. - if pr:next() < probability_fork then + if wp and pr:next() < probability_fork then -- 75% chance to fork off in 3 directions (making a crossing) -- 25% chance to fork off in 2 directions (making a t-junction) local is_crossing = pr:next(0, 3) < 3 @@ -911,7 +902,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da {a2, not s}, -- to the other side {a, s}, -- straight ahead } - for f=1, forks do + for _= 1, forks do local r = pr:next(1, #fork_dirs) create_corridor_line(wp, fork_dirs[r][1], fork_dirs[r][2], pr:next(way_min,way_max), wood, post, damage, no_spawner) table.remove(fork_dirs, r) @@ -928,7 +919,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da a="z" elseif a=="z" then a="x" - end; + end s = pr:next(1, 2) == 1 end end @@ -949,11 +940,8 @@ local function spawn_carts() -- This checks if the cart is actually spawned, it's a giant hack! -- Note that the callback function is also called there. -- TODO: Move callback function to this position when the - -- minetest.add_entity bug has been fixed. - - -- minetest.after(3, RecheckCartHack, {cpos, cart_id}) - -- This whole recheck logic leads to a stub right now - -- it can be reenabled when chest carts are a thing. + -- minetest.add_entity bug has been fixed (supposedly in 5.9.0?) + minetest.after(3, RecheckCartHack, {cpos, cart_id}) end end carts_table = {} @@ -1115,7 +1103,7 @@ mcl_structures.register_structure("mineshaft",{ sidelen = 32, y_max = 40, y_min = mcl_vars.mg_overworld_min, - place_func = function(pos,def,pr,blockseed) + place_func = function(pos,_,pr,blockseed) local r = pr:next(-50,-10) local p = vector.offset(pos,0,r,0) if p.y < mcl_vars.mg_overworld_min + 5 then @@ -1123,7 +1111,7 @@ mcl_structures.register_structure("mineshaft",{ end if p.y > -10 then return true end InitRandomizer(blockseed) - create_corridor_system(p, pr) + create_corridor_system(p) return true end, diff --git a/mods/MAPGEN/tsm_railcorridors/mod.conf b/mods/MAPGEN/tsm_railcorridors/mod.conf index d1a9ada4a..56fe9bb94 100644 --- a/mods/MAPGEN/tsm_railcorridors/mod.conf +++ b/mods/MAPGEN/tsm_railcorridors/mod.conf @@ -1,4 +1,5 @@ name = tsm_railcorridors +title = Rail Corridors author = UgnilJoZ description = Adds simple underground mines with railways and occasional treasure chests. depends = mcl_init, mcl_worlds, mcl_core, mcl_mapgen_core, mcl_loot, mcl_tnt, mcl_farming, mcl_mobspawners, mcl_minecarts, mcl_structures diff --git a/mods/MAPGEN/tsm_railcorridors/settingtypes.txt b/mods/MAPGEN/tsm_railcorridors/settingtypes.txt index a28962907..c4a83452c 100644 --- a/mods/MAPGEN/tsm_railcorridors/settingtypes.txt +++ b/mods/MAPGEN/tsm_railcorridors/settingtypes.txt @@ -25,14 +25,14 @@ tsm_railcorridors_probability_chest (Chest probability) float 0.05 0.0 1.0 #of finding a cart in rail corridors with high rail damage will be lower. #NOTE: Due to a bug in Minetest #carts often fail to spawn even if they should. -tsm_railcorridors_probability_cart (Cart probability) float 0.0 0.0 1.0 +tsm_railcorridors_probability_cart (Cart probability) float 0.05 0.0 1.0 #If enabled, cobwebs may be placed in some corridors. #Currently, cobwebs are only supported with the Mobs Redo mod. tsm_railcorridors_place_cobwebs (Cobwebs) bool true #Probability (0.0 to 1.0) for a rail corridor system to have damaged/incomplete railways -tsm_railcorridors_probability_damage (Damaged railway probability) float 1.0 0.0 1.0 +tsm_railcorridors_probability_damage (Damaged railway probability) float 0.55 0.0 1.0 #If enabled, rail corridors continue to generate through obstacles such #as other rail corridors (without destroying them, mostly). This may lead From 64c04a2f0abd0491a49b6f681d5c70bd4818b667 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 27 Aug 2024 05:55:57 -0500 Subject: [PATCH 109/273] Fix #4613 --- mods/ITEMS/mcl_honey/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index a870e7c08..127c788b0 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -19,6 +19,9 @@ function mcl_honey.wax_block(pos, node, player, itemstack) if def and def._mcl_waxed_variant then node.name = def._mcl_waxed_variant else + if def.on_rightclick then + return def.on_rightclick(pos, node, player, itemstack) + end return end From f9cd2500c039abd783f95c4f603a4f9b94b16f0f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 27 Aug 2024 17:39:41 -0500 Subject: [PATCH 110/273] Don't crash trying to right click unknown nodes while holding honeycomb --- mods/ITEMS/mcl_honey/init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 127c788b0..7f39a3c59 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -18,10 +18,9 @@ function mcl_honey.wax_block(pos, node, player, itemstack) if def and def._mcl_waxed_variant then node.name = def._mcl_waxed_variant + elseif def and def.on_rightclick then + return def.on_rightclick(pos, node, player, itemstack) else - if def.on_rightclick then - return def.on_rightclick(pos, node, player, itemstack) - end return end From f10827d0d63402774a36244690a0e9309736fa72 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 28 Aug 2024 18:08:43 -0500 Subject: [PATCH 111/273] Rework code --- mods/ITEMS/mcl_honey/init.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 7f39a3c59..32abbae44 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -15,15 +15,13 @@ function mcl_honey.wax_block(pos, node, player, itemstack) end local def = minetest.registered_nodes[node.name] + if not def then return end - if def and def._mcl_waxed_variant then - node.name = def._mcl_waxed_variant - elseif def and def.on_rightclick then + if def.on_rightclick then return def.on_rightclick(pos, node, player, itemstack) - else - return end + if not def._mcl_waxed_variant then return end node.name = def._mcl_waxed_variant minetest.set_node(pos, node) awards.unlock(player:get_player_name(), "mcl:wax_on") From 3e85736404654e8543df7b2866ce063d4acb19c7 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 31 Aug 2024 06:51:51 -0500 Subject: [PATCH 112/273] Change honeycomb to use same right-click logic recently added to buckets and bottles --- mods/ITEMS/mcl_honey/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 32abbae44..9aa5167f5 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -17,9 +17,9 @@ function mcl_honey.wax_block(pos, node, player, itemstack) local def = minetest.registered_nodes[node.name] if not def then return end - if def.on_rightclick then - return def.on_rightclick(pos, node, player, itemstack) - end + -- Handle right-clicking nodes + local new_stack = mcl_util.call_on_rightclick(itemstack, player, {type = "node", under = pos}) + if new_stack and new_stack ~= itemstack then return end if not def._mcl_waxed_variant then return end node.name = def._mcl_waxed_variant From 0e4b8d9c273ea80c72f8626d0c2777bbb9de6876 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 7 Sep 2023 19:41:17 +0200 Subject: [PATCH 113/273] Fix some cornerstairs missing textures --- mods/ITEMS/mcl_stairs/cornerstair.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_stairs/cornerstair.lua b/mods/ITEMS/mcl_stairs/cornerstair.lua index ae3eb4ea3..8acaac5d8 100644 --- a/mods/ITEMS/mcl_stairs/cornerstair.lua +++ b/mods/ITEMS/mcl_stairs/cornerstair.lua @@ -232,6 +232,8 @@ function mcl_stairs.cornerstair.add(name, stairtiles) outer_tiles = stairtiles[1] inner_tiles = stairtiles[2] end + if inner_tiles == nil then inner_tiles = node_def.tiles end + if outer_tiles == nil then outer_tiles = node_def.tiles end local outer_groups = table.copy(node_def.groups) outer_groups.not_in_creative_inventory = 1 local inner_groups = table.copy(outer_groups) From 562a9d6d98a831e86f57c5e643bd28211b4986c4 Mon Sep 17 00:00:00 2001 From: codiac Date: Fri, 3 Nov 2023 17:48:59 +1000 Subject: [PATCH 114/273] Convert stairs to nodebox --- mods/ITEMS/mcl_stairs/api.lua | 18 +++++++++++++++--- mods/ITEMS/mcl_stairs/cornerstair.lua | 23 +---------------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index 390461c6c..f63d8daa1 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -93,17 +93,29 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript groups.stair = 1 groups.building_block = 1 + local image_table = {} + for i, image in ipairs(images) do + image_table[i] = type(image) == "string" and { name = image } or table.copy(image) + image_table[i].align_style = "world" + end + minetest.register_node(":mcl_stairs:stair_" .. subname, { description = description, _doc_items_longdesc = S("Stairs are useful to reach higher places by walking over them; jumping is not required. Placing stairs in a corner pattern will create corner stairs. Stairs placed on the ceiling or at the upper half of the side of a block will be placed upside down."), - drawtype = "mesh", - mesh = "stairs_stair.obj", - tiles = images, + drawtype = "nodebox", + tiles = image_table, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = groups, sounds = sounds, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, selection_box = { type = "fixed", fixed = { diff --git a/mods/ITEMS/mcl_stairs/cornerstair.lua b/mods/ITEMS/mcl_stairs/cornerstair.lua index 8acaac5d8..03f8aacca 100644 --- a/mods/ITEMS/mcl_stairs/cornerstair.lua +++ b/mods/ITEMS/mcl_stairs/cornerstair.lua @@ -207,28 +207,7 @@ function mcl_stairs.cornerstair.add(name, stairtiles) local node_def = minetest.registered_nodes[name] local outer_tiles local inner_tiles - if stairtiles == "woodlike" then - outer_tiles = table.copy(node_def.tiles) - inner_tiles = table.copy(node_def.tiles) - for i=2,6 do - if outer_tiles[i] == nil then - outer_tiles[i] = outer_tiles[i-1] - end - if inner_tiles[i] == nil then - inner_tiles[i] = inner_tiles[i-1] - end - end - local t = node_def.tiles[1] - outer_tiles[1] = t.."^("..t.."^[transformR90^mcl_stairs_turntexture.png^[makealpha:255,0,255)" - outer_tiles[2] = t.."^("..t.."^mcl_stairs_turntexture.png^[transformR270^[makealpha:255,0,255)" - outer_tiles[3] = t - inner_tiles[1] = t.."^("..t.."^[transformR90^(mcl_stairs_turntexture.png^[transformR180)^[makealpha:255,0,255)" - inner_tiles[2] = t.."^("..t.."^[transformR270^(mcl_stairs_turntexture.png^[transformR90)^[makealpha:255,0,255)" - inner_tiles[3] = t - elseif stairtiles == nil or stairtiles == "default" then - outer_tiles = node_def.tiles - inner_tiles = node_def.tiles - else + if stairtiles ~= nil and stairtiles ~= "default" and stairtiles ~= "woodlike" then outer_tiles = stairtiles[1] inner_tiles = stairtiles[2] end From 444c491e14258d52d7e880dd62b80a0b9136f635 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 31 Aug 2024 21:01:44 +0200 Subject: [PATCH 115/273] Remove mcl_structures:structblocks (#4619) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As spawning happens via gennotify anyway, we can omit placing a structblock right away. This also avoids certain cases of holes in snow cover or water. Plus, the code is simpler. Isolated from the big mapgen overhaul, for the main branch. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4619 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_mapgen_core/init.lua | 6 +-- mods/MAPGEN/mcl_structures/api.lua | 76 ++++++++++------------------ 2 files changed, 28 insertions(+), 54 deletions(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index dfea4f3ce..09bf1d8f5 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -484,18 +484,14 @@ end -- This should be moved to mcl_structures eventually if the dependencies can be sorted out. mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed) local gennotify = minetest.get_mapgen_object("gennotify") - local has_struct = {} local has = false local poshash = minetest.hash_node_position(minp) for _,struct in pairs(mcl_structures.registered_structures) do local pr = PseudoRandom(blockseed + 42) if struct.deco_id then for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do - local realpos = vector.offset(pos,0,1,0) - minetest.remove_node(realpos) - minetest.fix_light(vector.offset(pos,-1,-1,-1),vector.offset(pos,1,3,1)) if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then - mcl_structures.place_structure(realpos,struct,pr,blockseed) + mcl_structures.place_structure(vector.offset(pos,0,1,0),struct,pr,blockseed) has=true end end diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 02f96a1b3..4f3bed207 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -325,43 +325,33 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot) end end -function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly - if mcl_structures.is_disabled(name) then return end - local structblock = "mcl_structures:structblock_"..name - local flags = "place_center_x, place_center_z, force_placement" - local y_offset = 0 - local sbgroups = { structblock = 1, not_in_creative_inventory=1 } - if def.flags then flags = def.flags end - def.name = name - if nospawn then - sbgroups.structblock = nil - sbgroups.structblock_lbm = 1 - else - if def.place_on then - minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered - def.deco = minetest.register_decoration({ - name = "mcl_structures:deco_"..name, - decoration = structblock, - deco_type = "simple", - place_on = def.place_on, - spawn_by = def.spawn_by, - num_spawn_by = def.num_spawn_by, - sidelen = 80, - fill_ratio = def.fill_ratio, - noise_params = def.noise_params, - flags = flags, - biomes = def.biomes, - y_max = def.y_max, - y_min = def.y_min - }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,}) - def.structblock = structblock - def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) - minetest.set_gen_notify({decoration=true}, { def.deco_id }) - --catching of gennotify happens in mcl_mapgen_core +local EMPTY_SCHEMATIC = { size = {x = 0, y = 0, z = 0}, data = { } } - end) - end +function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will not be placed by mapgen decoration mechanism + if mcl_structures.is_disabled(name) then return end + flags = def.flags or "place_center_x, place_center_z, force_placement" + def.name = name + if not nospawn and def.place_on then + minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered + def.deco = minetest.register_decoration({ + name = "mcl_structures:deco_"..name, + deco_type = "schematic", + schematic = EMPTY_SCHEMATIC, + place_on = def.place_on, + spawn_by = def.spawn_by, + num_spawn_by = def.num_spawn_by, + sidelen = 80, + fill_ratio = def.fill_ratio, + noise_params = def.noise_params, + flags = flags, + biomes = def.biomes, + y_max = def.y_max, + y_min = def.y_min + }) + def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) + minetest.set_gen_notify({decoration=true}, { def.deco_id }) + --catching of gennotify happens in mcl_mapgen_core + end) end mcl_structures.registered_structures[name] = def end @@ -395,16 +385,4 @@ function mcl_structures.register_structure_spawn(def) }) end ---lbm for secondary structures (structblock included in base structure) -minetest.register_lbm({ - name = "mcl_structures:struct_lbm", - run_at_every_load = true, - nodenames = {"group:structblock_lbm"}, - action = function(pos, node) - minetest.remove_node(pos) - local name = node.name:gsub("mcl_structures:structblock_","") - local def = mcl_structures.registered_structures[name] - if not def then return end - mcl_structures.place_structure(pos) - end -}) + From e9bf509c85e2d4d612741d566910f06e4a397bf8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 31 Aug 2024 23:41:06 +0200 Subject: [PATCH 116/273] Add crash guards against unknown items (#4623) This adds defensive checks to guard against crashing when digging with an unknown item in hand. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4623 Reviewed-by: the-real-herowl Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/HELP/mcl_tt/snippets_base.lua | 6 ++++++ mods/HELP/mcl_tt/snippets_mcl.lua | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/mods/HELP/mcl_tt/snippets_base.lua b/mods/HELP/mcl_tt/snippets_base.lua index f20f3dfe2..0468c50ac 100644 --- a/mods/HELP/mcl_tt/snippets_base.lua +++ b/mods/HELP/mcl_tt/snippets_base.lua @@ -37,6 +37,8 @@ end -- Digging capabilities of tool tt.register_snippet(function(itemstring, toolcaps, itemstack) local def = minetest.registered_items[itemstring] + if not def then return end + if not toolcaps then return end @@ -165,6 +167,8 @@ end)]] -- Food tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local desc if def._tt_food then desc = S("Food item") @@ -179,6 +183,8 @@ end) -- Node info tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local desc = "" -- Health-related node facts diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 639422295..a964b96a3 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -64,6 +64,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + local s = "" if def.groups.eatable and def.groups.eatable > 0 then s = s .. S("Hunger points: +@1", def.groups.eatable) @@ -89,6 +91,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + if def.groups.place_flowerlike == 1 then return S("Grows on grass blocks or dirt") elseif def.groups.place_flowerlike == 2 then @@ -98,6 +102,8 @@ end) tt.register_snippet(function(itemstring) local def = minetest.registered_items[itemstring] + if not def then return end + if def.groups.flammable then return S("Flammable") end @@ -127,6 +133,8 @@ end) tt.register_snippet(function(itemstring, _, itemstack) if not itemstack then return end local def = itemstack:get_definition() + if not def then return end + if def.groups._mcl_potion ~= 1 then return end local s = "" From 593a095a5f9d649ecabfd1c14a49ea214b46cc11 Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 5 Sep 2024 09:31:03 +0200 Subject: [PATCH 117/273] Fix "generateImagePart" warning (#4624) Placing the texture at -16 with width 16 means it is not used. At most -14 may be used (0 indexed, I believe) if you want to retain 2x2 pixels. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4624 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_dripping/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_dripping/init.lua b/mods/ENTITIES/mcl_dripping/init.lua index 5a96e65c4..6aa229a8c 100644 --- a/mods/ENTITIES/mcl_dripping/init.lua +++ b/mods/ENTITIES/mcl_dripping/init.lua @@ -29,7 +29,7 @@ local function make_drop(pos, liquid, sound, interval, texture) pt.expirationtime = t pt.texture = "[combine:2x2:" .. - -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=" .. texture + math.random(-14, 0) .. "," .. math.random(-14, 0) .. "=" .. texture minetest.add_particle(pt) From ebee85db7e176392e8dcd67f7db8958aec0d2926 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 7 Sep 2024 14:58:12 +0200 Subject: [PATCH 118/273] Fix incorrect usages of math.random (#4621) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit random() does not support float arguments Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4621 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/movement.lua | 12 ++++++------ mods/ENTITIES/mobs_mc/blaze.lua | 12 ++++++------ mods/ENTITIES/mobs_mc/cod.lua | 2 +- mods/ENTITIES/mobs_mc/dolphin.lua | 6 +++--- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 2 +- mods/ENVIRONMENT/lightning/init.lua | 2 +- mods/ITEMS/mcl_cherry_blossom/growth.lua | 12 ++++++------ mods/ITEMS/mcl_mobspawners/init.lua | 3 +-- mods/PLAYER/mcl_playerplus/init.lua | 2 +- 9 files changed, 26 insertions(+), 27 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/movement.lua b/mods/ENTITIES/mcl_mobs/movement.lua index ff9a38f56..dc4dcd272 100644 --- a/mods/ENTITIES/mcl_mobs/movement.lua +++ b/mods/ENTITIES/mcl_mobs/movement.lua @@ -362,7 +362,7 @@ function mob_class:env_danger_movement_checks(player_in_active_range) self.state = "stand" self:set_animation( "stand") end - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) return end @@ -788,9 +788,9 @@ function mob_class:flop() if self.object:get_velocity().y < 0.1 then self:mob_sound("flop") self.object:set_velocity({ - x = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), + x = (math.random()-0.5) * 2 * FLOP_HOR_SPEED, y = FLOP_HEIGHT, - z = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED), + z = (math.random()-0.5) * 2 * FLOP_HOR_SPEED, }) end end @@ -920,7 +920,7 @@ function mob_class:do_states_walk() -- Randomly turn if math.random(1, 100) <= 30 then - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) end end @@ -929,7 +929,7 @@ function mob_class:do_states_walk() -- otherwise randomly turn elseif math.random(1, 100) <= 30 then - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 yaw = self:set_yaw( yaw, 8) end @@ -989,7 +989,7 @@ function mob_class:do_states_stand(player_in_active_range) if lp.x > s.x then yaw = yaw +math.pi end else - yaw = yaw + math.random(-0.5, 0.5) + yaw = yaw + math.random() - 0.5 end yaw = self:set_yaw( yaw, 8) diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index bbc47df94..f5dd40470 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -95,8 +95,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { end local pos = self.object:get_pos() minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, @@ -110,8 +110,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { }, }) minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, @@ -125,8 +125,8 @@ mcl_mobs.register_mob("mobs_mc:blaze", { }, }) minetest.add_particle({ - pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2}, - velocity = {x=0, y=math.random(1,1), z=0}, + pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()}, + velocity = {x=0, y=1, z=0}, expirationtime = math.random(), size = math.random(1, 4), collisiondetection = true, diff --git a/mods/ENTITIES/mobs_mc/cod.lua b/mods/ENTITIES/mobs_mc/cod.lua index a2aa2eadf..fba769694 100644 --- a/mods/ENTITIES/mobs_mc/cod.lua +++ b/mods/ENTITIES/mobs_mc/cod.lua @@ -84,7 +84,7 @@ local cod = { self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) if minetest.get_item_group(self.standing_in, "water") ~= 0 then if self.object:get_velocity().y < 5 then - self.object:add_velocity({ x = 0 , y = math.random(-.007, .007), z = 0 }) + self.object:add_velocity({ x = 0 , y = math.random()*.014-.007, z = 0 }) end end --]] diff --git a/mods/ENTITIES/mobs_mc/dolphin.lua b/mods/ENTITIES/mobs_mc/dolphin.lua index 0db7647b9..45753ff7f 100644 --- a/mods/ENTITIES/mobs_mc/dolphin.lua +++ b/mods/ENTITIES/mobs_mc/dolphin.lua @@ -81,16 +81,16 @@ local dolphin = { reach = 2, damage = 2.5, attack_type = "dogfight", + --[[ this is supposed to make them jump out the water but doesn't appear to work very well do_custom = function(self,dtime) - --[[ this is supposed to make them jump out the water but doesn't appear to work very well self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) if minetest.get_item_group(self.standing_in, "water") ~= 0 then if self.object:get_velocity().y < 5 then - self.object:add_velocity({ x = 0 , y = math.random(-.007, .007), z = 0 }) + self.object:add_velocity({ x = 0 , y = math.random()*.014-.007, z = 0 }) end end - --]] end, + --]] } mcl_mobs.register_mob("mobs_mc:dolphin", dolphin) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index d56b6e2a2..8a4c8919f 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -122,7 +122,7 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) end local mndef = minetest.registered_nodes[minetest.get_node(pos).name] local mother_stuck = mndef and mndef.walkable - local angle = math.random(0, math.pi*2) + local angle = math.random() * math.pi * 2 local children = {} local spawn_count = math.random(2, 4) for i = 1, spawn_count do diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 41d6f458c..079c9cb38 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -177,7 +177,7 @@ function lightning.strike_func(pos, pos2, objects) add_entity(pos2, "mobs_mc:skeleton_horse") local angle, posadd - angle = math.random(0, math.pi*2) + angle = math.random() * math.pi * 2 for i=1,3 do posadd = { x=math.cos(angle),y=0,z=math.sin(angle) } posadd = vector.normalize(posadd) diff --git a/mods/ITEMS/mcl_cherry_blossom/growth.lua b/mods/ITEMS/mcl_cherry_blossom/growth.lua index bca926539..c7bbf3044 100644 --- a/mods/ITEMS/mcl_cherry_blossom/growth.lua +++ b/mods/ITEMS/mcl_cherry_blossom/growth.lua @@ -30,7 +30,7 @@ minetest.register_abm({ local cherry_particle = { velocity = vector.zero(), acceleration = vector.new(0,-1,0), - size = math.random(1.3,2.5), + size = 1.3 + math.random() * 1.2, texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png", animation = { type = "vertical_frames", @@ -45,8 +45,8 @@ local cherry_particle = { local wind_direction -- vector local time_changed -- 0 - afternoon; 1 - evening; 2 - morning local function change_wind_direction() - local east_west = math.random(-0.5,0.5) - local north_south = math.random(-0.5,0.5) + local east_west = math.random() - 0.5 + local north_south = math.random() - 0.5 wind_direction = vector.new(east_west, 0, north_south) end change_wind_direction() @@ -57,10 +57,10 @@ minetest.register_abm({ interval = 5, chance = 10, action = function(pos, node) - minetest.after(math.random(0.1,1.5),function() + minetest.after(0.1 + math.random() * 1.4,function() local pt = table.copy(cherry_particle) - pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5)) - pt.expirationtime = math.random(1.2,4.5) + pt.pos = vector.offset(pos,math.random()-0.5,-0.51,math.random()-0.5) + pt.expirationtime = 1.2 + math.random() * 3.3 pt.texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png" local time = minetest.get_timeofday() if time_changed ~= 0 and time > 0.6 and time < 0.605 then diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 83c03804e..8b2c73d8c 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -259,8 +259,7 @@ local function spawn_mobs(pos, elapsed) end -- Spawn attempt done. Next spawn attempt much later - timer:start(math.random(10, 39.95)) - + timer:start(math.random() * 29.95 + 10) end -- The mob spawner node. diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 709d1d0fb..e090e6df7 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -280,7 +280,7 @@ minetest.register_globalstep(function(dtime) pos = fly_pos, velocity = vector.zero(), acceleration = vector.zero(), - expirationtime = math.random(0.3, 0.5), + expirationtime = 0.3 + math.random() * 0.2, size = math.random(1, 2), collisiondetection = false, vertical = false, From 5d0d93db0a28afc2fdb2ae876984cdefd124672c Mon Sep 17 00:00:00 2001 From: William Goodspeed Date: Sun, 18 Aug 2024 16:35:13 +0000 Subject: [PATCH 119/273] Alias creeper heads to stalker heads This solves the issue of creeper heads in the old version not getting upgraded with newer VL reported in #4545. --- mods/ITEMS/mcl_heads/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 5409f21c4..1407bac6c 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -272,6 +272,12 @@ mcl_heads.register_head{ range_factor = 0.5, } +-- Alias old creeper heads +minetest.register_alias("mcl_heads:creeper_wall", "mcl_heads:stalker_wall") +for i, d in pairs(mcl_heads.FLOOR_DEGREES) do + minetest.register_alias("mcl_heads:creeper"..d, "mcl_heads:stalker"..d) +end + -- Original Minecraft name: “Head” mcl_heads.register_head{ name = "steve", From 2f25bc5277427dcbb48d4c01dca37d9c2e1669d5 Mon Sep 17 00:00:00 2001 From: William Goodspeed Date: Wed, 21 Aug 2024 22:03:39 +0000 Subject: [PATCH 120/273] Refactor head's `param2' to degrotate --- mods/ITEMS/mcl_heads/init.lua | 129 ++++++++---------- .../mcl_heads/models/mcl_heads_floor.obj | 41 ++++++ .../mcl_heads/models/mcl_heads_floor22_5.obj | 42 ------ .../mcl_heads/models/mcl_heads_floor45.obj | 42 ------ .../mcl_heads/models/mcl_heads_floor67_5.obj | 42 ------ 5 files changed, 96 insertions(+), 200 deletions(-) create mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj delete mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj delete mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj delete mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 1407bac6c..ad690b60d 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -21,8 +21,13 @@ mcl_heads.FLOOR_BOX = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, } --- node definition template for floor mod heads mcl_heads.deftemplate_floor = { - drawtype = "nodebox", - node_box = { + drawtype = "mesh", + mesh = "mcl_heads_floor.obj", + selection_box = { + type = "fixed", + fixed = mcl_heads.FLOOR_BOX, + }, + collision_box = { type = "fixed", fixed = mcl_heads.FLOOR_BOX, }, @@ -38,7 +43,7 @@ mcl_heads.deftemplate_floor = { }, use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "degrotate", stack_max = 64, sunlight_propagates = true, sounds = mcl_sounds.node_sound_defaults{ @@ -53,39 +58,8 @@ mcl_heads.deftemplate_floor = { on_secondary_use = equip_armor, } -mcl_heads.deftemplate_floor_angled = { - drawtype = "mesh", - selection_box = { - type = "fixed", - fixed = mcl_heads.FLOOR_BOX, - }, - collision_box = { - type = "fixed", - fixed = mcl_heads.FLOOR_BOX, - }, - groups = { - handy = 1, - head = 1, - deco_block = 1, - dig_by_piston = 1, - not_in_creative_inventory = 1, - }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - paramtype = "light", - paramtype2 = "facedir", - stack_max = 64, - sunlight_propagates = true, - sounds = mcl_sounds.node_sound_defaults{ - footstep = {name="default_hard_footstep", gain=0.3}, - }, - is_ground_content = false, - - _doc_items_create_entry = false, - _mcl_blast_resistance = 1, - _mcl_hardness = 1, -} - function mcl_heads.deftemplate_floor.on_rotate(pos, node, user, mode, new_param2) + if not (user and user:is_player()) then return end if mode == screwdriver.ROTATE_AXIS then node.name = node.name .. "_wall" node.param2 = minetest.dir_to_wallmounted(minetest.facedir_to_dir(node.param2)) @@ -125,19 +99,9 @@ function mcl_heads.deftemplate_floor.on_place(itemstack, placer, pointed_thing) -- place floor head node (floor and ceiling) else - local fdir = minetest.dir_to_facedir(dir) - -- determine the head node rotation based on player's yaw (in cw direction from North/Z+) - local yaw = placer:get_look_horizontal() - yaw = wdir == 1 and math.pi*2 - yaw or yaw - - local rotation_level = math.min(math.max(math.round((yaw / (math.pi*2)) * 16), 0), 15) - placestack:set_name(itemstring ..mcl_heads.FLOOR_DEGREES[rotation_level % 4]) - - -- determine the head node face direction based on rotation level - fdir = math.floor(rotation_level / 4) + (wdir == 1 and 0 or 20) - - itemstack = minetest.item_place(placestack, placer, pointed_thing, fdir) + local rotate_level = math.round(placer:get_look_horizontal() * 8/math.pi) + itemstack = minetest.item_place(placestack, placer, pointed_thing, rotate_level*15) end -- restore item from angled and wall head nodes @@ -179,6 +143,7 @@ mcl_heads.deftemplate_wall = { } function mcl_heads.deftemplate_wall.on_rotate(pos, node, user, mode, new_param2) + if not (user and user:is_player()) then return end if mode == screwdriver.ROTATE_AXIS then node.name = string.sub(node.name, 1, string.len(node.name)-5) node.param2 = minetest.dir_to_facedir(minetest.wallmounted_to_dir(node.param2)) @@ -207,33 +172,13 @@ function mcl_heads.register_head(head_def) description = head_def.description, _doc_items_longdesc = head_def.longdesc, - -- The head textures are based off the textures of an actual mob. - tiles = { - -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. - -- This is required for skeleton skull and wither skeleton skull. - -- Note: -x coords go right per-pixel, -y coords go down per-pixel - "[combine:16x16:-36,4=" ..head_def.texture, -- top - "([combine:16x16:-36,4=" ..head_def.texture..")^([combine:16x16:-44,4="..head_def.texture..")", -- bottom - "[combine:16x16:-28,0=" ..head_def.texture, -- left - "[combine:16x16:-44,0=" ..head_def.texture, -- right - "[combine:16x16:-52,0=" ..head_def.texture, -- back - "[combine:16x16:-36,0=" ..head_def.texture, -- front - }, + tiles = { head_def.texture }, _mcl_armor_mob_range_mob = head_def.range_mob, _mcl_armor_mob_range_factor = head_def.range_factor, _mcl_armor_texture = head_def.texture })) - -- register the angled floor head nodes - for i, d in ipairs(mcl_heads.FLOOR_DEGREES) do - minetest.register_node(name ..d, table.update(table.copy(mcl_heads.deftemplate_floor_angled), { - mesh = "mcl_heads_floor" ..d ..".obj", - tiles = { head_def.texture }, - drop = name, - })) - end - -- register the wall head node minetest.register_node(name .."_wall", table.update(table.copy(mcl_heads.deftemplate_wall), { -- The head textures are based off the textures of an actual mob. @@ -272,12 +217,6 @@ mcl_heads.register_head{ range_factor = 0.5, } --- Alias old creeper heads -minetest.register_alias("mcl_heads:creeper_wall", "mcl_heads:stalker_wall") -for i, d in pairs(mcl_heads.FLOOR_DEGREES) do - minetest.register_alias("mcl_heads:creeper"..d, "mcl_heads:stalker"..d) -end - -- Original Minecraft name: “Head” mcl_heads.register_head{ name = "steve", @@ -301,3 +240,45 @@ mcl_heads.register_head{ description = S("Wither Skeleton Skull"), longdesc = S("A wither skeleton skull is a small decorative block which resembles the skull of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection."), } + +-- Alias old creeper heads +minetest.register_alias("mcl_heads:creeper_wall", "mcl_heads:stalker_wall") +minetest.register_alias("mcl_heads:creeper", "mcl_heads:stalker") + +-- Register LBM updates for old floor heads +local old_heads_all = {"mcl_heads:zombie", "mcl_heads:creeper", "mcl_heads:stalker", "mcl_heads:steve", "mcl_heads:skeleton", "mcl_heads:wither_skeleton"} +local old_heads_angled = {} +for i=1,#old_heads_all do + for j=1,#mcl_heads.FLOOR_DEGREES do + old_heads_angled[#old_heads_angled+1] = old_heads_all[i]..mcl_heads.FLOOR_DEGREES[j] + end +end + +local facedir_to_degrotate = {0, 180, 120, 60} +minetest.register_lbm({ + name = "mcl_heads:heads_update_angled", + nodenames = old_heads_all, + action = function(pos, node) + local degrotate = 0 + + if node.name:sub(-4) == "22_5" then + node.name = node.name:sub(1, #node.name-4) + degrotate = ((4 - node.param2) * 90 - 22.5) / 1.5 + elseif node.name:sub(-4) == "67_5" then + node.name = node.name:sub(1, #node.name-4) + degrotate = ((4 - node.param2) * 90 - 67.5) / 1.5 + elseif node.name:sub(-2) == "45" then + node.name = node.name:sub(1, #node.name-2) + degrotate = ((4 - node.param2) * 90 - 45) / 1.5 + else + degrotate = facedir_to_degrotate[node.param2+1] + end + + if not degrotate then + return + end + + node.param2 = degrotate + minetest.set_node(pos, node) + end, +}) diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj new file mode 100644 index 000000000..53bb522d4 --- /dev/null +++ b/mods/ITEMS/mcl_heads/models/mcl_heads_floor.obj @@ -0,0 +1,41 @@ +# Blender 4.2.1 LTS +# www.blender.org +mtllib mcl_head.mtl +g Cube.002_Cube.002 +v -0.250000 -0.500000 0.250000 +v -0.250000 0.000000 0.250000 +v -0.250000 -0.500000 -0.250000 +v -0.250000 -0.000000 -0.250000 +v 0.250000 -0.500000 0.250000 +v 0.250000 0.000000 0.250000 +v 0.250000 -0.500000 -0.250000 +v 0.250000 0.000000 -0.250000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vt 0.875000 0.500000 +vt 0.875000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +s 0 +g off +g Cube.002_Material.002 +usemtl Material.002 +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/4/2 4/3/2 8/5/2 7/6/2 +f 7/6/3 8/5/3 6/7/3 5/8/3 +f 5/9/4 6/10/4 2/2/4 1/1/4 +f 3/2/5 7/11/5 5/12/5 1/3/5 +f 8/5/6 4/3/6 2/12/6 6/13/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj deleted file mode 100644 index 8e48015fc..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor22_5.mtl -o Cube.001 -v -0.326641 -0.500000 0.135299 -v -0.326641 0.000000 0.135299 -v -0.135299 -0.500000 -0.326641 -v -0.135299 0.000000 -0.326641 -v 0.135299 -0.500000 0.326641 -v 0.135299 0.000000 0.326641 -v 0.326641 -0.500000 -0.135299 -v 0.326641 0.000000 -0.135299 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.9239 0.0000 -0.3827 -vn 0.3827 0.0000 -0.9239 -vn 0.9239 0.0000 0.3827 -vn -0.3827 0.0000 0.9239 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.001 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj deleted file mode 100644 index 6300d4484..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor45.mtl -o Cube.002 -v -0.353553 -0.500000 0.000000 -v -0.353553 0.000000 0.000000 -v 0.000000 -0.500000 -0.353553 -v 0.000000 0.000000 -0.353553 -v 0.000000 -0.500000 0.353553 -v 0.000000 0.000000 0.353553 -v 0.353553 -0.500000 0.000000 -v 0.353553 0.000000 0.000000 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.7071 0.0000 -0.7071 -vn 0.7071 0.0000 -0.7071 -vn 0.7071 0.0000 0.7071 -vn -0.7071 0.0000 0.7071 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.002 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj deleted file mode 100644 index 0fe5567e3..000000000 --- a/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj +++ /dev/null @@ -1,42 +0,0 @@ -# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' -# www.blender.org -mtllib mcl_heads_floor67_5.mtl -o Cube.003 -v -0.326641 -0.500000 -0.135299 -v -0.326641 0.000000 -0.135299 -v 0.135299 -0.500000 -0.326641 -v 0.135299 0.000000 -0.326641 -v -0.135299 -0.500000 0.326641 -v -0.135299 0.000000 0.326641 -v 0.326641 -0.500000 0.135299 -v 0.326641 0.000000 0.135299 -vt 0.875000 0.500000 -vt 0.875000 0.750000 -vt 0.750000 0.750000 -vt 0.750000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.500000 0.750000 -vt 0.500000 0.500000 -vt 1.000000 0.500000 -vt 1.000000 0.750000 -vt 0.875000 0.750000 -vt 0.875000 1.000000 -vt 0.750000 1.000000 -vt 0.750000 0.750000 -vt 0.750000 1.000000 -vt 0.625000 1.000000 -vn -0.3827 0.0000 -0.9239 -vn 0.9239 0.0000 -0.3827 -vn 0.3827 0.0000 0.9239 -vn -0.9239 0.0000 0.3827 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl Material.003 -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 -f 3/4/2 4/3/2 8/5/2 7/6/2 -f 7/6/3 8/5/3 6/7/3 5/8/3 -f 5/9/4 6/10/4 2/2/4 1/1/4 -f 3/11/5 7/12/5 5/13/5 1/14/5 -f 8/5/6 4/3/6 2/15/6 6/16/6 From fb4a6b0e7b5d49d23f3d9fe27435f3e8816910d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Sun, 8 Sep 2024 04:26:51 +0200 Subject: [PATCH 121/273] Fix old angled heads not being converted (#4627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4627 Reviewed-by: the-real-herowl Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ITEMS/mcl_heads/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index ad690b60d..373802cfa 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -253,6 +253,10 @@ for i=1,#old_heads_all do old_heads_angled[#old_heads_angled+1] = old_heads_all[i]..mcl_heads.FLOOR_DEGREES[j] end end +-- add the angled heads to old_heads_all +for i=1,#old_heads_angled do + old_heads_all[#old_heads_all+1] = old_heads_angled[i] +end local facedir_to_degrotate = {0, 180, 120, 60} minetest.register_lbm({ From d85febdb1539af890446c9310b0fdcc259ed9995 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 8 Sep 2024 05:21:42 +0200 Subject: [PATCH 122/273] Cactus damage cleanup, drop redundant conditions (#4625) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4625 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/physics.lua | 132 +++++++++++----------------- mods/PLAYER/mcl_playerplus/init.lua | 22 ++--- 2 files changed, 60 insertions(+), 94 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 73aefb509..5c1d34684 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -692,14 +692,10 @@ function mob_class:do_env_damage() local nodef3 = minetest.registered_nodes[self.standing_under] -- rain - if self.rain_damage > 0 then - if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then - self.health = self.health - self.rain_damage - - if self:check_for_death("rain", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + if self.rain_damage > 0 and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then + self.health = self.health - self.rain_damage + if self:check_for_death("rain", {type = "environment", pos = pos, node = self.standing_in}) then + return true end end @@ -707,14 +703,10 @@ function mob_class:do_env_damage() -- water damage if self.water_damage > 0 and nodef.groups.water then - if self.water_damage ~= 0 then - self.health = self.health - self.water_damage - mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png", nil, nil, 1, nil) - - if self:check_for_death("water", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.water_damage + mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png", nil, nil, 1, nil) + if self:check_for_death("water", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif self.lava_damage > 0 and (nodef.groups.lava) then -- lava damage @@ -730,91 +722,69 @@ function mob_class:do_env_damage() end elseif self.fire_damage > 0 and (nodef2.groups.fire) then -- magma damage - if self.fire_damage ~= 0 then - self.health = self.health - self.fire_damage - - if self:check_for_death("fire", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.fire_damage + if self:check_for_death("fire", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif self.fire_damage > 0 and (nodef.groups.fire) then -- fire damage - if self.fire_damage ~= 0 then - self.health = self.health - self.fire_damage - mcl_mobs.effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) - mcl_burning.set_on_fire(self.object, 5) - - if self:check_for_death("fire", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end + self.health = self.health - self.fire_damage + mcl_mobs.effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) + mcl_burning.set_on_fire(self.object, 5) + if self:check_for_death("fire", {type = "environment", pos = pos, node = self.standing_in}) then + return true end elseif nodef.damage_per_second ~= 0 and not nodef.groups.lava and not nodef.groups.fire then -- damage_per_second node check self.health = self.health - nodef.damage_per_second mcl_mobs.effect(pos, 5, "mcl_particles_smoke.png") - - if self:check_for_death("dps", {type = "environment", - pos = pos, node = self.standing_in}) then + if self:check_for_death("dps", {type = "environment", pos = pos, node = self.standing_in}) then return true end end -- Cactus damage - local near = minetest.find_node_near(pos, 1, "mcl_core:cactus", true) - if not near and near ~= nil then - near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus", true) - end - if near then - -- is mob touching the cactus? - local dist = vector.distance(pos, near) - local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near) - local large_mob = false - local medium_mob = false - if self.name == "mobs_mc:ender_dragon" or - self.name == "mobs_mc:ghast" or - self.name == "mobs_mc:guardian_elder" or - self.name == "mobs_mc:slime_big" or - self.name == "mobs_mc:magma_cube_big" or - self.name == "mobs_mc:wither" then - - large_mob = true - elseif self.name == "mobs_mc:hoglin" or - self.name == "mobs_mc:zoglin" or - self.name == "mobs_mc:horse" or - self.name == "mobs_mc:skeleton_horse" or - self.name == "mobs_mc:zombie_horse" or - self.name == "mobs_mc:donkey" or - self.name == "mobs_mc:mule" or - self.name == "mobs_mc:iron_golem" or - self.name == "mobs_mc:polar_bear" or - self.name == "mobs_mc:spider" or - self.name == "mobs_mc:cave_spider" or - self.name == "mobs_mc:strider" then - - medium_mob = true + if self.standing_on == "mcl_core:cactus" or self.standing_in == "mcl_core:cactus" or self.standing_under == "mcl_core:cactus" then + self:damage_mob("cactus", 2) + if self:check_for_death("cactus", {type = "environment", pos = pos, node = self.standing_in}) then + return true end - if (not large_mob and not medium_mob and (dist < 1.03 or dist_feet < 1.6)) or (medium_mob and (dist < 1.165 or dist_feet < 1.73)) or (large_mob and (dist < 1.25 or dist_feet < 1.9)) then - if self.health ~= 0 then + else + local near = minetest.find_node_near(pos, 1, "mcl_core:cactus") + if near then + -- is mob touching the cactus? + local dist = vector.distance(pos, near) + local threshold = 1.04 -- small mobs + -- medium mobs + if self.name == "mobs_mc:spider" or + self.name == "mobs_mc:iron_golem" or + self.name == "mobs_mc:horse" or + self.name == "mobs_mc:donkey" or + self.name == "mobs_mc:mule" or + self.name == "mobs_mc:polar_bear" or + self.name == "mobs_mc:cave_spider" or + self.name == "mobs_mc:skeleton_horse" or + self.name == "mobs_mc:zombie_horse" or + self.name == "mobs_mc:strider" or + self.name == "mobs_mc:hoglin" or + self.name == "mobs_mc:zoglin" then + threshold = 1.165 + elseif self.name == "mobs_mc:slime_big" or + self.name == "mobs_mc:magma_cube_big" or + self.name == "mobs_mc:ghast" or + self.name == "mobs_mc:guardian_elder" or + self.name == "mobs_mc:wither" or + self.name == "mobs_mc:ender_dragon" then + threshold = 1.25 + end + if dist < threshold then self:damage_mob("cactus", 2) - - if self:check_for_death("cactus", {type = "environment", - pos = pos, node = self.standing_in}) then + if self:check_for_death("cactus", {type = "environment", pos = pos, node = self.standing_in}) then return true end end end end - -- is mob standing on the cactus? - if self.standing_on == "mcl_core:cactus" or self.standing_in == "mcl_core:cactus" or self.standing_under == "mcl_core:cactus" then - self:damage_mob("cactus", 2) - - if self:check_for_death("cactus", {type = "environment", - pos = pos, node = self.standing_in}) then - return true - end - end -- Drowning damage if self.breath_max ~= -1 then diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e090e6df7..e40411c10 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -560,22 +560,18 @@ minetest.register_globalstep(function(dtime) and (node_head ~= "ignore") -- Check privilege, too and (not check_player_privs(name, {noclip = true})) then - if player:get_hp() > 0 then - mcl_util.deal_damage(player, 1, {type = "in_wall"}) - end + mcl_util.deal_damage(player, 1, {type = "in_wall"}) end -- Am I near a cactus? - local near = find_node_near(pos, 1, "mcl_core:cactus") - if not near then - near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus") - end - if near then - -- Am I touching the cactus? If so, it hurts - local dist = vector.distance(pos, near) - local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near) - if dist < 1.1 or dist_feet < 1.1 then - if player:get_hp() > 0 then + if node_stand == "mcl_core:cactus" or node_feet == "mcl_core:cactus" or node_head == "mcl_core:cactus" then + mcl_util.deal_damage(player, 1, {type = "cactus"}) + else + local near = find_node_near(pos, 1, "mcl_core:cactus") + if near then + -- Am I touching the cactus? If so, it hurts + local dist = vector.distance(pos, near) + if dist < 1.1 then mcl_util.deal_damage(player, 1, {type = "cactus"}) end end From 38822aba0a55ccbe6dc6f583f39630c47ebd05e4 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 8 Sep 2024 14:01:05 +0200 Subject: [PATCH 123/273] Piglin brutes are not immune to fire and lava (#4378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you again WillConker Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4378 Reviewed-by: Mikita Wiśniewski Co-authored-by: JoseDouglas26 Co-committed-by: JoseDouglas26 --- mods/ENTITIES/mobs_mc/piglin.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/piglin.lua b/mods/ENTITIES/mobs_mc/piglin.lua index e81782b1c..8062e2da6 100644 --- a/mods/ENTITIES/mobs_mc/piglin.lua +++ b/mods/ENTITIES/mobs_mc/piglin.lua @@ -360,7 +360,7 @@ piglin_brute.xp_min = 20 piglin_brute.xp_max = 20 piglin_brute.hp_min = 50 piglin_brute.hp_max = 50 -piglin_brute.fire_resistant = 1 +piglin_brute.fire_resistant = false piglin_brute.do_custom = function() return end @@ -371,8 +371,8 @@ piglin_brute.on_rightclick = function() return end piglin_brute.attacks_monsters = true -piglin_brute.lava_damage = 0 -piglin_brute.fire_damage = 0 +piglin_brute.lava_damage = 4 +piglin_brute.fire_damage = 2 piglin_brute.attack_animals = true piglin_brute.mesh = "extra_mobs_sword_piglin.b3d" piglin_brute.textures = {"extra_mobs_piglin_brute.png", "default_tool_goldaxe.png", "extra_mobs_trans.png"} From dd4898b31923d5c01a1a68348640420b001c5cfc Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 9 Sep 2024 13:25:30 +0200 Subject: [PATCH 124/273] Fix surface pools with deep holes (#4571) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes, pools would spawn deep underground and then produce deep holes. I noticed that such pools would be at +48, at the block boundary. IMHO this may be an error in minetest surface detection. Nevertheless, here is a workaround: require air above pool spawns. Also clean up the pool code Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4571 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_terrain_features/init.lua | 46 +++++++++-------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index eab33e78e..acd40ca0f 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -30,26 +30,21 @@ local function airtower(pos,tbl,h) end local function makelake(pos,size,liquid,placein,border,pr,noair) - local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) - local p1 = vector.offset(pos,-size,-1,-size) - local p2 = vector.offset(pos,size,-1,size) - minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param) + local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size) + local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size) + minetest.emerge_area(e1, e2, function(blockpos, action, calls_remaining, param) if calls_remaining ~= 0 then return end local nn = minetest.find_nodes_in_area(p1,p2,placein) - table.sort(nn,function(a, b) - return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) - end) if not nn[1] then return end - local y = pos.y - pr:next(1,2) - local lq = {} - local air = {} + table.sort(nn,function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + local y = pos.y - 1 + local lq, air = {}, {} local r = pr:next(1,#nn) - if r > #nn then return end for i=1,r do - if nn[i].y == y then - airtower(nn[i],air,55) - table.insert(lq,nn[i]) - end + airtower(nn[i],air,20) + table.insert(lq,nn[i]) end minetest.bulk_set_node(lq,{name=liquid}) minetest.bulk_set_node(air,{name="air"}) @@ -59,7 +54,6 @@ local function makelake(pos,size,liquid,placein,border,pr,noair) for kk,vv in pairs(adjacents) do local pp = vector.add(v,vv) local an = minetest.get_node(pp) - local un = minetest.get_node(vector.offset(pp,0,1,0)) if not border then if minetest.get_item_group(an.name,"solid") > 0 then border = an.name @@ -72,9 +66,11 @@ local function makelake(pos,size,liquid,placein,border,pr,noair) end if not noair and an.name ~= liquid then table.insert(br,pp) + --[[ no need to have air above border: + local un = minetest.get_node(vector.offset(pp,0,1,0)) if un.name ~= liquid then - airtower(pp,air,55) - end + airtower(pp,air,20) + end]]-- end end end @@ -181,7 +177,7 @@ mcl_structures.register_structure("lavapool",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -201,7 +197,7 @@ mcl_structures.register_structure("water_lake",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -222,7 +218,7 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "place_center_x, place_center_z, all_floors", y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) @@ -230,14 +226,6 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{ end }) -local pool_adjacents = { - vector.new(1,0,0), - vector.new(-1,0,0), - vector.new(0,-1,0), - vector.new(0,0,1), - vector.new(0,0,-1), -} - mcl_structures.register_structure("basalt_column",{ place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, terrain_feature = true, From 6c388236063b8ab48dd299d6e583e8612152e2e3 Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 9 Sep 2024 19:58:54 +0200 Subject: [PATCH 125/273] More randomness for slime chunks (#4466) Use a classic pseudo-random hashing approach, by multiplication of chunk numbers with large primes that should be more random. - make slime density (as 1 in N) and maximum light level (default: no limit) configurable - Allow using a 3d chunking system where y is also used for hashing This does *not* modify spawn frequency, only the chunk logic. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4466 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 152 +++++---------------- settingtypes.txt | 7 + 2 files changed, 39 insertions(+), 120 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 8a4c8919f..fa9d24d09 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -1,112 +1,31 @@ --License for code WTFPL and otherwise stated in readmes local S = minetest.get_translator("mobs_mc") -local MAPBLOCK_SIZE = 16 - -local seed = minetest.get_mapgen_setting("seed") - -local slime_chunk_match +local MAPBLOCK_SIZE = 16 -- size for slime chunk logic +local SEED_OFFSET = 362 -- module specific seed +local world_seed = (minetest.get_mapgen_setting("seed") + SEED_OFFSET) % 4294967296 +-- slime density, where default N=10 is every 10th chunk +local slime_ratio = tonumber(minetest.settings:get("slime_ratio")) or 10 +-- use 3D chunking instead of 2d chunks +local slime_3d_chunks = minetest.settings:get_bool("slime_3d_chunks", false) +-- maximum light level, for slimes in caves only, not magma/swamps +local slime_max_light = (tonumber(minetest.settings:get("slime_max_light")) or minetest.LIGHT_MAX) + 1 +-- maximum light level for swamp spawning +local swamp_light_max = 7 +-- maximum height to spawn in slime chunks local slime_chunk_spawn_max = mcl_worlds.layer_to_y(40) -local x_modifier -local z_modifier -local function split_by_char (inputstr, sep, limit) - if sep == nil then - sep = "%d" - end - local t = {} - - local i = 0 - for str in string.gmatch(inputstr, "(["..sep.."])") do - i = i --+ 1 - table.insert(t, tonumber(str)) - if limit and i >= limit then - break - end - end - return t -end - ---Seed: "16002933932875202103" == random seed ---Seed: "1807191622654296300" == cheese ---Seed: "1" = 1 -local function process_seed (seed) - --minetest.log("seed: " .. seed) - - local split_chars = split_by_char(tostring(seed), nil, 10) - - slime_chunk_match = split_chars[1] - x_modifier = split_chars[2] - z_modifier = split_chars[3] - - --minetest.log("x_modifier: " .. tostring(x_modifier)) - --minetest.log("z_modifier: " .. tostring(z_modifier)) - --minetest.log("slime_chunk_match: " .. tostring(slime_chunk_match)) -end - -local processed = process_seed (seed) - - -local function convert_to_chunk_value (co_ord, modifier) - local converted = math.floor(math.abs(co_ord) / MAPBLOCK_SIZE) - - if modifier then - converted = (converted + modifier) - end - converted = converted % 10 - - --minetest.log("co_ord: " .. co_ord) - --minetest.log("converted: " .. converted) - return converted -end - -assert(convert_to_chunk_value(-16) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(-15) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(-1) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(0) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(15) == 0, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(16) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(31) == 1, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(32) == 2, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1599) == 9, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1600) == 0, "Incorrect convert_to_chunk_value result") - -assert(convert_to_chunk_value(0,9) == 9, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(16,5) == 6, "Incorrect convert_to_chunk_value result") -assert(convert_to_chunk_value(1599,4) == 3, "Incorrect convert_to_chunk_value result") - -local function calculate_chunk_value (pos, x_mod, z_mod) - local chunk_val = math.abs(convert_to_chunk_value(pos.x, x_mod) - convert_to_chunk_value(pos.z, z_mod)) % 10 - return chunk_val -end - -assert(calculate_chunk_value(vector.new(0,0,0)) == 0, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(0,0,0), 1, 1) == 0, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(0,0,0), 2, 1) == 1, "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(64,0,16)) == (4-1), "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(16,0,64)) == (3), "calculate_chunk_value failed") -assert(calculate_chunk_value(vector.new(-160,0,-160)) == 0, "calculate_chunk_value failed") +local floor = math.floor +local max = math.max local function is_slime_chunk(pos) - if not pos then return end - - local chunk_val = calculate_chunk_value (pos, x_modifier, z_modifier) - local slime_chunk = chunk_val == slime_chunk_match - - --minetest.log("x: " ..pos.x .. ", z:" .. pos.z) - - --minetest.log("seed slime_chunk_match: " .. tostring(slime_chunk_match)) - --minetest.log("chunk_val: " .. tostring(chunk_val)) - --minetest.log("Is slime chunk: " .. tostring(slime_chunk)) - return slime_chunk + if not pos then return end -- no position given + if slime_ratio == 0 then return end -- no slime chunks + if slime_ratio <= 1 then return true end -- slime everywhere + local bpos = vector.new(floor(pos.x / MAPBLOCK_SIZE), slime_3d_chunks and floor(pos.y / MAPBLOCK_SIZE) or 0, floor(pos.z / MAPBLOCK_SIZE)) + return PcgRandom(minetest.hash_node_position(bpos) + world_seed):next(0,1e9)/1e9 * slime_ratio < 1 end -local check_position = function (pos) - return is_slime_chunk(pos) -end - - -- Returns a function that spawns children in a circle around pos. -- To be used as on_die callback. -- self: mob reference @@ -116,19 +35,15 @@ end -- eject_speed: Initial speed of child mob away from "mother" mob local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) return function(self, pos) - local posadd, newpos, dir - if not eject_speed then - eject_speed = 1 - end + eject_speed = eject_speed or 1 local mndef = minetest.registered_nodes[minetest.get_node(pos).name] local mother_stuck = mndef and mndef.walkable local angle = math.random() * math.pi * 2 local children = {} local spawn_count = math.random(2, 4) for i = 1, spawn_count do - dir = vector.new(math.cos(angle), 0, math.sin(angle)) - posadd = vector.normalize(dir) * spawn_distance - newpos = pos + posadd + local dir = vector.new(math.cos(angle), 0, math.sin(angle)) + local newpos = pos + dir * spawn_distance -- If child would end up in a wall, use position of the "mother", unless -- the "mother" was stuck as well if not mother_stuck then @@ -162,16 +77,12 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) end end -local swamp_light_max = 7 - +-- two different rules, underground slime chunks and regular swamp spawning local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light) - local maxlight = swamp_light_max - if pos.y <= slime_chunk_spawn_max and is_slime_chunk(pos) then - maxlight = minetest.LIGHT_MAX + 1 + return max(artificial_light, sky_light) <= slime_max_light end - - return math.max(artificial_light, sky_light) <= maxlight + return max(artificial_light, sky_light) <= swamp_light_max end -- Slime @@ -322,13 +233,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_tiny", @@ -349,13 +260,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_small", @@ -376,13 +287,13 @@ mcl_mobs:spawn_specific( "ground", cave_biomes, 0, -minetest.LIGHT_MAX+1, +slime_max_light, 30, 1000, 4, cave_min, cave_max, -nil, nil, check_position) +nil, nil, is_slime_chunk) mcl_mobs:spawn_specific( "mobs_mc:slime_big", @@ -559,3 +470,4 @@ mcl_mobs:non_spawn_specific("mobs_mc:magma_cube_big","overworld",0, minetest.LIG mcl_mobs.register_egg("mobs_mc:slime_big", S("Slime"), "#52a03e", "#7ebf6d") -- FIXME: add spawn eggs for small and tiny slimes and magma cubes + diff --git a/settingtypes.txt b/settingtypes.txt index 975f02f29..7cfa03ce2 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -221,6 +221,13 @@ mcl_mobs_overworld_threshold (Artificial light threshold to stop monster spawns mcl_mobs_overworld_sky_threshold (Skylight threshold to stop monster spawns in the Overworld) int 7 0 14 mcl_mobs_overworld_passive_threshold (Combined light threshold to stop animal and npc spawns in the Overworld) int 7 0 14 +# Slime chunk ratio 1:N, default is 1 in 10, 0 to disable cave slime +slime_ratio (Slime chunk ratio) float 10.0 0.0 +# Use 3d chunking instead of 2d chunking +slime_3d_chunks (Slime chunk placement in 3d) bool false +# Slime chunk maximum light for spawning, default is no limit +slime_max_light (Maximum light level in slime chunks) int 14 0 14 + [Audio] # Enable flame sound. flame_sound (Flame sound) bool true From 71881154e9cda78bf167b2120aa11777582d5648 Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 9 Sep 2024 20:05:59 +0200 Subject: [PATCH 126/273] use vector.in_area instead of own code in mapgen (#4562) `between` and `in_cube` duplicate functionality already in minetest `vector`. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4562 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/CORE/mcl_util/init.lua | 9 ++++++++ mods/MAPGEN/mcl_mapgen_core/init.lua | 33 +--------------------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 783f5031b..1f53feef7 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1108,3 +1108,12 @@ function mcl_util.to_bool(val) if not val then return false end return true end + +if not vector.in_area then + -- backport from minetest 5.8, can be removed when the minimum version is 5.8 + vector.in_area = function(pos, min, max) + return (pos.x >= min.x) and (pos.x <= max.x) and + (pos.y >= min.y) and (pos.y <= max.y) and + (pos.z >= min.z) and (pos.z <= max.z) + end +end diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 09bf1d8f5..7f6413fb8 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -136,37 +136,6 @@ if string.len(mg_flags_str) > 0 then end minetest.set_mapgen_setting("mg_flags", mg_flags_str, true) -local function between(x, y, z) -- x is between y and z (inclusive) - return y <= x and x <= z -end - -local function in_cube(tpos,wpos1,wpos2) - local xmax=wpos2.x - local xmin=wpos1.x - - local ymax=wpos2.y - local ymin=wpos1.y - - local zmax=wpos2.z - local zmin=wpos1.z - if wpos1.x > wpos2.x then - xmax=wpos1.x - xmin=wpos2.x - end - if wpos1.y > wpos2.y then - ymax=wpos1.y - ymin=wpos2.y - end - if wpos1.z > wpos2.z then - zmax=wpos1.z - zmin=wpos2.z - end - if between(tpos.x,xmin,xmax) and between(tpos.y,ymin,ymax) and between(tpos.z,zmin,zmax) then - return true - end - return false -end - -- Helper function for converting a MC probability to MT, with -- regards to MapBlocks. -- Some MC generated structures are generated on per-chunk @@ -497,7 +466,7 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks end elseif struct.static_pos then for _,p in pairs(struct.static_pos) do - if in_cube(p,minp,maxp) then + if vector.in_area(p,minp,maxp) then mcl_structures.place_structure(p,struct,pr,blockseed) end end From 72c7489976699ee456b3094b7a3d1279a96f643a Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 9 Sep 2024 20:08:30 +0200 Subject: [PATCH 127/273] use vector.new in mcl_dungeons (#4567) No functional changes, just more vector API, which supposedly is faster? Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4567 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_dungeons/init.lua | 65 +++++++++++++------------------ 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 479052d2c..b9a7a270a 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -3,11 +3,8 @@ mcl_dungeons = {} local mg_name = minetest.get_mapgen_setting("mg_name") - -- Are dungeons disabled? -if mcl_vars.mg_dungeons == false or mg_name == "singlenode" then - return -end +if mcl_vars.mg_dungeons == false or mg_name == "singlenode" then return end --lua locals --minetest @@ -19,6 +16,7 @@ local get_meta = minetest.get_meta local emerge_area = minetest.emerge_area --vector +local vector_new = vector.new local vector_add = vector.add local vector_subtract = vector.subtract @@ -43,24 +41,17 @@ local max_y = mcl_vars.mg_overworld_max - 1 local attempts = math_ceil(((mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE) ^ 3) / 8192) -- 63 = 80*80*80/8192 local dungeonsizes = { - { x=5, y=4, z=5}, - { x=5, y=4, z=7}, - { x=7, y=4, z=5}, - { x=7, y=4, z=7}, + vector_new(5, 4, 5), + vector_new(5, 4, 7), + vector_new(7, 4, 5), + vector_new(7, 4, 7), } ---[[local dirs = { - { x= 1, y=0, z= 0 }, - { x= 0, y=0, z= 1 }, - { x=-1, y=0, z= 0 }, - { x= 0, y=0, z=-1 }, -}]] - local surround_vectors = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, + vector_new(-1, 0, 0), + vector_new( 1, 0, 0), + vector_new( 0, 0, -1), + vector_new( 0, 0, 1), } local loottable = @@ -138,8 +129,8 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do - local fdef = registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name] - local cdef = registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name] + local fdef = registered_nodes[get_node(vector_new(tx, y_floor , tz)).name] + local cdef = registered_nodes[get_node(vector_new(tx, y_ceiling, tz)).name] if not fdef or not fdef.walkable or not cdef or not cdef.walkable then return false end end end @@ -155,25 +146,25 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local x2,z2 = x+dim.x+1, z+dim.z+1 - if get_node({x=x, y=y+1, z=z}).name == "air" and get_node({x=x, y=y+2, z=z}).name == "air" then + if get_node(vector_new(x, y+1, z)).name == "air" and get_node(vector_new(x, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if not openings[x] then openings[x]={} end openings[x][z] = true table_insert(corners, {x=x, z=z}) end - if get_node({x=x2, y=y+1, z=z}).name == "air" and get_node({x=x2, y=y+2, z=z}).name == "air" then + if get_node(vector_new(x2, y+1, z)).name == "air" and get_node(vector_new(x2, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if not openings[x2] then openings[x2]={} end openings[x2][z] = true table_insert(corners, {x=x2, z=z}) end - if get_node({x=x, y=y+1, z=z2}).name == "air" and get_node({x=x, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(x, y+1, z2)).name == "air" and get_node(vector_new(x, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if not openings[x] then openings[x]={} end openings[x][z2] = true table_insert(corners, {x=x, z=z2}) end - if get_node({x=x2, y=y+1, z=z2}).name == "air" and get_node({x=x2, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(x2, y+1, z2)).name == "air" and get_node(vector_new(x2, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if not openings[x2] then openings[x2]={} end openings[x2][z2] = true @@ -181,13 +172,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) end for wx = x+1, x+dim.x do - if get_node({x=wx, y=y+1, z=z}).name == "air" and get_node({x=wx, y=y+2, z=z}).name == "air" then + if get_node(vector_new(wx, y+1, z)).name == "air" and get_node(vector_new(wx, y+2, z)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[wx] then openings[wx]={} end openings[wx][z] = true end - if get_node({x=wx, y=y+1, z=z2}).name == "air" and get_node({x=wx, y=y+2, z=z2}).name == "air" then + if get_node(vector_new(wx, y+1, z2)).name == "air" and get_node(vector_new(wx, y+2, z2)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[wx] then openings[wx]={} end @@ -195,13 +186,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) end end for wz = z+1, z+dim.z do - if get_node({x=x, y=y+1, z=wz}).name == "air" and get_node({x=x, y=y+2, z=wz}).name == "air" then + if get_node(vector_new(x, y+1, wz)).name == "air" and get_node(vector_new(x, y+2, wz)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[x] then openings[x]={} end openings[x][wz] = true end - if get_node({x=x2, y=y+1, z=wz}).name == "air" and get_node({x=x2, y=y+2, z=wz}).name == "air" then + if get_node(vector_new(x2, y+1, wz)).name == "air" and get_node(vector_new(x2, y+2, wz)).name == "air" then openings_counter = openings_counter + 1 if check and openings_counter > 5 then return end if not openings[x2] then openings[x2]={} end @@ -243,7 +234,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Check conditions. If okay, start generating if check and (openings_counter < 1 or openings_counter > 5) then return end - minetest.log("action","[mcl_dungeons] Placing new dungeon at "..minetest.pos_to_string({x=x,y=y,z=z})) + minetest.log("action","[mcl_dungeons] Placing new dungeon at "..minetest.pos_to_string(vector_new(x, y, z))) -- Okay! Spawning starts! -- Remember spawner chest positions to set metadata later @@ -276,7 +267,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local currentChest = 1 -- Calculate the mob spawner position, to be re-used for later - local sp = {x = x + math_ceil(dim.x/2), y = y+1, z = z + math_ceil(dim.z/2)} + local sp = vector_new(x + math_ceil(dim.x/2), y+1, z + math_ceil(dim.z/2)) local rn = registered_nodes[get_node(sp).name] if rn and rn.is_ground_content then table_insert(spawner_posses, sp) @@ -288,7 +279,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) for tx = x, maxx do for tz = z, maxz do for ty = y, maxy do - local p = {x = tx, y=ty, z=tz} + local p = vector_new(tx, ty, tz) -- Do not overwrite nodes with is_ground_content == false (e.g. bedrock) -- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other @@ -327,7 +318,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) else if (ty==y+1) and (tx==x+1 or tx==maxx-1 or tz==z+1 or tz==maxz-1) and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then currentChest = currentChest + 1 - table_insert(chests, {x=tx, y=ty, z=tz}) + table_insert(chests, vector_new(tx, ty, tz)) else swap_node(p, {name = "air"}) end @@ -337,7 +328,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Place next chest at the wall (if it was its chosen wall slot) if forChest and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then currentChest = currentChest + 1 - table_insert(chests, {x=tx, y=ty, z=tz}) + table_insert(chests, vector_new(tx, ty, tz)) -- else --swap_node(p, {name = "air"}) end @@ -411,8 +402,8 @@ local function dungeons_nodes(minp, maxp, blockseed) local x = pr:next(minp.x, maxp.x-dim.x-1) local y = pr:next(ymin , ymax -dim.y-1) local z = pr:next(minp.z, maxp.z-dim.z-1) - local p1 = {x=x,y=y,z=z} - local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1} + local p1 = vector_new(x, y, z) + local p2 = vector_new(x+dim.x+1, y+dim.y+1, z+dim.z+1) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr}) end @@ -422,7 +413,7 @@ end function mcl_dungeons.spawn_dungeon(p1, _, pr) if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end local dim = dungeonsizes[pr:next(1, #dungeonsizes)] - local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1} + local p2 = vector_new(p1.x+dim.x+1, p1.y+dim.y+1, p1.z+dim.z+1) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true}) end From 0752ed17d85c572979b399c05c853c62022fc0ab Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 9 Sep 2024 20:22:04 +0200 Subject: [PATCH 128/273] Improve cacti and cane growth ABM (#4590) - local functions, as they are not called by anywhere else - delay water check of reed, first check height - reduce number of get_node calls (for height 1,2,3 the old code used 4,5,4 calls, the new only 2,3,3) - cane growth rate is also reduced This will make the ABM cheaper. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4590 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_core/functions.lua | 77 ++++++++++++++----------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 84a88b529..eec432184 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -57,44 +57,41 @@ minetest.register_abm({ -- -- Papyrus and cactus growing -- - --- Functions -function mcl_core.grow_cactus(pos, node) - pos.y = pos.y-1 - local name = minetest.get_node(pos).name - if minetest.get_item_group(name, "sand") ~= 0 then - pos.y = pos.y+1 - local height = 0 - while minetest.get_node(pos).name == "mcl_core:cactus" and height < 4 do - height = height+1 - pos.y = pos.y+1 - end - if height < 3 then - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="mcl_core:cactus"}) - end - end +function grow_cactus(pos, node) + pos.y = pos.y - 1 -- below + if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then return end + pos.y = pos.y + 2 -- above + local above = minetest.get_node(pos).name + if above == "air" then + minetest.set_node(pos, {name="mcl_core:cactus"}) + return + end + if above ~= "mcl_core:cactus" then return end + pos.y = pos.y + 1 -- at max height 3 + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="mcl_core:cactus"}) end end -function mcl_core.grow_reeds(pos, node) - pos.y = pos.y-1 - local name = minetest.get_node(pos).name - if minetest.get_item_group(name, "soil_sugarcane") ~= 0 then - if minetest.find_node_near(pos, 1, {"group:water"}) == nil and minetest.find_node_near(pos, 1, {"group:frosted_ice"}) == nil then - return - end - pos.y = pos.y+1 - local height = 0 - while minetest.get_node(pos).name == "mcl_core:reeds" and height < 3 do - height = height+1 - pos.y = pos.y+1 - end - if height < 3 then - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="mcl_core:reeds"}) - end - end +function grow_reeds(pos, node) + pos.y = pos.y - 1 -- below + if minetest.get_item_group(minetest.get_node(pos).name, "soil_sugarcane") == 0 then return end + pos.y = pos.y + 2 -- above + local above = minetest.get_node(pos).name + if above == "air" then + pos.y = pos.y - 1 -- original position, check for water + if minetest.find_node_near(pos, 1, {"group:water", "group:frosted_ice"}) == nil then return end + pos.y = pos.y + 1 -- above + minetest.set_node(pos, {name="mcl_core:reeds"}) + return + end + if above ~= "mcl_core:reeds" then return end + pos.y = pos.y + 1 -- at max height 3 + if minetest.get_node(pos).name == "air" then + pos.y = pos.y - 2 -- original position, check for water + if minetest.find_node_near(pos, 1, {"group:water", "group:frosted_ice"}) == nil then return end + pos.y = pos.y + 2 -- above + minetest.set_node(pos, {name="mcl_core:reeds"}) end end @@ -192,9 +189,7 @@ minetest.register_abm({ neighbors = {"group:sand"}, interval = 25, chance = 40, - action = function(pos) - mcl_core.grow_cactus(pos) - end, + action = grow_cactus }) local function is_walkable(pos) @@ -239,10 +234,8 @@ minetest.register_abm({ nodenames = {"mcl_core:reeds"}, neighbors = {"group:soil_sugarcane"}, interval = 25, - chance = 10, - action = function(pos) - mcl_core.grow_reeds(pos) - end, + chance = 40, + action = grow_reeds }) -- From 382a35bb44ecac2552454bc5df876dea8a2f5287 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 28 Jun 2024 12:50:44 +0200 Subject: [PATCH 129/273] delay biome check when spawning --- mods/ENTITIES/mcl_mobs/spawning.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index b0b63ff39..9a5e77f9d 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -680,6 +680,7 @@ end --a simple helper function for mob_spawn local function biome_check(biome_list, biome_goal) + if not biome_goal then return false end for _, data in pairs(biome_list) do if data == biome_goal then return true @@ -760,9 +761,6 @@ local function spawn_check(pos, spawn_def) local gotten_node = get_node(pos).name if not gotten_node then return end - local biome_name = get_biome_name(pos) - if not biome_name then return end - local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 if not is_ground then pos.y = pos.y - 1 @@ -779,7 +777,7 @@ local function spawn_check(pos, spawn_def) if pos.y >= spawn_def.min_height and pos.y <= spawn_def.max_height and spawn_def.dimension == dimension - and biome_check(spawn_def.biomes, biome_name) then + and biome_check(spawn_def.biomes, get_biome_name(pos)) then mcl_log("Spawn level 1 check - Passed") if (is_ground or spawn_def.type_of_spawning ~= "ground") From 2e1df31399fe00016598e7b4be386c2cc0400d6d Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 4 Jul 2024 12:37:12 +0200 Subject: [PATCH 130/273] Refactor and clean up spawn checks, optimize. --- mods/ENTITIES/mcl_mobs/spawning.lua | 118 +++++++++++++--------------- 1 file changed, 54 insertions(+), 64 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 9a5e77f9d..282c186fd 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -753,80 +753,74 @@ end local function spawn_check(pos, spawn_def) if not spawn_def or not pos then return end - dbg_spawn_attempts = dbg_spawn_attempts + 1 + local dimension = mcl_worlds.pos_to_dimension(pos) - local mob_def = minetest.registered_entities[spawn_def.name] - local mob_type = mob_def.type + if spawn_def.dimension ~= dimension then return end -- wrong dimension + -- find ground node below spawn position local gotten_node = get_node(pos).name if not gotten_node then return end - - local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 - if not is_ground then + local is_ground = get_item_group(gotten_node,"solid") ~= 0 + if not is_ground then -- try node one below instead pos.y = pos.y - 1 gotten_node = get_node(pos).name - is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 + is_ground = get_item_group(gotten_node,"solid") ~= 0 end pos.y = pos.y + 1 - local is_water = get_item_group(gotten_node, "water") ~= 0 - local is_lava = get_item_group(gotten_node, "lava") ~= 0 - local is_leaf = get_item_group(gotten_node, "leaves") ~= 0 - local is_bedrock = gotten_node == "mcl_core:bedrock" - local is_grass = minetest.get_item_group(gotten_node,"grass_block") ~= 0 + -- check spawn height + if pos.y < spawn_def.min_height or pos.y > spawn_def.max_height then return end + mcl_log("spawn_check#1 position checks passed") - if pos.y >= spawn_def.min_height - and pos.y <= spawn_def.max_height - and spawn_def.dimension == dimension - and biome_check(spawn_def.biomes, get_biome_name(pos)) then + -- do not spawn on bedrock + if gotten_node == "mcl_core:bedrock" then return end + -- do not spawn ground mobs on leaves + if spawn_def.type_of_spawning == "ground" and (not is_ground or get_item_group(gotten_node, "leaves") ~= 0) then return end + -- farm animals on grass only + if is_farm_animal(spawn_def.name) and get_item_group(gotten_node, "grass_block") == 0 then return end + -- water mobs only on water + if spawn_def.type_of_spawning == "water" and get_item_group(gotten_node, "water") == 0 then return end + -- lava mobs only on lava + if spawn_def.type_of_spawning == "lava" and get_item_group(gotten_node, "lava") == 0 then return end - mcl_log("Spawn level 1 check - Passed") - if (is_ground or spawn_def.type_of_spawning ~= "ground") - and (spawn_def.type_of_spawning ~= "ground" or not is_leaf) - and (not is_farm_animal(spawn_def.name) or is_grass) - and (spawn_def.type_of_spawning ~= "water" or is_water) - and not is_bedrock - and has_room(mob_def,pos) - and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil) - and ( not spawn_protected or not minetest.is_protected(pos, "") ) then + ---- More expensive calls: + -- check the biome + if not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end + -- check if there is enough room + local mob_def = minetest.registered_entities[spawn_def.name] + if not has_room(mob_def,pos) then return end + -- additional checks (slime etc.) + if spawn_def.check_position and not spawn_def.check_position(pos) then return end + if spawn_protected and minetest.is_protected(pos, "") then return end + mcl_log("spawn_check#2 advanced checks passed") - mcl_log("Spawn level 2 check - Passed") - local gotten_light = get_node_light(pos) + -- check light thresholds + local gotten_light = get_node_light(pos) + -- old lighting + if not modern_lighting then return gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light end - if modern_lighting then - local my_node = get_node(pos) - local sky_light = minetest.get_natural_light(pos) - local art_light = minetest.get_artificial_light(my_node.param1) - - if mob_def.spawn_check then - return mob_def.spawn_check(pos, gotten_light, art_light, sky_light) - elseif mob_type == "monster" then - if dimension == "nether" then - if art_light <= nether_threshold then - return true - end - elseif dimension == "end" then - if art_light <= end_threshold then - return true - end - elseif dimension == "overworld" then - if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then - return true - end - end - else - -- passive threshold is apparently the same in all dimensions ... - if gotten_light > overworld_passive_threshold then - return true - end - end - else - if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then - return true - end + local sky_light = minetest.get_natural_light(pos) + local art_light = minetest.get_artificial_light(get_node(pos).param1) + if mob_def.spawn_check then + return mob_def.spawn_check(pos, gotten_light, art_light, sky_light) + end + if mob_def.type == "monster" then + if dimension == "nether" then + if art_light <= nether_threshold then + return true + end + elseif dimension == "end" then + if art_light <= end_threshold then + return true + end + elseif dimension == "overworld" then + if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then + return true end end + return false end - return false + -- passive threshold is apparently the same in all dimensions ... + return gotten_light > overworld_passive_threshold end function mcl_mobs.spawn(pos,id) @@ -834,11 +828,7 @@ function mcl_mobs.spawn(pos,id) if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then return false end - if not dbg_spawn_counts[def.name] then - dbg_spawn_counts[def.name] = 1 - else - dbg_spawn_counts[def.name] = dbg_spawn_counts[def.name] + 1 - end + dbg_spawn_counts[def.name] = (dbg_spawn_counts[def.name] or 0) + 1 return minetest.add_entity(pos, def.name) end From bdd3ae2cd82c4ca8ec15e25a41f774d5ed7ff87c Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 5 Jul 2024 11:32:30 +0200 Subject: [PATCH 131/273] avoid spawning ground mobs in shallow water --- mods/ENTITIES/mcl_mobs/spawning.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 282c186fd..e8b42d6b1 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -760,12 +760,11 @@ local function spawn_check(pos, spawn_def) -- find ground node below spawn position local gotten_node = get_node(pos).name if not gotten_node then return end - local is_ground = get_item_group(gotten_node,"solid") ~= 0 - if not is_ground then -- try node one below instead + if get_item_group(gotten_node, "air") ~= 0 then -- try node one below instead pos.y = pos.y - 1 gotten_node = get_node(pos).name - is_ground = get_item_group(gotten_node,"solid") ~= 0 end + local is_ground = get_item_group(gotten_node,"solid") ~= 0 pos.y = pos.y + 1 -- check spawn height if pos.y < spawn_def.min_height or pos.y > spawn_def.max_height then return end @@ -776,11 +775,11 @@ local function spawn_check(pos, spawn_def) -- do not spawn ground mobs on leaves if spawn_def.type_of_spawning == "ground" and (not is_ground or get_item_group(gotten_node, "leaves") ~= 0) then return end -- farm animals on grass only - if is_farm_animal(spawn_def.name) and get_item_group(gotten_node, "grass_block") == 0 then return end + if is_farm_animal(spawn_def.name) and get_item_group(gotten_node, "grass_block") ~= 0 then return end -- water mobs only on water - if spawn_def.type_of_spawning == "water" and get_item_group(gotten_node, "water") == 0 then return end + if spawn_def.type_of_spawning == "water" and get_item_group(gotten_node, "water") ~= 0 then return end -- lava mobs only on lava - if spawn_def.type_of_spawning == "lava" and get_item_group(gotten_node, "lava") == 0 then return end + if spawn_def.type_of_spawning == "lava" and get_item_group(gotten_node, "lava") ~= 0 then return end ---- More expensive calls: -- check the biome @@ -820,7 +819,7 @@ local function spawn_check(pos, spawn_def) return false end -- passive threshold is apparently the same in all dimensions ... - return gotten_light > overworld_passive_threshold + return gotten_light < overworld_passive_threshold end function mcl_mobs.spawn(pos,id) From 7d763b72578370626ff336849997b55ee0cc0cc4 Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 22 Aug 2024 16:28:34 +0200 Subject: [PATCH 132/273] more mob spawn code improvements --- mods/ENTITIES/mcl_mobs/spawning.lua | 56 +++++++++++------------------ 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index e8b42d6b1..ef64843a8 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -10,12 +10,12 @@ local overworld_sky_threshold = tonumber(minetest.settings:get("mcl_mobs_overwor local overworld_passive_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_passive_threshold")) or 7 local get_node = minetest.get_node -local get_item_group = minetest.get_item_group local get_node_light = minetest.get_node_light local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air local mt_get_biome_name = minetest.get_biome_name local get_objects_inside_radius = minetest.get_objects_inside_radius local get_connected_players = minetest.get_connected_players +local registered_nodes = minetest.registered_nodes local math_min = math.min local math_max = math.max @@ -35,14 +35,11 @@ local table_remove = table.remove local pairs = pairs local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn", false) -local function mcl_log (message, property) - if logging then - if property then - message = message .. ": " .. dump(property) - end - mcl_util.mcl_log (message, "[Mobs spawn]", true) - end +local function mcl_log(message, property) + if property then message = message .. ": " .. dump(property) end + mcl_util.mcl_log(message, "[Mobs spawn]", true) end +if not logging then mcl_log = function() end end local dbg_spawn_attempts = 0 local dbg_spawn_succ = 0 @@ -733,22 +730,10 @@ function mcl_mobs.register_custom_biomecheck(custom_biomecheck) mcl_mobs.custom_biomecheck = custom_biomecheck end - local function get_biome_name(pos) - if mcl_mobs.custom_biomecheck then - return mcl_mobs.custom_biomecheck (pos) - else - local gotten_biome = minetest.get_biome_data(pos) - - if not gotten_biome then - return - end - - gotten_biome = mt_get_biome_name(gotten_biome.biome) - --minetest.log ("biome: " .. dump(gotten_biome)) - - return gotten_biome - end + if mcl_mobs.custom_biomecheck then return mcl_mobs.custom_biomecheck(pos) end + local gotten_biome = minetest.get_biome_data(pos) + return gotten_biome and mt_get_biome_name(gotten_biome.biome) end local function spawn_check(pos, spawn_def) @@ -758,28 +743,29 @@ local function spawn_check(pos, spawn_def) local dimension = mcl_worlds.pos_to_dimension(pos) if spawn_def.dimension ~= dimension then return end -- wrong dimension -- find ground node below spawn position - local gotten_node = get_node(pos).name - if not gotten_node then return end - if get_item_group(gotten_node, "air") ~= 0 then -- try node one below instead + local node_name = get_node(pos).name + local node_def = registered_nodes[node_name] + if node_def and not node_def.groups.solid then -- try node one below instead pos.y = pos.y - 1 - gotten_node = get_node(pos).name + node_name = get_node(pos).name + node_def = registered_nodes[node_name] end - local is_ground = get_item_group(gotten_node,"solid") ~= 0 + if not node_def or not node_def.groups then return end + -- do not spawn on bedrock + if node_name == "mcl_core:bedrock" then return end pos.y = pos.y + 1 -- check spawn height if pos.y < spawn_def.min_height or pos.y > spawn_def.max_height then return end mcl_log("spawn_check#1 position checks passed") - -- do not spawn on bedrock - if gotten_node == "mcl_core:bedrock" then return end -- do not spawn ground mobs on leaves - if spawn_def.type_of_spawning == "ground" and (not is_ground or get_item_group(gotten_node, "leaves") ~= 0) then return end - -- farm animals on grass only - if is_farm_animal(spawn_def.name) and get_item_group(gotten_node, "grass_block") ~= 0 then return end + if spawn_def.type_of_spawning == "ground" and (not node_def.groups.solid or node_def.groups.leaves) then return end -- water mobs only on water - if spawn_def.type_of_spawning == "water" and get_item_group(gotten_node, "water") ~= 0 then return end + if spawn_def.type_of_spawning == "water" and node_def.groups.water then return end -- lava mobs only on lava - if spawn_def.type_of_spawning == "lava" and get_item_group(gotten_node, "lava") ~= 0 then return end + if spawn_def.type_of_spawning == "lava" and node_def.groups.lava then return end + -- farm animals on grass only + if is_farm_animal(spawn_def.name) and node_def.groups.grass_block then return end ---- More expensive calls: -- check the biome From 19d662dee44065f1f1df2e1ba17695d77ebe4086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Thu, 12 Sep 2024 18:13:52 +0200 Subject: [PATCH 133/273] Fix some typos in the API documentation (#4630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4630 Reviewed-by: teknomunk Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/CORE/flowlib/API.md | 20 +++++++-------- mods/CORE/mcl_autogroup/API.md | 8 +++--- mods/CORE/mcl_colors/API.md | 2 +- mods/CORE/mcl_damage/API.md | 4 +-- mods/CORE/mcl_events/API.md | 20 +++++++++------ mods/CORE/mcl_explosions/API.md | 6 ++--- mods/CORE/mcl_worlds/API.md | 30 ++++++++++++----------- mods/HUD/mcl_info/API.md | 5 +++- mods/HUD/mcl_inventory/API.md | 1 + mods/HUD/mcl_title/API.md | 8 +++--- mods/ITEMS/mcl_armor/API.md | 2 +- mods/ITEMS/mcl_buckets/API.md | 39 ++++++++++++++++-------------- mods/ITEMS/mcl_chests/API.md | 4 +-- mods/ITEMS/mcl_doors/api_doors.lua | 2 +- mods/MISC/mcl_wip/API.md | 18 +++++++------- 15 files changed, 92 insertions(+), 77 deletions(-) diff --git a/mods/CORE/flowlib/API.md b/mods/CORE/flowlib/API.md index 20e85036b..dfef0e06c 100644 --- a/mods/CORE/flowlib/API.md +++ b/mods/CORE/flowlib/API.md @@ -2,33 +2,33 @@ Simple flow functions. ## flowlib.is_touching(realpos, nodepos, radius) -Return true if a sphere of at collide with node at . +Return true if a sphere of `radius` at `realpos` collide with node at `nodepos`. * realpos: position * nodepos: position * radius: number ## flowlib.is_water(pos) -Return true if node at is water, false overwise. +Return true if node at `pos` is water, false otherwise. * pos: position ## flowlib.node_is_water(node) -Return true if is water, false overwise. +Return true if `node` is water, false otherwise. * node: node ## flowlib.is_lava(pos) -Return true if node at is lava, false overwise. +Return true if node at `pos` is lava, false otherwise. * pos: position ## flowlib.node_is_lava(node) -Return true if is lava, false overwise. +Return true if `node` is lava, false otherwise. * node: node ## flowlib.is_liquid(pos) -Return true if node at is liquid, false overwise. +Return true if node at `pos` is liquid, false otherwise. * pos: position ## flowlib.node_is_liquid(node) -Return true if is liquid, false overwise. +Return true if `node` is liquid, false otherwise. * node: node ## flowlib.quick_flow(pos, node) @@ -37,9 +37,9 @@ Return direction where the water is flowing (to be use to push mobs, items...). * node: node ## flowlib.move_centre(pos, realpos, node, radius) -Return the pos of the nearest not water block near from in a sphere of at . -WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong. +Return the pos of the nearest not water block near from `pos` in a sphere of `radius` at `realpos`. +WARNING: This function is never used in VL, use at your own risk. The informations described here may be wrong. * pos: position * realpos: position, position of the entity * node: node -* radius: number \ No newline at end of file +* radius: number diff --git a/mods/CORE/mcl_autogroup/API.md b/mods/CORE/mcl_autogroup/API.md index b3a913ab6..f95516882 100644 --- a/mods/CORE/mcl_autogroup/API.md +++ b/mods/CORE/mcl_autogroup/API.md @@ -1,8 +1,8 @@ # mcl_autogroup -This mod emulate digging times from mc. +This mod emulates digging times from MC. ## mcl_autogroup.can_harvest(nodename, toolname, player) -Return true if can be dig with by . +Return true if `nodename` can be dig with `toolname` by . * nodename: string, valid nodename * toolname: (optional) string, valid toolname * player: (optinal) ObjectRef, valid player @@ -14,7 +14,7 @@ WARNING: This function can only be called after mod initialization. * efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0) ## mcl_autogroup.get_wear(toolname, diggroup) -Return the max wear of with +Return the max wear of `toolname` with `diggroup` WARNING: This function can only be called after mod initialization. * toolname: string, name of the tool used * diggroup: string, the name of the diggroup the tool is used on @@ -25,4 +25,4 @@ WARNING: This function can only be called after mod initialization. * level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports ## mcl_autogroup.registered_diggroups -List of registered diggroups, indexed by name. \ No newline at end of file +List of registered diggroups, indexed by name. diff --git a/mods/CORE/mcl_colors/API.md b/mods/CORE/mcl_colors/API.md index 71cad335b..f58a38a3b 100644 --- a/mods/CORE/mcl_colors/API.md +++ b/mods/CORE/mcl_colors/API.md @@ -1,5 +1,5 @@ # mcl_colors -Mod providing global table containing legacity minecraft colors to be used in mods. +Mod providing global table containing legacy Minecraft colors to be used in mods. ## mcl_colors.* Colors by upper name, in hex value. diff --git a/mods/CORE/mcl_damage/API.md b/mods/CORE/mcl_damage/API.md index 9ffdcb9f4..0ca5c6e38 100644 --- a/mods/CORE/mcl_damage/API.md +++ b/mods/CORE/mcl_damage/API.md @@ -6,10 +6,10 @@ WARNING: Not using it inside your mods may cause strange bugs (using the native ## Callbacks -To modify the amount of damage made by something: +To modify the amount of damage dealt by something: ```lua --obj: an ObjectRef mcl_damage.register_modifier(function(obj, damage, reason) end, 0) -``` \ No newline at end of file +``` diff --git a/mods/CORE/mcl_events/API.md b/mods/CORE/mcl_events/API.md index c94328e50..caa99c0b4 100644 --- a/mods/CORE/mcl_events/API.md +++ b/mods/CORE/mcl_events/API.md @@ -1,9 +1,13 @@ -## mcl_events -### Registering Events - `mlc_events.register_event("name",def)` +# mcl_events -#### Event Definition - { +## Registering Events + +`mcl_events.register_event("name", def)` + +### Event Definition + +``` +{ stage = 0, max_stage = 1, percent = 100, @@ -22,6 +26,8 @@ cond_complete = function(event) end, --return true if event finished successfully } +``` -### Debugging - * /event_start -- starts the given event at the current player coordinates +## Debugging + +* /event_start `event` -- starts the given event at the current player coordinates diff --git a/mods/CORE/mcl_explosions/API.md b/mods/CORE/mcl_explosions/API.md index cb0e9252d..58748582f 100644 --- a/mods/CORE/mcl_explosions/API.md +++ b/mods/CORE/mcl_explosions/API.md @@ -3,13 +3,13 @@ This mod provide helper functions to create explosions. ## mcl_explosions.explode(pos, strength, info, puncher) * pos: position, initial position of the explosion -* strenght: number, radius of the explosion +* strength: number, radius of the explosion * info: table, explosion informations: * drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength) * max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value * sound: bool, if true, the explosion will play a sound (default: true) * particles: bool, if true, the explosion will create particles (default: true) - * fire: bool, if true, 1/3 nodes become fire (default: false) + * fire: bool, if true, 1/3 of nodes become fire (default: false) * griefing: bool, if true, the explosion will destroy nodes (default: true) * grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false) -* puncher: (optional) entity, will be used as source for damage done by the explosion \ No newline at end of file +* puncher: (optional) entity, will be used as source for damage done by the explosion diff --git a/mods/CORE/mcl_worlds/API.md b/mods/CORE/mcl_worlds/API.md index 6ad7639f4..f7da7b199 100644 --- a/mods/CORE/mcl_worlds/API.md +++ b/mods/CORE/mcl_worlds/API.md @@ -5,20 +5,21 @@ This mod provides utility functions about positions and dimensions. This function returns: * true, true: if pos is in deep void (deadly) -* true, false: if the pos is in void (non deadly) -* false, false: owerwise +* true, false: if the pos is in void (non-deadly) +* false, false: otherwise Params: * pos: position ## mcl_worlds.y_to_layer(y) -This function is used to calculate the minetest y layer and dimension of the given minecraft layer. +This function is used to calculate the Minetest y layer and dimension of the given y Minecraft layer. Mainly used for ore generation. -Takes an Y coordinate as input and returns: +Takes a Y coordinate as input and returns: + +* The corresponding Minecraft layer (can be `nil` if void) +* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if y is in the void -* The corresponding Minecraft layer (can be nil if void) -* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if is in the void If the Y coordinate is not located in any dimension, it will return: nil, "void" Params: @@ -26,7 +27,7 @@ Params: * y: int ## mcl_worlds.pos_to_dimension(pos) -This function return the Minecraft dimension of ("overworld", "nether" or "end") or "void" if is in the void. +This function return the Minecraft dimension of pos ("overworld", "nether" or "end") or "void" if y is in the void. * pos: position @@ -38,31 +39,32 @@ mc_dimension can be "overworld", "nether", "end" (default: "overworld"). * mc_dimension: string ## mcl_worlds.has_weather(pos) -Returns true if can have weather, false owerwise. +Returns true if pos can have weather, false otherwise. Weather can be only in the overworld. * pos: position ## mcl_worlds.has_dust(pos) -Returns true if can have nether dust, false owerwise. +Returns true if pos can have nether dust, false otherwise. Nether dust can be only in the nether. * pos: position ## mcl_worlds.compass_works(pos) -Returns true if compasses are working at , false owerwise. -In mc, you cant use compass in the nether and the end. +Returns true if compasses are working at pos, false otherwise. +In MC, you cant use compass in the nether and the end. * pos: position ## mcl_worlds.compass_works(pos) -Returns true if clock are working at , false owerwise. -In mc, you cant use clock in the nether and the end. +Returns true if clock are working at pos, false otherwise. +In MC, you cant use clock in the nether and the end. * pos: position ## 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. @@ -75,7 +77,7 @@ The void counts as dimension. Table containing all function registered with mcl_worlds.register_on_dimension_change() ## mcl_worlds.dimension_change(player, dimension) -Notify this mod of a dimension change of to +Notify this mod of a dimension change of player to dimension * player: player, player who changed the dimension * dimension: string, new dimension ("overworld", "nether", "end", "void") diff --git a/mods/HUD/mcl_info/API.md b/mods/HUD/mcl_info/API.md index 18c901162..789a5c76b 100644 --- a/mods/HUD/mcl_info/API.md +++ b/mods/HUD/mcl_info/API.md @@ -1,8 +1,10 @@ ## mcl_info -An api to make custom entries in the mcl2 debug hud. +An API to make custom entries in the VL debug hud. ### mcl_info.register_debug_field(name,defintion) Debug field defintion example: + +``` { level = 3, --show with debug level 3 and upwards @@ -13,6 +15,7 @@ Debug field defintion example: -- It should output a string and determines -- the content of the debug field. } +``` ### mcl_info.registered_debug_fields Table the debug definitions are stored in. Do not modify this directly. If you need to overwrite a field just set it again with mcl_info.register_debug_field(). diff --git a/mods/HUD/mcl_inventory/API.md b/mods/HUD/mcl_inventory/API.md index 5fc5a8d6e..3ba784559 100644 --- a/mods/HUD/mcl_inventory/API.md +++ b/mods/HUD/mcl_inventory/API.md @@ -32,4 +32,5 @@ mcl_inventory.register_survival_inventory_tab({ -- Returns true by default access = function(player) end, +}) ``` diff --git a/mods/HUD/mcl_title/API.md b/mods/HUD/mcl_title/API.md index 37f1c279f..78621488f 100644 --- a/mods/HUD/mcl_title/API.md +++ b/mods/HUD/mcl_title/API.md @@ -8,7 +8,7 @@ Show a hud message of `type` to player `player` with `data` as params. The element will stay for the per-player param `stay` or `data.stay` (in gametick which is 1/20 second). -Here is a usage exemple: +Here is a usage example: ```lua --show a title in the HUD with minecraft color "gold" @@ -35,7 +35,7 @@ Basicaly run `mcl_title.remove(player, type)` for every type. ## mcl_title.params_set(player, params) -Allow mods to set `stay` and upcomming `fadeIn`/`fadeOut` params. +Allow mods to set `stay` and upcoming `fadeIn`/`fadeOut` params. ```lua mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field will stay during 30s (600/20) @@ -43,8 +43,8 @@ mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field ## mcl_title.params_get(player) -Get `stay` and upcomming `fadeIn` and `fadeOut` params of a player as a table. +Get `stay` and upcoming `fadeIn` and `fadeOut` params of a player as a table. ```lua mcl_title.params_get(player) -``` \ No newline at end of file +``` diff --git a/mods/ITEMS/mcl_armor/API.md b/mods/ITEMS/mcl_armor/API.md index 507deab39..4c4284017 100644 --- a/mods/ITEMS/mcl_armor/API.md +++ b/mods/ITEMS/mcl_armor/API.md @@ -119,7 +119,7 @@ mcl_armor.register_set({ end, }, - --this is used to generate automaticaly armor crafts based on each element type folowing the regular minecraft pattern + --this is used to generate automaticaly armor crafts based on each element type following the regular minecraft pattern --if set to nil no craft will be added craft_material = "mcl_mobitems:leather", diff --git a/mods/ITEMS/mcl_buckets/API.md b/mods/ITEMS/mcl_buckets/API.md index 94ec48de5..007f78343 100644 --- a/mods/ITEMS/mcl_buckets/API.md +++ b/mods/ITEMS/mcl_buckets/API.md @@ -1,25 +1,28 @@ # mcl_buckets -Add an API to register buckets to mcl +Adds an API to register buckets to VL ## mcl_buckets.register_liquid(def) -Register a new liquid -Accept folowing params: -* source_place: a string or function. - * string: name of the node to place - * function(pos): will returns name of the node to place with pos being the placement position -* source_take: table of liquid source node names to take -* bucketname: itemstring of the new bucket item -* inventory_image: texture of the new bucket item (ignored if itemname == nil) -* name: user-visible bucket description -* longdesc: long explanatory description (for help) -* usagehelp: short usage explanation (for help) -* tt_help: very short tooltip help -* extra_check(pos, placer): (optional) function(pos) -* groups: optional list of item groups +Register a new liquid. + +Accepts the following parameters: + +* `source_place`: a string or a function + * `string`: name of the node to place + * `function(pos)`: will return name of the node to place with pos being the placement position +* `source_take`: table of liquid source node names to take +* `bucketname`: itemstring of the new bucket item +* `inventory_image`: texture of the new bucket item (ignored if itemname == nil) +* `name`: user-visible bucket description +* `longdesc`: long explanatory description (for help) +* `usagehelp`: short usage explanation (for help) +* `tt_help`: very short tooltip help +* `extra_check(pos, placer)`: (optional) additional check before liquid placement (return 2 booleans: (1) whether to place the liquid source and (2) whether to empty the bucket) +* `groups`: optional list of item groups -**Usage exemple:** +**Usage example:** + ```lua mcl_buckets.register_liquid({ bucketname = "dummy:bucket_dummy", @@ -39,7 +42,7 @@ mcl_buckets.register_liquid({ tt_help = S("Places a dummy liquid source"), extra_check = function(pos, placer) --pos = pos where the liquid should be placed - --placer people who tried to place the bucket (can be nil) + --placer who tried to place the bucket (can be nil) --no liquid node will be placed --the bucket will not be emptied @@ -51,4 +54,4 @@ mcl_buckets.register_liquid({ end, groups = { dummy_group = 123 }, }) -``` \ No newline at end of file +``` diff --git a/mods/ITEMS/mcl_chests/API.md b/mods/ITEMS/mcl_chests/API.md index 5550cfbfa..e0e6bde5e 100644 --- a/mods/ITEMS/mcl_chests/API.md +++ b/mods/ITEMS/mcl_chests/API.md @@ -5,9 +5,9 @@ animations are achieved by giving each chest node an entity, as Minetest (as of 5.8.1) doesn't support giving nodes animated meshes, only static ones. Because of that, a lot of parameters passed through the exposed functions are -be related to nodes and entities. +related to nodes and entities. -Please refer to [Minetest documentation](http://api.minetest.net/) and the code +Please refer to the [Minetest documentation](http://api.minetest.net/) and code comments in `api.lua`. diff --git a/mods/ITEMS/mcl_doors/api_doors.lua b/mods/ITEMS/mcl_doors/api_doors.lua index e392bc710..0108738b4 100644 --- a/mods/ITEMS/mcl_doors/api_doors.lua +++ b/mods/ITEMS/mcl_doors/api_doors.lua @@ -25,7 +25,7 @@ end -- Registers a door -- name: The name of the door --- def: a table with the folowing fields: +-- def: a table with the following fields: -- description -- inventory_image -- groups diff --git a/mods/MISC/mcl_wip/API.md b/mods/MISC/mcl_wip/API.md index e3439af77..776983783 100644 --- a/mods/MISC/mcl_wip/API.md +++ b/mods/MISC/mcl_wip/API.md @@ -1,16 +1,16 @@ # mcl_wip Used to mark items or nodes as WIP. -## mcl_wip.register_wip_item(itemname) -Register as a WIP item. -If isn't a valid itemname, an error will be shown after mods loaded. +## `mcl_wip.register_wip_item(itemname)` +Register `itemname` as a WIP item. +If `itemname` isn't a valid itemname, an error will be shown after mods loaded. -## mcl_wip.register_experimental_item(itemname) -Register as a experimental item. -If isn't a valid itemname, an error will be shown after mods loaded. +## `mcl_wip.register_experimental_item(itemname)` +Register `itemname` as a experimental item. +If `itemname` isn't a valid itemname, an error will be shown after mods loaded. -## mcl_wip.registered_wip_items +## `mcl_wip.registered_wip_items` Table containing WIP items names. -## mcl_wip.registered_experimental_items -Table containing experimental items names. \ No newline at end of file +## `mcl_wip.registered_experimental_items` +Table containing experimental items names. From 52124bd20132b16b8b759f21ab67366e976b0a9c Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 13 Sep 2024 11:14:51 +0200 Subject: [PATCH 134/273] FIX spawning --- mods/ENTITIES/mcl_mobs/spawning.lua | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index ef64843a8..ecb2318f2 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -25,6 +25,7 @@ local math_ceil = math.ceil local math_cos = math.cos local math_sin = math.sin local math_sqrt = math.sqrt +local math_abs = math.abs local vector_distance = vector.distance local vector_new = vector.new @@ -286,11 +287,7 @@ local function count_mobs_total(mob_type) end local function count_mobs_add_entry (mobs_list, mob_cat) - if mobs_list[mob_cat] then - mobs_list[mob_cat] = mobs_list[mob_cat] + 1 - else - mobs_list[mob_cat] = 1 - end + mobs_list[mob_cat] = (mobs_list[mob_cat] or 0) + 1 end --categorise_by can be name or type or spawn_class @@ -616,14 +613,14 @@ local function get_next_mob_spawn_pos(pos) xoff, yoff, zoff = xoff * dd, yoff * dd, zoff * dd local goal_pos = vector.offset(pos, xoff, yoff, zoff) - if not ( math.abs(goal_pos.x) <= SPAWN_MAPGEN_LIMIT and math.abs(goal_pos.y) <= SPAWN_MAPGEN_LIMIT and math.abs(goal_pos.z) <= SPAWN_MAPGEN_LIMIT ) then + if not (math_abs(goal_pos.x) <= SPAWN_MAPGEN_LIMIT and math_abs(goal_pos.y) <= SPAWN_MAPGEN_LIMIT and math_abs(goal_pos.z) <= SPAWN_MAPGEN_LIMIT) then mcl_log("Pos outside mapgen limits: " .. minetest.pos_to_string(goal_pos)) return nil end -- Calculate upper/lower y limits local d2 = xoff*xoff + zoff*zoff -- squared distance in x,z plane only - local y1 = math_sqrt( MOB_SPAWN_ZONE_OUTER_SQ - d2 ) -- absolue value of distance to outer sphere + local y1 = math_sqrt(MOB_SPAWN_ZONE_OUTER_SQ - d2) -- absolue value of distance to outer sphere local y_min, y_max if d2 >= MOB_SPAWN_ZONE_INNER_SQ then @@ -632,7 +629,7 @@ local function get_next_mob_spawn_pos(pos) y_max = pos.y + y1 else -- Inner region, y range spans between inner and outer spheres - local y2 = math_sqrt( MOB_SPAWN_ZONE_INNER_SQ - d2 ) + local y2 = math_sqrt(MOB_SPAWN_ZONE_INNER_SQ - d2) if goal_pos.y > pos.y then -- Upper hemisphere y_min = pos.y + y2 @@ -683,7 +680,6 @@ local function biome_check(biome_list, biome_goal) return true end end - return false end @@ -761,15 +757,15 @@ local function spawn_check(pos, spawn_def) -- do not spawn ground mobs on leaves if spawn_def.type_of_spawning == "ground" and (not node_def.groups.solid or node_def.groups.leaves) then return end -- water mobs only on water - if spawn_def.type_of_spawning == "water" and node_def.groups.water then return end + if spawn_def.type_of_spawning == "water" and not node_def.groups.water then return end -- lava mobs only on lava - if spawn_def.type_of_spawning == "lava" and node_def.groups.lava then return end + if spawn_def.type_of_spawning == "lava" and not node_def.groups.lava then return end -- farm animals on grass only - if is_farm_animal(spawn_def.name) and node_def.groups.grass_block then return end + if is_farm_animal(spawn_def.name) and not node_def.groups.grass_block then return end ---- More expensive calls: -- check the biome - if not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end + if spawn_def.biomes ~= list_of_all_biomes and not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end -- check if there is enough room local mob_def = minetest.registered_entities[spawn_def.name] if not has_room(mob_def,pos) then return end @@ -805,12 +801,12 @@ local function spawn_check(pos, spawn_def) return false end -- passive threshold is apparently the same in all dimensions ... - return gotten_light < overworld_passive_threshold + return gotten_light > overworld_passive_threshold end function mcl_mobs.spawn(pos,id) local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id] - if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then + if not pos or not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then return false end dbg_spawn_counts[def.name] = (dbg_spawn_counts[def.name] or 0) + 1 From f9290c6493b6ef96f0c33b439c18c9fb9d3633f9 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 13 Sep 2024 17:47:08 +0200 Subject: [PATCH 135/273] drop entirely --- mods/ENTITIES/mcl_mobs/spawning.lua | 175 +--------------------------- 1 file changed, 4 insertions(+), 171 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index ecb2318f2..d47b2212f 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -44,7 +44,6 @@ if not logging then mcl_log = function() end end local dbg_spawn_attempts = 0 local dbg_spawn_succ = 0 -local dbg_spawn_counts = {} local remove_far = true @@ -97,169 +96,6 @@ mcl_log("Percentage of hostile spawns are group: " .. hostile_group_percentage_s local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false --- THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs --- Also used for missing parameter --- Please update the list when adding new biomes! - -local list_of_all_biomes = { - - -- underground: - - "FlowerForest_underground", - "JungleEdge_underground", - "ColdTaiga_underground", - "IcePlains_underground", - "IcePlainsSpikes_underground", - "MegaTaiga_underground", - "Taiga_underground", - "ExtremeHills+_underground", - "JungleM_underground", - "ExtremeHillsM_underground", - "JungleEdgeM_underground", - "MangroveSwamp_underground", - - -- ocean: - - "RoofedForest_ocean", - "JungleEdgeM_ocean", - "BirchForestM_ocean", - "BirchForest_ocean", - "IcePlains_deep_ocean", - "Jungle_deep_ocean", - "Savanna_ocean", - "MesaPlateauF_ocean", - "ExtremeHillsM_deep_ocean", - "Savanna_deep_ocean", - "SunflowerPlains_ocean", - "Swampland_deep_ocean", - "Swampland_ocean", - "MegaSpruceTaiga_deep_ocean", - "ExtremeHillsM_ocean", - "JungleEdgeM_deep_ocean", - "SunflowerPlains_deep_ocean", - "BirchForest_deep_ocean", - "IcePlainsSpikes_ocean", - "Mesa_ocean", - "StoneBeach_ocean", - "Plains_deep_ocean", - "JungleEdge_deep_ocean", - "SavannaM_deep_ocean", - "Desert_deep_ocean", - "Mesa_deep_ocean", - "ColdTaiga_deep_ocean", - "Plains_ocean", - "MesaPlateauFM_ocean", - "Forest_deep_ocean", - "JungleM_deep_ocean", - "FlowerForest_deep_ocean", - "MushroomIsland_ocean", - "MegaTaiga_ocean", - "StoneBeach_deep_ocean", - "IcePlainsSpikes_deep_ocean", - "ColdTaiga_ocean", - "SavannaM_ocean", - "MesaPlateauF_deep_ocean", - "MesaBryce_deep_ocean", - "ExtremeHills+_deep_ocean", - "ExtremeHills_ocean", - "MushroomIsland_deep_ocean", - "Forest_ocean", - "MegaTaiga_deep_ocean", - "JungleEdge_ocean", - "MesaBryce_ocean", - "MegaSpruceTaiga_ocean", - "ExtremeHills+_ocean", - "Jungle_ocean", - "RoofedForest_deep_ocean", - "IcePlains_ocean", - "FlowerForest_ocean", - "ExtremeHills_deep_ocean", - "MesaPlateauFM_deep_ocean", - "Desert_ocean", - "Taiga_ocean", - "BirchForestM_deep_ocean", - "Taiga_deep_ocean", - "JungleM_ocean", - "MangroveSwamp_ocean", - "MangroveSwamp_deep_ocean", - - -- water or beach? - - "MesaPlateauFM_sandlevel", - "MesaPlateauF_sandlevel", - "MesaBryce_sandlevel", - "Mesa_sandlevel", - - -- beach: - - "FlowerForest_beach", - "Forest_beach", - "StoneBeach", - "ColdTaiga_beach_water", - "Taiga_beach", - "Savanna_beach", - "Plains_beach", - "ExtremeHills_beach", - "ColdTaiga_beach", - "Swampland_shore", - "MushroomIslandShore", - "JungleM_shore", - "Jungle_shore", - "BambooJungleM_shore", - "BambooJungle_shore", - "MangroveSwamp_shore", - - -- dimension biome: - - "Nether", - "BasaltDelta", - "CrimsonForest", - "WarpedForest", - "SoulsandValley", - "End", - - -- Overworld regular: - - "Mesa", - "FlowerForest", - "Swampland", - "Taiga", - "ExtremeHills", - "ExtremeHillsM", - "ExtremeHills+_snowtop", - "Jungle", - "Savanna", - "BirchForest", - "MegaSpruceTaiga", - "MegaTaiga", - "ExtremeHills+", - "Forest", - "Plains", - "Desert", - "ColdTaiga", - "MushroomIsland", - "IcePlainsSpikes", - "SunflowerPlains", - "IcePlains", - "RoofedForest", - "ExtremeHills+_snowtop", - "MesaPlateauFM_grasstop", - "JungleEdgeM", - "JungleM", - "BirchForestM", - "MesaPlateauF", - "MesaPlateauFM", - "MesaPlateauF_grasstop", - "MesaBryce", - "JungleEdge", - "SavannaM", - "MangroveSwamp", - "BambooJungle", - "BambooJungleEdge", - "BambooJungleEdgeM", - "BambooJungleM", -} - -- count how many mobs are in an area local function count_mobs(pos,r,mob_type) local num = 0 @@ -446,7 +282,7 @@ function mcl_mobs:spawn_setup(def) local dimension = def.dimension or "overworld" local type_of_spawning = def.type_of_spawning or "ground" - local biomes = def.biomes or list_of_all_biomes + local biomes = def.biomes or nil local min_light = def.min_light or 0 local max_light = def.max_light or (minetest.LIGHT_MAX + 1) local chance = def.chance or 1000 @@ -765,7 +601,7 @@ local function spawn_check(pos, spawn_def) ---- More expensive calls: -- check the biome - if spawn_def.biomes ~= list_of_all_biomes and not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end + if spawn_def.biomes and not biome_check(spawn_def.biomes, get_biome_name(pos)) then return end -- check if there is enough room local mob_def = minetest.registered_entities[spawn_def.name] if not has_room(mob_def,pos) then return end @@ -805,11 +641,9 @@ local function spawn_check(pos, spawn_def) end function mcl_mobs.spawn(pos,id) + if not pos or not id then return false end local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id] - if not pos or not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then - return false - end - dbg_spawn_counts[def.name] = (dbg_spawn_counts[def.name] or 0) + 1 + if not def or not def.is_mob or (def.can_spawn and not def.can_spawn(pos)) then return false end return minetest.add_entity(pos, def.name) end @@ -1207,7 +1041,6 @@ end minetest.register_chatcommand("mobstats",{ privs = { debug = true }, func = function(n,param) - --minetest.chat_send_player(n,dump(dbg_spawn_counts)) local pos = minetest.get_player_by_name(n):get_pos() minetest.chat_send_player(n,"mobs: within 32 radius of player/total loaded :"..count_mobs(pos,MOB_CAP_INNER_RADIUS) .. "/" .. count_mobs_total()) minetest.chat_send_player(n,"spawning attempts since server start:" .. dbg_spawn_succ .. "/" .. dbg_spawn_attempts) From 7f5b19cda81b792ca36532a11e8bf6142b5b839a Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Thu, 25 Jul 2024 18:14:50 +0700 Subject: [PATCH 136/273] Fix missing dependencies for random_mod_load_order --- mods/CORE/_mcl_autogroup/mod.conf | 1 + mods/ENVIRONMENT/mcl_void_damage/mod.conf | 2 +- mods/HUD/mcl_death_messages/mod.conf | 2 +- mods/HUD/mcl_title/mod.conf | 4 ++-- mods/ITEMS/REDSTONE/mesecons_button/mod.conf | 2 +- mods/ITEMS/mcl_crimson/mod.conf | 2 +- mods/ITEMS/mcl_fences/mod.conf | 2 +- mods/ITEMS/mcl_grindstone/mod.conf | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mods/CORE/_mcl_autogroup/mod.conf b/mods/CORE/_mcl_autogroup/mod.conf index db43aff39..f62edd60b 100644 --- a/mods/CORE/_mcl_autogroup/mod.conf +++ b/mods/CORE/_mcl_autogroup/mod.conf @@ -1,3 +1,4 @@ name = _mcl_autogroup +depends = mcl_autogroup author = ryvnf description = VoxeLibre core mod which automatically adds groups to all items. Very important for digging times. diff --git a/mods/ENVIRONMENT/mcl_void_damage/mod.conf b/mods/ENVIRONMENT/mcl_void_damage/mod.conf index 1358e5217..83d76956f 100644 --- a/mods/ENVIRONMENT/mcl_void_damage/mod.conf +++ b/mods/ENVIRONMENT/mcl_void_damage/mod.conf @@ -1,4 +1,4 @@ name = mcl_void_damage author = Wuzzy description = Deal damage to entities stuck in the deep void -depends = mcl_worlds +depends = mcl_worlds, mcl_spawn diff --git a/mods/HUD/mcl_death_messages/mod.conf b/mods/HUD/mcl_death_messages/mod.conf index a634e16de..5497e9473 100644 --- a/mods/HUD/mcl_death_messages/mod.conf +++ b/mods/HUD/mcl_death_messages/mod.conf @@ -1,4 +1,4 @@ name = mcl_death_messages author = 4Evergreen4 description = Shows messages in chat when a player dies. -depends = mcl_colors +depends = mcl_colors, mcl_damage diff --git a/mods/HUD/mcl_title/mod.conf b/mods/HUD/mcl_title/mod.conf index 0f29a8118..ee6104479 100644 --- a/mods/HUD/mcl_title/mod.conf +++ b/mods/HUD/mcl_title/mod.conf @@ -1,4 +1,4 @@ name = mcl_title -description = Add an API to add in HUD title -depends = mcl_colors +description = Add an API to add in HUD title +depends = mcl_colors, mcl_util author = AFCMS \ No newline at end of file diff --git a/mods/ITEMS/REDSTONE/mesecons_button/mod.conf b/mods/ITEMS/REDSTONE/mesecons_button/mod.conf index be127362b..a554792a1 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/mod.conf +++ b/mods/ITEMS/REDSTONE/mesecons_button/mod.conf @@ -1,3 +1,3 @@ name = mesecons_button -depends = mesecons +depends = mesecons, mesecons_mvps optional_depends = doc diff --git a/mods/ITEMS/mcl_crimson/mod.conf b/mods/ITEMS/mcl_crimson/mod.conf index b4303cd48..fcfa34a2f 100644 --- a/mods/ITEMS/mcl_crimson/mod.conf +++ b/mods/ITEMS/mcl_crimson/mod.conf @@ -1,3 +1,3 @@ name = mcl_crimson author = debiankaios, Exhale -depends = mcl_core, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots +depends = mcl_core, mcl_fences, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots diff --git a/mods/ITEMS/mcl_fences/mod.conf b/mods/ITEMS/mcl_fences/mod.conf index 8b20dd169..aba4a33c3 100644 --- a/mods/ITEMS/mcl_fences/mod.conf +++ b/mods/ITEMS/mcl_fences/mod.conf @@ -1,3 +1,3 @@ name = mcl_fences -depends = mcl_core, mcl_sounds +depends = mcl_core, mcl_nether, mcl_sounds optional_depends = doc, screwdriver diff --git a/mods/ITEMS/mcl_grindstone/mod.conf b/mods/ITEMS/mcl_grindstone/mod.conf index 66773c57f..42f792ef9 100644 --- a/mods/ITEMS/mcl_grindstone/mod.conf +++ b/mods/ITEMS/mcl_grindstone/mod.conf @@ -1,4 +1,4 @@ name = mcl_grindstone author = TheRandomLegoBrick, ChrisPHP -depends = mcl_experience, mcl_sounds +depends = mcl_experience, mcl_formspec, mcl_sounds description = Add block that disenchants tools and armour except for curses, and repairs two items of the same type it is also the weapon smith's work station. From fb3e9dae8494d5bff0c408ce528c1e8b1a5c2705 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Thu, 25 Jul 2024 19:30:44 +0700 Subject: [PATCH 137/273] autogroup: Do node overwrites after all mods have loaded --- mods/CORE/_mcl_autogroup/init.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/CORE/_mcl_autogroup/init.lua b/mods/CORE/_mcl_autogroup/init.lua index 884508032..7139535d2 100644 --- a/mods/CORE/_mcl_autogroup/init.lua +++ b/mods/CORE/_mcl_autogroup/init.lua @@ -117,10 +117,6 @@ end -- Array of unique hardness values for each group which affects dig time. local hardness_values = get_hardness_values_for_groups() --- Map indexed by hardness values which return the index of that value in --- hardness_value. Used for quick lookup. -local hardness_lookup = get_hardness_lookup_for_groups(hardness_values) - --[[local function compute_creativetimes(group) local creativetimes = {} @@ -186,6 +182,7 @@ local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency) local mult = capsdef.speed or 1 local uses = capsdef.uses local def = mcl_autogroup.registered_diggroups[g] + assert(def, toolname .. " has unknown diggroup '" .. dump(g) .. "'") local max_level = def.levels and #def.levels or 1 assert(capsdef.level, toolname .. ' is missing level for ' .. g) @@ -313,6 +310,13 @@ function mcl_autogroup.get_wear(toolname, diggroup) end local function overwrite() + -- Refresh, now that all groups are known. + hardness_values = get_hardness_values_for_groups() + + -- Map indexed by hardness values which return the index of that value in + -- hardness_value. Used for quick lookup. + local hardness_lookup = get_hardness_lookup_for_groups(hardness_values) + for nname, ndef in pairs(minetest.registered_nodes) do local newgroups = table.copy(ndef.groups) if (nname ~= "ignore" and ndef.diggable) then @@ -374,4 +378,5 @@ local function overwrite() end end -overwrite() +-- Make sure all tools and groups are registered +minetest.register_on_mods_loaded(overwrite) From 1707eef6725f14cd2d9b26afed52ba771d74feb9 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 14 Sep 2024 08:53:16 -0500 Subject: [PATCH 138/273] Fix two additional dependency issues --- mods/ENTITIES/mobs_mc/mod.conf | 2 +- mods/ITEMS/mcl_crimson/mod.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/mod.conf b/mods/ENTITIES/mobs_mc/mod.conf index ec7446505..f90989d1a 100644 --- a/mods/ENTITIES/mobs_mc/mod.conf +++ b/mods/ENTITIES/mobs_mc/mod.conf @@ -1,5 +1,5 @@ name = mobs_mc author = maikerumine description = Adds Minecraft-like monsters and animals. -depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util +depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util, mcl_entity_invs optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items, mcl_worlds diff --git a/mods/ITEMS/mcl_crimson/mod.conf b/mods/ITEMS/mcl_crimson/mod.conf index fcfa34a2f..86be6bfe8 100644 --- a/mods/ITEMS/mcl_crimson/mod.conf +++ b/mods/ITEMS/mcl_crimson/mod.conf @@ -1,3 +1,3 @@ name = mcl_crimson author = debiankaios, Exhale -depends = mcl_core, mcl_fences, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots +depends = mcl_core, mcl_fences, mcl_stairs, mobs_mc, mcl_util, mcl_dye, mcl_flowerpots, mcl_doors From ce5eb8d88db719050dcb16ccbe869d52dcab860f Mon Sep 17 00:00:00 2001 From: WillConker Date: Sun, 15 Sep 2024 23:08:37 +0200 Subject: [PATCH 139/273] Remove mobs_mc name check from mcl_mobspawners warning (#4501) Fixes a warning. Mobs spawners really only need to check the entity `.is_mob` as all mobs should have this set. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4501 Reviewed-by: the-real-herowl Co-authored-by: WillConker Co-committed-by: WillConker --- mods/ITEMS/mcl_mobspawners/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 8b2c73d8c..f2ee44ab1 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -401,7 +401,7 @@ minetest.register_lbm({ minetest.register_on_mods_loaded(function() for name,mobinfo in pairs(minetest.registered_entities) do - if ( mobinfo.is_mob or name:find("mobs_mc") ) and not ( mobinfo.visual_size or mobinfo._convert_to ) then + if mobinfo.is_mob and not ( mobinfo.visual_size or mobinfo._convert_to ) then minetest.log("warning", "Definition for "..tostring(name).." is missing field 'visual_size', mob spawners will not work properly") end end From 66b7a52d473a28a57417566f12ae9721a9cd074d Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 15 Sep 2024 23:14:10 +0200 Subject: [PATCH 140/273] Make zombies and skeletons not float (#4512) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4512 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 1 + mods/ENTITIES/mobs_mc/skeleton_wither.lua | 1 + mods/ENTITIES/mobs_mc/villager_zombie.lua | 1 + mods/ENTITIES/mobs_mc/zombie.lua | 1 + 4 files changed, 4 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 8ea4d9ced..711c11091 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -103,6 +103,7 @@ local skeleton = { return true end, ignited_by_sunlight = true, + floats = 0, view_range = 16, fear_height = 4, attack_type = "dogshoot", diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index b01fb4b96..331b4fd06 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -94,6 +94,7 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", { dogshoot_switch = 1, dogshoot_count_max =0.5, fear_height = 4, + floats = 0, harmed_by_heal = true, fire_resistant = true, dealt_effect = { diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index ada456aff..6e343c327 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -134,6 +134,7 @@ mcl_mobs.register_mob("mobs_mc:villager_zombie", { end, sunlight_damage = 2, ignited_by_sunlight = true, + floats = 0, view_range = 16, fear_height = 4, harmed_by_heal = true, diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 2f6d7e79f..83eae82ad 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -96,6 +96,7 @@ local zombie = { }, ignited_by_sunlight = true, sunlight_damage = 2, + floats = 0, view_range = 16, attack_type = "dogfight", harmed_by_heal = true, From f219e5f4ae6fd090c11178aefbec759649eea599 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 15 Sep 2024 23:15:30 +0200 Subject: [PATCH 141/273] Fix structure spawns under water + peaceful spawns (#4607) - peaceful structure spawns would not run in peaceful mode (e.g., parrots) - water structure spawns (e.g., guardians) would not run because the code required air above - small code improvements Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4607 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/mcl_structures/api.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 4f3bed207..a76140e61 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -229,14 +229,14 @@ function mcl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water) sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) end table.shuffle(sp) - for i,node in pairs(sp) do - if not peaceful and i <= n then - local pos = vector.offset(node,0,1,0) - if pos then - minetest.add_entity(pos,mob) - end + local count = 0 + local mob_def = minetest.registered_entities[mob] + local enabled = (not peaceful) or (mob_def and mob_def.spawn_class ~= "hostile") + for _,node in pairs(sp) do + if enabled and count < n and minetest.add_entity(vector.offset(node, 0, 1, 0), mob) then + count = count + 1 end - minetest.get_meta(node):set_string("spawnblock","yes") + minetest.get_meta(node):set_string("spawnblock", "yes") -- note: also in peaceful mode! end end @@ -371,7 +371,12 @@ function mcl_structures.register_structure_spawn(def) if active_object_count_wider > limit + mob_cap_animal then return end if active_object_count_wider > mob_cap_player then return end local p = vector.offset(pos,0,1,0) - if minetest.get_node(p).name ~= "air" then return end + local pname = minetest.get_node(p).name + if def.type_of_spawning == "water" then + if pname ~= "mcl_core:water_source" and pname ~= "mclx_core:river_water_source" then return end + else + if pname ~= "air" then return end + end if minetest.get_meta(pos):get_string("spawnblock") == "" then return end if mg_name ~= "v6" and mg_name ~= "singlenode" and def.biomes then if table.indexof(def.biomes,minetest.get_biome_name(minetest.get_biome_data(p).biome)) == -1 then From 178cb9340dcd1ec0d6430df26208b70db1e1de29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Mon, 16 Sep 2024 12:12:55 +0200 Subject: [PATCH 142/273] Clean-up `set_string(..., nil)` usage (fixes #4639) (#4641) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4641 Reviewed-by: kno10 Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ENTITIES/mobs_mc/villager.lua | 12 ++++++------ mods/ITEMS/mcl_campfires/api.lua | 12 ++++++------ mods/ITEMS/mcl_stonecutter/init.lua | 1 - mods/PLAYER/mcl_spawn/init.lua | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index b1e291037..47b4cb470 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -818,7 +818,7 @@ local function find_closest_bed (self) if (owned_by and owned_by == self._id) then mcl_log("Clear as already owned by me.") - bed_meta:set_string("villager", nil) + bed_meta:set_string("villager", "") owned_by = nil end @@ -1279,7 +1279,7 @@ local function validate_jobsite(self) mcl_log("Jobsite far, so resettle: " .. tostring(resettle)) if resettle then local m = minetest.get_meta(self._jobsite) - m:set_string("villager", nil) + m:set_string("villager", "") remove_job (self) return false end @@ -1421,7 +1421,7 @@ local function validate_bed(self) mcl_log("Bed far, so resettle: " .. tostring(resettle)) if resettle then mcl_log("Resettled. Ditch bed.") - m:set_string("villager", nil) + m:set_string("villager", "") self._bed = nil bed_valid = false return false @@ -1431,7 +1431,7 @@ local function validate_bed(self) mcl_log("Player owner: " .. owned_by_player) if owned_by_player ~= "" then mcl_log("Player owns this. Villager won't take this.") - m:set_string("villager", nil) + m:set_string("villager", "") self._bed = nil bed_valid = false return false @@ -2300,13 +2300,13 @@ mcl_mobs.register_mob("mobs_mc:villager", { local bed = self._bed if bed then local bed_meta = minetest.get_meta(bed) - bed_meta:set_string("villager", nil) + bed_meta:set_string("villager", "") mcl_log("Died, so bye bye bed") end local jobsite = self._jobsite if jobsite then local jobsite_meta = minetest.get_meta(jobsite) - jobsite_meta:set_string("villager", nil) + jobsite_meta:set_string("villager", "") mcl_log("Died, so bye bye jobsite") end diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 98318f3f1..bacbdeccc 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -39,9 +39,9 @@ local function drop_items(pos, node, oldmeta) if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then food_entity:remove() for i = 1, 4 do - meta:set_string("food_x_"..tostring(i), nil) - meta:set_string("food_y_"..tostring(i), nil) - meta:set_string("food_z_"..tostring(i), nil) + meta:set_string("food_x_"..tostring(i), "") + meta:set_string("food_y_"..tostring(i), "") + meta:set_string("food_z_"..tostring(i), "") end end end @@ -135,9 +135,9 @@ function mcl_campfires.cook_item(pos, elapsed) if cooked then if food_entity then food_entity:remove() -- Remove visual food entity - meta:set_string("food_x_"..tostring(i), nil) - meta:set_string("food_y_"..tostring(i), nil) - meta:set_string("food_z_"..tostring(i), nil) + meta:set_string("food_x_"..tostring(i), "") + meta:set_string("food_y_"..tostring(i), "") + meta:set_string("food_z_"..tostring(i), "") minetest.add_item(pos, cooked.item) -- Drop Cooked Item -- Throw some Experience Points because why not? -- Food is cooked, xp is deserved for using this unique cooking method. Take that Minecraft ;) diff --git a/mods/ITEMS/mcl_stonecutter/init.lua b/mods/ITEMS/mcl_stonecutter/init.lua index 0b2f6f166..2bba9528a 100644 --- a/mods/ITEMS/mcl_stonecutter/init.lua +++ b/mods/ITEMS/mcl_stonecutter/init.lua @@ -279,7 +279,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) for field_name, value in pairs(fields) do if field_name ~= "scroll" then local itemname = fieldname_to_itemname(field_name) - player:get_meta():set_string("mcl_stonecutter:selected", itemname) set_selected_item(player, itemname) update_stonecutter_slots(player) mcl_stonecutter.show_stonecutter_form(player) diff --git a/mods/PLAYER/mcl_spawn/init.lua b/mods/PLAYER/mcl_spawn/init.lua index 89ededeed..7bf27b0f9 100644 --- a/mods/PLAYER/mcl_spawn/init.lua +++ b/mods/PLAYER/mcl_spawn/init.lua @@ -453,7 +453,7 @@ function mcl_spawn.set_spawn_pos(player, pos, message) -- Pass in villager as arg. Shouldn't know about villagers if bed_bottom_meta then mcl_log("Removing villager from bed bottom meta") - bed_bottom_meta:set_string("villager", nil) + bed_bottom_meta:set_string("villager", "") else mcl_log("Cannot remove villager from bed bottom meta") end From b6aafedf25a2b8dd3bc598cc8a9b49de8fb3697f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 17 Jun 2024 07:15:04 -0500 Subject: [PATCH 143/273] Fix space check function has_room() in mcl_mobs/spawning.lua so it allows spiderproofing --- mods/ENTITIES/mcl_mobs/spawning.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index d47b2212f..1fb07247c 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -542,13 +542,20 @@ local function has_room(self,pos) end end table.insert(nodes,"air") - local x = cb[4] - cb[1] - local y = cb[5] - cb[2] - local z = cb[6] - cb[3] - local r = math.ceil(x * y * z) - local p1 = vector.offset(pos,cb[1],cb[2],cb[3]) - local p2 = vector.offset(pos,cb[4],cb[5],cb[6]) - local n = #minetest.find_nodes_in_area(p1,p2,nodes) or 0 + + local p1 = vector.offset(pos,cb[1],cb[2] + 1,cb[3]) + p1.x = math.floor(p1.x) + p1.y = math.floor(p1.y) + p1.z = math.floor(p1.z) + + local p2 = vector.offset(p1,cb[4] - cb[1], cb[5] - cb[2], cb[6] - cb[3]) + p2.x = math.floor(p2.x) + p2.y = math.floor(p2.y) + p2.z = math.floor(p2.z) + + local r = (p2.x - p1.x + 1) * (p2.y - p1.y + 1) * (p2.z - p1.z + 1) + local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) + local n = #found_nodes or 0 if r > n then minetest.log("warning","[mcl_mobs] No room for mob "..self.name.." at "..minetest.pos_to_string(vector.round(pos))) return false From d8d39ffd52a1c36315109f98cac53ee85a482b26 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 17 Jun 2024 20:27:55 -0500 Subject: [PATCH 144/273] Add spawnbox parameter that overrides collision box for spawn volume checks --- mods/ENTITIES/mcl_mobs/spawning.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 1fb07247c..aed87631c 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -531,7 +531,7 @@ local function get_water_spawn(p) end local function has_room(self,pos) - local cb = self.collisionbox + local cb = self.spawnbox or self.collisionbox local nodes = {} if self.fly_in then local t = type(self.fly_in) From fa09b650108ed8d79e22f9e9ba4235aa3b0a2a5d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 18 Jun 2024 06:07:30 -0500 Subject: [PATCH 145/273] Add most of the code for sub-node accurate spawning volume check (needs a function to calculate bounding box height of nodes) --- mods/ENTITIES/mcl_mobs/spawning.lua | 44 +++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index aed87631c..45516c754 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -548,19 +548,47 @@ local function has_room(self,pos) p1.y = math.floor(p1.y) p1.z = math.floor(p1.z) - local p2 = vector.offset(p1,cb[4] - cb[1], cb[5] - cb[2], cb[6] - cb[3]) + local cb_height = cb[5] - cb[2] + local p2 = vector.offset(p1,cb[4] - cb[1], cb_height, cb[6] - cb[3]) p2.x = math.floor(p2.x) p2.y = math.floor(p2.y) p2.z = math.floor(p2.z) - local r = (p2.x - p1.x + 1) * (p2.y - p1.y + 1) * (p2.z - p1.z + 1) - local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) - local n = #found_nodes or 0 - if r > n then - minetest.log("warning","[mcl_mobs] No room for mob "..self.name.." at "..minetest.pos_to_string(vector.round(pos))) - return false + -- Check if the entire spawn volume is free + local dx = p2.x - p1.x + 1 + local dy = p2.y - p1.y + 1 + local dz = p2.z - p1.z + 1 + local n = #minetest.find_nodes_in_area(p1,p2,nodes) or 0 + if n == ( dx * dz * dz ) then return true end + + -- Make sure the entire volume except for the top level is free before checking the top layer + if dy > 1 then + n = #minetest.find_nodes_in_area(p1, vector.offset(p2, 0, -1, 0), nodes) + if n < (dx * dz * ( dy - 1)) then return false end end - return true + + -- Check the top layer to see if we have enough space to spawn in + local top_layer_height = 1 + local processed = {} + for x = p1.x,p2.x do + for z = p1.z,p2.z do + local node = minetest.get_node(vector.new(x,p2.y,z)) or { name = "ignore" } + if not processed[node.name] then + local nodedef = minetest.registered_nodes + + -- TODO: calculate node bounding box and select the lowest y value + local lowest_y = 0 + top_layer_height = math.min(lowest_y, top_layer_height) + + processed[node.name] = true + end + end + end + if top_layer_height + dy - 1 >= cb_height then return true end + + -- We don't have room + mcl_log("No room for mob "..self.name.." at "..minetest.pos_to_string(vector.round(pos))) + return false end mcl_mobs.custom_biomecheck = nil From 4d58f63485945709e8026e32a377f6bbe30fc265 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 24 Jun 2024 08:53:20 -0500 Subject: [PATCH 146/273] Implement partial node spawning check --- mods/ENTITIES/mcl_mobs/spawning.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 45516c754..43a4e5dfa 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -572,15 +572,20 @@ local function has_room(self,pos) local processed = {} for x = p1.x,p2.x do for z = p1.z,p2.z do - local node = minetest.get_node(vector.new(x,p2.y,z)) or { name = "ignore" } - if not processed[node.name] then - local nodedef = minetest.registered_nodes + local test_pos = vector.new(x,p2.y,z) + local node = minetest.get_node(test_pos) or { name = "ignore" } + local cache_name = string.format("%s-%d", node.name, node.param2) + if not processed[cache_name] then + -- Calculate node bounding box and select the lowest y value + local boxes = minetest.get_node_boxes("collision_box", test_pos, node) + for i = 1,#boxes do + local box = boxes[i] + local y_test = box[2] + 0.5 + if y_test < top_layer_height then top_layer_height = y_test end - -- TODO: calculate node bounding box and select the lowest y value - local lowest_y = 0 - top_layer_height = math.min(lowest_y, top_layer_height) - - processed[node.name] = true + local y_test = box[5] + 0.5 + if y_test < top_layer_height then top_layer_height = y_test end + end end end end From c41ce8ba59d4770199a771788abdeae181ab138b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 24 Jun 2024 09:36:22 -0500 Subject: [PATCH 147/273] Make spiders require 3x1x3 space to spawn --- mods/ENTITIES/mobs_mc/spider.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index d01c7afbe..7fd8909ba 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -67,6 +67,7 @@ local spider = { curiosity = 10, head_yaw="z", collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7}, + spawnbox = {-1.2, -0.01, -1.2, 1.2, 0.89, 1.2}, visual = "mesh", mesh = "mobs_mc_spider.b3d", textures = { From fa3df0d8c6920bdf411f9aed07afd28a557ef7bf Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 26 Jun 2024 15:56:21 -0500 Subject: [PATCH 148/273] Add check for presence of minetest.get_node_boxes before attempting sub-node space checks --- mods/ENTITIES/mcl_mobs/spawning.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 43a4e5dfa..987918e99 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -561,6 +561,9 @@ local function has_room(self,pos) local n = #minetest.find_nodes_in_area(p1,p2,nodes) or 0 if n == ( dx * dz * dz ) then return true end + -- If we don't have an implementation of get_node_boxes, we can't check for sub-node space + if not minetest.get_node_boxes then return false end + -- Make sure the entire volume except for the top level is free before checking the top layer if dy > 1 then n = #minetest.find_nodes_in_area(p1, vector.offset(p2, 0, -1, 0), nodes) From 15efd00a29b415221e4da17f91ab858648004829 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 26 Jun 2024 19:18:53 -0500 Subject: [PATCH 149/273] Replace second call to minetest.find_nodes_in_area with checking top layer for matching nodes, change p2 calculation to use ceil(value) - 1, fix dx*dy*dz calculation --- mods/ENTITIES/mcl_mobs/spawning.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 987918e99..515b96e66 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -550,23 +550,31 @@ local function has_room(self,pos) local cb_height = cb[5] - cb[2] local p2 = vector.offset(p1,cb[4] - cb[1], cb_height, cb[6] - cb[3]) - p2.x = math.floor(p2.x) - p2.y = math.floor(p2.y) - p2.z = math.floor(p2.z) + p2.x = math.ceil(p2.x) - 1 + p2.y = math.ceil(p2.y) - 1 + p2.z = math.ceil(p2.z) - 1 -- Check if the entire spawn volume is free local dx = p2.x - p1.x + 1 local dy = p2.y - p1.y + 1 local dz = p2.z - p1.z + 1 - local n = #minetest.find_nodes_in_area(p1,p2,nodes) or 0 - if n == ( dx * dz * dz ) then return true end + local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) or 0 + local n = #found_nodes + if n == ( dx * dy * dz ) then return true end -- If we don't have an implementation of get_node_boxes, we can't check for sub-node space if not minetest.get_node_boxes then return false end -- Make sure the entire volume except for the top level is free before checking the top layer if dy > 1 then - n = #minetest.find_nodes_in_area(p1, vector.offset(p2, 0, -1, 0), nodes) + -- Remove nodes in the top layer from the count + for i = 1,#found_nodes do + if found_nodes[i].y == p2.y then + n = n - 1 + end + end + + -- If the entire volume except the top layer isn't air (or nodes) then we can't spawn this mob here if n < (dx * dz * ( dy - 1)) then return false end end From 8ef08128b16a92013fef80810a72f437e411fc70 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 26 Jun 2024 19:24:55 -0500 Subject: [PATCH 150/273] Add short circuit if sub-node space check isn't possible: --- mods/ENTITIES/mcl_mobs/spawning.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 515b96e66..86c942be0 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -565,6 +565,10 @@ local function has_room(self,pos) -- If we don't have an implementation of get_node_boxes, we can't check for sub-node space if not minetest.get_node_boxes then return false end + -- Check if it's possible for a sub-node space check to succeed + local needed_in_bottom_section = (dx * dz * ( dy - 1)) + if n < needed_in_bottom_section then return false end + -- Make sure the entire volume except for the top level is free before checking the top layer if dy > 1 then -- Remove nodes in the top layer from the count @@ -575,7 +579,7 @@ local function has_room(self,pos) end -- If the entire volume except the top layer isn't air (or nodes) then we can't spawn this mob here - if n < (dx * dz * ( dy - 1)) then return false end + if n < needed_in_bottom_section then return false end end -- Check the top layer to see if we have enough space to spawn in From 6c50e0a82b97c118eedcc370df2bd2ade8ae50fa Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 13 Sep 2024 17:10:05 -0500 Subject: [PATCH 151/273] Fix volume used for room check during spawn, make mcl_mobs.spawn check for room before adding entity, change iron golems and mob spawners to use mcl_mobs.spawn --- mods/CORE/mcl_util/init.lua | 12 ++++++++ mods/ENTITIES/mcl_mobs/spawning.lua | 40 +++++++++++++++++++-------- mods/ENTITIES/mobs_mc/villager.lua | 18 +++++++----- mods/ITEMS/mcl_mobspawners/init.lua | 43 ++++++++++------------------- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 1f53feef7..36cbf2e63 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -48,6 +48,18 @@ function table.pairs_by_keys(t, f) return iter end +local function table.pull_random_items(table) + local count = #table + return function() + local idx = math.random(count) + local res = table[idx] + table[idx] = table[count] + table[count] = nil + count = count - 1 + return res + end +end + local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false) local LOG_MODULE = "[MCL2]" function mcl_util.mcl_log(message, module, bypass_default_logger) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 86c942be0..8a2e099cf 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -530,7 +530,7 @@ local function get_water_spawn(p) end end -local function has_room(self,pos) +local function has_room(self, pos) local cb = self.spawnbox or self.collisionbox local nodes = {} if self.fly_in then @@ -543,16 +543,16 @@ local function has_room(self,pos) end table.insert(nodes,"air") - local p1 = vector.offset(pos,cb[1],cb[2] + 1,cb[3]) - p1.x = math.floor(p1.x) - p1.y = math.floor(p1.y) - p1.z = math.floor(p1.z) - + -- Calculate area to check for room local cb_height = cb[5] - cb[2] - local p2 = vector.offset(p1,cb[4] - cb[1], cb_height, cb[6] - cb[3]) - p2.x = math.ceil(p2.x) - 1 - p2.y = math.ceil(p2.y) - 1 - p2.z = math.ceil(p2.z) - 1 + local p1 = vector.new( + math.round(pos.x + cb[1]), + pos.y, + math.round(pos.z + cb[3])) + local p2 = vector.new( + math.round(pos.x + cb[4]), + math.ceil(p1.y + cb_height) - 1, + math.round(pos.z + cb[6])) -- Check if the entire spawn volume is free local dx = p2.x - p1.x + 1 @@ -560,7 +560,23 @@ local function has_room(self,pos) local dz = p2.z - p1.z + 1 local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) or 0 local n = #found_nodes - if n == ( dx * dy * dz ) then return true end + --[[ + minetest.log(dump({ + cb = cb, + pos = pos, + n = n, + dx = dx, + dy = dy, + dz = dz, + p1 = p1, + p2 = p2, + found_nodes = found_nodes, + nodes = nodes, + })) + ]] + if n == ( dx * dy * dz ) then + return true + end -- If we don't have an implementation of get_node_boxes, we can't check for sub-node space if not minetest.get_node_boxes then return false end @@ -699,10 +715,10 @@ function mcl_mobs.spawn(pos,id) if not pos or not id then return false end local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id] if not def or not def.is_mob or (def.can_spawn and not def.can_spawn(pos)) then return false end + if not has_room(def, pos) then return false end return minetest.add_entity(pos, def.name) end - local function spawn_group(p,mob,spawn_on,amount_to_spawn) local nn= minetest.find_nodes_in_area_under_air(vector.offset(p,-5,-3,-5),vector.offset(p,5,3,5),spawn_on) local o diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 47b4cb470..76cf2715d 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -1049,14 +1049,18 @@ local function has_summon_participants(self) end local function summon_golem(self) - vector.offset(self.object:get_pos(),-10,-10,-10) - local nn = minetest.find_nodes_in_area_under_air(vector.offset(self.object:get_pos(),-10,-10,-10),vector.offset(self.object:get_pos(),10,10,10),{"group:solid","group:water"}) - table.shuffle(nn) - for _,n in pairs(nn) do - local up = minetest.find_nodes_in_area(vector.offset(n,0,1,0),vector.offset(n,0,3,0),{"air"}) - if up and #up >= 3 then + local pos = self.object:get_pos() + local p1 = vector.offset(pos, -10, -10, -10) + local p2 = vector.offset(pos, 10, 10, 10) + local nn = minetest.find_nodes_in_area_under_air(p1, p2,{"group:solid","group:water"}) + for n in table.pull_random_items(nn) do + n.y = n.y + 1 + minetest.log("trying to summon golem at "..vector.to_string(n)) + + local summon = mcl_mobs.spawn(n, "mobs_mc:iron_golem") + if summon then minetest.sound_play("mcl_portals_open_end_portal", {pos=n, gain=0.5, max_hear_distance = 16}, true) - return minetest.add_entity(vector.offset(n,0,1,0),"mobs_mc:iron_golem") + return summon end end end diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index f2ee44ab1..13fc1010e 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -147,20 +147,14 @@ local function spawn_mobs(pos, elapsed) -- get meta local meta = minetest.get_meta(pos) - -- get settings - local mob = meta:get_string("Mob") - local mlig = meta:get_int("MinLight") - local xlig = meta:get_int("MaxLight") - local num = meta:get_int("MaxMobsInArea") - local pla = meta:get_int("PlayerDistance") - local yof = meta:get_int("YOffset") - -- if amount is 0 then do nothing + local num = meta:get_int("MaxMobsInArea") if num == 0 then return end -- are we spawning a registered mob? + local mob = meta:get_string("Mob") if not mcl_mobs.spawning_mobs[mob] then minetest.log("error", "[mcl_mobspawners] Mob Spawner: Mob doesn't exist: "..mob) return @@ -174,17 +168,14 @@ local function spawn_mobs(pos, elapsed) local timer = minetest.get_node_timer(pos) -- spawn mob if player detected and in range + local pla = meta:get_int("PlayerDistance") if pla > 0 then - local in_range = 0 local objs = minetest.get_objects_inside_radius(pos, pla) for _,oir in pairs(objs) do - if oir:is_player() then - in_range = 1 - break end end @@ -213,7 +204,6 @@ local function spawn_mobs(pos, elapsed) -- count mob objects of same type in area for k, obj in ipairs(objs) do - ent = obj:get_luaentity() if ent and ent.name and ent.name == mob then @@ -228,31 +218,28 @@ local function spawn_mobs(pos, elapsed) end -- find air blocks within 8×3×8 nodes of spawner + local yof = meta:get_int("YOffset") local air = minetest.find_nodes_in_area( {x = pos.x - 4, y = pos.y - 1 + yof, z = pos.z - 4}, {x = pos.x + 4, y = pos.y + 1 + yof, z = pos.z + 4}, {"air"}) - -- spawn up to 4 mobs in random air blocks + -- spawn mobs in random air blocks. Default max of 4 if air then - local max = 4 - if spawn_count_overrides[mob] then - max = spawn_count_overrides[mob] - end - for a=1, max do - if #air <= 0 then - -- We're out of space! Stop spawning - break - end - local air_index = math.random(#air) - local pos2 = air[air_index] - local lig = minetest.get_node_light(pos2) or 0 + local num_to_spawn = spawn_count_overrides[mob] or 4 + local mlig = meta:get_int("MinLight") + local xlig = meta:get_int("MaxLight") - pos2.y = pos2.y + 0.5 + for pos2 = table.pull_random_items(air) do + local pos2 = air[air_index] -- only if light levels are within range + local lig = minetest.get_node_light(pos2) or 0 if lig >= mlig and lig <= xlig then - minetest.add_entity(pos2, mob) + if mcl_mobs.spawn(pos2, mob) then + num_to_spawn = num_to_spawn - 1 + if num_to_spawn == 0 then break end + end end table.remove(air, air_index) end From e65370b8455cc4a68df6369927aaf9e1260e631f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 13 Sep 2024 17:36:19 -0500 Subject: [PATCH 152/273] Fixes --- mods/CORE/mcl_util/init.lua | 2 +- mods/ENTITIES/mobs_mc/villager.lua | 1 - mods/ITEMS/mcl_mobspawners/init.lua | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 36cbf2e63..15f935a41 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -48,7 +48,7 @@ function table.pairs_by_keys(t, f) return iter end -local function table.pull_random_items(table) +function table.pull_random_items(table) local count = #table return function() local idx = math.random(count) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 76cf2715d..e80518e48 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -1055,7 +1055,6 @@ local function summon_golem(self) local nn = minetest.find_nodes_in_area_under_air(p1, p2,{"group:solid","group:water"}) for n in table.pull_random_items(nn) do n.y = n.y + 1 - minetest.log("trying to summon golem at "..vector.to_string(n)) local summon = mcl_mobs.spawn(n, "mobs_mc:iron_golem") if summon then diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 13fc1010e..80f57faa8 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -230,9 +230,7 @@ local function spawn_mobs(pos, elapsed) local mlig = meta:get_int("MinLight") local xlig = meta:get_int("MaxLight") - for pos2 = table.pull_random_items(air) do - local pos2 = air[air_index] - + for pos2 in table.pull_random_items(air) do -- only if light levels are within range local lig = minetest.get_node_light(pos2) or 0 if lig >= mlig and lig <= xlig then @@ -241,7 +239,6 @@ local function spawn_mobs(pos, elapsed) if num_to_spawn == 0 then break end end end - table.remove(air, air_index) end end From 31a3788ce157eb5f8ff6a4cb79db25cbad1dc94c Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 13 Sep 2024 20:24:34 -0500 Subject: [PATCH 153/273] Address review comments --- mods/CORE/mcl_util/init.lua | 20 +++++++++++--------- mods/ENTITIES/mcl_mobs/spawning.lua | 4 ++-- mods/ENTITIES/mobs_mc/villager.lua | 3 ++- mods/ITEMS/mcl_mobspawners/init.lua | 3 ++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 15f935a41..6143bfb41 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -48,16 +48,18 @@ function table.pairs_by_keys(t, f) return iter end -function table.pull_random_items(table) +-- Removes one element randomly selected from the array section of the table and +-- returns it, or nil if there are no elements in the array section of the table +function table.remove_random_element(table) local count = #table - return function() - local idx = math.random(count) - local res = table[idx] - table[idx] = table[count] - table[count] = nil - count = count - 1 - return res - end + if count == 0 then return nil end + + local idx = math.random(count) + local res = table[idx] + table[idx] = table[count] + table[count] = nil + count = count - 1 + return res end local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 8a2e099cf..d5ebe8788 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -574,7 +574,7 @@ local function has_room(self, pos) nodes = nodes, })) ]] - if n == ( dx * dy * dz ) then + if n == dx * dy * dz then return true end @@ -582,7 +582,7 @@ local function has_room(self, pos) if not minetest.get_node_boxes then return false end -- Check if it's possible for a sub-node space check to succeed - local needed_in_bottom_section = (dx * dz * ( dy - 1)) + local needed_in_bottom_section = dx * ( dy - 1) * dz if n < needed_in_bottom_section then return false end -- Make sure the entire volume except for the top level is free before checking the top layer diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index e80518e48..5ea20c707 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -1053,7 +1053,8 @@ local function summon_golem(self) local p1 = vector.offset(pos, -10, -10, -10) local p2 = vector.offset(pos, 10, 10, 10) local nn = minetest.find_nodes_in_area_under_air(p1, p2,{"group:solid","group:water"}) - for n in table.pull_random_items(nn) do + while #nn > 0 do + local n = table.remove_random_element(nn) n.y = n.y + 1 local summon = mcl_mobs.spawn(n, "mobs_mc:iron_golem") diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 80f57faa8..5c934a819 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -230,7 +230,8 @@ local function spawn_mobs(pos, elapsed) local mlig = meta:get_int("MinLight") local xlig = meta:get_int("MaxLight") - for pos2 in table.pull_random_items(air) do + while #air > 0 do + local pos2 = table.remove_random_element(air) -- only if light levels are within range local lig = minetest.get_node_light(pos2) or 0 if lig >= mlig and lig <= xlig then From 626bdd13d8538e13dd7093cc61460a8062b6b9ef Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 13 Sep 2024 21:31:04 -0500 Subject: [PATCH 154/273] Change several places where mobs are created to use mcl_mobs.spawn() instead of minetest.add_entity() --- mods/ENTITIES/mcl_mobs/breeding.lua | 3 +- mods/ENTITIES/mcl_mobs/init.lua | 25 +++++++++-------- mods/ENTITIES/mcl_mobs/spawning.lua | 32 +++++++++++----------- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 12 ++++---- mods/ENTITIES/mobs_mc/villager_evoker.lua | 14 ++++++---- mods/ENVIRONMENT/lightning/init.lua | 7 ++--- 6 files changed, 50 insertions(+), 43 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/breeding.lua b/mods/ENTITIES/mcl_mobs/breeding.lua index 90e625db8..559195681 100644 --- a/mods/ENTITIES/mcl_mobs/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/breeding.lua @@ -105,7 +105,7 @@ end -- Spawn a child function mcl_mobs.spawn_child(pos, mob_type) - local child = minetest.add_entity(pos, mob_type) + local child = mcl_mobs.spawn(pos, mob_type) if not child then return end @@ -285,6 +285,7 @@ function mob_class:check_breeding() end local child = mcl_mobs.spawn_child(pos, parent1.name) + if not child then return end local ent_c = child:get_luaentity() diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 81b5fdfe7..74e6edbec 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -528,7 +528,7 @@ end -- Note: This also introduces the “spawn_egg” group: -- * spawn_egg=1: Spawn egg (generic mob, no metadata) -- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata) -function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addegg, no_creative) +function mcl_mobs.register_egg(mob_id, desc, background_color, overlay_color, addegg, no_creative) local grp = {spawn_egg = 1} @@ -539,7 +539,7 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg local invimg = "(spawn_egg.png^[multiply:" .. background_color ..")^(spawn_egg_overlay.png^[multiply:" .. overlay_color .. ")" if old_spawn_icons then - local mobname = mob:gsub("mobs_mc:","") + local mobname = mob_id:gsub("mobs_mc:","") local fn = "mobs_mc_spawn_icon_"..mobname..".png" if mcl_util.file_exists(minetest.get_modpath("mobs_mc").."/textures/"..fn) then invimg = fn @@ -551,7 +551,7 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg end -- register old stackable mob egg - minetest.register_craftitem(mob, { + minetest.register_craftitem(mob_id, { description = desc, inventory_image = invimg, @@ -561,7 +561,6 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg _doc_items_usagehelp = S("Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns."), on_place = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.above -- am I clicking on something with existing on_rightclick function? @@ -571,11 +570,12 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return def.on_rightclick(pointed_thing.under, under, placer, itemstack) end + local mob_name = itemstack:get_name() + if pos and within_limits(pos, 0) and not minetest.is_protected(pos, placer:get_player_name()) then local name = placer:get_player_name() local privs = minetest.get_player_privs(name) - if under.name == "mcl_mobspawners:spawner" then if minetest.is_protected(pointed_thing.under, name) then minetest.record_protection_violation(pointed_thing.under, name) @@ -593,7 +593,6 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg --minetest.log("max light: " .. mob_light_lvl[2]) -- Handle egg conversion - local mob_name = itemstack:get_name() local convert_to = (minetest.registered_entities[mob_name] or {})._convert_to if convert_to then mob_name = convert_to end @@ -604,19 +603,24 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return itemstack end - if not minetest.registered_entities[mob] then + if not minetest.registered_entities[mob_name] then return itemstack end if minetest.settings:get_bool("only_peaceful_mobs", false) - and minetest.registered_entities[mob].type == "monster" then + and minetest.registered_entities[mob_name].type == "monster" then minetest.chat_send_player(name, S("Only peaceful mobs allowed!")) return itemstack end - pos.y = pos.y - 0.5 + pos.y = pos.y - 1 + local mob = mcl_mobs.spawn(pos, mob_name) + if not object then + pos.y = pos.y + 1 + mob = mcl_mobs.spawn(pos, mob_name) + if not mob then return end + end - local mob = minetest.add_entity(pos, mob) local entityname = itemstack:get_name() minetest.log("action", "Player " ..name.." spawned "..entityname.." at "..minetest.pos_to_string(pos)) local ent = mob:get_luaentity() @@ -647,5 +651,4 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg return itemstack end, }) - end diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index d5ebe8788..332603392 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -1,4 +1,5 @@ --lua locals +local DEBUG = false local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs local mob_class = mcl_mobs.mob_class @@ -547,7 +548,7 @@ local function has_room(self, pos) local cb_height = cb[5] - cb[2] local p1 = vector.new( math.round(pos.x + cb[1]), - pos.y, + math.floor(pos.y), math.round(pos.z + cb[3])) local p2 = vector.new( math.round(pos.x + cb[4]), @@ -560,20 +561,20 @@ local function has_room(self, pos) local dz = p2.z - p1.z + 1 local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) or 0 local n = #found_nodes - --[[ - minetest.log(dump({ - cb = cb, - pos = pos, - n = n, - dx = dx, - dy = dy, - dz = dz, - p1 = p1, - p2 = p2, - found_nodes = found_nodes, - nodes = nodes, - })) - ]] + if DEBUG then + minetest.log(dump({ + cb = cb, + pos = pos, + n = n, + dx = dx, + dy = dy, + dz = dz, + p1 = p1, + p2 = p2, + found_nodes = found_nodes, + nodes = nodes, + })) + end if n == dx * dy * dz then return true end @@ -623,7 +624,6 @@ local function has_room(self, pos) if top_layer_height + dy - 1 >= cb_height then return true end -- We don't have room - mcl_log("No room for mob "..self.name.." at "..minetest.pos_to_string(vector.round(pos))) return false end diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index fa9d24d09..57eb5a859 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -53,12 +53,14 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) eject_speed = eject_speed * 0.5 end end - local mob = minetest.add_entity(newpos, child_mob) - if not mother_stuck then - mob:set_velocity(dir * eject_speed) + local mob = mcl_mobs.spawn(newpos, child_mob) + if mob then + if not mother_stuck then + mob:set_velocity(dir * eject_speed) + end + mob:set_yaw(angle - math.pi/2) + table.insert(children, mob) end - mob:set_yaw(angle - math.pi/2) - table.insert(children, mob) angle = angle + (math.pi*2) / spawn_count end -- If mother was murdered, children attack the killer after 1 second diff --git a/mods/ENTITIES/mobs_mc/villager_evoker.lua b/mods/ENTITIES/mobs_mc/villager_evoker.lua index 9d465c25d..2dc175341 100644 --- a/mods/ENTITIES/mobs_mc/villager_evoker.lua +++ b/mods/ENTITIES/mobs_mc/villager_evoker.lua @@ -55,14 +55,16 @@ mcl_mobs.register_mob("mobs_mc:evoker", { basepos.y = basepos.y + 1 for i=1, r do local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360))) - local vex = minetest.add_entity(spawnpos, "mobs_mc:vex") - local ent = vex:get_luaentity() + local vex = mcl_mobs.spawn(spawnpos, "mobs_mc:vex") + if vex then + local ent = vex:get_luaentity() - -- Mark vexes as summoned and start their life clock (they take damage it reaches 0) - ent._summoned = true - ent._lifetimer = pr:next(33, 108) + -- Mark vexes as summoned and start their life clock (they take damage it reaches 0) + ent._summoned = true + ent._lifetimer = pr:next(33, 108) - table.insert(spawned_vexes[self],ent) + table.insert(spawned_vexes[self],ent) + end end end, passive = false, diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 079c9cb38..d4756bd9f 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -19,7 +19,6 @@ local set_node = minetest.set_node local sound_play = minetest.sound_play local add_particlespawner = minetest.add_particlespawner local after = minetest.after -local add_entity = minetest.add_entity local get_objects_inside_radius = minetest.get_objects_inside_radius local get_item_group = minetest.get_item_group @@ -165,7 +164,7 @@ function lightning.strike_func(pos, pos2, objects) -- Events caused by the lightning strike: Fire, damage, mob transformations, rare skeleton spawn - pos2.y = pos2.y + 1/2 + pos2.y = pos2.y + 1 local skeleton_lightning = false if rng:next(1,100) <= 3 then skeleton_lightning = true @@ -174,14 +173,14 @@ function lightning.strike_func(pos, pos2, objects) if get_node(pos2).name == "air" then -- Low chance for a lightning to spawn skeleton horse + skeletons if skeleton_lightning then - add_entity(pos2, "mobs_mc:skeleton_horse") + mcl_mobs.spawn(pos2, "mobs_mc:skeleton_horse") local angle, posadd angle = math.random() * math.pi * 2 for i=1,3 do posadd = { x=math.cos(angle),y=0,z=math.sin(angle) } posadd = vector.normalize(posadd) - local mob = add_entity(vector.add(pos2, posadd), "mobs_mc:skeleton") + local mob = mcl_mobs.spawn(vector.add(pos2, posadd), "mobs_mc:skeleton") if mob then mob:set_yaw(angle-math.pi/2) end From 0b62c827aa965990595471391bc8431acf1d3ada Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 13 Sep 2024 21:31:26 -0500 Subject: [PATCH 155/273] Remove has_room debug data --- mods/ENTITIES/mcl_mobs/spawning.lua | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 332603392..8436540bf 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -1,5 +1,4 @@ --lua locals -local DEBUG = false local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs local mob_class = mcl_mobs.mob_class @@ -561,20 +560,6 @@ local function has_room(self, pos) local dz = p2.z - p1.z + 1 local found_nodes = minetest.find_nodes_in_area(p1,p2,nodes) or 0 local n = #found_nodes - if DEBUG then - minetest.log(dump({ - cb = cb, - pos = pos, - n = n, - dx = dx, - dy = dy, - dz = dz, - p1 = p1, - p2 = p2, - found_nodes = found_nodes, - nodes = nodes, - })) - end if n == dx * dy * dz then return true end From 79e8452f6245322eb57860fade34cacf12569b91 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 18 Aug 2024 18:59:57 +0200 Subject: [PATCH 156/273] Soul speed works on soul soil too (needs localization) --- mods/ITEMS/mcl_enchanting/enchantments.lua | 2 +- mods/PLAYER/mcl_playerplus/init.lua | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index 44b3a5bd6..64fe2ac09 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -691,7 +691,7 @@ mcl_enchanting.enchantments.soul_speed = { disallow = {non_combat_armor = true}, incompatible = {frost_walker = true}, weight = 2, - description = S("Increases walking speed on soul sand."), + description = S("Increases walking speed on soul sand and soul soil."), curse = false, on_enchant = function() end, requires_tool = false, diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e40411c10..a467786f2 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -514,13 +514,18 @@ minetest.register_globalstep(function(dtime) return end - -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots) - if node_stand == "mcl_nether:soul_sand" then + local boots = player:get_inventory():get_stack("armor", 5) + local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") + + -- Standing on soul soil? If so, apply Soul Speed bonus + if node_stand == "mcl_blackstone:soul_soil" and soul_speed > 0 then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) + + -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus) + elseif node_stand == "mcl_nether:soul_sand" then -- TODO: Tweak walk speed -- TODO: Also slow down mobs -- Slow down even more when soul sand is above certain block - local boots = player:get_inventory():get_stack("armor", 5) - local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") if soul_speed > 0 then playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) else From e2bcd129c1ec881397c89ae854ce9d6ea4f02801 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Mon, 19 Aug 2024 19:41:34 +0200 Subject: [PATCH 157/273] Use soul_block group for soul speed bonus --- mods/PLAYER/mcl_playerplus/init.lua | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index a467786f2..a4af9d000 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -517,23 +517,26 @@ minetest.register_globalstep(function(dtime) local boots = player:get_inventory():get_stack("armor", 5) local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed") - -- Standing on soul soil? If so, apply Soul Speed bonus - if node_stand == "mcl_blackstone:soul_soil" and soul_speed > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) - - -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus) - elseif node_stand == "mcl_nether:soul_sand" then - -- TODO: Tweak walk speed - -- TODO: Also slow down mobs - -- Slow down even more when soul sand is above certain block - if soul_speed > 0 then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) - else - if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.1) + -- Standing on a soul block? If so, check for speed bonus / penalty + if get_item_group(node_stand, "soul_block") ~= 0 then + + -- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus) + if node_stand == "mcl_nether:soul_sand" then + -- TODO: Tweak walk speed + -- TODO: Also slow down mobs + -- Slow down even more when soul sand is above certain block + if soul_speed > 0 then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) else - playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4) + if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.1) + else + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4) + end end + elseif soul_speed > 0 then + -- Standing on a different soul block? If so, apply Soul Speed bonus unconditionally + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) end else playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:soul_speed") From de3b34f5eac9abd3cce4e09303192db524f61c18 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sat, 31 Aug 2024 15:43:29 +0200 Subject: [PATCH 158/273] Update English translation keys with soul soil --- mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr | 2 +- mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr | 2 +- mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr | 2 +- mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr | 2 +- mods/ITEMS/mcl_enchanting/locale/template.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr index ecc08b5dc..d8d97a677 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr @@ -68,7 +68,7 @@ Mined blocks drop themselves.=Abgebaute Blöcke werfen sich selbst ab. Smite=Qual Increases damage to undead mobs.=Erhöht Schaden für untote Mobs. Soul Speed=Schnelle Seele -Increases walking speed on soul sand.=Erhöht Gehgeschwindigkeit auf Seelensand. +Increases walking speed on soul sand and soul soil.=Erhöht Gehgeschwindigkeit auf Seelensand. Sweeping Edge=Schwungklinge Increases sweeping attack damage.=Erhöht Schwungangriffsschaden. Thorns=Dornen diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr index a977e8fe6..2b76b8af6 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr @@ -36,7 +36,7 @@ Increases mob loot.=Incrementa el botín de los enemigos. Increases rate of good loot (enchanting books, etc.)=Incrementa la probabilidad de encontrar tesoros. Increases sweeping attack damage.=Incrementa el daño de efecto area. Increases underwater movement speed.=Incrementa la velocidad de nado bajo el agua. -Increases walking speed on soul sand.=Incrementa la velocidad al caminar sobre arena de Almas. +Increases walking speed on soul sand and soul soil.=Incrementa la velocidad al caminar sobre arena de Almas. Infinity=Infinidad Item destroyed on death.=El objeto se destruye tras tu muerte. Knockback=Empuje diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr index 23cf257da..e05a91fd7 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr @@ -36,7 +36,7 @@ Increases mob loot.=Augmente le butin des mobs. Increases rate of good loot (enchanting books, etc.)=Augmente le taux de bon butin (livres enchanteurs, etc.) Increases sweeping attack damage.=Augmente les dégâts de l'épée Increases underwater movement speed.=Augmente la vitesse de déplacement sous l'eau. -Increases walking speed on soul sand.=Augmente la vitesse de marche sur le sable des âmes. +Increases walking speed on soul sand and soul soil.=Augmente la vitesse de marche sur le sable des âmes. Infinity=Infinité Item destroyed on death.=Objet détruit à la mort. Knockback=Recul diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr index 1983ec4d4..d539c35a1 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ja.tr @@ -36,7 +36,7 @@ Increases mob loot.=MOBの戦利品が増加します。 Increases rate of good loot (enchanting books, etc.)=釣果の質が良くなります(エンチャントの本など)。 Increases sweeping attack damage.=なぎ払い攻撃のダメージが増加します。 Increases underwater movement speed.=水中での横移動速度が増加します。 -Increases walking speed on soul sand.=ソウルサンドとソウルソイルの上を歩く速度が増加します。 +Increases walking speed on soul sand and soul soil.=ソウルサンドとソウルソイルの上を歩く速度が増加します。 Infinity=無限 Item destroyed on death.=死亡時にアイテムが消滅します。 Knockback=ノックバック diff --git a/mods/ITEMS/mcl_enchanting/locale/template.txt b/mods/ITEMS/mcl_enchanting/locale/template.txt index 2a0890d91..99dca7a55 100644 --- a/mods/ITEMS/mcl_enchanting/locale/template.txt +++ b/mods/ITEMS/mcl_enchanting/locale/template.txt @@ -36,7 +36,7 @@ Increases mob loot.= Increases rate of good loot (enchanting books, etc.)= Increases sweeping attack damage.= Increases underwater movement speed.= -Increases walking speed on soul sand.= +Increases walking speed on soul sand and soul soil.= Infinity= Item destroyed on death.= Knockback= From eea96867c4c1322fc40ae8a066206e2da3920901 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 18 Sep 2024 10:10:53 +0200 Subject: [PATCH 159/273] Don't add rain skycolor layer if the current layer is already the rain skycolor (#4648) Fixes #4647 Rain makes the sky black until restart. This also fixes a memory leak caused by rain adding a color layer every time step. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4648 Reviewed-by: the-real-herowl Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ENVIRONMENT/mcl_weather/rain.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 00dc2f6eb..ed6c2c5fb 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -60,13 +60,15 @@ end -- set skybox based on time (uses skycolor api) function mcl_weather.rain.set_sky_box() if mcl_weather.state == "rain" then - mcl_weather.skycolor.add_layer( - "weather-pack-rain-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=98}, - {r=135, g=135, b=151}, - {r=85, g=86, b=98}, - {r=0, g=0, b=0}}) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-rain-sky" then + mcl_weather.skycolor.add_layer( + "weather-pack-rain-sky", + {{r=0, g=0, b=0}, + {r=85, g=86, b=98}, + {r=135, g=135, b=151}, + {r=85, g=86, b=98}, + {r=0, g=0, b=0}}) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#5D5D5FE8"}) From 011be754ca65ddd04bbccf7ea5c6aaf80176217b Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 18 Sep 2024 10:11:55 +0200 Subject: [PATCH 160/273] Allow deepslate copper to be mined with stone pickaxe (#4635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4635 Reviewed-by: Mikita Wiśniewski Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_deepslate/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index f13c1319d..d9a9c7021 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -111,7 +111,7 @@ for _, p in pairs(deepslate_ores) do end if copper_mod then - register_deepslate_ore("Copper", "mcl_copper:raw_copper", "mcl_copper:copper_ingot", 4, 4) + register_deepslate_ore("Copper", "mcl_copper:raw_copper", "mcl_copper:copper_ingot", 3, 4) end local redstone_timer = 68.28 From 513413afc719a8c6c95ddbf5302c7528698772d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Thu, 19 Sep 2024 18:54:39 +0200 Subject: [PATCH 161/273] Use `remove_node` instead of `dig_node` in mcl_core ABMs (fixes #4628) (#4629) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mycelium ABM has been left untouched because of the potential destructiveness. If we ever find that to be an issue, it can be fixed as part of a bigger PR. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4629 Reviewed-by: teknomunk Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ITEMS/mcl_core/functions.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index eec432184..596a9c875 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -161,7 +161,7 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) liquid_flow_action(pos, "water", function(pos) drop_attached_node(pos) - minetest.dig_node(pos) + minetest.remove_node(pos) end) end, }) @@ -217,7 +217,8 @@ minetest.register_abm({ while true do local node = minetest.get_node(lpos) if not node or node.name ~= "mcl_core:cactus" then break end - minetest.dig_node(lpos) + -- minetest.dig_node ignores protected nodes and causes infinite drop (#4628) + minetest.remove_node(lpos) dx = dx or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 dy = dy or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 local obj = minetest.add_item(vector.offset(lpos, dx, 0.25, dy), "mcl_core:cactus") From d264ba70d8be578146401a135b7c0d6818879de2 Mon Sep 17 00:00:00 2001 From: kno10 Date: Fri, 20 Sep 2024 14:00:49 +0200 Subject: [PATCH 162/273] Fix growth logic, clean up mcl_farming/shared_functions (#4640) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4640 Reviewed-by: teknomunk Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_dye/init.lua | 2 +- mods/ITEMS/mcl_farming/shared_functions.lua | 482 ++++++++------------ 2 files changed, 201 insertions(+), 283 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index c14f7eaeb..b35904fc4 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -283,7 +283,7 @@ local function apply_bone_meal(pointed_thing, user) if n.name == "mcl_farming:sweet_berry_bush_3" then return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") else - return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true) + return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 1, true) end elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then mcl_dye.add_bone_meal_particle(pos) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index f597e786a..241e61c56 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -1,81 +1,79 @@ +-- Possible future improvements: +-- * rewrite to use node timers instead of ABMs, but needs benchmarking +-- * redesign the catch-up logic +-- * switch to exponentially-weighted moving average for light instead using a single variable to conserve IO +-- local math = math -local tostring = tostring - -mcl_farming.plant_lists = {} +local vector = vector local plant_lists = {} - +mcl_farming.plant_lists = plant_lists -- export local plant_nodename_to_id_list = {} -local function get_intervals_counter(pos, interval, chance) - local meta = minetest.get_meta(pos) - local time_speed = tonumber(minetest.settings:get("time_speed") or 72) - local current_game_time - if time_speed == nil then - return 1 - end - if (time_speed < 0.1) then - return 1 - end - local time_multiplier = 86400 / time_speed - current_game_time = .0 + ((minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier) +local time_speed = tonumber(minetest.settings:get("time_speed")) or 72 +local time_multiplier = time_speed > 0 and (86400 / time_speed) or 0 +local function get_intervals_counter(pos, interval, chance) + if time_multiplier == 0 then return 0 end + -- "wall clock time", so plants continue to grow while sleeping + local current_game_time = (minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier local approx_interval = math.max(interval, 1) * math.max(chance, 1) - local last_game_time = meta:get_string("last_gametime") - if last_game_time then - last_game_time = tonumber(last_game_time) - end - if not last_game_time or last_game_time < 1 then - last_game_time = current_game_time - approx_interval / 10 + local meta = minetest.get_meta(pos) + local last_game_time = meta:get_float("last_gametime") + if last_game_time < 1 then + last_game_time = current_game_time - approx_interval * 0.5 elseif last_game_time == current_game_time then current_game_time = current_game_time + approx_interval end - - local elapsed_game_time = .0 + current_game_time - last_game_time - - meta:set_string("last_gametime", tostring(current_game_time)) - - return elapsed_game_time / approx_interval + meta:set_float("last_gametime", current_game_time) + return (current_game_time - last_game_time) / approx_interval end local function get_avg_light_level(pos) - local node_light = tonumber(minetest.get_node_light(pos) or 0) local meta = minetest.get_meta(pos) - local counter = meta:get_int("avg_light_count") + -- EWMA would use a single variable: + -- local avg = meta:get_float("avg_light") + -- avg = avg + (node_light - avg) * 0.985 + -- meta.set_float("avg_light", avg) local summary = meta:get_int("avg_light_summary") + local counter = meta:get_int("avg_light_count") if counter > 99 then - counter = 51 - summary = math.ceil((summary + 0.0) / 2.0) - else - counter = counter + 1 + summary, counter = math.ceil(summary * 0.5), 50 end - summary = summary + node_light - meta:set_int("avg_light_count", counter) - meta:set_int("avg_light_summary", summary) - return math.ceil((summary + 0.0) / counter) + local node_light = minetest.get_node_light(pos) + if node_light ~= nil then + summary, counter = summary + node_light, counter + 1 + meta:set_int("avg_light_summary", summary) + meta:set_int("avg_light_count", counter) + end + return math.ceil(summary / counter) end function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) - mcl_farming.plant_lists[identifier] = {} - mcl_farming.plant_lists[identifier].full_grown = full_grown - mcl_farming.plant_lists[identifier].names = names - mcl_farming.plant_lists[identifier].interval = interval - mcl_farming.plant_lists[identifier].chance = chance - plant_lists = mcl_farming.plant_lists --provide local copy of plant lists (performances) + local plant_info = {} + plant_info.full_grown = full_grown + plant_info.names = names + plant_info.interval = interval + plant_info.chance = chance + for _, nodename in pairs(names) do + plant_nodename_to_id_list[nodename] = identifier + end + plant_info.step_from_name = {} + for i, name in ipairs(names) do + plant_info.step_from_name[name] = i + end + plant_lists[identifier] = plant_info minetest.register_abm({ label = string.format("Farming plant growth (%s)", identifier), nodenames = names, interval = interval, chance = chance, action = function(pos, node) - local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) + local low_speed = minetest.get_node(vector.offset(pos, 0, -1, 0)).name ~= "mcl_farming:soil_wet" + mcl_farming:grow_plant(identifier, pos, node, 1, false, low_speed) end, }) - for _, nodename in pairs(names) do - plant_nodename_to_id_list[nodename] = identifier - end end -- Attempts to advance a plant at pos by one or more growth stages (if possible) @@ -84,56 +82,36 @@ end -- node: Node table -- stages: Number of stages to advance (optional, defaults to 1) -- ignore_light: if true, ignore light requirements for growing - +-- low_speed: grow more slowly (not wet), default false -- Returns true if plant has been grown by 1 or more stages. -- Returns false if nothing changed. function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low_speed) - local average_light_level = get_avg_light_level(pos) + stages = stages or 1 local plant_info = plant_lists[identifier] local intervals_counter = get_intervals_counter(pos, plant_info.interval, plant_info.chance) - local low_speed = low_speed or false - if low_speed then - if intervals_counter < 1.01 and math.random(0, 9) > 0 then - return - else - intervals_counter = intervals_counter / 10 - end + if stages > 0 then intervals_counters = intervals_counter - 1 end + if low_speed then -- 10% speed approximately + if intervals_counter < 1.01 and math.random(0, 9) > 0 then return false end + intervals_counter = intervals_counter / 10 end - if not minetest.get_node_light(pos) and not ignore_light and intervals_counter < 1.5 then - return false - end - if minetest.get_node_light(pos) < 10 and not ignore_light and intervals_counter < 1.5 then - return false + if not ignore_light and intervals_counter < 1.5 then + local light = minetest.get_node_light(pos) + if not light or light < 10 then return false end end if intervals_counter >= 1.5 then - if average_light_level < 0.1 then - return false - end + local average_light_level = get_avg_light_level(pos) + if average_light_level < 0.1 then return false end if average_light_level < 10 then intervals_counter = intervals_counter * average_light_level / 10 end end - local step = nil - - for i, name in ipairs(plant_info.names) do - if name == node.name then - step = i - break - end - end - if step == nil then - return false - end - if not stages then - stages = 1 - end - stages = stages + math.ceil(intervals_counter) - local new_node = { name = plant_info.names[step + stages] } - if new_node.name == nil then - new_node.name = plant_info.full_grown - end + local step = plant_info.step_from_name[node.name] + if step == nil then return false end + stages = stages + math.floor(intervals_counter) + if stages == 0 then return false end + local new_node = { name = plant_info.names[step + stages] or plant_info.full_grown } new_node.param = node.param new_node.param2 = node.param2 minetest.set_node(pos, new_node) @@ -142,12 +120,7 @@ end function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) local pt = pointed_thing - if not pt then - return - end - if pt.type ~= "node" then - return - end + if not pt or pt.type ~= "node" then return end -- Use pointed node's on_rightclick function first, if present local node = minetest.get_node(pt.under) @@ -157,22 +130,13 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) end end - local pos = { x = pt.above.x, y = pt.above.y - 1, z = pt.above.z } - local farmland = minetest.get_node(pos) - pos = { x = pt.above.x, y = pt.above.y, z = pt.above.z } - local place_s = minetest.get_node(pos) + if minetest.get_node(pt.above).name ~= "air" then return end + local farmland = minetest.registered_nodes[minetest.get_node(vector.offset(pt.above, 0, -1, 0)).name] + if not farmland or (farmland.groups.soil or 0) < 2 then return end + minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, { pos = pt.above }, true) + minetest.add_node(pt.above, { name = plantname, param2 = minetest.registered_nodes[plantname].place_param2 }) - 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) - else - return - end - - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end + if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end return itemstack end @@ -189,48 +153,41 @@ end - grow_interval: Will attempt to grow a gourd periodically at this interval in seconds - grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number - connected_stem_texture: Texture of the connected stem -- gourd_on_construct_extra: Custom on_construct extra function for the gourd. Will be called after the stem check code ]] -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) +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) local connected_stem_names = { connected_stem_basename .. "_r", connected_stem_basename .. "_l", connected_stem_basename .. "_t", - connected_stem_basename .. "_b", - } - - local neighbors = { - { x = -1, y = 0, z = 0 }, - { x = 1, y = 0, z = 0 }, - { x = 0, y = 0, z = -1 }, - { x = 0, y = 0, z = 1 }, - } + connected_stem_basename .. "_b" } -- Connect the stem at stempos to the first neighboring gourd block. -- No-op if not a stem or no gourd block found local function try_connect_stem(stempos) local stem = minetest.get_node(stempos) - if stem.name ~= full_unconnected_stem then - return false + if stem.name ~= full_unconnected_stem then return false end + -- four directions, but avoid table allocation + local neighbor = vector.offset(stempos, 1, 0, 0) + if minetest.get_node(neighbor).name == gourd_itemstring then + minetest.swap_node(stempos, { name = connected_stem_names[1] }) + return true end - for n = 1, #neighbors do - local offset = neighbors[n] - local blockpos = vector.add(stempos, offset) - local block = minetest.get_node(blockpos) - if block.name == gourd_itemstring then - if offset.x == 1 then - minetest.set_node(stempos, { name = connected_stem_names[1] }) - elseif offset.x == -1 then - minetest.set_node(stempos, { name = connected_stem_names[2] }) - elseif offset.z == 1 then - minetest.set_node(stempos, { name = connected_stem_names[3] }) - elseif offset.z == -1 then - minetest.set_node(stempos, { name = connected_stem_names[4] }) - end - return true - end + local neighbor = vector.offset(stempos, -1, 0, 0) + if minetest.get_node(neighbor).name == gourd_itemstring then + minetest.swap_node(stempos, { name = connected_stem_names[2] }) + return true + end + local neighbor = vector.offset(stempos, 0, 0, 1) + if minetest.get_node(neighbor).name == gourd_itemstring then + minetest.swap_node(stempos, { name = connected_stem_names[3] }) + return true + end + local neighbor = vector.offset(stempos, 0, 0, -1) + if minetest.get_node(neighbor).name == gourd_itemstring then + minetest.swap_node(stempos, { name = connected_stem_names[4] }) + return true end end @@ -238,29 +195,37 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if not gourd_def.after_destruct then gourd_def.after_destruct = function(blockpos, oldnode) -- Disconnect any connected stems, turning them back to normal stems - for n = 1, #neighbors do - local offset = neighbors[n] - local expected_stem = connected_stem_names[n] - local stempos = vector.add(blockpos, offset) - local stem = minetest.get_node(stempos) - if stem.name == expected_stem then - minetest.add_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) - end + -- four directions, but avoid using a table + -- opposite directions to above, as we go from groud to stem now! + local stempos = vector.offset(blockpos, -1, 0, 0) + if minetest.get_node(stempos).name == connected_stem_names[1] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) + try_connect_stem(stempos) + end + local stempos = vector.offset(blockpos, 1, 0, 0) + if minetest.get_node(stempos).name == connected_stem_names[2] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) + try_connect_stem(stempos) + end + local stempos = vector.offset(blockpos, 0, 0, -1) + if minetest.get_node(stempos).name == connected_stem_names[3] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) + try_connect_stem(stempos) + end + local stempos = vector.offset(blockpos, 0, 0, 1) + if minetest.get_node(stempos).name == connected_stem_names[4] then + minetest.swap_node(stempos, { name = full_unconnected_stem }) + try_connect_stem(stempos) end end end if not gourd_def.on_construct then function gourd_def.on_construct(blockpos) -- Connect all unconnected stems at full size - for n = 1, #neighbors do - local stempos = vector.add(blockpos, neighbors[n]) - try_connect_stem(stempos) - end - -- Call custom on_construct - if gourd_on_construct_extra then - gourd_on_construct_extra(blockpos) - end + try_connect_stem(vector.offset(blockpos, 1, 0, 0)) + try_connect_stem(vector.offset(blockpos, -1, 0, 0)) + try_connect_stem(vector.offset(blockpos, 0, 0, 1)) + try_connect_stem(vector.offset(blockpos, 0, 0, -1)) end end minetest.register_node(gourd_itemstring, gourd_def) @@ -269,72 +234,47 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s -- Default values for the stem definition if not stem_def.selection_box then - stem_def.selection_box = { - type = "fixed", - fixed = { - { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } - }, - } - end - if not stem_def.paramtype then - stem_def.paramtype = "light" - end - if not stem_def.drawtype then - stem_def.drawtype = "plantlike" - end - if stem_def.walkable == nil then - stem_def.walkable = false - end - if stem_def.sunlight_propagates == nil then - stem_def.sunlight_propagates = true - end - if stem_def.drop == nil then - stem_def.drop = stem_drop - end - if stem_def.groups == nil then - stem_def.groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, } - end - if stem_def.sounds == nil then - stem_def.sounds = mcl_sounds.node_sound_leaves_defaults() - end - - if not stem_def.on_construct then - function stem_def.on_construct(stempos) - -- Connect stem to gourd (if possible) - try_connect_stem(stempos) - end + stem_def.selection_box = { type = "fixed", fixed = { { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } } } end + stem_def.paramtype = stem_def.paramtype or "light" + stem_def.drawtype = stem_def.drawtype or "plantlike" + stem_def.walkable = stem_def.walkable or false + stem_def.sunlight_propagates = stem_def.sunlight_propagates == nil or stem_def.sunlight_propagates + stem_def.drop = stem_def.drop or stem_drop + stem_def.groups = stem_def.groups or { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 } + stem_def.sounds = stem_def.sounds or mcl_sounds.node_sound_leaves_defaults() + stem_def.on_construct = stem_def.on_construct or try_connect_stem minetest.register_node(stem_itemstring, stem_def) -- Register connected stems local connected_stem_tiles = { - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom "blank.png", -- right "blank.png", -- left connected_stem_texture, -- back - connected_stem_texture .. "^[transformFX" --front + connected_stem_texture .. "^[transformFX" -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom "blank.png", -- right "blank.png", -- left - connected_stem_texture .. "^[transformFX", --back + connected_stem_texture .. "^[transformFX", -- back connected_stem_texture, -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom connected_stem_texture .. "^[transformFX", -- right connected_stem_texture, -- left - "blank.png", --back + "blank.png", -- back "blank.png", -- front }, - { "blank.png", --top + { "blank.png", -- top "blank.png", -- bottom connected_stem_texture, -- right connected_stem_texture .. "^[transformFX", -- left - "blank.png", --back + "blank.png", -- back "blank.png", -- front } } @@ -359,17 +299,11 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s walkable = false, drop = stem_drop, drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = connected_stem_nodebox[i] - }, - selection_box = { - type = "fixed", - fixed = connected_stem_selectionbox[i] - }, + node_box = { type = "fixed", fixed = connected_stem_nodebox[i] }, + selection_box = { type = "fixed", fixed = connected_stem_selectionbox[i] }, tiles = connected_stem_tiles[i], use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, - groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, }, + groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 }, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, }) @@ -379,6 +313,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s end end + -- Check for a suitable spot to grow + local function check_neighbor_soil(blockpos) + if minetest.get_node(blockpos).name ~= "air" then return false end + local floorpos = vector.offset(blockpos, 0, -1, 0) + local floorname = minetest.get_node(floorpos).name + if floorname == "mcl_core:dirt" then return true end + local floordef = minetest.registered_nodes[floorname] + return floordef.groups.grass_block or floordef.groups.dirt or (floordef.groups.soil or 0) >= 2 + end + minetest.register_abm({ label = "Grow gourd stem to gourd (" .. full_unconnected_stem .. " → " .. gourd_itemstring .. ")", nodenames = { full_unconnected_stem }, @@ -387,67 +331,50 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s chance = grow_chance, action = function(stempos) local light = minetest.get_node_light(stempos) - if light and light > 10 then - -- Check the four neighbors and filter out neighbors where gourds can't grow - local neighbors = { - { x = -1, y = 0, z = 0 }, - { x = 1, y = 0, z = 0 }, - { x = 0, y = 0, z = -1 }, - { x = 0, y = 0, z = 1 }, - } - local floorpos, floor - for n = #neighbors, 1, -1 do - local offset = neighbors[n] - local blockpos = vector.add(stempos, offset) - floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } - floor = minetest.get_node(floorpos) - local block = minetest.get_node(blockpos) - local soilgroup = minetest.get_item_group(floor.name, "soil") - if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name == "mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then - table.remove(neighbors, n) - end + if not light or light <= 10 then return end + -- Check the four neighbors and filter out neighbors where gourds can't grow + local neighbor, dir, nchance = nil, -1, 1 -- reservoir sampling + if nchance == 1 or math.random(1, nchance) == 1 then + local blockpos = vector.offset(stempos, 1, 0, 0) + if check_neighbor_soil(blockpos) then + neighbor, dir, nchance = blockpos, 1, nchance + 1 end - - -- Gourd needs at least 1 free neighbor to grow - if #neighbors > 0 then - -- From the remaining neighbors, grow randomly - local r = math.random(1, #neighbors) - local offset = neighbors[r] - local blockpos = vector.add(stempos, offset) - local p2 - if offset.x == 1 then - minetest.set_node(stempos, { name = connected_stem_names[1] }) - p2 = 3 - elseif offset.x == -1 then - minetest.set_node(stempos, { name = connected_stem_names[2] }) - p2 = 1 - elseif offset.z == 1 then - minetest.set_node(stempos, { name = connected_stem_names[3] }) - p2 = 2 - elseif offset.z == -1 then - minetest.set_node(stempos, { name = connected_stem_names[4] }) - p2 = 0 - end - -- Place the gourd - if gourd_def.paramtype2 == "facedir" then - minetest.add_node(blockpos, { name = gourd_itemstring, param2 = p2 }) - else - minetest.add_node(blockpos, { name = gourd_itemstring }) - end - - -- Reset farmland, etc. to dirt when the gourd grows on top - - -- FIXED: The following 2 lines were missing, and wasn't being set (outside of the above loop that - -- finds the neighbors.) - -- FYI - don't factor this out thinking that the loop above is setting the positions correctly. - floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } - floor = minetest.get_node(floorpos) - -- END OF FIX ------------------------------------- - if minetest.get_item_group(floor.name, "dirtifies_below_solid") == 1 then - minetest.set_node(floorpos, { name = "mcl_core:dirt" }) - end + end + if nchance == 1 or math.random(1, nchance) == 1 then + local blockpos = vector.offset(stempos, -1, 0, 0) + if check_neighbor_soil(blockpos) then + neighbor, dir, nchance = blockpos, 2, nchance + 1 end end + if nchance == 1 or math.random(1, nchance) == 1 then + local blockpos = vector.offset(stempos, 0, 0, 1) + if check_neighbor_soil(blockpos) then + neighbor, dir, nchance = blockpos, 3, nchance + 1 + end + end + if nchance == 1 or math.random(1, nchance) == 1 then + local blockpos = vector.offset(stempos, 0, 0, -1) + if check_neighbor_soil(blockpos) then + neighbor, dir, nchance = blockpos, 4, nchance + 1 + end + end + + -- Gourd needs at least 1 free neighbor to grow + if not neighbor then return end + minetest.swap_node(stempos, { name = connected_stem_names[dir] }) + -- Place the gourd + if gourd_def.paramtype2 == "facedir" then + local p2 = (dir == 1 and 3) or (dir == 2 and 1) or (dir == 3 and 2) or 0 + minetest.add_node(neighbor, { name = gourd_itemstring, param2 = p2 }) + else + minetest.add_node(neighbor, { name = gourd_itemstring }) + end + + -- Reset farmland, etc. to dirt when the gourd grows on top + local floorpos = vector.offset(neighbor, 0, -1, 0) + if minetest.get_item_group(minetest.get_node(floorpos).name, "dirtifies_below_solid") == 1 then + minetest.set_node(floorpos, { name = "mcl_core:dirt" }) + end end, }) end @@ -458,15 +385,11 @@ end -- * step: The nth growth step. Counting starts at 1 -- * step_count: The number of total growth steps function mcl_farming:stem_color(startcolor, endcolor, step, step_count) - local color = {} - local function get_component(startt, endd, step, step_count) - return math.floor(math.max(0, math.min(255, (startt + (((step - 1) / step_count) * endd))))) - end - color.r = get_component(startcolor.r, endcolor.r, step, step_count) - color.g = get_component(startcolor.g, endcolor.g, step, step_count) - color.b = get_component(startcolor.b, endcolor.b, step, step_count) - local colorstring = string.format("#%02X%02X%02X", color.r, color.g, color.b) - return colorstring + local mix = (step - 1) / (step_count - 1) + return string.format("#%02X%02X%02X", + math.max(0, math.min(255, math.round((1 - mix) * startcolor.r + mix * endcolor.r))), + math.max(0, math.min(255, math.round((1 - mix) * startcolor.g + mix * endcolor.g))), + math.max(0, math.min(255, math.round((1 - mix) * startcolor.b + mix * endcolor.b)))) end --[[Get a callback that either eats the item or plants it. @@ -475,12 +398,8 @@ Used for on_place callbacks for craft items which are seeds that can also be con ]] function mcl_farming:get_seed_or_eat_callback(plantname, hp_change) return function(itemstack, placer, pointed_thing) - local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) - if new then - return new - else - return minetest.do_item_eat(hp_change, nil, itemstack, placer, pointed_thing) - end + return mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) + or minetest.do_item_eat(hp_change, nil, itemstack, placer, pointed_thing) end end @@ -489,12 +408,11 @@ minetest.register_lbm({ name = "mcl_farming:growth", nodenames = { "group:plant" }, run_at_every_load = true, - action = function(pos, node) + action = function(pos, node, dtime_s) local identifier = plant_nodename_to_id_list[node.name] - if not identifier then - return - end - local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) + if not identifier then return end + local low_speed = minetest.get_node(vector.offset(pos, 0, -1, 0)).name ~= "mcl_farming:soil_wet" + mcl_farming:grow_plant(identifier, pos, node, 0, false, low_speed) end, }) + From 9cb4f51468d4ed4ddb33b8e87b70afe9f5e40d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Sun, 29 Sep 2024 13:34:20 +0200 Subject: [PATCH 163/273] Fix invalid global call in mcl_chests LBM (#4667) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4667 Reviewed-by: the-real-herowl Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ITEMS/mcl_chests/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 9294ee642..988353601 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -79,7 +79,7 @@ minetest.register_lbm({ local node_name = node.name node.name = node_name .. "_small" minetest.swap_node(pos, node) - select_and_spawn_entity(pos, node) + mcl_chests.select_and_spawn_entity(pos, node) if node_name == "mcl_chests:trapped_chest_on" then minetest.log("action", "[mcl_chests] Disabled active trapped chest on load: " .. minetest.pos_to_string(pos)) mcl_chests.chest_update_after_close(pos) From c34aecfcab25e6f0ed62a28d46d4f1417d0b3bde Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 13:57:52 +0200 Subject: [PATCH 164/273] Don't make 'ignore' nodes break bamboo or kelp (#4551) This modifies the behavior of kelp and bamboo so that neither breaks when an unloaded node is encountered. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4551 Reviewed-by: the-real-herowl Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ITEMS/mcl_bamboo/globals.lua | 2 +- mods/ITEMS/mcl_ocean/kelp.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/globals.lua b/mods/ITEMS/mcl_bamboo/globals.lua index 37fafc2fd..9c7db5486 100644 --- a/mods/ITEMS/mcl_bamboo/globals.lua +++ b/mods/ITEMS/mcl_bamboo/globals.lua @@ -74,7 +74,7 @@ function mcl_bamboo.break_orphaned(pos) local node_name = node_below.name -- short circuit checks. - if mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then + if node_name == "ignore" or mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then return end diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 0b43b9775..e51466145 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -196,7 +196,7 @@ function kelp.find_unsubmerged(pos, node, height) for i=1,height do walk_pos.y = y + i local walk_node = mt_get_node(walk_pos) - if not kelp.is_submerged(walk_node) then + if walk_node.name ~= "ignore" and not kelp.is_submerged(walk_node) then return walk_pos, walk_node, height, i end end From dcfd31d17a5a9703f5838b389a4adbdbbf7ee7ea Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 30 Sep 2024 11:22:31 +0200 Subject: [PATCH 165/273] Avoid random jumps when standing due to gravity (fewer villagers on the roofs) (#4547) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4547 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/api.lua | 10 +++++----- mods/ENTITIES/mcl_mobs/physics.lua | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b3d1ac142..dd3c84819 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -388,7 +388,7 @@ end -local function on_step_work (self, dtime) +local function on_step_work(self, dtime, moveresult) local pos = self.object:get_pos() if not pos then return end @@ -402,7 +402,7 @@ local function on_step_work (self, dtime) -- Do we abandon out of here now? end - if self:falling(pos) then return end + if self:falling(pos, moveresult) then return end if self:step_damage (dtime, pos) then return end if self.state == "die" then return end @@ -502,11 +502,11 @@ end -- main mob function -function mob_class:on_step(dtime) +function mob_class:on_step(dtime, moveresult) if not DEVELOPMENT then -- Removed as bundled Lua (5.1 doesn't support xpcall) --local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime) - local status, retVal = pcall(on_step_work, self, dtime) + local status, retVal = pcall(on_step_work, self, dtime, moveresult) if status then return retVal else @@ -521,7 +521,7 @@ function mob_class:on_step(dtime) log_error (dump(retVal), dump(pos), dump(self)) end else - return on_step_work (self, dtime) + return on_step_work (self, dtime, moveresult) end end diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 5c1d34684..994c530f5 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -927,7 +927,8 @@ end -- falling and fall damage -- returns true if mob died -function mob_class:falling(pos) +function mob_class:falling(pos, moveresult) + if moveresult and moveresult.touching_ground then return false end if self.fly and self.state ~= "die" then return From 253a06fa08aef02116d5fe06549c349aa7da330c Mon Sep 17 00:00:00 2001 From: kno10 Date: Mon, 30 Sep 2024 19:21:40 +0200 Subject: [PATCH 166/273] Fix mob egg double-spawns (#4657) If you spawn a mob clicking on a wall, two mobs will be spawned. To reproduce: face a stack of stones, with a spawn egg click on the side of a stone. It does not happen when you click the top of a node, because spawning below fails and only the second one succeeds. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4657 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 74e6edbec..d8f8491d5 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -615,7 +615,7 @@ function mcl_mobs.register_egg(mob_id, desc, background_color, overlay_color, ad pos.y = pos.y - 1 local mob = mcl_mobs.spawn(pos, mob_name) - if not object then + if not mob then pos.y = pos.y + 1 mob = mcl_mobs.spawn(pos, mob_name) if not mob then return end From 614518c6cd97f9b87af1e785cfda21f90e205a0a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 8 Oct 2024 15:34:30 +0200 Subject: [PATCH 167/273] Revert minetest.add_entity() -> mcl_mobs.spawn() from #4445 (#4679) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4679 Reviewed-by: kno10 Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ENTITIES/mcl_mobs/breeding.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/breeding.lua b/mods/ENTITIES/mcl_mobs/breeding.lua index 559195681..426353b5a 100644 --- a/mods/ENTITIES/mcl_mobs/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/breeding.lua @@ -105,7 +105,7 @@ end -- Spawn a child function mcl_mobs.spawn_child(pos, mob_type) - local child = mcl_mobs.spawn(pos, mob_type) + local child = minetest.add_entity(pos, mob_type) if not child then return end From 2ca0ccd8fea52c8e83f935a6b6170cd9a13af563 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 12:11:59 -0500 Subject: [PATCH 168/273] Fix fog tint in overworld, apply memory leak fix from rain.lua to snow.lua and thunder.lua --- .../mcl_weather/skycolor/dimensions.lua | 3 +++ mods/ENVIRONMENT/mcl_weather/snow.lua | 16 +++++++++------- mods/ENVIRONMENT/mcl_weather/thunder.lua | 16 +++++++++------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index fcf85a7e0..6113ad851 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -52,6 +52,9 @@ function dimension_handlers.overworld(player, sky_data) dawn_horizon = dawn_color, night_sky = night_color, night_horizon = night_color, + fog_sun_tint = "#ff5f33", + fog_moon_tint = nil, + fog_tint_type = "custom", }, clouds = true, } diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index 9ff2605df..73c65c3da 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -75,13 +75,15 @@ function mcl_weather.has_snow(pos) end function mcl_weather.snow.set_sky_box() - 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}}) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-snow-sky" then + 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}}) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#ADADADE8"}) diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index c594cde37..1431e423d 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -23,13 +23,15 @@ minetest.register_globalstep(function(dtime) 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}, - }) + if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-thunder-sky" 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}, + }) + end mcl_weather.skycolor.active = true for _, player in pairs(get_connected_players()) do player:set_clouds({color="#3D3D3FE8"}) From 2145470f639416f105809abb1a7db92f553d42f9 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 12:25:18 -0500 Subject: [PATCH 169/273] Fix clouds during rain->clear weather transition --- mods/ENVIRONMENT/mcl_weather/rain.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index ed6c2c5fb..9307dd64c 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -157,6 +157,7 @@ function mcl_weather.rain.clear() mcl_weather.rain.remove_sound(player) mcl_weather.rain.remove_player(player) mcl_weather.remove_spawners_player(player) + player:set_clouds({color="#FFF0EF"}) end end From 96a03b1923a1e5be294cbabfcd69515d7670891e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 17:01:28 -0500 Subject: [PATCH 170/273] Remove posibility of nil sky colors in overworld, add line break --- .../mcl_weather/skycolor/dimensions.lua | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 6113ad851..6a8856434 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -46,12 +46,12 @@ function dimension_handlers.overworld(player, sky_data) sky_data.sky = { type = "regular", sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, + day_sky = day_color or "#7BA4FF", + day_horizon = day_color or "#C0D8FF", + dawn_sky = dawn_color or "7BA4FF", + dawn_horizon = dawn_color or "#C0D8FF", + night_sky = night_color or "000000", + night_horizon = night_color or "4A6790", fog_sun_tint = "#ff5f33", fog_moon_tint = nil, fog_tint_type = "custom", @@ -81,12 +81,12 @@ function dimension_handlers.overworld(player, sky_data) sky_data.sky = { type = "regular", sky_color = { - day_sky = day_color, - day_horizon = day_color, - dawn_sky = dawn_color, - dawn_horizon = dawn_color, - night_sky = night_color, - night_horizon = night_color, + day_sky = day_color or "#7BA4FF", + day_horizon = day_color or "#C0D8FF", + dawn_sky = dawn_color or "7BA4FF", + dawn_horizon = dawn_color or "#C0D8FF", + night_sky = night_color or "000000", + night_horizon = night_color or "4A6790", }, clouds = true, } @@ -167,7 +167,8 @@ function dimension_handlers.nether(player, sky_data) end function dimension_handlers.void(player, sky_data) - sky_data.sky = { type = "plain", + sky_data.sky = { + type = "plain", base_color = "#000000", clouds = false, } From f6c3f4bd1601c5fe497a966b603d1c91e2efbff8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 18:33:04 -0500 Subject: [PATCH 171/273] Correct value clamping --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 19cec9eac..fdf7c33c8 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -190,8 +190,8 @@ end function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) -- Clamp current_val to valid range - current_val = math.min(minval, current_val) - current_val = math.max(maxval, current_val) + current_val = math.max(minval, current_val) + current_val = math.min(maxval, current_val) -- Rescale current_val from a number between minval and maxval to a number between 1 and #colors local scaled_value = (current_val - minval) / (maxval - minval) * (#colors - 1) + 1.0 From 7807093b50bf91f6828938571b632cfe793e1216 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 5 Oct 2024 10:15:53 -0500 Subject: [PATCH 172/273] Another correction to color interpolation, change day color from layer position 0.15 to 0.50 --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 26 +++++++++++++++++-- .../mcl_weather/skycolor/dimensions.lua | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index fdf7c33c8..eb217b3b2 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -2,6 +2,7 @@ local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) local NIGHT_VISION_RATIO = 0.45 +local DEBUG = false -- Settings local minimum_update_interval = { 250e3 } @@ -199,7 +200,7 @@ function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) -- Get the first color's values local index1 = math.floor(scaled_value) local color1 = colors[index1] - local frac1 = scaled_value - index1 + local frac1 = 1.0 - (scaled_value - index1) -- Get the second color's values local index2 = math.min(index1 + 1, #colors) -- clamp to maximum color index (will occur if index1 == #colors) @@ -207,11 +208,32 @@ function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) local color2 = colors[index2] -- Interpolate between color1 and color2 - return { + local res = { r = math.floor(frac1 * color1.r + frac2 * color2.r), g = math.floor(frac1 * color1.g + frac2 * color2.g), b = math.floor(frac1 * color1.b + frac2 * color2.b), } + + if DEBUG then + minetest.log(dump({ + minval = minval, + maxval = maxval, + current_val = current_val, + colors = colors, + res = res, + scaled_value = scaled_value, + + frac1 = frac1, + index1 = index1, + color1 = color1, + + frac2 = frac2, + index2 = index2, + color2 = color2, + })) + end + + return res end -- Simple getter. Either returns user given players list or get all connected players if none provided diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 6a8856434..5596e756e 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -40,7 +40,7 @@ function dimension_handlers.overworld(player, sky_data) end -- Use overworld defaults - local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) + local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) sky_data.sky = { From 66c3c014a148d1ec82d7794f9d464d87645caa7e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 5 Oct 2024 19:18:19 -0500 Subject: [PATCH 173/273] Make sure fog tints are preserved during weather is present --- .../mcl_weather/skycolor/dimensions.lua | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 5596e756e..0ac0e26b1 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -78,18 +78,14 @@ function dimension_handlers.overworld(player, sky_data) local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - sky_data.sky = { - type = "regular", - sky_color = { - day_sky = day_color or "#7BA4FF", - day_horizon = day_color or "#C0D8FF", - dawn_sky = dawn_color or "7BA4FF", - dawn_horizon = dawn_color or "#C0D8FF", - night_sky = night_color or "000000", - night_horizon = night_color or "4A6790", - }, - clouds = true, - } + table.update(sky_data.sky.sky_color,{ + day_sky = day_color or "#7BA4FF", + day_horizon = day_color or "#C0D8FF", + dawn_sky = dawn_color or "7BA4FF", + dawn_horizon = dawn_color or "#C0D8FF", + night_sky = night_color or "000000", + night_horizon = night_color or "4A6790", + }) sky_data.sun = {visible = false, sunrise_visible = false} sky_data.moon = {visible = false} sky_data.stars = {visible = false} From e864cc19ed16f5e645cc79723bafbf73f18ce8b3 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 5 Oct 2024 19:36:15 -0500 Subject: [PATCH 174/273] Make fog_tint_type = "default" when weather is present to match behavior at 0.87.2 --- mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua index 0ac0e26b1..671ead2bb 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor/dimensions.lua @@ -85,6 +85,7 @@ function dimension_handlers.overworld(player, sky_data) dawn_horizon = dawn_color or "#C0D8FF", night_sky = night_color or "000000", night_horizon = night_color or "4A6790", + fog_tint_type = "default", }) sky_data.sun = {visible = false, sunrise_visible = false} sky_data.moon = {visible = false} From e293cbe631efde9a6795405a0146362f86d1549a Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 27 Oct 2024 14:03:50 +0100 Subject: [PATCH 175/273] Better handling of touching_ground for bouncing on beds (#4689) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4689 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/physics.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 994c530f5..441156a1d 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -928,8 +928,6 @@ end -- falling and fall damage -- returns true if mob died function mob_class:falling(pos, moveresult) - if moveresult and moveresult.touching_ground then return false end - if self.fly and self.state ~= "die" then return end @@ -952,7 +950,13 @@ function mob_class:falling(pos, moveresult) new_acceleration = vector.new(0, DEFAULT_FALL_SPEED, 0) elseif v.y <= 0 and v.y > self.fall_speed then -- fall downwards at set speed - new_acceleration = vector.new(0, self.fall_speed, 0) + if moveresult and moveresult.touching_ground then + -- when touching ground, retain a minimal gravity to keep the touching_ground flag + -- but also to not get upwards acceleration with large dtime when on bouncy ground + new_acceleration = vector.new(0, self.fall_speed * 0.01, 0) + else + new_acceleration = vector.new(0, self.fall_speed, 0) + end else -- stop accelerating once max fall speed hit new_acceleration =vector.zero() From ae7995d195c113992fe6f220ffe2319ffebad06f Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 27 Oct 2024 14:10:11 +0100 Subject: [PATCH 176/273] Fix axolotl attacking water mobs (#4675) Also avoid jumping out of the water closes #4644 Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4675 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mobs_mc/axolotl.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/axolotl.lua b/mods/ENTITIES/mobs_mc/axolotl.lua index a30f8ffe1..5f5a90764 100644 --- a/mods/ENTITIES/mobs_mc/axolotl.lua +++ b/mods/ENTITIES/mobs_mc/axolotl.lua @@ -72,18 +72,24 @@ local axolotl = { fly = true, fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, breathes_in_water = true, - jump = true, + jump = false, -- would get them out of the water too often damage = 2, reach = 2, attack_type = "dogfight", attack_animals = true, specific_attack = { - "extra_mobs_cod", - "extra_mobs_glow_squid", - "extra_mobs_salmon", - "extra_mobs_tropical_fish", - "mobs_mc_squid" - }, + "mobs_mc:cod", + "mobs_mc:glow_squid", + "mobs_mc:salmon", + "mobs_mc:tropical_fish", + "mobs_mc:squid", + "mobs_mc:zombie", -- todo: only drowned? + "mobs_mc:baby_zombie", + "mobs_mc:husk", + "mobs_mc:baby_husk", + "mobs_mc:guardian_elder", + "mobs_mc:guardian", + }, runaway = true, } From 41b188caeac96a2745df39249bc79e3c05a9ece8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Sun, 27 Oct 2024 14:16:06 +0100 Subject: [PATCH 177/273] Remove "double drop" mechanics for bamboo (fixes #4514) (#4642) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4642 Reviewed-by: the-real-herowl Co-authored-by: Mikita Wiśniewski Co-committed-by: Mikita Wiśniewski --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 37 ++------------------------ mods/ITEMS/mcl_bamboo/bamboo_items.lua | 2 -- mods/ITEMS/mcl_bamboo/init.lua | 2 -- mods/ITEMS/mcl_bamboo/recipes.lua | 2 -- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 98a3a9257..9390dbc86 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -5,9 +5,6 @@ --- Copyright (C) 2022 - 2023, Michieal. See License.txt -- CONSTS -local DOUBLE_DROP_CHANCE = 8 --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap" local BAMBOO_PLANK = BAMBOO .. "_plank" @@ -16,7 +13,7 @@ local BAMBOO_PLANK = BAMBOO .. "_plank" local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local node_sound = mcl_sounds.node_sound_wood_defaults() -local pr = PseudoRandom((os.time() + 15766) * 12) -- switched from math.random() to PseudoRandom because the random wasn't very random. +local pr = PseudoRandom((os.time() + 15766) * 12) local on_rotate if minetest.get_modpath("screwdriver") then @@ -31,33 +28,7 @@ local bamboo_def = { paramtype = "light", groups = {handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}, sounds = node_sound, - - drop = { - max_items = 1, - -- From the API: - -- max_items: Maximum number of item lists to drop. - -- The entries in 'items' are processed in order. For each: - -- Item filtering is applied, chance of drop is applied, if both are - -- successful the entire item list is dropped. - -- Entry processing continues until the number of dropped item lists - -- equals 'max_items'. - -- Therefore, entries should progress from low to high drop chance. - items = { - -- Examples: - { - -- 1 in DOUBLE_DROP_CHANCE chance of dropping. - -- Default rarity is '1'. - rarity = DOUBLE_DROP_CHANCE, - items = {BAMBOO .. " 2"}, - }, - { - -- 1 in 1 chance of dropping. (Note: this means that it will drop 100% of the time.) - -- Default rarity is '1'. - rarity = 1, - items = {BAMBOO}, - }, - }, - }, + drop = BAMBOO, inventory_image = "mcl_bamboo_bamboo_shoot.png", wield_image = "mcl_bamboo_bamboo_shoot.png", @@ -86,7 +57,6 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if not pointed_thing then return itemstack end @@ -241,9 +211,6 @@ local bamboo_def = { if node_above and ((bamboo_node and bamboo_node > 0) or node_above.name == BAMBOO_ENDCAP_NAME) then minetest.remove_node(new_pos) minetest.sound_play(node_sound.dug, sound_params, true) - if pr:next(1, DOUBLE_DROP_CHANCE) == 1 then - minetest.add_item(new_pos, istack) - end minetest.add_item(new_pos, istack) end end, diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index 83f26b340..6ecc2f027 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -9,8 +9,6 @@ local SIDE_SCAFFOLDING = false local SIDE_SCAFFOLD_NAME = "mcl_bamboo:scaffolding_horizontal" -- --------------------------------------------------------------------------- local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding" --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_PLANK = BAMBOO .. "_plank" diff --git a/mods/ITEMS/mcl_bamboo/init.lua b/mods/ITEMS/mcl_bamboo/init.lua index f2323b66c..b8051841f 100644 --- a/mods/ITEMS/mcl_bamboo/init.lua +++ b/mods/ITEMS/mcl_bamboo/init.lua @@ -7,8 +7,6 @@ -- LOCALS local modname = minetest.get_current_modname() --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" mcl_bamboo = {} diff --git a/mods/ITEMS/mcl_bamboo/recipes.lua b/mods/ITEMS/mcl_bamboo/recipes.lua index 74f9f9879..f5c697a1b 100644 --- a/mods/ITEMS/mcl_bamboo/recipes.lua +++ b/mods/ITEMS/mcl_bamboo/recipes.lua @@ -5,8 +5,6 @@ --- These are all of the fuel recipes and all of the crafting recipes, consolidated into one place. --- Copyright (C) 2022 - 2023, Michieal. See License.txt --- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it... --- "BAMBOO" goes here. local BAMBOO = "mcl_bamboo:bamboo" local BAMBOO_PLANK = BAMBOO .. "_plank" -- Craftings From cb1999414bcf7bf55f9ea52e897409f61ccdd0f4 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 23 Sep 2024 06:58:19 +0200 Subject: [PATCH 178/273] Fix putting items in protected smithing tables --- mods/ITEMS/mcl_smithing_table/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_smithing_table/init.lua b/mods/ITEMS/mcl_smithing_table/init.lua index 1294c2c52..5e0b129b0 100755 --- a/mods/ITEMS/mcl_smithing_table/init.lua +++ b/mods/ITEMS/mcl_smithing_table/init.lua @@ -167,6 +167,12 @@ minetest.register_node("mcl_smithing_table:table", { end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + end + local stackname = stack:get_name() local def = stack:get_definition() if From 78125f425a78470f4fc12e9942294736a9d5bf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Sat, 28 Sep 2024 10:32:17 +0700 Subject: [PATCH 179/273] Fix taking items out of protected smithing tables --- mods/ITEMS/mcl_smithing_table/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/ITEMS/mcl_smithing_table/init.lua b/mods/ITEMS/mcl_smithing_table/init.lua index 5e0b129b0..29d59b152 100755 --- a/mods/ITEMS/mcl_smithing_table/init.lua +++ b/mods/ITEMS/mcl_smithing_table/init.lua @@ -193,6 +193,16 @@ minetest.register_node("mcl_smithing_table:table", { return 0 end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + else + return stack:get_count() + end + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) return 0 end, From b136cbf9bbce8aa54fe4f17b959c26cf518a4130 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 2 Nov 2024 21:04:00 +0100 Subject: [PATCH 180/273] Changed bamboo cap drawtype (#4658) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4658 Co-authored-by: the-real-herowl Co-committed-by: the-real-herowl --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 9390dbc86..e1b8ba640 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -220,10 +220,12 @@ minetest.register_node(BAMBOO, bamboo_def) local bamboo_top = table.copy(bamboo_def) bamboo_top.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3} bamboo_top.tiles = {"mcl_bamboo_endcap.png"} -bamboo_top.drawtype = "plantlike_rooted" --"plantlike" ---bamboo_top.paramtype2 = "meshoptions" ---bamboo_top.param2 = 2 --- bamboo_top.waving = 2 + +-- bamboo_top.drawtype = "plantlike_rooted" --"plantlike" +bamboo_top.drawtype = "plantlike" +bamboo_top.paramtype2 = "meshoptions" +bamboo_top.param2 = 2 +bamboo_top.waving = 2 bamboo_top.special_tiles = {{name = "mcl_bamboo_endcap.png"}} bamboo_top.nodebox = nil bamboo_top.selection_box = nil From cffc8e0145e0323fbdc82ece64aa2aa052fe6d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Mon, 26 Feb 2024 19:50:03 +0100 Subject: [PATCH 181/273] Fix loosing interact bug in mcl_shields --- mods/ITEMS/mcl_shields/init.lua | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 6edee7e89..2d40db2f0 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -211,16 +211,36 @@ local function set_interact(player, interact) return end local meta = player:get_meta() - if meta:get_int("mcl_privs:interact_revoked") ~= 1 then - privs.interact = interact - minetest.set_player_privs(player_name, privs) - meta:set_int("mcl_privs:interact_revoked",0) + + if interact and meta:get_int("mcl_shields:interact_revoked") ~= 0 then + meta:set_int("mcl_shields:interact_revoked", 0) + privs.interact = true + elseif not interact then + meta:set_int("mcl_shields:interact_revoked", privs.interact and 1 or 0) + privs.interact = nil end + + minetest.set_player_privs(player_name, privs) end +-- Prevent player from being able to circumvent interact privilage removal by +-- using shield. +minetest.register_on_priv_revoke(function(name, revoker, priv) + if priv == "interact" and revoker then + local player = minetest.get_player_by_name(name) + if not player then + return + end + local meta = player:get_meta() + meta:set_int("mcl_shields:interact_revoked", 0) + end +end) + local shield_hud = {} local function remove_shield_hud(player) + set_interact(player, true) + if not shield_hud[player] then return end --this function takes a long time. only run it when necessary player:hud_remove(shield_hud[player]) shield_hud[player] = nil @@ -233,7 +253,6 @@ local function remove_shield_hud(player) end playerphysics.remove_physics_factor(player, "speed", "shield_speed") - set_interact(player, true) end local function add_shield_entity(player, i) @@ -344,7 +363,7 @@ local function add_shield_hud(shieldstack, player, blocking) z_index = -200, }) playerphysics.add_physics_factor(player, "speed", "shield_speed", 0.5) - set_interact(player, nil) + set_interact(player, false) end local function update_shield_hud(player, blocking, shieldstack) From d0d1217dec16938806c6cfbff561ac34e22cfccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Mon, 26 Feb 2024 20:05:53 +0100 Subject: [PATCH 182/273] Remove unused code in mcl_privs --- mods/MISC/mcl_privs/init.lua | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index ddca9f946..09239390a 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -30,17 +30,5 @@ for _, action in pairs({"grant", "revoke"}) do if priv == "fly" then meta:set_int("mcl_privs:fly_changed", 1) end - - --[[ - so e.g. hackers who have been revoked of the interact privilege - will not automatically get the interact privilege through the mcl shields code back - ]] - if priv == "interact" then - if action == "revoke" then - meta:set_int("mcl_privs:interact_revoked", 1) - else - meta:set_int("mcl_privs:interact_revoked", 0) - end - end end) -end \ No newline at end of file +end From 45ae17044726cf1541c3168c8690301beccfd6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Mon, 26 Feb 2024 20:09:41 +0100 Subject: [PATCH 183/273] Deduplicate shield slowdown removal code --- mods/ITEMS/mcl_shields/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 2d40db2f0..9a1458b85 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -240,6 +240,7 @@ local shield_hud = {} local function remove_shield_hud(player) set_interact(player, true) + playerphysics.remove_physics_factor(player, "speed", "shield_speed") if not shield_hud[player] then return end --this function takes a long time. only run it when necessary player:hud_remove(shield_hud[player]) @@ -251,8 +252,6 @@ local function remove_shield_hud(player) if not hf.wielditem then player:hud_set_flags({wielditem = true}) end - - playerphysics.remove_physics_factor(player, "speed", "shield_speed") end local function add_shield_entity(player, i) From 04e29c5796910fd0dd3035c43fcec7b3af956716 Mon Sep 17 00:00:00 2001 From: Loveaabb Date: Wed, 22 May 2024 10:20:26 +0000 Subject: [PATCH 184/273] Several improvements to the Shield --- mods/ITEMS/mcl_shields/init.lua | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 9a1458b85..0bc0a18ba 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -269,6 +269,15 @@ local function remove_shield_entity(player, i) end end +local function is_node_stack(itemstack) + return itemstack:get_definition().drawtype -- only node's definition table contains element "drawtype" +end + +local function is_rmb_conflicting_node(nodename) + nodedef = minetest.registered_nodes[nodename] + return nodedef.on_rightclick +end + local function handle_blocking(player) local player_shield = mcl_shields.players[player] local rmb = player:get_player_control().RMB @@ -284,7 +293,7 @@ local function handle_blocking(player) local pos = player:get_pos() if shield_in_hand then if not_blocking then - minetest.after(0.25, function() + minetest.after(0.05, function() if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb then player_shield.blocking = 2 set_shield(player, true, 2) @@ -295,11 +304,16 @@ local function handle_blocking(player) end elseif shield_in_offhand then local pointed_thing = mcl_util.get_pointed_thing(player, true) - local offhand_can_block = (wielded_item(player) == "" or not pointed_thing) - and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1) + local wielded_stack = player:get_wielded_item() + local offhand_can_block = (minetest.get_item_group(wielded_item(player), "bow") ~= 1 + and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1) if pointed_thing and pointed_thing.type == "node" then - if minetest.get_item_group(minetest.get_node(pointed_thing.under).name, "container") > 1 then + local pointed_node = minetest.get_node(pointed_thing.under) + if minetest.get_item_group(pointed_node.name, "container") > 1 + or is_rmb_conflicting_node(pointed_node.name) + or is_node_stack(wielded_stack) + then return end end @@ -308,7 +322,7 @@ local function handle_blocking(player) return end if not_blocking then - minetest.after(0.25, function() + minetest.after(0.05, function() if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then player_shield.blocking = 1 set_shield(player, true, 1) From f26c34e65f507230ac64baffa417abd4e8e142c1 Mon Sep 17 00:00:00 2001 From: Loveaabb Date: Tue, 21 May 2024 14:51:43 +0000 Subject: [PATCH 185/273] Bugfix: Shield fails to block arrows --- mods/ITEMS/mcl_bows/arrow.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 652819aa6..14d289c10 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -257,10 +257,10 @@ function ARROW_ENTITY.on_step(self, dtime) mcl_burning.set_on_fire(obj, 5) end if not self._in_player and not self._blocked then - obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=self._damage}, - }, self.object:get_velocity()) + mcl_util.deal_damage(obj, self._damage, {type = "arrow", source = self._shooter, direct = self.object}) + if self._extra_hit_func then + self._extra_hit_func(obj) + end if obj:is_player() then if not mcl_shields.is_blocking(obj) then local placement From d5bc0613d8aba3b0febcbcaf088bdab50d9f70a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Fri, 9 Aug 2024 16:12:15 +0700 Subject: [PATCH 186/273] Make node itemstack check in mcl_shields less hacky --- mods/ITEMS/mcl_shields/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 0bc0a18ba..62904aa1d 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -270,7 +270,7 @@ local function remove_shield_entity(player, i) end local function is_node_stack(itemstack) - return itemstack:get_definition().drawtype -- only node's definition table contains element "drawtype" + return (itemstack:get_definition().type == "node") end local function is_rmb_conflicting_node(nodename) From 084741b733157af951bae9962ba65cffc9f6b19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Fri, 16 Aug 2024 10:54:21 +0700 Subject: [PATCH 187/273] Fix using shield on unknown nodes and cleanup --- mods/ITEMS/mcl_shields/init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 62904aa1d..b3323bd3f 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -269,12 +269,8 @@ local function remove_shield_entity(player, i) end end -local function is_node_stack(itemstack) - return (itemstack:get_definition().type == "node") -end - local function is_rmb_conflicting_node(nodename) - nodedef = minetest.registered_nodes[nodename] + nodedef = minetest.registered_nodes[nodename] or {} return nodedef.on_rightclick end @@ -312,7 +308,7 @@ local function handle_blocking(player) local pointed_node = minetest.get_node(pointed_thing.under) if minetest.get_item_group(pointed_node.name, "container") > 1 or is_rmb_conflicting_node(pointed_node.name) - or is_node_stack(wielded_stack) + or wielded_stack:get_definition().type == "node" then return end From f86a641dfa82039d206293a76a16fa15dd39815e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikita=20Wi=C5=9Bniewski?= Date: Tue, 17 Sep 2024 12:22:05 +0700 Subject: [PATCH 188/273] Improve shield block code and unhardcode offhand group --- mods/ITEMS/mcl_bows/bow.lua | 4 ++-- mods/ITEMS/mcl_bows/crossbow.lua | 6 +++--- mods/ITEMS/mcl_shields/init.lua | 33 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 9f381f501..34784ab07 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -168,7 +168,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,bow=1,enchantability=1}, + groups = {weapon=1,weapon_ranged=1,bow=1,cannot_block=1,enchantability=1}, _mcl_uses = 385, }) @@ -216,7 +216,7 @@ for level=0, 2 do wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 0, -- Pointing range to 0 to prevent punching with bow :D - groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1}, + groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, cannot_block=1, enchantability=1}, -- Trick to disable digging as well on_use = function() return end, on_drop = function(itemstack, dropper, pos) diff --git a/mods/ITEMS/mcl_bows/crossbow.lua b/mods/ITEMS/mcl_bows/crossbow.lua index c1cb7f8be..b6dc31dd0 100644 --- a/mods/ITEMS/mcl_bows/crossbow.lua +++ b/mods/ITEMS/mcl_bows/crossbow.lua @@ -158,7 +158,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,crossbow=1,enchantability=1}, + groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1}, _mcl_uses = 326, }) @@ -193,7 +193,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula itemstack:get_meta():set_string("active", "true") return itemstack end, - groups = {weapon=1,weapon_ranged=1,crossbow=1,enchantability=1,not_in_creative_inventory=1}, + groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1,not_in_creative_inventory=1}, _mcl_uses = 326, }) @@ -238,7 +238,7 @@ for level=0, 2 do wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 0, -- Pointing range to 0 to prevent punching with bow :D - groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1}, + groups = {not_in_creative_inventory=1, not_in_craft_guide=1, cannot_block=1, bow=1, enchantability=1}, -- Trick to disable digging as well on_use = function() return end, on_drop = function(itemstack, dropper, pos) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index b3323bd3f..e1b790049 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -270,7 +270,7 @@ local function remove_shield_entity(player, i) end local function is_rmb_conflicting_node(nodename) - nodedef = minetest.registered_nodes[nodename] or {} + local nodedef = minetest.registered_nodes[nodename] or {} return nodedef.on_rightclick end @@ -282,11 +282,22 @@ local function handle_blocking(player) return end + local pointed_thing = mcl_util.get_pointed_thing(player, true) + local wielded_stack = player:get_wielded_item() + local shield_in_offhand = mcl_shields.wielding_shield(player, 1) local shield_in_hand = mcl_shields.wielding_shield(player) local not_blocking = player_shield.blocking == 0 - local pos = player:get_pos() + if pointed_thing and pointed_thing.type == "node" then + local pointed_node = minetest.get_node(pointed_thing.under) + if minetest.get_item_group(pointed_node.name, "container") > 1 + or is_rmb_conflicting_node(pointed_node.name) + or wielded_stack:get_definition().type == "node" then + return + end + end + if shield_in_hand then if not_blocking then minetest.after(0.05, function() @@ -299,27 +310,15 @@ local function handle_blocking(player) player_shield.blocking = 2 end elseif shield_in_offhand then - local pointed_thing = mcl_util.get_pointed_thing(player, true) - local wielded_stack = player:get_wielded_item() - local offhand_can_block = (minetest.get_item_group(wielded_item(player), "bow") ~= 1 - and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1) - - if pointed_thing and pointed_thing.type == "node" then - local pointed_node = minetest.get_node(pointed_thing.under) - if minetest.get_item_group(pointed_node.name, "container") > 1 - or is_rmb_conflicting_node(pointed_node.name) - or wielded_stack:get_definition().type == "node" - then - return - end - end + local offhand_can_block = minetest.get_item_group(wielded_item(player), "cannot_block") ~= 1 if not offhand_can_block then return end if not_blocking then minetest.after(0.05, function() - if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then + if (not_blocking or not shield_in_hand) and shield_in_offhand + and rmb and offhand_can_block then player_shield.blocking = 1 set_shield(player, true, 1) end From e1ace4ad01d12dad95b4e2b37919d644292da013 Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 9 Oct 2024 18:01:20 +0200 Subject: [PATCH 189/273] pumpkin/melon growth only tests one neighbor every time --- mods/ITEMS/mcl_farming/shared_functions.lua | 99 ++++----------------- 1 file changed, 15 insertions(+), 84 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 241e61c56..3264287ae 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -89,7 +89,7 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low stages = stages or 1 local plant_info = plant_lists[identifier] local intervals_counter = get_intervals_counter(pos, plant_info.interval, plant_info.chance) - if stages > 0 then intervals_counters = intervals_counter - 1 end + if stages > 0 then intervals_counter = intervals_counter - 1 end if low_speed then -- 10% speed approximately if intervals_counter < 1.01 and math.random(0, 9) > 0 then return false end intervals_counter = intervals_counter / 10 @@ -163,34 +163,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s connected_stem_basename .. "_t", connected_stem_basename .. "_b" } - -- Connect the stem at stempos to the first neighboring gourd block. - -- No-op if not a stem or no gourd block found - local function try_connect_stem(stempos) - local stem = minetest.get_node(stempos) - if stem.name ~= full_unconnected_stem then return false end - -- four directions, but avoid table allocation - local neighbor = vector.offset(stempos, 1, 0, 0) - if minetest.get_node(neighbor).name == gourd_itemstring then - minetest.swap_node(stempos, { name = connected_stem_names[1] }) - return true - end - local neighbor = vector.offset(stempos, -1, 0, 0) - if minetest.get_node(neighbor).name == gourd_itemstring then - minetest.swap_node(stempos, { name = connected_stem_names[2] }) - return true - end - local neighbor = vector.offset(stempos, 0, 0, 1) - if minetest.get_node(neighbor).name == gourd_itemstring then - minetest.swap_node(stempos, { name = connected_stem_names[3] }) - return true - end - local neighbor = vector.offset(stempos, 0, 0, -1) - if minetest.get_node(neighbor).name == gourd_itemstring then - minetest.swap_node(stempos, { name = connected_stem_names[4] }) - return true - end - end - -- Register gourd if not gourd_def.after_destruct then gourd_def.after_destruct = function(blockpos, oldnode) @@ -200,34 +172,21 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s local stempos = vector.offset(blockpos, -1, 0, 0) if minetest.get_node(stempos).name == connected_stem_names[1] then minetest.swap_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) end local stempos = vector.offset(blockpos, 1, 0, 0) if minetest.get_node(stempos).name == connected_stem_names[2] then minetest.swap_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) end local stempos = vector.offset(blockpos, 0, 0, -1) if minetest.get_node(stempos).name == connected_stem_names[3] then minetest.swap_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) end local stempos = vector.offset(blockpos, 0, 0, 1) if minetest.get_node(stempos).name == connected_stem_names[4] then minetest.swap_node(stempos, { name = full_unconnected_stem }) - try_connect_stem(stempos) end end end - if not gourd_def.on_construct then - function gourd_def.on_construct(blockpos) - -- Connect all unconnected stems at full size - try_connect_stem(vector.offset(blockpos, 1, 0, 0)) - try_connect_stem(vector.offset(blockpos, -1, 0, 0)) - try_connect_stem(vector.offset(blockpos, 0, 0, 1)) - try_connect_stem(vector.offset(blockpos, 0, 0, -1)) - end - end minetest.register_node(gourd_itemstring, gourd_def) -- Register unconnected stem @@ -243,7 +202,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.drop = stem_def.drop or stem_drop stem_def.groups = stem_def.groups or { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 } stem_def.sounds = stem_def.sounds or mcl_sounds.node_sound_leaves_defaults() - stem_def.on_construct = stem_def.on_construct or try_connect_stem minetest.register_node(stem_itemstring, stem_def) -- Register connected stems @@ -313,16 +271,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s end end - -- Check for a suitable spot to grow - local function check_neighbor_soil(blockpos) - if minetest.get_node(blockpos).name ~= "air" then return false end - local floorpos = vector.offset(blockpos, 0, -1, 0) - local floorname = minetest.get_node(floorpos).name - if floorname == "mcl_core:dirt" then return true end - local floordef = minetest.registered_nodes[floorname] - return floordef.groups.grass_block or floordef.groups.dirt or (floordef.groups.soil or 0) >= 2 - end - minetest.register_abm({ label = "Grow gourd stem to gourd (" .. full_unconnected_stem .. " → " .. gourd_itemstring .. ")", nodenames = { full_unconnected_stem }, @@ -332,37 +280,21 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s action = function(stempos) local light = minetest.get_node_light(stempos) if not light or light <= 10 then return end - -- Check the four neighbors and filter out neighbors where gourds can't grow - local neighbor, dir, nchance = nil, -1, 1 -- reservoir sampling - if nchance == 1 or math.random(1, nchance) == 1 then - local blockpos = vector.offset(stempos, 1, 0, 0) - if check_neighbor_soil(blockpos) then - neighbor, dir, nchance = blockpos, 1, nchance + 1 - end - end - if nchance == 1 or math.random(1, nchance) == 1 then - local blockpos = vector.offset(stempos, -1, 0, 0) - if check_neighbor_soil(blockpos) then - neighbor, dir, nchance = blockpos, 2, nchance + 1 - end - end - if nchance == 1 or math.random(1, nchance) == 1 then - local blockpos = vector.offset(stempos, 0, 0, 1) - if check_neighbor_soil(blockpos) then - neighbor, dir, nchance = blockpos, 3, nchance + 1 - end - end - if nchance == 1 or math.random(1, nchance) == 1 then - local blockpos = vector.offset(stempos, 0, 0, -1) - if check_neighbor_soil(blockpos) then - neighbor, dir, nchance = blockpos, 4, nchance + 1 - end - end + -- Pick one neighbor and check if it can be used to grow + local dir = math.random(1, 4) -- pick direction at random + local neighbor = (dir == 1 and vector.offset(stempos, 1, 0, 0)) + or (dir == 2 and vector.offset(stempos, -1, 0, 0)) + or (dir == 3 and vector.offset(stempos, 0, 0, 1)) + or vector.offset(stempos, 0, 0, -1) + if minetest.get_node(neighbor).name ~= "air" then return end -- occupied + -- check for suitable floor: grass, dirt, or soil + local floorpos = vector.offset(neighbor, 0, -1, 0) + local floorname = minetest.get_node(floorpos).name + local floordef = minetest.registered_nodes[floorname] + if not floordef then return end + if (floordef.groups.grass_block or 0) == 0 and (floordef.groups.dirt or 0) == 0 and (floordef.groups.soil or 0) < 2 then return end -- not suitable for growing - -- Gourd needs at least 1 free neighbor to grow - if not neighbor then return end minetest.swap_node(stempos, { name = connected_stem_names[dir] }) - -- Place the gourd if gourd_def.paramtype2 == "facedir" then local p2 = (dir == 1 and 3) or (dir == 2 and 1) or (dir == 3 and 2) or 0 minetest.add_node(neighbor, { name = gourd_itemstring, param2 = p2 }) @@ -371,8 +303,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s end -- Reset farmland, etc. to dirt when the gourd grows on top - local floorpos = vector.offset(neighbor, 0, -1, 0) - if minetest.get_item_group(minetest.get_node(floorpos).name, "dirtifies_below_solid") == 1 then + if (floordef.groups.dirtifies_below_solid or 0) > 0 then minetest.set_node(floorpos, { name = "mcl_core:dirt" }) end end, From c4030115c4ecfb599a4596d7a597c941a960aa9a Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 9 Oct 2024 22:15:30 +0200 Subject: [PATCH 190/273] improve moisture logic --- mods/ITEMS/mcl_farming/shared_functions.lua | 72 ++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 3264287ae..5d4d5d49e 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -50,6 +50,55 @@ local function get_avg_light_level(pos) return math.ceil(summary / counter) end +local function get_moisture_level(pos) + local n = vector.offset(pos, 0, -1, 0) + local totalm = 1 + for z = -1,1 do + n.z = pos.z + z + for x = -1,1 do + n.x = pos.x + x + local ndef = minetest.registered_nodes[minetest.get_node(n).name] + local soil = ndef and ndef.groups.soil or 0 + local m = (soil == 2 and 2) or (soil >= 3 and 4) or 0 + if x ~= 0 and z ~= 0 then m = m * 0.25 end + totalm = totalm + m + end + end + return totalm +end + +-- moisture penalty function: +-- 0.5 if both on the x axis and the z axis the same plant growth +-- 0.5 if one diagonal neighbor is the same +-- 1.0 otherwise +local function get_moisture_penalty(pos) + local name = minetest.get_node(pos).name + local n, p = vector.copy(pos), 1 + -- check adjacent points, avoid vector allocations and reduce node accesses + n.x = pos.x - 1 + local dx = minetest.get_node(n).name == name + n.x = pos.x + 1 + dx = dx or minetest.get_node(n).name == name + if dx then + n.x = pos.x + n.z = pos.z - 1 + local dz = minetest.get_node(n).name == name + n.z = pos.z + 1 + dz = dz or minetest.get_node(n).name == name + if dz then return 0.5 end + end + -- check diagonals, clockwise + n.x, n.z = pos.x - 1, pos.z - 1 + if minetest.get_node(n).name == name then return 0.5 end + n.x = pos.x + 1 + if minetest.get_node(n).name == name then return 0.5 end + n.z = pos.z + 1 + if minetest.get_node(n).name == name then return 0.5 end + n.x = pos.x - 1 + if minetest.get_node(n).name == name then return 0.5 end + return 1 +end + function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) local plant_info = {} plant_info.full_grown = full_grown @@ -70,8 +119,7 @@ function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) interval = interval, chance = chance, action = function(pos, node) - local low_speed = minetest.get_node(vector.offset(pos, 0, -1, 0)).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, 1, false, low_speed) + mcl_farming:grow_plant(identifier, pos, node, 1, false) end, }) end @@ -82,7 +130,7 @@ end -- node: Node table -- stages: Number of stages to advance (optional, defaults to 1) -- ignore_light: if true, ignore light requirements for growing --- low_speed: grow more slowly (not wet), default false +-- low_speed: grow more slowly (not wet), default false -- OBSOLETE -- Returns true if plant has been grown by 1 or more stages. -- Returns false if nothing changed. function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low_speed) @@ -96,17 +144,22 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low end if not ignore_light and intervals_counter < 1.5 then local light = minetest.get_node_light(pos) - if not light or light < 10 then return false end + if not light or light < 9 then return false end end if intervals_counter >= 1.5 then local average_light_level = get_avg_light_level(pos) if average_light_level < 0.1 then return false end - if average_light_level < 10 then + if average_light_level < 9 then intervals_counter = intervals_counter * average_light_level / 10 end end + if low_speed == nil then + local moisture = get_moisture_level(pos) * get_moisture_penalty(pos) + if math.random(1, math.floor(25 / moisture) + 1) ~= 1 then return end + end + local step = plant_info.step_from_name[node.name] if step == nil then return false end stages = stages + math.floor(intervals_counter) @@ -279,7 +332,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s chance = grow_chance, action = function(stempos) local light = minetest.get_node_light(stempos) - if not light or light <= 10 then return end + if not light or light < 9 then return end -- Pick one neighbor and check if it can be used to grow local dir = math.random(1, 4) -- pick direction at random local neighbor = (dir == 1 and vector.offset(stempos, 1, 0, 0)) @@ -294,6 +347,10 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if not floordef then return end if (floordef.groups.grass_block or 0) == 0 and (floordef.groups.dirt or 0) == 0 and (floordef.groups.soil or 0) < 2 then return end -- not suitable for growing + -- check moisture level + local moisture = get_moisture_level(stempos) * get_moisture_penalty(stempos) + if math.random(1, math.floor(25 / moisture) + 1) ~= 1 then return end + minetest.swap_node(stempos, { name = connected_stem_names[dir] }) if gourd_def.paramtype2 == "facedir" then local p2 = (dir == 1 and 3) or (dir == 2 and 1) or (dir == 3 and 2) or 0 @@ -342,8 +399,7 @@ minetest.register_lbm({ action = function(pos, node, dtime_s) local identifier = plant_nodename_to_id_list[node.name] if not identifier then return end - local low_speed = minetest.get_node(vector.offset(pos, 0, -1, 0)).name ~= "mcl_farming:soil_wet" - mcl_farming:grow_plant(identifier, pos, node, 0, false, low_speed) + mcl_farming:grow_plant(identifier, pos, node, 0, false) end, }) From 9376cf92b134ad48f82d97daa02ad6768f217f4c Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 10 Oct 2024 14:37:01 +0200 Subject: [PATCH 191/273] Adjust growth speeds --- mods/ITEMS/mcl_farming/beetroot.lua | 3 ++- mods/ITEMS/mcl_farming/carrots.lua | 2 +- mods/ITEMS/mcl_farming/melon.lua | 4 ++-- mods/ITEMS/mcl_farming/potatoes.lua | 2 +- mods/ITEMS/mcl_farming/pumpkin.lua | 4 ++-- mods/ITEMS/mcl_farming/sweet_berry.lua | 2 +- mods/ITEMS/mcl_farming/wheat.lua | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 962fb100e..01a572355 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -171,7 +171,8 @@ minetest.register_craft({ }, }) -mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 68, 3) +-- beetroots grow 1/3rd of the default speed +mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 13.512, 15) if minetest.get_modpath("doc") then for i = 1, 2 do diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index e8e295d8b..fe68767f2 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -118,7 +118,7 @@ minetest.register_craft({ } }) -mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 25, 20) +mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 13.513, 5) if minetest.get_modpath("doc") then for i=2,7 do diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index d62288333..b8242f112 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -123,10 +123,10 @@ local stem_def = { } -- Register stem growth -mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 30, 5) +mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 13.514, 5) -- Register actual melon, connected stems and stem-to-melon growth -mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 25, 15, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 13.515, 5, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") -- Items and crafting minetest.register_craftitem("mcl_farming:melon_item", { diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 66c5169c4..a19070d1e 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -135,7 +135,7 @@ minetest.register_craft({ cooktime = 10, }) -mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 19.75, 20) +mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 13.516, 5) minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 5bcf5e8a3..d33e73f16 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -180,10 +180,10 @@ if minetest.get_modpath("mcl_armor") then end -- Register stem growth -mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5) +mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 13.517, 5) -- Register actual pumpkin, connected stems and stem-to-pumpkin growth -mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 13.518, 5, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") -- Steal function to properly disconnect a carved pumpkin pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index fdcc460df..328339f01 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -100,7 +100,7 @@ minetest.register_craftitem("mcl_farming:sweet_berry", { minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry") -- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages. -mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 68, 3) +mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 13.519, 15) local function berry_damage_check(obj) local p = obj:get_pos() diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 051c5a8d6..d30cc77a7 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -99,7 +99,7 @@ minetest.register_node("mcl_farming:wheat", { } }) -mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 25, 20) +mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 13.520, 5) minetest.register_craftitem("mcl_farming:wheat_item", { description = S("Wheat"), From e9453d62103e2e61389092adac1dd14980c765e0 Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 10 Oct 2024 16:23:54 +0200 Subject: [PATCH 192/273] Add plant growth speed option, drop average light level Closes: #4683 by removal --- mods/ITEMS/mcl_farming/shared_functions.lua | 94 +++++++++------------ settingtypes.txt | 3 + 2 files changed, 43 insertions(+), 54 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 5d4d5d49e..f31272dc9 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -8,7 +8,10 @@ local vector = vector local plant_lists = {} mcl_farming.plant_lists = plant_lists -- export -local plant_nodename_to_id_list = {} +local plant_nodename_to_id_list = {} -- map nodes to plants +local plant_step_from_name = {} -- map nodes to growth steps + +local growth_factor = tonumber(minetest.settings:get("vl_plant_growth")) or 1.0 local time_speed = tonumber(minetest.settings:get("time_speed")) or 72 local time_multiplier = time_speed > 0 and (86400 / time_speed) or 0 @@ -30,26 +33,6 @@ local function get_intervals_counter(pos, interval, chance) return (current_game_time - last_game_time) / approx_interval end -local function get_avg_light_level(pos) - local meta = minetest.get_meta(pos) - -- EWMA would use a single variable: - -- local avg = meta:get_float("avg_light") - -- avg = avg + (node_light - avg) * 0.985 - -- meta.set_float("avg_light", avg) - local summary = meta:get_int("avg_light_summary") - local counter = meta:get_int("avg_light_count") - if counter > 99 then - summary, counter = math.ceil(summary * 0.5), 50 - end - local node_light = minetest.get_node_light(pos) - if node_light ~= nil then - summary, counter = summary + node_light, counter + 1 - meta:set_int("avg_light_summary", summary) - meta:set_int("avg_light_count", counter) - end - return math.ceil(summary / counter) -end - local function get_moisture_level(pos) local n = vector.offset(pos, 0, -1, 0) local totalm = 1 @@ -100,6 +83,7 @@ local function get_moisture_penalty(pos) end function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) + interval = growth_factor > 0 and (interval / growth_factor) or 0 local plant_info = {} plant_info.full_grown = full_grown plant_info.names = names @@ -108,11 +92,11 @@ function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) for _, nodename in pairs(names) do plant_nodename_to_id_list[nodename] = identifier end - plant_info.step_from_name = {} for i, name in ipairs(names) do - plant_info.step_from_name[name] = i + plant_step_from_name[name] = i end plant_lists[identifier] = plant_info + if interval == 0 then return end -- growth disabled minetest.register_abm({ label = string.format("Farming plant growth (%s)", identifier), nodenames = names, @@ -129,45 +113,32 @@ end -- pos: Position -- node: Node table -- stages: Number of stages to advance (optional, defaults to 1) --- ignore_light: if true, ignore light requirements for growing --- low_speed: grow more slowly (not wet), default false -- OBSOLETE +-- ignore_light_water: if true, ignore light and water requirements for growing -- Returns true if plant has been grown by 1 or more stages. -- Returns false if nothing changed. -function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low_speed) - stages = stages or 1 +function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_water) + stages = stages or 1 -- 0 when run from block loading + -- check light + if not ignore_light_water and (minetest.get_node_light(pos) or 0) < 0 then return false end + -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] - local intervals_counter = get_intervals_counter(pos, plant_info.interval, plant_info.chance) - if stages > 0 then intervals_counter = intervals_counter - 1 end - if low_speed then -- 10% speed approximately - if intervals_counter < 1.01 and math.random(0, 9) > 0 then return false end - intervals_counter = intervals_counter / 10 + if plant_info then + stages = stages + math.floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) end - if not ignore_light and intervals_counter < 1.5 then - local light = minetest.get_node_light(pos) - if not light or light < 9 then return false end - end - - if intervals_counter >= 1.5 then - local average_light_level = get_avg_light_level(pos) - if average_light_level < 0.1 then return false end - if average_light_level < 9 then - intervals_counter = intervals_counter * average_light_level / 10 + if not ignore_light_water then + local odds = math.floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1 + for i = 1,stages do + if math.random(1, odds) ~= 1 then stages = stages - 1 end end end - if low_speed == nil then - local moisture = get_moisture_level(pos) * get_moisture_penalty(pos) - if math.random(1, math.floor(25 / moisture) + 1) ~= 1 then return end - end - - local step = plant_info.step_from_name[node.name] - if step == nil then return false end - stages = stages + math.floor(intervals_counter) if stages == 0 then return false end - local new_node = { name = plant_info.names[step + stages] or plant_info.full_grown } - new_node.param = node.param - new_node.param2 = node.param2 - minetest.set_node(pos, new_node) + local step = plant_step_from_name[node.name] + if step == nil then return false end + minetest.set_node(pos, { + name = plant_info.names[step + stages] or plant_info.full_grown, + param = node.param, param2 = node.param2, + }) return true end @@ -210,6 +181,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) + grow_interval = growth_factor > 0 and (grow_interval / growth_factor) or 0 local connected_stem_names = { connected_stem_basename .. "_r", connected_stem_basename .. "_l", @@ -324,6 +296,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s end end + if grow_interval == 0 then return end minetest.register_abm({ label = "Grow gourd stem to gourd (" .. full_unconnected_stem .. " → " .. gourd_itemstring .. ")", nodenames = { full_unconnected_stem }, @@ -403,3 +376,16 @@ minetest.register_lbm({ end, }) +-- The average light levels were unreliable +minetest.register_lbm({ + label = "Drop legacy average lighting data", + name = "mcl_farming:drop_average_light_meta", + nodenames = { "group:plant" }, + run_at_every_load = false, -- only convert once + action = function(pos, node, dtime_s) + local meta = minetest.get_meta(pos) + meta:set_string("avg_light_summary", "") -- drop + meta:set_string("avg_light_count", "") -- drop + end, +}) + diff --git a/settingtypes.txt b/settingtypes.txt index 7cfa03ce2..86c635582 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -45,6 +45,9 @@ mcl_disabled_structures (Disabled structures) string # Comma separated list of disabled event names mcl_disabled_events (Disabled events) string +# Control the relative plant growth speed (default: 1) +vl_plant_growth (Plant growth factor) float 1.0 0 100 + [Players] # If enabled, players respawn at the bed they last lay on instead of normal # spawn. From 78a958db4e548b03618aaa9b2dd604d7a07a55c7 Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 10 Oct 2024 17:32:36 +0200 Subject: [PATCH 193/273] Double the odds, to halve the ABM frequencies. --- mods/ITEMS/mcl_farming/beetroot.lua | 2 +- mods/ITEMS/mcl_farming/carrots.lua | 2 +- mods/ITEMS/mcl_farming/melon.lua | 4 ++-- mods/ITEMS/mcl_farming/potatoes.lua | 2 +- mods/ITEMS/mcl_farming/pumpkin.lua | 4 ++-- mods/ITEMS/mcl_farming/shared_functions.lua | 14 +++++++++----- mods/ITEMS/mcl_farming/sweet_berry.lua | 4 ++-- mods/ITEMS/mcl_farming/wheat.lua | 2 +- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 01a572355..904274b8e 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -172,7 +172,7 @@ minetest.register_craft({ }) -- beetroots grow 1/3rd of the default speed -mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 13.512, 15) +mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 16.2012, 25) if minetest.get_modpath("doc") then for i = 1, 2 do diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index fe68767f2..580e4da5a 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -118,7 +118,7 @@ minetest.register_craft({ } }) -mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 13.513, 5) +mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 5.4013, 25) if minetest.get_modpath("doc") then for i=2,7 do diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index b8242f112..74c95e686 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -123,10 +123,10 @@ local stem_def = { } -- Register stem growth -mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 13.514, 5) +mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 5.4014, 25) -- Register actual melon, connected stems and stem-to-melon growth -mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 13.515, 5, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 5.4015, 25, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") -- Items and crafting minetest.register_craftitem("mcl_farming:melon_item", { diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index a19070d1e..455befa7d 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -135,7 +135,7 @@ minetest.register_craft({ cooktime = 10, }) -mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 13.516, 5) +mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 5.4016, 25) minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index d33e73f16..e06ce7774 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -180,10 +180,10 @@ if minetest.get_modpath("mcl_armor") then end -- Register stem growth -mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 13.517, 5) +mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 5.4017, 25) -- Register actual pumpkin, connected stems and stem-to-pumpkin growth -mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 13.518, 5, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 5.4018, 25, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") -- Steal function to properly disconnect a carved pumpkin pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index f31272dc9..80c1ce1fa 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -5,6 +5,8 @@ -- local math = math local vector = vector +local random = math.random +local floor = math.floor local plant_lists = {} mcl_farming.plant_lists = plant_lists -- export @@ -123,12 +125,13 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_wate -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] if plant_info then - stages = stages + math.floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) + stages = stages + floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) end if not ignore_light_water then - local odds = math.floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1 + local odds = floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1 for i = 1,stages do - if math.random(1, odds) ~= 1 then stages = stages - 1 end + -- we double the odds, and rather call the ABM less often + if random() * odds >= 2 then stages = stages - 1 end end end @@ -307,7 +310,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s local light = minetest.get_node_light(stempos) if not light or light < 9 then return end -- Pick one neighbor and check if it can be used to grow - local dir = math.random(1, 4) -- pick direction at random + local dir = random(1, 4) -- pick direction at random local neighbor = (dir == 1 and vector.offset(stempos, 1, 0, 0)) or (dir == 2 and vector.offset(stempos, -1, 0, 0)) or (dir == 3 and vector.offset(stempos, 0, 0, 1)) @@ -322,7 +325,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s -- check moisture level local moisture = get_moisture_level(stempos) * get_moisture_penalty(stempos) - if math.random(1, math.floor(25 / moisture) + 1) ~= 1 then return end + -- we double the odds, and rather call the ABM less often + if random() * (math.floor(25 / moisture) + 1) >= 2 then return end minetest.swap_node(stempos, { name = connected_stem_names[dir] }) if gourd_def.paramtype2 == "facedir" then diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index 328339f01..7f565e97b 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -99,8 +99,8 @@ minetest.register_craftitem("mcl_farming:sweet_berry", { }) minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry") --- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages. -mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 13.519, 15) +-- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages, 1/3rd of the default. +mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 16.2019, 25) local function berry_damage_check(obj) local p = obj:get_pos() diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index d30cc77a7..b68ac4ce4 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -99,7 +99,7 @@ minetest.register_node("mcl_farming:wheat", { } }) -mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 13.520, 5) +mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 5.4020, 25) minetest.register_craftitem("mcl_farming:wheat_item", { description = S("Wheat"), From 540a070c596bdac9bcf70adff6f7198a5206b3d5 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 13 Oct 2024 21:42:42 +0200 Subject: [PATCH 194/273] always use day light level, more fixes --- mods/ITEMS/mcl_farming/shared_functions.lua | 80 +++++++------- mods/ITEMS/mcl_farming/soil.lua | 112 ++++++++------------ 2 files changed, 87 insertions(+), 105 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 80c1ce1fa..94450acbd 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -10,7 +10,7 @@ local floor = math.floor local plant_lists = {} mcl_farming.plant_lists = plant_lists -- export -local plant_nodename_to_id_list = {} -- map nodes to plants +local plant_nodename_to_id = {} -- map nodes to plants local plant_step_from_name = {} -- map nodes to growth steps local growth_factor = tonumber(minetest.settings:get("vl_plant_growth")) or 1.0 @@ -22,19 +22,19 @@ local function get_intervals_counter(pos, interval, chance) if time_multiplier == 0 then return 0 end -- "wall clock time", so plants continue to grow while sleeping local current_game_time = (minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier - local approx_interval = math.max(interval, 1) * math.max(chance, 1) local meta = minetest.get_meta(pos) local last_game_time = meta:get_float("last_gametime") - if last_game_time < 1 then - last_game_time = current_game_time - approx_interval * 0.5 - elseif last_game_time == current_game_time then - current_game_time = current_game_time + approx_interval - end meta:set_float("last_gametime", current_game_time) - return (current_game_time - last_game_time) / approx_interval + if last_game_time < 1 then return 0 end + return (current_game_time - last_game_time) / (interval * chance) end +-- wetness of the surroundings +-- dry farmland = 1 point +-- wet farmland = 3 points +-- diagonal neighbors only 25% +-- center point gives + 1 point local function get_moisture_level(pos) local n = vector.offset(pos, 0, -1, 0) local totalm = 1 @@ -43,44 +43,50 @@ local function get_moisture_level(pos) for x = -1,1 do n.x = pos.x + x local ndef = minetest.registered_nodes[minetest.get_node(n).name] - local soil = ndef and ndef.groups.soil or 0 - local m = (soil == 2 and 2) or (soil >= 3 and 4) or 0 - if x ~= 0 and z ~= 0 then m = m * 0.25 end - totalm = totalm + m + local soil = ndef and ndef.groups.soil + if soil and soil >= 2 then + local m = (soil > 2 or soil == 2 and (minetest.get_meta(n):get_int("wet") or 0) > 0) and 3 or 1 + -- corners have less weight + if x ~= 0 and z ~= 0 then m = m * 0.25 end + totalm = totalm + m + end end end return totalm end -- moisture penalty function: --- 0.5 if both on the x axis and the z axis the same plant growth --- 0.5 if one diagonal neighbor is the same +-- 0.5 if both on the x axis and the z axis at least one of the same plants grows +-- 0.5 if at least one diagonal neighbor is the same -- 1.0 otherwise -local function get_moisture_penalty(pos) +-- we cannot use the names directly, because growth is encoded in the names +local function get_same_crop_penalty(pos) local name = minetest.get_node(pos).name - local n, p = vector.copy(pos), 1 - -- check adjacent points, avoid vector allocations and reduce node accesses + local plant = plant_nodename_to_id[name] + if not plant then return "unregistered plant" end + local n = vector.copy(pos) + -- check adjacent positions, avoid vector allocations and reduce node accesses n.x = pos.x - 1 - local dx = minetest.get_node(n).name == name + local dx = plant_nodename_to_id[minetest.get_node(n).name] == plant n.x = pos.x + 1 - dx = dx or minetest.get_node(n).name == name - if dx then + dx = dx or plant_nodename_to_id[minetest.get_node(n).name] == plant + if dx then -- no need to check z otherwise n.x = pos.x n.z = pos.z - 1 - local dz = minetest.get_node(n).name == name + local dz = plant_nodename_to_id[minetest.get_node(n).name] == plant n.z = pos.z + 1 - dz = dz or minetest.get_node(n).name == name + dz = dz or plant_nodename_to_id[minetest.get_node(n).name] == plant if dz then return 0.5 end end -- check diagonals, clockwise n.x, n.z = pos.x - 1, pos.z - 1 - if minetest.get_node(n).name == name then return 0.5 end + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end n.x = pos.x + 1 - if minetest.get_node(n).name == name then return 0.5 end + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end n.z = pos.z + 1 - if minetest.get_node(n).name == name then return 0.5 end + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end n.x = pos.x - 1 - if minetest.get_node(n).name == name then return 0.5 end + if plant_nodename_to_id[minetest.get_node(n).name] == plant then return 0.5 end return 1 end @@ -92,7 +98,7 @@ function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) plant_info.interval = interval plant_info.chance = chance for _, nodename in pairs(names) do - plant_nodename_to_id_list[nodename] = identifier + plant_nodename_to_id[nodename] = identifier end for i, name in ipairs(names) do plant_step_from_name[name] = i @@ -121,16 +127,15 @@ end function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_water) stages = stages or 1 -- 0 when run from block loading -- check light - if not ignore_light_water and (minetest.get_node_light(pos) or 0) < 0 then return false end + if not ignore_light_water and (minetest.get_node_light(pos, 0.5) or 0) < 0 then return false end -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] - if plant_info then - stages = stages + floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) - end + if not plant_info then return end + stages = stages + floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) if not ignore_light_water then - local odds = floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1 + local odds = floor(25 / (get_moisture_level(pos) * get_same_crop_penalty(pos))) + 1 for i = 1,stages do - -- we double the odds, and rather call the ABM less often + -- compared to MC, our ABM runs half as often, hence we use double the chance if random() * odds >= 2 then stages = stages - 1 end end end @@ -307,7 +312,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s interval = grow_interval, chance = grow_chance, action = function(stempos) - local light = minetest.get_node_light(stempos) + local light = minetest.get_node_light(stempos, 0.5) if not light or light < 9 then return end -- Pick one neighbor and check if it can be used to grow local dir = random(1, 4) -- pick direction at random @@ -324,9 +329,9 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if (floordef.groups.grass_block or 0) == 0 and (floordef.groups.dirt or 0) == 0 and (floordef.groups.soil or 0) < 2 then return end -- not suitable for growing -- check moisture level - local moisture = get_moisture_level(stempos) * get_moisture_penalty(stempos) + local odds = floor(25 / (get_moisture_level(stempos) * get_same_crop_penalty(stempos))) + 1 -- we double the odds, and rather call the ABM less often - if random() * (math.floor(25 / moisture) + 1) >= 2 then return end + if random() * odds >= 2 then return end minetest.swap_node(stempos, { name = connected_stem_names[dir] }) if gourd_def.paramtype2 == "facedir" then @@ -374,13 +379,14 @@ minetest.register_lbm({ nodenames = { "group:plant" }, run_at_every_load = true, action = function(pos, node, dtime_s) - local identifier = plant_nodename_to_id_list[node.name] + local identifier = plant_nodename_to_id[node.name] if not identifier then return end mcl_farming:grow_plant(identifier, pos, node, 0, false) end, }) -- The average light levels were unreliable +-- LBM added in fall 2024 minetest.register_lbm({ label = "Drop legacy average lighting data", name = "mcl_farming:drop_average_light_meta", diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index e91feb1e8..67ea1bd3c 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -15,10 +15,6 @@ minetest.register_node("mcl_farming:soil", { {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_int("wet", 0) - end, groups = {handy=1,shovely=1, dirtifies_below_solid=1, dirtifier=1, soil=2, soil_sapling=1, deco_block=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), _mcl_blast_resistance = 0.6, @@ -38,10 +34,6 @@ minetest.register_node("mcl_farming:soil_wet", { {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_int("wet", 7) - end, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, dirtifier=1, soil=3, soil_sapling=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), _mcl_blast_resistance = 0.6, @@ -51,76 +43,60 @@ minetest.register_node("mcl_farming:soil_wet", { minetest.register_abm({ label = "Farmland hydration", nodenames = {"mcl_farming:soil", "mcl_farming:soil_wet"}, - interval = 15, - chance = 4, + interval = 2.73, + chance = 25, action = function(pos, node) - -- Get wetness value - local meta = minetest.get_meta(pos) - local wet = meta:get_int("wet") - if not wet then - if node.name == "mcl_farming:soil" then - wet = 0 - else - wet = 7 - end - end - -- Turn back into dirt when covered by solid node - local above_node = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z}) - if above_node then - if minetest.get_item_group(above_node.name, "solid") ~= 0 then - node.name = "mcl_core:dirt" - minetest.set_node(pos, node) - return - end + local above_node = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) + if above_node and minetest.get_item_group(above_node.name, "solid") ~= 0 then + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) -- also removes "wet" metadata + return end - -- Check an area of 9×2×9 around the node for nodename (9×9 on same level and 9×9 below) - local function check_surroundings(pos, nodename) - local nodes = minetest.find_nodes_in_area({x=pos.x-4,y=pos.y,z=pos.z-4}, {x=pos.x+4,y=pos.y+1,z=pos.z+4}, {nodename}) - return #nodes > 0 + local raining = mcl_weather and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) + local has_water, fully_loaded = false, true + if not raining then + -- Check an area of 9×2×9 around the node for nodename (9×9 on same level and 9×9 above) + -- include "ignore" to detect unloaded blocks + local nodes, counts = minetest.find_nodes_in_area(vector.offset(pos, -4, 0, -4), vector.offset(pos, 4, 1, 4), {"group:water", "ignore"}) + local ignore = counts.ignore or 0 + has_water, fully_loaded = #nodes - ignore > 0, ignore == 0 end - if check_surroundings(pos, "group:water") then - if node.name ~= "mcl_farming:soil_wet" then - -- Make it wet + local meta = minetest.get_meta(pos) + local wet = meta:get_int("wet") or (node.name == "mcl_farming:soil" and 0 or 7) + -- Hydrate by rain or water + if raining or has_water then + if node.name == "mcl_farming:soil" then node.name = "mcl_farming:soil_wet" + minetest.set_node(pos, node) -- resets wetness + meta:set_int("wet", 7) + elseif wet < 7 then + meta:set_int("wet", 7) + end + return + end + -- No decay near unloaded areas (ignore) since these might include water. + if not fully_loaded then return end + + -- Decay: make farmland dry or turn back to dirt + if wet > 1 then + if node.name == "mcl_farming:soil_wet" then -- change visual appearance to dry + node.name = "mcl_farming:soil" minetest.set_node(pos, node) end - else -- No water nearby. - -- The decay branch (make farmland dry or turn back to dirt) - - -- Don't decay while it's raining - if mcl_weather.rain.raining then - if mcl_weather.is_outdoor(pos) then - return - end - end - -- No decay near unloaded areas since these might include water. - if not check_surroundings(pos, "ignore") then - if wet <= 0 then - --local n_def = minetest.registered_nodes[node.name] or nil - local nn = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z}) - if not nn or not nn.name then - return - end - local nn_def = minetest.registered_nodes[nn.name] or nil - - if nn_def and minetest.get_item_group(nn.name, "plant") == 0 then - node.name = "mcl_core:dirt" - minetest.set_node(pos, node) - return - end - else - if wet == 7 then - node.name = "mcl_farming:soil" - minetest.swap_node(pos, node) - end - -- Slowly count down wetness - meta:set_int("wet", wet-1) - end - end + meta:set_int("wet", wet - 1) + return end + -- Revert to dirt if wetness is 0, and no plant above + local nn = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) + local nn_def = nn and minetest.registered_nodes[nn.name] or nil + if nn_def and (nn_def.groups.plant or 0) > 0 then + return + end + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) -- also removes "wet" metadata end, }) From 220a7b06e67506313e3c004a17fce00fb0fbfc68 Mon Sep 17 00:00:00 2001 From: kno10 Date: Tue, 15 Oct 2024 10:18:22 +0200 Subject: [PATCH 195/273] code review feedback --- mods/ITEMS/mcl_farming/shared_functions.lua | 9 +++++---- mods/ITEMS/mcl_farming/soil.lua | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 94450acbd..f7d5c9584 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -45,7 +45,7 @@ local function get_moisture_level(pos) local ndef = minetest.registered_nodes[minetest.get_node(n).name] local soil = ndef and ndef.groups.soil if soil and soil >= 2 then - local m = (soil > 2 or soil == 2 and (minetest.get_meta(n):get_int("wet") or 0) > 0) and 3 or 1 + local m = (soil > 2 or (soil == 2 and minetest.get_meta(n):get_int("wet") > 0)) and 3 or 1 -- corners have less weight if x ~= 0 and z ~= 0 then m = m * 0.25 end totalm = totalm + m @@ -63,7 +63,7 @@ end local function get_same_crop_penalty(pos) local name = minetest.get_node(pos).name local plant = plant_nodename_to_id[name] - if not plant then return "unregistered plant" end + if not plant then return end local n = vector.copy(pos) -- check adjacent positions, avoid vector allocations and reduce node accesses n.x = pos.x - 1 @@ -135,7 +135,7 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_wate if not ignore_light_water then local odds = floor(25 / (get_moisture_level(pos) * get_same_crop_penalty(pos))) + 1 for i = 1,stages do - -- compared to MC, our ABM runs half as often, hence we use double the chance + -- compared to info from the MC wiki, our ABM runs half as often, hence we use double the chance if random() * odds >= 2 then stages = stages - 1 end end end @@ -145,7 +145,8 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_wate if step == nil then return false end minetest.set_node(pos, { name = plant_info.names[step + stages] or plant_info.full_grown, - param = node.param, param2 = node.param2, + param = node.param, + param2 = node.param2, }) return true end diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index 67ea1bd3c..d943a7000 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -91,10 +91,8 @@ minetest.register_abm({ end -- Revert to dirt if wetness is 0, and no plant above local nn = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) - local nn_def = nn and minetest.registered_nodes[nn.name] or nil - if nn_def and (nn_def.groups.plant or 0) > 0 then - return - end + local nn_def = nn and minetest.registered_nodes[nn.name] + if nn_def and (nn_def.groups.plant or 0) > 0 then return end node.name = "mcl_core:dirt" minetest.set_node(pos, node) -- also removes "wet" metadata end, From c097c652626ba466a2e062e0fc1dafecc55e8be4 Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 16 Oct 2024 00:00:05 +0200 Subject: [PATCH 196/273] adjust growth rates again --- mods/ITEMS/mcl_farming/beetroot.lua | 4 ++-- mods/ITEMS/mcl_farming/carrots.lua | 2 +- mods/ITEMS/mcl_farming/melon.lua | 4 ++-- mods/ITEMS/mcl_farming/potatoes.lua | 2 +- mods/ITEMS/mcl_farming/pumpkin.lua | 4 ++-- mods/ITEMS/mcl_farming/sweet_berry.lua | 4 ++-- mods/ITEMS/mcl_farming/wheat.lua | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 904274b8e..4c77f3dad 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -171,8 +171,8 @@ minetest.register_craft({ }, }) --- beetroots grow 1/3rd of the default speed -mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 16.2012, 25) +-- beetroots grow at 2/3rd of the default speed +mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 8.7012, 35) if minetest.get_modpath("doc") then for i = 1, 2 do diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index 580e4da5a..6f7d7a6aa 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -118,7 +118,7 @@ minetest.register_craft({ } }) -mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 5.4013, 25) +mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 5.8013, 35) if minetest.get_modpath("doc") then for i=2,7 do diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 74c95e686..205150b6e 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -123,10 +123,10 @@ local stem_def = { } -- Register stem growth -mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 5.4014, 25) +mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 5.8014, 35) -- Register actual melon, connected stems and stem-to-melon growth -mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 5.4015, 25, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 5.8015, 35, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127") -- Items and crafting minetest.register_craftitem("mcl_farming:melon_item", { diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 455befa7d..2dc4a3522 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -135,7 +135,7 @@ minetest.register_craft({ cooktime = 10, }) -mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 5.4016, 25) +mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 5.8016, 35) minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index e06ce7774..1befef8a8 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -180,10 +180,10 @@ if minetest.get_modpath("mcl_armor") then end -- Register stem growth -mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 5.4017, 25) +mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 5.8017, 35) -- Register actual pumpkin, connected stems and stem-to-pumpkin growth -mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 5.4018, 25, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") +mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 5.8018, 35, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") -- Steal function to properly disconnect a carved pumpkin pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index 7f565e97b..a03eee012 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -99,8 +99,8 @@ minetest.register_craftitem("mcl_farming:sweet_berry", { }) minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry") --- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages, 1/3rd of the default. -mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 16.2019, 25) +-- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages, 2/3rd of the default. +mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 8.7019, 35) local function berry_damage_check(obj) local p = obj:get_pos() diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index b68ac4ce4..4ddbb156a 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -99,7 +99,7 @@ minetest.register_node("mcl_farming:wheat", { } }) -mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 5.4020, 25) +mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 5.8020, 35) minetest.register_craftitem("mcl_farming:wheat_item", { description = S("Wheat"), From fa7a7f4e8159ba2bac9109ce19b4d94f06f4a671 Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 16 Oct 2024 00:24:07 +0200 Subject: [PATCH 197/273] more fixes to plant growth --- mods/ITEMS/mcl_farming/shared_functions.lua | 26 +++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index f7d5c9584..61a0df2f2 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -15,14 +15,13 @@ local plant_step_from_name = {} -- map nodes to growth steps local growth_factor = tonumber(minetest.settings:get("vl_plant_growth")) or 1.0 +-- note: does not support /set time_speed! local time_speed = tonumber(minetest.settings:get("time_speed")) or 72 local time_multiplier = time_speed > 0 and (86400 / time_speed) or 0 local function get_intervals_counter(pos, interval, chance) - if time_multiplier == 0 then return 0 end - -- "wall clock time", so plants continue to grow while sleeping + -- in-game days, so plants continue to grow while sleeping, and we try to catch up local current_game_time = (minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier - local meta = minetest.get_meta(pos) local last_game_time = meta:get_float("last_gametime") meta:set_float("last_gametime", current_game_time) @@ -33,8 +32,8 @@ end -- wetness of the surroundings -- dry farmland = 1 point -- wet farmland = 3 points --- diagonal neighbors only 25% --- center point gives + 1 point +-- center point gives + 1 point, so 2 resp. 4 +-- neighbors only 25% local function get_moisture_level(pos) local n = vector.offset(pos, 0, -1, 0) local totalm = 1 @@ -47,7 +46,7 @@ local function get_moisture_level(pos) if soil and soil >= 2 then local m = (soil > 2 or (soil == 2 and minetest.get_meta(n):get_int("wet") > 0)) and 3 or 1 -- corners have less weight - if x ~= 0 and z ~= 0 then m = m * 0.25 end + if x ~= 0 or z ~= 0 then m = m * 0.25 end totalm = totalm + m end end @@ -63,7 +62,7 @@ end local function get_same_crop_penalty(pos) local name = minetest.get_node(pos).name local plant = plant_nodename_to_id[name] - if not plant then return end + if not plant then return 1 end local n = vector.copy(pos) -- check adjacent positions, avoid vector allocations and reduce node accesses n.x = pos.x - 1 @@ -97,6 +96,7 @@ function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) plant_info.names = names plant_info.interval = interval plant_info.chance = chance + plant_nodename_to_id[full_grown] = identifier for _, nodename in pairs(names) do plant_nodename_to_id[nodename] = identifier end @@ -131,12 +131,12 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_wate -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] if not plant_info then return end - stages = stages + floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance)) + stages = floor(stages + get_intervals_counter(pos, plant_info.interval, plant_info.chance) - 0.45) if not ignore_light_water then local odds = floor(25 / (get_moisture_level(pos) * get_same_crop_penalty(pos))) + 1 for i = 1,stages do - -- compared to info from the MC wiki, our ABM runs half as often, hence we use double the chance - if random() * odds >= 2 then stages = stages - 1 end + -- compared to info from the MC wiki, our ABM runs a third as often, hence we use triple the chance + if random() * odds >= 3 then stages = stages - 1 end end end @@ -237,6 +237,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.groups = stem_def.groups or { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1 } stem_def.sounds = stem_def.sounds or mcl_sounds.node_sound_leaves_defaults() minetest.register_node(stem_itemstring, stem_def) + plant_nodename_to_id[stem_itemstring] = stem_itemstring -- Register connected stems @@ -299,6 +300,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, }) + plant_nodename_to_id[connected_stem_names[i]] = stem_itemstring if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", full_unconnected_stem, "nodes", connected_stem_names[i]) @@ -331,8 +333,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s -- check moisture level local odds = floor(25 / (get_moisture_level(stempos) * get_same_crop_penalty(stempos))) + 1 - -- we double the odds, and rather call the ABM less often - if random() * odds >= 2 then return end + -- we triple the odds, and rather call the ABM less often + if random() * odds >= 3 then return end minetest.swap_node(stempos, { name = connected_stem_names[dir] }) if gourd_def.paramtype2 == "facedir" then From a8318f66006a053064cbb6e7370d518dc414e679 Mon Sep 17 00:00:00 2001 From: kno10 Date: Wed, 16 Oct 2024 21:19:38 +0200 Subject: [PATCH 198/273] simplify catch-up LBM logic --- mods/ITEMS/mcl_farming/shared_functions.lua | 47 ++++++--------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 61a0df2f2..a33e414ed 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -15,20 +15,6 @@ local plant_step_from_name = {} -- map nodes to growth steps local growth_factor = tonumber(minetest.settings:get("vl_plant_growth")) or 1.0 --- note: does not support /set time_speed! -local time_speed = tonumber(minetest.settings:get("time_speed")) or 72 -local time_multiplier = time_speed > 0 and (86400 / time_speed) or 0 - -local function get_intervals_counter(pos, interval, chance) - -- in-game days, so plants continue to grow while sleeping, and we try to catch up - local current_game_time = (minetest.get_day_count() + minetest.get_timeofday()) * time_multiplier - local meta = minetest.get_meta(pos) - local last_game_time = meta:get_float("last_gametime") - meta:set_float("last_gametime", current_game_time) - if last_game_time < 1 then return 0 end - return (current_game_time - last_game_time) / (interval * chance) -end - -- wetness of the surroundings -- dry farmland = 1 point -- wet farmland = 3 points @@ -125,14 +111,11 @@ end -- Returns true if plant has been grown by 1 or more stages. -- Returns false if nothing changed. function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_water) - stages = stages or 1 -- 0 when run from block loading - -- check light - if not ignore_light_water and (minetest.get_node_light(pos, 0.5) or 0) < 0 then return false end -- number of missed interval ticks, for catch-up in block loading local plant_info = plant_lists[identifier] if not plant_info then return end - stages = floor(stages + get_intervals_counter(pos, plant_info.interval, plant_info.chance) - 0.45) if not ignore_light_water then + if (minetest.get_node_light(pos, 0.5) or 0) < 0 then return false end -- day light local odds = floor(25 / (get_moisture_level(pos) * get_same_crop_penalty(pos))) + 1 for i = 1,stages do -- compared to info from the MC wiki, our ABM runs a third as often, hence we use triple the chance @@ -384,21 +367,19 @@ minetest.register_lbm({ action = function(pos, node, dtime_s) local identifier = plant_nodename_to_id[node.name] if not identifier then return end - mcl_farming:grow_plant(identifier, pos, node, 0, false) - end, -}) - --- The average light levels were unreliable --- LBM added in fall 2024 -minetest.register_lbm({ - label = "Drop legacy average lighting data", - name = "mcl_farming:drop_average_light_meta", - nodenames = { "group:plant" }, - run_at_every_load = false, -- only convert once - action = function(pos, node, dtime_s) - local meta = minetest.get_meta(pos) - meta:set_string("avg_light_summary", "") -- drop - meta:set_string("avg_light_count", "") -- drop + + local plant_info = plant_lists[identifier] + if not plant_info then return end + local rolls = floor(dtime_s / plant_info.interval) + if rolls <= 0 then return end + -- simulate how often the block will be ticked + local stages = 0 + for i = 1,rolls do + if random(1, plant_info.chance) == 1 then stages = stages + 1 end + end + if stages > 0 then + mcl_farming:grow_plant(identifier, pos, node, stages, false) + end end, }) From ebf6cf32e89fe1d402e1859a81c4f361153beb27 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 2 Nov 2024 21:05:57 +0100 Subject: [PATCH 199/273] meta:set_private("wet"), require only walkable nodes --- mods/ITEMS/mcl_farming/shared_functions.lua | 5 ++--- mods/ITEMS/mcl_farming/soil.lua | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index a33e414ed..6ebf659ca 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -307,12 +307,11 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s or (dir == 3 and vector.offset(stempos, 0, 0, 1)) or vector.offset(stempos, 0, 0, -1) if minetest.get_node(neighbor).name ~= "air" then return end -- occupied - -- check for suitable floor: grass, dirt, or soil + -- check for suitable floor -- in contrast to MC, we think everything solid is fine local floorpos = vector.offset(neighbor, 0, -1, 0) local floorname = minetest.get_node(floorpos).name local floordef = minetest.registered_nodes[floorname] - if not floordef then return end - if (floordef.groups.grass_block or 0) == 0 and (floordef.groups.dirt or 0) == 0 and (floordef.groups.soil or 0) < 2 then return end -- not suitable for growing + if not floordef or not floordef.walkable then return end -- check moisture level local odds = floor(25 / (get_moisture_level(stempos) * get_same_crop_penalty(stempos))) + 1 diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index d943a7000..32f624c3c 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -72,6 +72,7 @@ minetest.register_abm({ node.name = "mcl_farming:soil_wet" minetest.set_node(pos, node) -- resets wetness meta:set_int("wet", 7) + meta:mark_as_private("wet") elseif wet < 7 then meta:set_int("wet", 7) end @@ -85,8 +86,11 @@ minetest.register_abm({ if node.name == "mcl_farming:soil_wet" then -- change visual appearance to dry node.name = "mcl_farming:soil" minetest.set_node(pos, node) + meta:set_int("wet", wet - 1) + meta:mark_as_private("wet") -- after set_int + else + meta:set_int("wet", wet - 1) end - meta:set_int("wet", wet - 1) return end -- Revert to dirt if wetness is 0, and no plant above From b5afa34469673766dd11969e9fada9494326b0dc Mon Sep 17 00:00:00 2001 From: kno10 Date: Sat, 2 Nov 2024 23:41:38 +0100 Subject: [PATCH 200/273] Remove "wet" metadata altogether --- mods/ITEMS/mcl_farming/shared_functions.lua | 2 +- mods/ITEMS/mcl_farming/soil.lua | 63 +++++++++------------ 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 6ebf659ca..2cf5514a2 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -30,7 +30,7 @@ local function get_moisture_level(pos) local ndef = minetest.registered_nodes[minetest.get_node(n).name] local soil = ndef and ndef.groups.soil if soil and soil >= 2 then - local m = (soil > 2 or (soil == 2 and minetest.get_meta(n):get_int("wet") > 0)) and 3 or 1 + local m = soil > 2 and 3 or 1 -- corners have less weight if x ~= 0 or z ~= 0 then m = m * 0.25 end totalm = totalm + m diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index 32f624c3c..6196f5286 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -50,55 +50,48 @@ minetest.register_abm({ local above_node = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) if above_node and minetest.get_item_group(above_node.name, "solid") ~= 0 then node.name = "mcl_core:dirt" - minetest.set_node(pos, node) -- also removes "wet" metadata + minetest.set_node(pos, node) return end - local raining = mcl_weather and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) - local has_water, fully_loaded = false, true - if not raining then - -- Check an area of 9×2×9 around the node for nodename (9×9 on same level and 9×9 above) - -- include "ignore" to detect unloaded blocks - local nodes, counts = minetest.find_nodes_in_area(vector.offset(pos, -4, 0, -4), vector.offset(pos, 4, 1, 4), {"group:water", "ignore"}) - local ignore = counts.ignore or 0 - has_water, fully_loaded = #nodes - ignore > 0, ignore == 0 - end - - local meta = minetest.get_meta(pos) - local wet = meta:get_int("wet") or (node.name == "mcl_farming:soil" and 0 or 7) - -- Hydrate by rain or water - if raining or has_water then + -- in rain, become wet, do not decay + if mcl_weather and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then if node.name == "mcl_farming:soil" then node.name = "mcl_farming:soil_wet" - minetest.set_node(pos, node) -- resets wetness - meta:set_int("wet", 7) - meta:mark_as_private("wet") - elseif wet < 7 then - meta:set_int("wet", 7) + minetest.set_node(pos, node) + end + return + end + + -- Check an area of 9x2x9 around the node for nodename (9x9 on same level and 9x9 above) + -- include "ignore" to detect unloaded blocks + local nodes, counts = minetest.find_nodes_in_area(vector.offset(pos, -4, 0, -4), vector.offset(pos, 4, 1, 4), {"group:water", "ignore"}) + local ignore = counts.ignore or 0 + local has_water, fully_loaded = #nodes > ignore, ignore == 0 + + -- Hydrate by rain or water, do not decay + if has_water then + if node.name == "mcl_farming:soil" then + node.name = "mcl_farming:soil_wet" + minetest.set_node(pos, node) end return end -- No decay near unloaded areas (ignore) since these might include water. if not fully_loaded then return end - -- Decay: make farmland dry or turn back to dirt - if wet > 1 then - if node.name == "mcl_farming:soil_wet" then -- change visual appearance to dry - node.name = "mcl_farming:soil" - minetest.set_node(pos, node) - meta:set_int("wet", wet - 1) - meta:mark_as_private("wet") -- after set_int - else - meta:set_int("wet", wet - 1) - end + -- Decay: make wet farmland dry up + if node.name == "mcl_farming:soil_wet" then + node.name = "mcl_farming:soil" + minetest.set_node(pos, node) return end -- Revert to dirt if wetness is 0, and no plant above - local nn = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) - local nn_def = nn and minetest.registered_nodes[nn.name] - if nn_def and (nn_def.groups.plant or 0) > 0 then return end - node.name = "mcl_core:dirt" - minetest.set_node(pos, node) -- also removes "wet" metadata + local above = minetest.get_node_or_nil(vector.offset(pos, 0, 1, 0)) + if minetest.get_item_group(above.name, "plant") == 0 then + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) + end end, }) From d49426d453ae9ce1f21f9ba0cca66fdcbb50d234 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 10 Nov 2024 02:32:51 +0100 Subject: [PATCH 201/273] Cleanup of mcl_core/functions (#4592) Cleanup of mods/ITEMS/mcl_core/functions.lua This improves several further ABMs such as vine growing, and uses the `vector` API instead of tables. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4592 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ITEMS/mcl_core/functions.lua | 931 ++++++++++++------------------ 1 file changed, 375 insertions(+), 556 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 596a9c875..399b2d15c 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1,13 +1,20 @@ --- --- Lava vs water interactions --- - local modpath = minetest.get_modpath(minetest.get_current_modname()) - local mg_name = minetest.get_mapgen_setting("mg_name") -local math = math -local vector = vector +local random = math.random +local sqrt = math.sqrt +local floor = math.floor +local ceil = math.ceil +local abs = math.abs +local max = math.max + +local vector_new = vector.new +local vector_zero = vector.zero +local vector_offset = vector.offset +local vector_copy = vector.copy +local vector_add = vector.add +local vector_subtract = vector.subtract +local vector_distance = vector.distance local OAK_TREE_ID = 1 local DARK_OAK_TREE_ID = 2 @@ -24,7 +31,7 @@ minetest.register_abm({ chance = 1, min_y = mcl_vars.mg_end_min, action = function(pos, node, active_object_count, active_object_count_wider) - local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water") + local water = minetest.find_nodes_in_area(vector_offset(pos, -1, -1, -1), vector_offset(pos, 1, 1, 1), "group:water") local lavatype = minetest.registered_nodes[node.name].liquidtype @@ -100,18 +107,11 @@ end local function drop_attached_node(p) local nn = minetest.get_node(p).name - if nn == "air" or nn == "ignore" then - return - end + if nn == "air" or nn == "ignore" then return end minetest.remove_node(p) for _, item in pairs(minetest.get_node_drops(nn, "")) do - local pos = { - x = p.x + math.random()/2 - 0.25, - y = p.y + math.random()/2 - 0.25, - z = p.z + math.random()/2 - 0.25, - } if item ~= "" then - minetest.add_item(pos, item) + minetest.add_item(vector_offset(p, random() * 0.5 - 0.25, random() * 0.5 - 0.25, random() * 0.5 - 0.25), item) end end end @@ -119,36 +119,25 @@ end -- Helper function for node actions for liquid flow local function liquid_flow_action(pos, group, action) local function check_detach(pos, xp, yp, zp) - local p = {x=pos.x+xp, y=pos.y+yp, z=pos.z+zp} - local n = minetest.get_node_or_nil(p) - if not n then - return false - end - local d = minetest.registered_nodes[n.name] - if not d then - return false - end + local n = minetest.get_node_or_nil(vector_offset(pos, xp, yp, zp)) + local d = n and minetest.registered_nodes[n.name] + if not d then return false end --[[ Check if we want to perform the liquid action. * 1: Item must be in liquid group * 2a: If target node is below liquid, always succeed * 2b: If target node is horizontal to liquid: succeed if source, otherwise check param2 for horizontal flow direction ]] local range = d.liquid_range or 8 - if (minetest.get_item_group(n.name, group) ~= 0) and - ((yp > 0) or - (yp == 0 and ((d.liquidtype == "source") or (n.param2 > (8-range) and n.param2 < 9)))) then + if minetest.get_item_group(n.name, group) ~= 0 and + (yp > 0 or + (yp == 0 and (d.liquidtype == "source" or (n.param2 > 8-range and n.param2 < 9)))) then action(pos) end end - local posses = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, - { x=0, y=1, z=0 }, - } - for p=1,#posses do - check_detach(pos, posses[p].x, posses[p].y, posses[p].z) - end + check_detach(pos, -1, 0, 0) + check_detach(pos, 1, 0, 0) + check_detach(pos, 0, 0, -1) + check_detach(pos, 0, 0, 1) + check_detach(pos, 0, 1, 0) end -- Drop some nodes next to flowing water, if it would flow into the node @@ -208,21 +197,21 @@ minetest.register_abm({ object:remove() end end - if is_walkable(vector.offset(pos, 1, 0, 0)) - or is_walkable(vector.offset(pos, -1, 0, 0)) - or is_walkable(vector.offset(pos, 0, 0, 1)) - or is_walkable(vector.offset(pos, 0, 0, -1)) then - local lpos = vector.copy(pos) + if is_walkable(vector_offset(pos, 1, 0, 0)) + or is_walkable(vector_offset(pos, -1, 0, 0)) + or is_walkable(vector_offset(pos, 0, 0, 1)) + or is_walkable(vector_offset(pos, 0, 0, -1)) then + local lpos = vector_copy(pos) local dx, dy while true do local node = minetest.get_node(lpos) if not node or node.name ~= "mcl_core:cactus" then break end -- minetest.dig_node ignores protected nodes and causes infinite drop (#4628) minetest.remove_node(lpos) - dx = dx or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 - dy = dy or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5 - local obj = minetest.add_item(vector.offset(lpos, dx, 0.25, dy), "mcl_core:cactus") - obj:set_velocity(vector.new(dx, 1, dy)) + dx = dx or ((random(0,1)-0.5) * sqrt(random())) * 1.5 + dy = dy or ((random(0,1)-0.5) * sqrt(random())) * 1.5 + local obj = minetest.add_item(vector_offset(lpos, dx, 0.25, dy), "mcl_core:cactus") + obj:set_velocity(vector_new(dx, 1, dy)) lpos.y = lpos.y + 1 end end @@ -242,52 +231,25 @@ minetest.register_abm({ -- -- Sugar canes drop -- - -local timber_nodenames={"mcl_core:reeds"} - minetest.register_on_dignode(function(pos, node) - local i=1 - while timber_nodenames[i]~=nil do - local np={x=pos.x, y=pos.y+1, z=pos.z} - while minetest.get_node(np).name==timber_nodenames[i] do - minetest.remove_node(np) - minetest.add_item(np, timber_nodenames[i]) - np={x=np.x, y=np.y+1, z=np.z} - end - i=i+1 + local name = "mcl_core:reeds" + local np = vector_offset(pos, 0, 1, 0) + while minetest.get_node(np).name == name do + minetest.remove_node(np) + minetest.add_item(np, name) + np.y = np.y + 1 end end) -local function air_leaf(leaftype) - if math.random(0, 50) == 3 then - return {name = "air"} - else - return {name = leaftype} - end -end - --- Check if a node stops a tree from growing. Torches, plants, wood, tree, +-- Check if a node stops a tree from growing. Torches, plants, wood, tree, -- leaves and dirt does not affect tree growth. local function node_stops_growth(node) - if node.name == "air" then - return false - end - + if node.name == "air" then return false end local def = minetest.registered_nodes[node.name] - if not def then - return true - end + local groups = def and def.groups + if not groups then return true end - local groups = def.groups - if not groups then - return true - end - if groups.plant or groups.torch or groups.dirt or groups.tree - or groups.bark or groups.leaves or groups.wood then - return false - end - - return true + return not (groups.leaves or groups.wood or groups.tree or groups.plant or groups.dirt or groups.torch or groups.bark) end -- Check if a tree can grow at position. The width is the width to check @@ -297,16 +259,11 @@ end local function check_growth_width(pos, width, height) -- Huge tree (with even width to check) will check one more node in -- positive x and y directions. - local neg_space = math.min((width - 1) / 2) - local pos_space = math.max((width - 1) / 2) + local neg_space, pos_space = floor((width - 1) * 0.5), ceil((width - 1) * 0.5) for x = -neg_space, pos_space do for z = -neg_space, pos_space do for y = 1, height do - local np = vector.new( - pos.x + x, - pos.y + y, - pos.z + z) - if node_stops_growth(minetest.get_node(np)) then + if node_stops_growth(minetest.get_node(vector_offset(pos, x, y, z))) then return false end end @@ -358,13 +315,7 @@ end -- generate huge trees. The 'balloon' option is used by oak to generate a balloon -- oak tree. function mcl_core.generate_tree(pos, tree_type, options) - pos.y = pos.y-1 - --local nodename = minetest.get_node(pos).name - - pos.y = pos.y+1 - if not minetest.get_node_light(pos) then - return - end + if not minetest.get_node_light(pos) then return end local two_by_two = options and options.two_by_two local balloon = options and options.balloon @@ -410,65 +361,36 @@ function mcl_core.generate_tree(pos, tree_type, options) end -- Classic oak in v6 style -function mcl_core.generate_v6_oak_tree(pos) - local trunk = "mcl_core:tree" - local leaves = "mcl_core:leaves" - local node - for dy=1,4 do - pos.y = pos.y+dy - if minetest.get_node(pos).name ~= "air" then - return - end - pos.y = pos.y-dy +function mcl_core.generate_v6_oak_tree(p) + local pos = vector_copy(p) + for dy = 0, 4 do + pos.y = p.y + dy + if minetest.get_node(pos).name ~= "air" then return end end - node = {name = trunk} - for dy=0,4 do - pos.y = pos.y+dy - if minetest.get_node(pos).name == "air" then - minetest.add_node(pos, node) - end - pos.y = pos.y-dy + local trunk = {name = "mcl_core:tree" } + for dy = 0, 4 do + pos.y = p.y + dy + minetest.add_node(pos, trunk) end - node = {name = leaves} - pos.y = pos.y+3 - --[[local rarity = 0 - if math.random(0, 10) == 3 then - rarity = 1 - end]] - for dx=-2,2 do - for dz=-2,2 do - for dy=0,3 do - pos.x = pos.x+dx - pos.y = pos.y+dy - pos.z = pos.z+dz - - if dx == 0 and dz == 0 and dy==3 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) + local leaves = { name = "mcl_core:leaves" } + for dx = -2, 2 do + for dz = -2, 2 do + for dy = 3, 6 do + pos.x, pos.y, pos.z = p.x + dx, p.y + dy, p.z + dz + if dy == 6 then + if dx == 0 and dz == 0 and minetest.get_node(pos).name == "air" and random(1, 5) <= 4 then + minetest.add_node(pos, leaves) end - elseif dx == 0 and dz == 0 and dy==4 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) - end - elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then + elseif abs(dx) ~= 2 and abs(dz) ~= 2 then if minetest.get_node(pos).name == "air" then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) + minetest.add_node(pos, leaves) end - else - if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then - if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then - minetest.add_node(pos, node) - minetest.add_node(pos, air_leaf(leaves)) - end + elseif abs(dx) ~= 2 or abs(dz) ~= 2 then + if minetest.get_node(pos).name == "air" and random(1, 5) <= 4 then + minetest.add_node(pos, leaves) end end - pos.x = pos.x-dx - pos.y = pos.y-dy - pos.z = pos.z-dz end end end @@ -476,39 +398,32 @@ end -- Ballon Oak function mcl_core.generate_balloon_oak_tree(pos) - local path - local offset - local s = math.random(1, 12) - if s == 1 then + if random(1, 12) == 1 then -- Small balloon oak - path = modpath .. "/schematics/mcl_core_oak_balloon.mts" - offset = { x = -2, y = -1, z = -2 } - else - -- Large balloon oak - local t = math.random(1, 4) - path = modpath .. "/schematics/mcl_core_oak_large_"..t..".mts" - if t == 1 or t == 3 then - offset = { x = -3, y = -1, z = -3 } - elseif t == 2 or t == 4 then - offset = { x = -4, y = -1, z = -4 } - end + minetest.place_schematic(vector_offset(pos, -2, -1, -2), + modpath .. "/schematics/mcl_core_oak_balloon.mts", + "random", nil, false) + return + end + -- Large balloon oak + local t = random(1, 4) + local path = modpath .. "/schematics/mcl_core_oak_large_"..t..".mts" + if t == 1 or t == 3 then + minetest.place_schematic(vector_offset(pos, -3, -1, -3), path, "random", nil, false) + elseif t == 2 or t == 4 then + minetest.place_schematic(vector_offset(pos, -4, -1, -4), path, "random", nil, false) end - minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false) end -- Oak local path_oak_tree = modpath.."/schematics/mcl_core_oak_classic.mts" - function mcl_core.generate_oak_tree(pos) - local offset = { x = -2, y = -1, z = -2 } - minetest.place_schematic(vector.add(pos, offset), path_oak_tree, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2 ), path_oak_tree, "random", nil, false) end -- Birch function mcl_core.generate_birch_tree(pos) - local path = modpath .. - "/schematics/mcl_core_birch.mts" - minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2), modpath .. "/schematics/mcl_core_birch.mts", "random", nil, false) end -- BEGIN of spruce tree generation functions -- @@ -524,7 +439,7 @@ end function mcl_core.generate_v6_spruce_tree(pos) local x, y, z = pos.x, pos.y, pos.z - local maxy = y + math.random(9, 13) -- Trunk top + local maxy = y + random(9, 13) -- Trunk top local c_air = minetest.get_content_id("air") local c_ignore = minetest.get_content_id("ignore") @@ -533,11 +448,8 @@ function mcl_core.generate_v6_spruce_tree(pos) local c_snow = minetest.get_content_id("mcl_core:snow") local vm = minetest.get_voxel_manip() - local minp, maxp = vm:read_from_map( - {x = x - 3, y = y, z = z - 3}, - {x = x + 3, y = maxy + 3, z = z + 3} - ) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local minp, maxp = vm:read_from_map(vector_offset(pos, -3, 0, -3), vector_offset(pos, 3, maxy - y + 3, 3)) + local a = VoxelArea:new(minp, maxp) local data = vm:get_data() -- Upper branches layer @@ -545,42 +457,32 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = maxy - 1, maxy + 1 do for zz = z - dev, z + dev do local vi = a:index(x - dev, yy, zz) - local via = a:index(x - dev, yy + 1, zz) for xx = x - dev, x + dev do - if math.random() < 0.95 - dev * 0.05 then - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + if random() < 0.95 - dev * 0.05 then + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) end vi = vi + 1 - via = via + 1 end end dev = dev - 1 end -- Centre top nodes - add_spruce_leaves(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, - c_spruce_leaves) - add_spruce_leaves(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, - c_spruce_leaves) -- Paramat added a pointy top node + add_spruce_leaves(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, c_spruce_leaves) + add_spruce_leaves(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, c_spruce_leaves) -- Lower branches layer local my = 0 for i = 1, 20 do -- Random 2x2 squares of leaves - local xi = x + math.random(-3, 2) - local yy = maxy + math.random(-6, -5) - local zi = z + math.random(-3, 2) - if yy > my then - my = yy - end - for zz = zi, zi+1 do + local xi = x + random(-3, 2) + local yy = maxy + random(-6, -5) + local zi = z + random(-3, 2) + if yy > my then my = yy end + for zz = zi, zi + 1 do local vi = a:index(xi, yy, zz) - local via = a:index(xi, yy + 1, zz) for xx = xi, xi + 1 do - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) vi = vi + 1 - via = via + 1 end end end @@ -589,14 +491,11 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = my + 1, my + 2 do for zz = z - dev, z + dev do local vi = a:index(x - dev, yy, zz) - local via = a:index(x - dev, yy + 1, zz) for xx = x - dev, x + dev do - if math.random() < 0.95 - dev * 0.05 then - add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, - c_spruce_leaves) + if random() < 0.95 - dev * 0.05 then + add_spruce_leaves(data, vi, c_air, c_ignore, c_snow, c_spruce_leaves) end vi = vi + 1 - via = via + 1 end end dev = dev - 1 @@ -608,8 +507,7 @@ function mcl_core.generate_v6_spruce_tree(pos) for yy = y + 1, maxy do local vi = a:index(x, yy, z) local node_id = data[vi] - if node_id == c_air or node_id == c_ignore or - node_id == c_spruce_leaves or node_id == c_snow then + if node_id == c_air or node_id == c_ignore or node_id == c_spruce_leaves or node_id == c_snow then data[vi] = c_spruce_tree end end @@ -619,51 +517,50 @@ function mcl_core.generate_v6_spruce_tree(pos) end function mcl_core.generate_spruce_tree(pos) - local r = math.random(1, 3) - local path = modpath .. "/schematics/mcl_core_spruce_"..r..".mts" - minetest.place_schematic({ x = pos.x - 3, y = pos.y - 1, z = pos.z - 3 }, path, "0", nil, false) + minetest.place_schematic(vector_offset(pos, -3, -1, -3), + modpath .. "/schematics/mcl_core_spruce_"..random(1, 3)..".mts", "0", nil, false) end local function find_necorner(p) - local n=minetest.get_node_or_nil(vector.offset(p,0,1,1)) - local e=minetest.get_node_or_nil(vector.offset(p,1,1,0)) + local n = minetest.get_node_or_nil(vector_offset(p, 0, 1, 1)) + local e = minetest.get_node_or_nil(vector_offset(p, 1, 1, 0)) if n and n.name == "mcl_core:sprucetree" then - p=vector.offset(p,0,0,1) + p = vector_offset(p, 0, 0, 1) end if e and e.name == "mcl_core:sprucetree" then - p=vector.offset(p,1,0,0) + p = vector_offset(p, 1, 0, 0) end return p end local function generate_spruce_podzol(ps) - local pos=find_necorner(ps) - local pos1=vector.offset(pos,-6,-6,-6) - local pos2=vector.offset(pos,6,6,6) - local nn=minetest.find_nodes_in_area_under_air(pos1, pos2, {"group:dirt"}) + local pos = find_necorner(ps) + local pos1, pos2 = vector_offset(pos, -6, -6, -6), vector_offset(pos, 6, 6, 6) + local nn = minetest.find_nodes_in_area_under_air(pos1, pos2, {"group:dirt"}) for k,v in pairs(nn) do - if math.random(vector.distance(pos,v)) < 4 and not (math.abs(pos.x-v.x) == 6 and math.abs(pos.z-v.z) == 6) then --leave out the corners - minetest.set_node(v,{name="mcl_core:podzol"}) + if not (abs(pos.x - v.x) == 6 and abs(pos.z - v.z) == 6) and random(vector_distance(pos,v)) < 4 then --leave out the corners + minetest.set_node(v, {name="mcl_core:podzol"}) end end end function mcl_core.generate_huge_spruce_tree(pos) - local r1 = math.random(1, 2) - local r2 = math.random(1, 4) - local path - local offset = { x = -4, y = -1, z = -5 } + local r1, r2 = random(1, 2), random(1, 4) + local path, offset if r1 <= 2 then -- Mega Spruce Taiga (full canopy) path = modpath.."/schematics/mcl_core_spruce_huge_"..r2..".mts" + offset = vector_offset(pos, -4, -1, -5) else -- Mega Taiga (leaves only at top) if r2 == 1 or r2 == 3 then - offset = { x = -3, y = -1, z = -4} + offset = vector_offset(pos, -3, -1, -4) + else + offset = vector_offset(pos, -4, -1, -5) end path = modpath.."/schematics/mcl_core_spruce_huge_up_"..r2..".mts" end - minetest.place_schematic(vector.add(pos, offset), path, "0", nil, false) + minetest.place_schematic(offset, path, "0", nil, false) generate_spruce_podzol(pos) end @@ -671,29 +568,26 @@ end -- Acacia tree (multiple variants) function mcl_core.generate_acacia_tree(pos) - local r = math.random(1, 7) - local offset = vector.new() - if r == 2 or r == 3 then - offset = { x = -4, y = -1, z = -4 } + local r = random(1, 7) + local path, offset = modpath.."/schematics/mcl_core_acacia_"..r..".mts", nil + if r == 1 or r == 5 then + offset = vector_offset(pos, -5, -1, -5) + elseif r == 2 or r == 3 then + offset = vector_offset(pos, -4, -1, -4) elseif r == 4 or r == 6 or r == 7 then - offset = { x = -3, y = -1, z = -3 } - elseif r == 1 or r == 5 then - offset = { x = -5, y = -1, z = -5 } + offset = vector_offset(pos, -3, -1, -3) end - local path = modpath.."/schematics/mcl_core_acacia_"..r..".mts" - minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false) + minetest.place_schematic(offset, path, "random", nil, false) end --- Generate dark oak tree with 2×2 trunk. +-- Generate dark oak tree with 2x2 trunk. -- With pos being the lower X and the higher Z value of the trunk function mcl_core.generate_dark_oak_tree(pos) - local path = modpath.."/schematics/mcl_core_dark_oak.mts" - minetest.place_schematic({x = pos.x - 3, y = pos.y - 1, z = pos.z - 4}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -3, -1, -4), modpath.."/schematics/mcl_core_dark_oak.mts", "random", nil, false) end -- Helper function for jungle tree, form Minetest Game 0.4.15 -local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, - height, size, iters) +local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, height, size, iters) local x, y, z = pos.x, pos.y, pos.z local c_air = minetest.CONTENT_AIR local c_ignore = minetest.CONTENT_IGNORE @@ -710,33 +604,33 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, -- Force leaves near the trunk for z_dist = -1, 1 do - for y_dist = -size, 1 do - local vi = a:index(x - 1, y + height + y_dist, z + z_dist) - for x_dist = -1, 1 do - if data[vi] == c_air or data[vi] == c_ignore then - data[vi] = leaves_cid + for y_dist = -size, 1 do + local vi = a:index(x - 1, y + height + y_dist, z + z_dist) + for x_dist = -1, 1 do + if data[vi] == c_air or data[vi] == c_ignore then + data[vi] = leaves_cid + end + vi = vi + 1 end - vi = vi + 1 end end - end -- Randomly add leaves in 2x2x2 clusters. for i = 1, iters do - local clust_x = x + math.random(-size, size - 1) - local clust_y = y + height + math.random(-size, 0) - local clust_z = z + math.random(-size, size - 1) + local clust_x = x + random(-size, size - 1) + local clust_y = y + height + random(-size, 0) + local clust_z = z + random(-size, size - 1) for xi = 0, 1 do - for yi = 0, 1 do - for zi = 0, 1 do - local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) - if data[vi] == c_air or data[vi] == c_ignore then - data[vi] = leaves_cid + for yi = 0, 1 do + for zi = 0, 1 do + local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) + if data[vi] == c_air or data[vi] == c_ignore then + data[vi] = leaves_cid + end + end end end - end - end end end @@ -749,18 +643,15 @@ function mcl_core.generate_v6_jungle_tree(pos) --]] local x, y, z = pos.x, pos.y, pos.z - local height = math.random(8, 12) + local height = random(8, 12) local c_air = minetest.get_content_id("air") local c_ignore = minetest.get_content_id("ignore") local c_jungletree = minetest.get_content_id("mcl_core:jungletree") local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves") local vm = minetest.get_voxel_manip() - local minp, maxp = vm:read_from_map( - {x = x - 3, y = y - 1, z = z - 3}, - {x = x + 3, y = y + height + 1, z = z + 3} - ) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local minp, maxp = vm:read_from_map(vector_offset(pos, -3, -1, -3), vector_offset(pos, 3, 1, 3)) + local a = VoxelArea:new(minp, maxp) local data = vm:get_data() add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, height, 3, 30) @@ -770,7 +661,7 @@ function mcl_core.generate_v6_jungle_tree(pos) local vi_1 = a:index(x - 1, y - 1, z + z_dist) local vi_2 = a:index(x - 1, y, z + z_dist) for x_dist = -1, 1 do - if math.random(1, 3) >= 2 then + if random(1, 3) >= 2 then if data[vi_1] == c_air or data[vi_1] == c_ignore then data[vi_1] = c_jungletree elseif data[vi_2] == c_air or data[vi_2] == c_ignore then @@ -787,17 +678,15 @@ function mcl_core.generate_v6_jungle_tree(pos) end function mcl_core.generate_jungle_tree(pos) - local path = modpath.."/schematics/mcl_core_jungle_tree.mts" - minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -2, -1, -2), modpath.."/schematics/mcl_core_jungle_tree.mts", "random", nil, false) end --- Generate huge jungle tree with 2×2 trunk. +-- Generate huge jungle tree with 2x2 trunk. -- With pos being the lower X and the higher Z value of the trunk. function mcl_core.generate_huge_jungle_tree(pos) - -- 2 variants - local r = math.random(1, 2) - local path = modpath.."/schematics/mcl_core_jungle_tree_huge_"..r..".mts" - minetest.place_schematic({x = pos.x - 6, y = pos.y - 1, z = pos.z - 7}, path, "random", nil, false) + minetest.place_schematic(vector_offset(pos, -6, -1, -7), + modpath.."/schematics/mcl_core_jungle_tree_huge_"..random(1, 2)..".mts", + "random", nil, false) end @@ -805,9 +694,7 @@ local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed") -- Return appropriate grass block node for pos function mcl_core.get_grass_block_type(pos, requested_grass_block_name) - local grass_palette_index = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index - local grass_block_name = requested_grass_block_name or minetest.get_node(pos).name - return {name = grass_block_name, param2 = grass_palette_index} + return {name = requested_grass_block_name or minetest.get_node(pos).name, param2 = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index} end -- Return appropriate foliage block node for pos @@ -824,7 +711,7 @@ end -- Spread grass blocks and mycelium on neighbor dirt ------------------------------ minetest.register_abm({ - label = "Grass Block and Mycelium spread", + label = "Grass block and mycelium spread", nodenames = {"mcl_core:dirt"}, neighbors = {"air", "group:grass_block_no_snow", "mcl_core:mycelium"}, interval = 30, @@ -833,7 +720,7 @@ minetest.register_abm({ action = function(pos) if pos == nil then return end - local above = {x=pos.x, y=pos.y+1, z=pos.z} + local above = vector_offset(pos, 0, 1, 0) 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 -- Never grow directly below liquids or opaque blocks @@ -844,18 +731,14 @@ minetest.register_abm({ if not light_self then return end --[[ Try to find a spreading dirt-type block (e.g. grass block or mycelium) - within a 3×5×3 area, with the source block being on the 2nd-topmost layer. ]] - local nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+3, z=pos.z+1}, "group:spreading_dirt_type") - local p2 + within a 3x5x3 area, with the source block being on the 2nd-topmost layer. ]] + local nodes = minetest.find_nodes_in_area(vector_offset(pos, -1, -1, -1), vector_offset(pos, 1, 3, 1), "group:spreading_dirt_type") -- Nothing found ? Bail out! - if #nodes <= 0 then - return - else - p2 = nodes[grass_spread_randomizer:next(1, #nodes)] - end + if #nodes <= 0 then return end + local p2 = nodes[grass_spread_randomizer:next(1, #nodes)] -- Found it! Now check light levels! - local source_above = {x=p2.x, y=p2.y+1, z=p2.z} + local source_above = vector_offset(p2, 0, 1, 0) local light_source = minetest.get_node_light(source_above) if not light_source then return end @@ -881,16 +764,15 @@ minetest.register_abm({ -- Grass/mycelium death in darkness minetest.register_abm({ - label = "Grass Block / Mycelium in darkness", + label = "Grass block / mycelium in darkness", nodenames = {"group:spreading_dirt_type"}, interval = 8, chance = 50, catch_up = false, action = function(pos, node) - local above = {x = pos.x, y = pos.y + 1, z = pos.z} - local name = minetest.get_node(above).name + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name -- Kill grass/mycelium when below opaque block or liquid - if name ~= "ignore" and (minetest.get_item_group(name, "opaque") == 1 or minetest.get_item_group(name, "liquid") ~= 0) then + if above ~= "ignore" and (minetest.get_item_group(above, "opaque") == 1 or minetest.get_item_group(above, "liquid") ~= 0) then minetest.set_node(pos, {name = "mcl_core:dirt"}) end end @@ -898,9 +780,8 @@ minetest.register_abm({ -- Turn Grass Path and similar nodes to Dirt if a solid node is placed above it minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) - if minetest.get_item_group(newnode.name, "solid") ~= 0 or - minetest.get_item_group(newnode.name, "dirtifier") ~= 0 then - local below = {x=pos.x, y=pos.y-1, z=pos.z} + if minetest.get_item_group(newnode.name, "solid") ~= 0 or minetest.get_item_group(newnode.name, "dirtifier") ~= 0 then + local below = vector_offset(pos, 0, -1, 0) local belownode = minetest.get_node(below) if minetest.get_item_group(belownode.name, "dirtifies_below_solid") == 1 then minetest.set_node(below, {name="mcl_core:dirt"}) @@ -909,16 +790,16 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack end) minetest.register_abm({ - label = "Turn Grass Path below solid block into Dirt", + label = "Turn grass path below solid block into dirt", nodenames = {"mcl_core:grass_path"}, neighbors = {"group:solid"}, interval = 8, chance = 50, action = function(pos, node) - local above = {x = pos.x, y = pos.y + 1, z = pos.z} - local name = minetest.get_node(above).name - local nodedef = minetest.registered_nodes[name] - if name ~= "ignore" and nodedef and (nodedef.groups and nodedef.groups.solid) then + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name + if above == "ignore" then return end + local nodedef = minetest.registered_nodes[above] + if nodedef and (nodedef.groups and nodedef.groups.solid) then minetest.set_node(pos, {name = "mcl_core:dirt"}) end end, @@ -931,17 +812,10 @@ minetest.register_lbm({ nodenames = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt_with_dry_grass_snow"}, run_at_every_load = true, action = function(pos, node) - if node.name == "mcl_core:dirt_with_dry_grass_snow" then - node.name = "mcl_core:dirt_with_grass_snow" - else - node.name = "mcl_core:dirt_with_grass" - end + node.name = node.name == "mcl_core:dirt_with_dry_grass_snow" and "mcl_core:dirt_with_grass_snow" or "mcl_core:dirt_with_grass" -- use savanna palette index to simulate dry grass. - if not node.param2 then - node.param2 = SAVANNA_INDEX - end + node.param2 = node.param2 or SAVANNA_INDEX minetest.set_node(pos, node) - return end, }) @@ -957,7 +831,7 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, -- Checks if the sapling at pos has enough light and the correct soil local light = minetest.get_node_light(pos) if not light then return end - local low_light = (light < treelight) + local low_light = light < treelight local delta = 1 local current_game_time = minetest.get_day_count() + minetest.get_timeofday() @@ -978,7 +852,7 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, -- TODO: delta is [days] missed in inactive area. Currently we just add it to stage, which is far from a perfect calculation... - local soilnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + local soilnode = minetest.get_node(vector_offset(pos, 0, -1, 0)) local soiltype = minetest.get_item_group(soilnode.name, "soil_sapling") if soiltype < soil_needed then return end @@ -986,66 +860,67 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, local meta = minetest.get_meta(pos) local stage = meta:get_int("stage") if stage == nil then stage = 0 end - stage = stage + math.max(1, math.floor(delta)) + stage = stage + max(1, floor(delta)) if stage >= 3 then meta:set_string("grown", "true") - -- This sapling grows in a special way when there are 4 saplings in a 2×2 pattern + -- This sapling grows in a special way when there are 4 saplings in a 2x2 pattern if two_by_two then - -- Check 8 surrounding saplings and try to find a 2×2 pattern + -- Check 8 surrounding saplings and try to find a 2x2 pattern local function is_sapling(pos, sapling) return minetest.get_node(pos).name == sapling end - local p2 = {x=pos.x+1, y=pos.y, z=pos.z} - local p3 = {x=pos.x, y=pos.y, z=pos.z-1} - local p4 = {x=pos.x+1, y=pos.y, z=pos.z-1} - local p5 = {x=pos.x-1, y=pos.y, z=pos.z-1} - local p6 = {x=pos.x-1, y=pos.y, z=pos.z} - local p7 = {x=pos.x-1, y=pos.y, z=pos.z+1} - local p8 = {x=pos.x, y=pos.y, z=pos.z+1} - local p9 = {x=pos.x+1, y=pos.y, z=pos.z+1} - local s2 = is_sapling(p2, sapling) - local s3 = is_sapling(p3, sapling) - local s4 = is_sapling(p4, sapling) - local s5 = is_sapling(p5, sapling) - local s6 = is_sapling(p6, sapling) - local s7 = is_sapling(p7, sapling) - local s8 = is_sapling(p8, sapling) - local s9 = is_sapling(p9, sapling) - -- In a 9×9 field there are 4 possible 2×2 squares. We check them all. - if s2 and s3 and s4 and check_tree_growth(pos, tree_id, { two_by_two = true }) then + -- clockwise from x+1, coded right/bottom/left/top + local prr = vector_offset(pos, 1, 0, 0) -- right + local prb = vector_offset(pos, 1, 0, -1) -- right bottom + local pbb = vector_offset(pos, 0, 0, -1) -- bottom + local pbl = vector_offset(pos, -1, 0, -1) -- bottom left + local pll = vector_offset(pos, -1, 0, 0) -- left + local plt = vector_offset(pos, -1, 0, 1) -- left top + local ptt = vector_offset(pos, 0, 0, 1) -- top + local ptr = vector_offset(pos, 1, 0, 1) -- top right + local srr = is_sapling(prr, sapling) + local srb = is_sapling(prb, sapling) + local sbb = is_sapling(pbb, sapling) + local sbl = is_sapling(pbl, sapling) + local sll = is_sapling(pll, sapling) + local slt = is_sapling(plt, sapling) + local stt = is_sapling(ptt, sapling) + local str = is_sapling(ptr, sapling) + -- In a 3x3 field there are 4 possible 2x2 squares. We check them all. + if srr and srb and sbb and check_tree_growth(pos, tree_id, { two_by_two = true }) then -- Success: Remove saplings and place tree minetest.remove_node(pos) - minetest.remove_node(p2) - minetest.remove_node(p3) - minetest.remove_node(p4) - mcl_core.generate_tree(pos, tree_id, { two_by_two = true }) + minetest.remove_node(prr) + minetest.remove_node(prb) + minetest.remove_node(pbb) + mcl_core.generate_tree(pos, tree_id, { two_by_two = true }) -- center is top-left of 2x2 return - elseif s3 and s5 and s6 and check_tree_growth(p6, tree_id, { two_by_two = true }) then + elseif sbb and sbl and sll and check_tree_growth(pll, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p3) - minetest.remove_node(p5) - minetest.remove_node(p6) - mcl_core.generate_tree(p6, tree_id, { two_by_two = true }) + minetest.remove_node(pbb) + minetest.remove_node(pbl) + minetest.remove_node(pll) + mcl_core.generate_tree(pll, tree_id, { two_by_two = true }) -- ll is top-left of 2x2 return - elseif s6 and s7 and s8 and check_tree_growth(p7, tree_id, { two_by_two = true }) then + elseif sll and slt and stt and check_tree_growth(plt, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p6) - minetest.remove_node(p7) - minetest.remove_node(p8) - mcl_core.generate_tree(p7, tree_id, { two_by_two = true }) + minetest.remove_node(pll) + minetest.remove_node(plt) + minetest.remove_node(ptt) + mcl_core.generate_tree(plt, tree_id, { two_by_two = true }) -- lt is top-left of 2x2 return - elseif s2 and s8 and s9 and check_tree_growth(p8, tree_id, { two_by_two = true }) then + elseif stt and str and srr and check_tree_growth(ptt, tree_id, { two_by_two = true }) then minetest.remove_node(pos) - minetest.remove_node(p2) - minetest.remove_node(p8) - minetest.remove_node(p9) - mcl_core.generate_tree(p8, tree_id, { two_by_two = true }) + minetest.remove_node(ptt) + minetest.remove_node(ptr) + minetest.remove_node(prr) + mcl_core.generate_tree(ptt, tree_id, { two_by_two = true }) -- tt is top-left of 2x2 return end end if one_by_one and tree_id == OAK_TREE_ID then -- There is a chance that this tree wants to grow as a balloon oak - if math.random(1, 12) == 1 then + if random(1, 12) == 1 then -- Check if there is room for that if check_tree_growth(pos, tree_id, { balloon = true }) then minetest.set_node(pos, {name="air"}) @@ -1054,11 +929,10 @@ local function sapling_grow_action(tree_id, soil_needed, one_by_one, two_by_two, end end end - -- If this sapling can grow alone + -- If this sapling can grow alone 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) mcl_core.generate_tree(pos, tree_id) return end @@ -1076,44 +950,39 @@ local grow_spruce = sapling_grow_action(SPRUCE_TREE_ID, 1, true, true, "mcl_core local grow_birch = sapling_grow_action(BIRCH_TREE_ID, 1, true, false) function mcl_core.update_sapling_foliage_colors(pos) - local pos1, pos2 = vector.offset(pos, -8, 0, -8), vector.offset(pos, 8, 30, 8) - local fnode - local foliage = minetest.find_nodes_in_area(pos1, pos2, {"group:foliage_palette", "group:foliage_palette_wallmounted"}) + local foliage = minetest.find_nodes_in_area( + vector_offset(pos, -8, 0, -8), vector_offset(pos, 8, 30, 8), + {"group:foliage_palette", "group:foliage_palette_wallmounted"}) for _, fpos in pairs(foliage) do - fnode = minetest.get_node(fpos) - minetest.set_node(fpos, fnode) + minetest.set_node(fpos, minetest.get_node(fpos)) end end --- Attempts to grow the sapling at the specified position +--- Attempts to grow the sapling at the specified position -- pos: Position -- node: Node table of the node at this position, from minetest.get_node -- Returns true on success and false on failure function mcl_core.grow_sapling(pos, node) - local grow if node.name == "mcl_core:sapling" then - grow = grow_oak + grow_oak(pos) elseif node.name == "mcl_core:darksapling" then - grow = grow_dark_oak + grow_dark_oak(pos) elseif node.name == "mcl_core:junglesapling" then - grow = grow_jungle_tree + grow_jungle_tree(pos) elseif node.name == "mcl_core:acaciasapling" then - grow = grow_acacia + grow_acacia(pos) elseif node.name == "mcl_core:sprucesapling" then - grow = grow_spruce + grow_spruce(pos) elseif node.name == "mcl_core:birchsapling" then - grow = grow_birch - end - if grow then - grow(pos) - return true + grow_birch(pos) else return false end + return true end -- TODO: Use better tree models for everything --- TODO: Support 2×2 saplings +-- TODO: Support 2x2 saplings -- Oak tree minetest.register_abm({ @@ -1219,14 +1088,14 @@ minetest.register_lbm({ local function leafdecay_particles(pos, node) minetest.add_particlespawner({ - amount = math.random(10, 20), + amount = random(10, 20), time = 0.1, - minpos = vector.add(pos, {x=-0.4, y=-0.4, z=-0.4}), - maxpos = vector.add(pos, {x=0.4, y=0.4, z=0.4}), - minvel = {x=-0.2, y=-0.2, z=-0.2}, - maxvel = {x=0.2, y=0.1, z=0.2}, - minacc = {x=0, y=-9.81, z=0}, - maxacc = {x=0, y=-9.81, z=0}, + minpos = vector_offset(pos, -0.4, -0.4, -0.4), + maxpos = vector_offset(pos, 0.4, 0.4, 0.4), + minvel = vector_new(-0.2, -0.2, -0.2), + maxvel = vector_new(0.2, 0.1, 0.2), + minacc = vector_new(0, -9.81, 0), + maxacc = vector_new(0, -9.81, 0), minexptime = 0.1, maxexptime = 0.5, minsize = 0.5, @@ -1239,32 +1108,33 @@ end local function vinedecay_particles(pos, node) local dir = minetest.wallmounted_to_dir(node.param2) - local relpos1, relpos2 + if not dir then return end -- Don't crash if the map data got corrupted somehow + local minpos, maxpos if dir.x < 0 then - relpos1 = { x = -0.45, y = -0.4, z = -0.5 } - relpos2 = { x = -0.4, y = 0.4, z = 0.5 } + minpos = vector_offset(pos, -0.45, -0.4, -0.5) + maxpos = vector_offset(pos, -0.4, 0.4, 0.5) elseif dir.x > 0 then - relpos1 = { x = 0.4, y = -0.4, z = -0.5 } - relpos2 = { x = 0.45, y = 0.4, z = 0.5 } + minpos = vector_offset(pos, 0.4, -0.4, -0.5) + maxpos = vector_offset(pos, 0.45, 0.4, 0.5) elseif dir.z < 0 then - relpos1 = { x = -0.5, y = -0.4, z = -0.45 } - relpos2 = { x = 0.5, y = 0.4, z = -0.4 } + minpos = vector_offset(pos, -0.5, -0.4, -0.45) + maxpos = vector_offset(pos, 0.5, 0.4, -0.4) elseif dir.z > 0 then - relpos1 = { x = -0.5, y = -0.4, z = 0.4 } - relpos2 = { x = 0.5, y = 0.4, z = 0.45 } + minpos = vector_offset(pos, -0.5, -0.4, 0.4) + maxpos = vector_offset(pos, 0.5, 0.4, 0.45) else return end minetest.add_particlespawner({ - amount = math.random(8, 16), + amount = random(8, 16), time = 0.1, - minpos = vector.add(pos, relpos1), - maxpos = vector.add(pos, relpos2), - minvel = {x=-0.2, y=-0.2, z=-0.2}, - maxvel = {x=0.2, y=0.1, z=0.2}, - minacc = {x=0, y=-9.81, z=0}, - maxacc = {x=0, y=-9.81, z=0}, + minpos = minpos, + maxpos = maxpos, + minvel = vector_new(-0.2, -0.2, -0.2), + maxvel = vector_new( 0.2, 0.1, 0.2), + minacc = vector_new(0, -9.81, 0), + maxacc = vector_new(0, -9.81, 0), minexptime = 0.1, maxexptime = 0.5, minsize = 0.5, @@ -1275,17 +1145,57 @@ local function vinedecay_particles(pos, node) }) end ---------------------- --- Vine generating -- ---------------------- +----------------- +-- Vine growth -- +----------------- +-- Add vines below pos (if empty) +local function vine_spread_down(origin, node) + if random(1, 2) == 1 then return end + local target = vector_offset(origin, 0, -1, 0) + if minetest.get_node(target).name == "air" then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + +-- Add vines above pos if it is backed up +local function vine_spread_up(origin, node) + if random(1, 2) == 1 then return end + local vines_in_area = minetest.find_nodes_in_area(vector_offset(origin, -4, -1, -4), vector_offset(origin, 4, 1, 4), "mcl_core:vine") + -- Less than 4 other vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) + if #vines_in_area >= 5 then return end + local target = vector_offset(origin, 0, 1, 0) + if minetest.get_node(target).name ~= "air" then return end + local backupnodename = minetest.get_node(vector_subtract(target, minetest.wallmounted_to_dir(node.param2))).name + + -- Check if the block above is supported + if mcl_core.supports_vines(backupnodename) then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + +local function vine_spread_horizontal(origin, dir, node) + local vines_in_area = minetest.find_nodes_in_area(vector_offset(origin, -4, -1, -4), vector_offset(origin, 4, 1, 4), "mcl_core:vine") + if #vines_in_area >= 5 then return end + -- Less than 4 other vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) + local target = vector_add(origin, dir) + -- Spread horizontally, but not into support direction + local backup_dir = minetest.wallmounted_to_dir(node.param2) + if backup_dir.x == dir.x and backup_dir.y == dir.y then return end + local target_node = minetest.get_node(target) + if target_node.name ~= "air" then return end + local backupnodename = minetest.get_node(vector_add(target, backup_dir)).name + if mcl_core.supports_vines(backupnodename) then + minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) + end +end + minetest.register_abm({ - label = "Vines growth", + label = "Vine growth", nodenames = {"mcl_core:vine"}, interval = 47, chance = 4, action = function(pos, node, active_object_count, active_object_count_wider) - - -- First of all, check if we are even supported, otherwise, let's die! + -- First of all, check if we are even supported, otherwise, decay. if not mcl_core.check_vines_supported(pos, node) then minetest.remove_node(pos) vinedecay_particles(pos, node) @@ -1293,68 +1203,20 @@ minetest.register_abm({ return end - -- Add vines below pos (if empty) - local function spread_down(origin, target, dir, node) - if math.random(1, 2) == 1 then - if minetest.get_node(target).name == "air" then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end + local d = random(1, 6) + if d == 1 then + vine_spread_horizontal(pos, vector_new( 1, 0, 0), node) + elseif d == 2 then + vine_spread_horizontal(pos, vector_new(-1, 0, 0), node) + elseif d == 3 then + vine_spread_horizontal(pos, vector_new( 0, 0, 1), node) + elseif d == 4 then + vine_spread_horizontal(pos, vector_new( 0, 0, -1), node) + elseif d == 5 then + vine_spread_up(pos, node) + else + vine_spread_down(pos, node) end - - -- Add vines above pos if it is backed up - local function spread_up(origin, target, dir, node) - local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine") - -- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) - if #vines_in_area < 5 then - if math.random(1, 2) == 1 then - if minetest.get_node(target).name == "air" then - local backup_dir = minetest.wallmounted_to_dir(node.param2) - local backup = vector.subtract(target, backup_dir) - local backupnodename = minetest.get_node(backup).name - - -- Check if the block above is supported - if mcl_core.supports_vines(backupnodename) then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end - end - end - end - - local function spread_horizontal(origin, target, dir, node) - local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine") - -- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well) - if #vines_in_area < 5 then - -- Spread horizontally - local backup_dir = minetest.wallmounted_to_dir(node.param2) - if not vector.equals(backup_dir, dir) then - local target_node = minetest.get_node(target) - if target_node.name == "air" then - local backup = vector.add(target, backup_dir) - local backupnodename = minetest.get_node(backup).name - if mcl_core.supports_vines(backupnodename) then - minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2}) - end - end - end - end - end - - local directions = { - { { x= 1, y= 0, z= 0 }, spread_horizontal }, - { { x=-1, y= 0, z= 0 }, spread_horizontal }, - { { x= 0, y= 1, z= 0 }, spread_up }, - { { x= 0, y=-1, z= 0 }, spread_down }, - { { x= 0, y= 0, z= 1 }, spread_horizontal }, - { { x= 0, y= 0, z=-1 }, spread_horizontal }, - } - - local d = math.random(1, #directions) - local dir = directions[d][1] - local spread = directions[d][2] - - spread(pos, vector.add(pos, dir), dir, node) end }) @@ -1380,12 +1242,11 @@ minetest.register_abm({ nodenames = {"group:orphan_leaves"}, interval = 5, chance = 10, - action = function(pos, node) + action = function(pos, node) -- Spawn item entities for any of the leaf's drops local itemstacks = minetest.get_node_drops(node.name) for _, itemname in pairs(itemstacks) do - local p_drop = vector.offset(pos, math.random() - 0.5, math.random() - 0.5, math.random() - 0.5) - minetest.add_item(p_drop, itemname) + minetest.add_item(vector_offset(pos, random() - 0.5, random() - 0.5, random() - 0.5), itemname) end -- Remove the decayed node minetest.remove_node(pos) @@ -1393,23 +1254,19 @@ minetest.register_abm({ minetest.check_for_falling(pos) -- Kill depending vines immediately to skip the vines decay delay - local surround = { - { 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 = -1 }, - } - for s=1, #surround do - local spos = vector.add(pos, surround[s]) + local function clean_vines(spos) local maybe_vine = minetest.get_node(spos) - --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) minetest.check_for_falling(spos) end end + clean_vines(vector_offset(pos, 0, 0, -1)) + clean_vines(vector_offset(pos, 0, 0, 1)) + clean_vines(vector_offset(pos, -1, 0, 0)) + clean_vines(vector_offset(pos, 1, 0, 0)) + clean_vines(vector_offset(pos, 0, -1, 0)) end }) @@ -1424,13 +1281,11 @@ minetest.register_abm({ -- A low interval and a high inverse chance spreads the load interval = 4, chance = 8, - action = function(p0, node, _, _) - if not mcl_core.check_vines_supported(p0, node) then - -- Vines must die! - minetest.remove_node(p0) - vinedecay_particles(p0, node) - -- Just in case a falling node happens to float above vines - minetest.check_for_falling(p0) + action = function(pos, node) + if not mcl_core.check_vines_supported(pos, node) then + minetest.remove_node(pos) + vinedecay_particles(pos, node) + minetest.check_for_falling(pos) end end }) @@ -1460,7 +1315,7 @@ minetest.register_abm({ chance = 8, action = function(pos, node) if mcl_weather.has_snow(pos) - and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 + and minetest.get_natural_light(vector_offset(pos, 0, 1, 0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_artificial_light(minetest.get_node(pos).param1) < 10 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) @@ -1473,49 +1328,39 @@ Given the pos and node of a vines node, this returns true if the vines are suppo and false if the vines are currently floating. Vines are considered “supported” if they face a walkable+solid block or “hang” from a vines node above. ]] function mcl_core.check_vines_supported(pos, node) - local supported = false local dir = minetest.wallmounted_to_dir(node.param2) - local pos1 = vector.add(pos, dir) - local node_neighbor = minetest.get_node(pos1) - -- Check if vines are attached to a solid block. - -- If ignore, we assume its solid. - if node_neighbor.name == "ignore" or mcl_core.supports_vines(node_neighbor.name) then - supported = true - elseif dir.y == 0 then + if not dir then return end -- Don't crash if the map data got corrupted somehow + local node_neighbor = minetest.get_node(vector_add(pos, dir)) + -- Check if vines are attached to a solid block, assume "ignore" is good. + if node_neighbor.name == "ignore" or mcl_core.supports_vines(node_neighbor.name) then return true end + if dir.y == 0 then -- Vines are not attached, now we check if the vines are “hanging” below another vines block -- of equal orientation. - local pos2 = vector.add(pos, {x=0, y=1, z=0}) - local node2 = minetest.get_node(pos2) - -- Again, ignore means we assume its supported + local node2 = minetest.get_node(vector_offset(pos, 0, 1, 0)) if node2.name == "ignore" or (node2.name == "mcl_core:vine" and node2.param2 == node.param2) then - supported = true + return true end end - return supported + return false end -- Melt ice at pos. mcl_core:ice MUST be at pos if you call this! function mcl_core.melt_ice(pos) -- Create a water source if ice is destroyed and there was something below it - local below = {x=pos.x, y=pos.y-1, z=pos.z} - local belownode = minetest.get_node(below) + local below = vector_offset(pos, 0, -1, 0) local dim = mcl_worlds.pos_to_dimension(below) - if dim ~= "nether" and belownode.name ~= "air" and belownode.name ~= "ignore" and belownode.name ~= "mcl_core:void" then - minetest.set_node(pos, {name="mcl_core:water_source"}) - else + local belownode = minetest.get_node(below) + if dim == "nether" or belownode.name == "air" or belownode.name == "ignore" or belownode.name == "mcl_core:void" then minetest.remove_node(pos) + else + minetest.set_node(pos, {name="mcl_core:water_source"}) end - local neighbors = { - {x=-1, y=0, z=0}, - {x=1, y=0, z=0}, - {x=0, y=-1, z=0}, - {x=0, y=1, z=0}, - {x=0, y=0, z=-1}, - {x=0, y=0, z=1}, - } - for n=1, #neighbors do - minetest.check_single_for_falling(vector.add(pos, neighbors[n])) - end + minetest.check_single_for_falling(vector_offset(pos, -1, 0, 0)) + minetest.check_single_for_falling(vector_offset(pos, 1, 0, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, -1, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, 1, 0)) + minetest.check_single_for_falling(vector_offset(pos, 0, 0, -1)) + minetest.check_single_for_falling(vector_offset(pos, 0, 0, 1)) end ---- FUNCTIONS FOR SNOWED NODES ---- @@ -1534,12 +1379,6 @@ end -- of the snowed node. function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tiles, sounds, clear_colorization, desc, grass_palette) local def = table.copy(minetest.registered_nodes[itemstring_clear]) - local create_doc_alias - if def.description then - create_doc_alias = true - else - create_doc_alias = false - end -- Just some group clearing def.description = desc def._doc_items_longdesc = nil @@ -1563,11 +1402,7 @@ function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tile -- Note: _mcl_snowed must be added to the clear node manually! - if not tiles then - def.tiles = {"default_snow.png", "default_dirt.png", {name="mcl_core_grass_side_snowed.png", tileable_vertical=false}} - else - def.tiles = tiles - end + def.tiles = tiles or {"default_snow.png", "default_dirt.png", {name="mcl_core_grass_side_snowed.png", tileable_vertical=false}} if clear_colorization then def.paramtype2 = nil def.palette = nil @@ -1575,20 +1410,14 @@ function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tile def.color = nil def.overlay_tiles = nil end - if not sounds then - def.sounds = mcl_sounds.node_sound_dirt_defaults({ - footstep = mcl_sounds.node_sound_snow_defaults().footstep, - }) - else - def.sounds = sounds - end + def.sounds = sounds or mcl_sounds.node_sound_dirt_defaults({footstep = mcl_sounds.node_sound_snow_defaults().footstep}) def._mcl_silk_touch_drop = {itemstring_clear} -- Register stuff minetest.register_node(itemstring_snowed, def) - if create_doc_alias and minetest.get_modpath("doc") then + if def.description and minetest.get_modpath("doc") then doc.add_entry_alias("nodes", itemstring_clear, "nodes", itemstring_snowed) end end @@ -1599,7 +1428,7 @@ end function mcl_core.clear_snow_dirt(pos, node) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowless then - minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2}) + minetest.swap_node(pos, {name = def._mcl_snowless, param2 = node.param2}) end end @@ -1609,18 +1438,13 @@ end -- on_construct -- Makes constructed snowable node snowed if placed below a snow cover node. function mcl_core.on_snowable_construct(pos) - -- Myself - local node = minetest.get_node(pos) - - -- Above - local apos = {x=pos.x, y=pos.y+1, z=pos.z} - local anode = minetest.get_node(apos) - + local above = minetest.get_node(vector_offset(pos, 0, 1, 0)).name -- Make snowed if needed - if minetest.get_item_group(anode.name, "snow_cover") == 1 then + if minetest.get_item_group(above.name, "snow_cover") == 1 then + local node = minetest.get_node(pos) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowed then - minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2}) + minetest.swap_node(pos, {name = def._mcl_snowed, param2 = node.param2}) end end end @@ -1637,31 +1461,26 @@ end -- on_construct -- Makes snowable node below snowed. function mcl_core.on_snow_construct(pos) - local npos = {x=pos.x, y=pos.y-1, z=pos.z} - local node = minetest.get_node(npos) + local below = vector_offset(pos, 0, -1, 0) + local node = minetest.get_node(below) local def = minetest.registered_nodes[node.name] if def and def._mcl_snowed then - minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2}) + minetest.swap_node(below, {name = def._mcl_snowed, param2 = node.param2}) end end -- after_destruct -- Clears snowed dirtlike node below. function mcl_core.after_snow_destruct(pos) - local nn = minetest.get_node(pos).name - -- No-op if snow was replaced with snow - if minetest.get_item_group(nn, "snow_cover") == 1 then - return - end - local npos = {x=pos.x, y=pos.y-1, z=pos.z} - local node = minetest.get_node(npos) - mcl_core.clear_snow_dirt(npos, node) + if minetest.get_item_group(minetest.get_node(pos).name, "snow_cover") == 1 then return end + local below = vector_offset(pos, 0, -1, 0) + mcl_core.clear_snow_dirt(below, minetest.get_node(below)) end -- Obsidian crying local crobby_particle = { - velocity = vector.zero(), - acceleration = vector.zero(), + velocity = vector_zero(), + acceleration = vector_zero(), texture = "mcl_core_crying_obsidian_tear.png", collisiondetection = false, collision_removal = false, @@ -1673,16 +1492,16 @@ minetest.register_abm({ interval = 5, chance = 10, action = function(pos, node) - minetest.after(0.1 + math.random() * 1.4, function() + minetest.after(0.1 + random() * 1.4, function() local pt = table.copy(crobby_particle) - pt.size = 1.3 + math.random() * 1.2 - pt.expirationtime = 0.5 + math.random() - pt.pos = vector.offset(pos, math.random() - 0.5, -0.51, math.random() - 0.5) + pt.size = 1.3 + random() * 1.2 + pt.expirationtime = 0.5 + random() + pt.pos = vector_offset(pos, random() - 0.5, -0.51, random() - 0.5) minetest.add_particle(pt) minetest.after(pt.expirationtime, function() - pt.acceleration = vector.new(0, -9, 0) + pt.acceleration = vector_new(0, -9, 0) pt.collisiondetection = true - pt.expirationtime = 1.2 + math.random() * 3.3 + pt.expirationtime = 1.2 + random() * 3.3 minetest.add_particle(pt) end) end) From b540e6c77b56ca5e694ab91287a393bc641df96c Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 10 Nov 2024 02:41:55 +0100 Subject: [PATCH 202/273] Improve head swivel code (#4622) * Utilize the minetest 5.9.0 API that uses radians not degree. * Simplify computations to make this more efficient, in particular by querying and updating the bone position less frequently. * Resolves minetest warning `Deprecated call to set_bone_position, use set_bone_override instead` in this location, but other uses remain. * `mcl_util.set_bone_position` not modified, because it redundantly compares to the previous rotation once more. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4622 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mcl_mobs/effects.lua | 127 +++++++++++++---------------- mods/ENTITIES/mcl_mobs/init.lua | 2 +- 2 files changed, 59 insertions(+), 70 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/effects.lua b/mods/ENTITIES/mcl_mobs/effects.lua index e746fef39..27811e5c2 100644 --- a/mods/ENTITIES/mcl_mobs/effects.lua +++ b/mods/ENTITIES/mcl_mobs/effects.lua @@ -5,6 +5,7 @@ local validate_vector = mcl_util.validate_vector local active_particlespawners = {} local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local DEFAULT_FALL_SPEED = -9.81*1.5 +local PI_THIRD = math.pi / 3 -- 60 degrees local PATHFINDING = "gowp" @@ -294,86 +295,66 @@ function mcl_mobs:set_animation(self, anim) self:set_animation(anim) end -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 function who_are_you_looking_at (self, dtime) - local pos = self.object:get_pos() + if self.order == "sleep" then + self._locked_object = nil + return + end - local stop_look_at_player_chance = math.random(833/self.curiosity) -- was 10000 - div by 12 for avg entities as outside loop - - local stop_look_at_player = stop_look_at_player_chance == 1 + local stop_look_at_player = math.random() * 833 <= self.curiosity if self.attack then - if not self.target_time_lost then - self._locked_object = self.attack - else - self._locked_object = nil - end + self._locked_object = not self.target_time_lost and self.attack or nil elseif self.following then self._locked_object = self.following elseif self._locked_object then - if stop_look_at_player then - --minetest.log("Stop look: ".. self.name) - self._locked_object = nil - end + if stop_look_at_player then self._locked_object = nil end elseif not self._locked_object then if mcl_util.check_dtime_timer(self, dtime, "step_look_for_someone", 0.2) then - --minetest.log("Change look check: ".. self.name) - - -- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates. - -- but frequency of check isn't good as it is costly. Making others too infrequent requires testing - local chance = 150/self.curiosity - - if chance < 1 then chance = 1 end - local look_at_player_chance = math.random(chance) - - -- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found, - -- then div by 20 as less freq lookup - - local look_at_player = look_at_player_chance == 1 - + local pos = self.object:get_pos() for _, obj in pairs(minetest.get_objects_inside_radius(pos, 8)) do - if obj:is_player() and vector.distance(pos,obj:get_pos()) < 4 then - --minetest.log("Change look to player: ".. self.name) + if obj:is_player() and vector.distance(pos, obj:get_pos()) < 4 then self._locked_object = obj break - elseif obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name == self.name and self ~= obj:get_luaentity()) then - if look_at_player then - --minetest.log("Change look to mob: ".. self.name) + elseif obj:is_player() or (obj:get_luaentity() and self ~= obj:get_luaentity() and obj:get_luaentity().name == self.name) then + -- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates. + -- but frequency of check isn't good as it is costly. Making others too infrequent requires testing + -- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found, + -- then div by 20 as less freq lookup + if math.random() * 150 <= self.curiosity then self._locked_object = obj break end end end end - end end function mob_class:check_head_swivel(dtime) if not self.head_swivel or type(self.head_swivel) ~= "string" then return end + who_are_you_looking_at(self, dtime) - who_are_you_looking_at (self, dtime) + local newr, oldp, oldr = vector.zero(), nil, nil + if self.object.get_bone_override then -- minetest >= 5.9 + local ov = self.object:get_bone_override(self.head_swivel) + oldp, oldr = ov.position.vec, ov.rotation.vec + else -- minetest < 5.9 + oldp, oldr = self.object:get_bone_position(self.head_swivel) + oldr = vector.apply(oldr, math.rad) -- old API uses radians + end - local final_rotation = vector.zero() - local oldp,oldr = self.object:get_bone_position(self.head_swivel) - - if self._locked_object and (self._locked_object:is_player() or self._locked_object:get_luaentity()) and self._locked_object:get_hp() > 0 then + local locked_object = self._locked_object + if locked_object and (locked_object:is_player() or locked_object:get_luaentity()) and locked_object:get_hp() > 0 then local _locked_object_eye_height = 1.5 - if self._locked_object:get_luaentity() then - _locked_object_eye_height = self._locked_object:get_luaentity().head_eye_height - end - if self._locked_object:is_player() then - _locked_object_eye_height = self._locked_object:get_properties().eye_height + if locked_object:is_player() then + _locked_object_eye_height = locked_object:get_properties().eye_height + elseif locked_object:get_luaentity() then + _locked_object_eye_height = locked_object:get_luaentity().head_eye_height end if _locked_object_eye_height then - local self_rot = self.object:get_rotation() -- If a mob is attached, should we really be messing with what they are looking at? -- Should this be excluded? @@ -381,40 +362,48 @@ function mob_class:check_head_swivel(dtime) self_rot = self.object:get_attach():get_rotation() end - local player_pos = self._locked_object:get_pos() - local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0))) - local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))+self.head_yaw_offset - local mob_pitch = math.deg(-dir_to_pitch(direction_player))*self.head_pitch_multiplier + local ps = self.object:get_pos() + ps.y = ps.y + self.head_eye_height * .7 + local pt = locked_object:get_pos() + pt.y = pt.y + _locked_object_eye_height + local dir = vector.direction(ps, pt) + local mob_yaw = self_rot.y + math.atan2(dir.x, dir.z) + self.head_yaw_offset + local mob_pitch = math.asin(-dir.y) * self.head_pitch_multiplier - if (mob_yaw < -60 or mob_yaw > 60) and not (self.attack and self.state == "attack" and not self.runaway) then - final_rotation = vector.multiply(oldr, 0.9) + if (mob_yaw < -PI_THIRD or mob_yaw > PI_THIRD) and not (self.attack and self.state == "attack" and not self.runaway) then + newr = vector.multiply(oldr, 0.9) elseif self.attack and self.state == "attack" and not self.runaway then if self.head_yaw == "y" then - final_rotation = vector.new(mob_pitch, mob_yaw, 0) + newr = vector.new(mob_pitch, mob_yaw, 0) elseif self.head_yaw == "z" then - final_rotation = vector.new(mob_pitch, 0, -mob_yaw) + newr = vector.new(mob_pitch, 0, -mob_yaw) end - else - if self.head_yaw == "y" then - final_rotation = vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, ((mob_yaw-oldr.y)*.3)+oldr.y, 0) + newr = vector.new((mob_pitch-oldr.x)*.3+oldr.x, (mob_yaw-oldr.y)*.3+oldr.y, 0) elseif self.head_yaw == "z" then - final_rotation = vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, 0, -(((mob_yaw-oldr.y)*.3)+oldr.y)*3) + newr = vector.new((mob_pitch-oldr.x)*.3+oldr.x, 0, ((mob_yaw-oldr.y)*.3+oldr.y)*-3) end end end - elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then - final_rotation = vector.multiply(oldr, 0.9) - else - --final_rotation = vector.new(0,0,0) + elseif not locked_object and math.abs(oldr.y) > 0.05 and math.abs(oldr.x) < 0.05 then + newr = vector.multiply(oldr, 0.9) + end + + -- 0.02 is about 1.14 degrees tolerance, to update less often + local newp = vector.new(0, self.bone_eye_height, self.horizontal_head_height) + if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 and vector.equals(oldp, newp) then return end + if self.object.get_bone_override then -- minetest >= 5.9 + self.object:set_bone_override(self.head_swivel, { + position = { vec = newp, absolute = true }, + rotation = { vec = newr, absolute = true } }) + else -- minetest < 5.9 + -- old API uses degrees not radians + self.object:set_bone_position(self.head_swivel, newp, vector.apply(newr, math.deg)) end - - mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horizontal_head_height), final_rotation) end - function mob_class:set_animation_speed() local v = self.object:get_velocity() if v then diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index d8f8491d5..b0a7ed9d4 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -141,7 +141,7 @@ function mcl_mobs.register_mob(name, def) local final_def = { use_texture_alpha = def.use_texture_alpha, head_swivel = def.head_swivel or nil, -- bool to activate this function - head_yaw_offset = def.head_yaw_offset or 0, -- for wonkey model bones + head_yaw_offset = math.rad(def.head_yaw_offset or 0), -- for wonkey model bones head_pitch_multiplier = def.head_pitch_multiplier or 1, --for inverted pitch bone_eye_height = def.bone_eye_height or 1.4, -- head bone offset head_eye_height = def.head_eye_height or def.bone_eye_height or 0, -- how hight aproximatly the mobs head is fromm the ground to tell the mob how high to look up at the player From 0422635047ce344a24a0f019a430e513ee4f2832 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 04:06:43 +0200 Subject: [PATCH 203/273] Add bonemealing callback to saplings. * Adds a _mcl_on_bonemealing callback to the sapling node definitions. --- mods/ITEMS/mcl_core/nodes_trees.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index beead761d..96b619f73 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -280,6 +280,14 @@ function mcl_core.register_sapling(subname, description, longdesc, tt_help, text nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt" end), + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Saplings: 45% chance to advance growth stage + if math.random(1,100) <= 45 then + return mcl_core.grow_sapling(pos, n) + end + end, node_placement_prediction = "", _mcl_blast_resistance = 0, _mcl_hardness = 0, From 9ea52ce9b38bb1a8ee3e8878fe59b41e2ed4a5fd Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 05:48:00 +0200 Subject: [PATCH 204/273] Add bonemealing callback to small mushrooms. * Adds a _mcl_on_bonemealing callback to the mushroom node definitions. --- mods/ITEMS/mcl_mushrooms/small.lua | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/mods/ITEMS/mcl_mushrooms/small.lua b/mods/ITEMS/mcl_mushrooms/small.lua index 4d1ffa2f5..260fe700a 100644 --- a/mods/ITEMS/mcl_mushrooms/small.lua +++ b/mods/ITEMS/mcl_mushrooms/small.lua @@ -1,5 +1,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local schempath = modpath .. "/schematics/" + local on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node) local soil_node = minetest.get_node_or_nil({x=place_pos.x, y=place_pos.y-1, z=place_pos.z}) if not soil_node then return false end @@ -16,6 +19,40 @@ local on_place = mcl_util.generate_on_place_plant_function(function(place_pos, p return ((snn == "mcl_core:podzol" or snn == "mcl_core:podzol_snow" or snn == "mcl_core:mycelium" or snn == "mcl_core:mycelium_snow") or (light_ok and minetest.get_item_group(snn, "solid") == 1 and minetest.get_item_group(snn, "opaque") == 1)) end) +-- Try to grow huge mushroom +local function apply_bonemeal(pos, schematic, offset) + -- Must be on a dirt-type block + local below = minetest.get_node(vector.offset(pos, 0, -1, 0)) + if minetest.get_item_group(below.name, "grass_block") ~= 1 + and below.name ~= "mcl_core:mycelium" + and below.name ~= "mcl_core:dirt" + and below.name ~= "mcl_core:coarse_dirt" + and below.name ~= "mcl_core:podzol" then + return false + end + -- 40% chance + if math.random(1, 100) <= 40 then + -- Check space requirements + for i= 1, 3 do + local cpos = vector.offset(pos, 0, i, 0) + if minetest.get_node(cpos).name ~= "air" then + return false + end + end + local minp = vector.offset(pos, -3, 3, -3) + local maxp = vector.offset(pos, 3, 8, 3) + local diff = maxp - minp + local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"}) + if #goodnodes < (diff.x + 1) * (diff.y + 1) * (diff.z + 1) then + return false + end + -- Place the huge mushroom + minetest.remove_node(pos) + return minetest.place_schematic(pos + offset, schematic, 0, nil, false) + end + return false +end + local longdesc_intro_brown = S("Brown mushrooms are fungi which grow and spread in darkness, but are sensitive to light. They are inedible as such, but they can be used to craft food items.") local longdesc_intro_red = S("Red mushrooms are fungi which grow and spread in darkness, but are sensitive to light. They are inedible as such, but they can be used to craft food items.") @@ -51,6 +88,11 @@ minetest.register_node("mcl_mushrooms:mushroom_brown", { }, node_placement_prediction = "", on_place = on_place, + _mcl_on_bonemealing = function(pointed_thing, placer) + local schematic = schempath .. "mcl_mushrooms_huge_brown.mts" + local offset = vector.new(-3, -1, -3) + return apply_bonemeal(pointed_thing.under, schematic, offset) + end, _mcl_blast_resistance = 0, }) @@ -78,6 +120,11 @@ minetest.register_node("mcl_mushrooms:mushroom_red", { }, node_placement_prediction = "", on_place = on_place, + _mcl_on_bonemealing = function(pointed_thing, placer) + local schematic = schempath .. "mcl_mushrooms_huge_red.mts" + local offset = vector.new(-2, -1, -2) + return apply_bonemeal(pointed_thing.under, schematic, offset) + end, _mcl_blast_resistance = 0, }) From 71e6fa9646e8855ec16a9e242b71291103f88d3b Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 05:59:14 +0200 Subject: [PATCH 205/273] Add bonemealing callback to wheat. * Adds a _mcl_on_bonemealing callback to the unripe wheat node definitions. --- mods/ITEMS/mcl_farming/wheat.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 4ddbb156a..d8ed0d0fb 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -60,6 +60,12 @@ for i=1,7 do dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) + end }) end From 69032c3222197cc176ce7d3ae12f6e9d25d5c34c Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:05:37 +0200 Subject: [PATCH 206/273] Add bonemealing callback to potatoes. * Adds a _mcl_on_bonemealing callback to the unripe potato plants. --- mods/ITEMS/mcl_farming/potatoes.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 2dc4a3522..da837009a 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -49,6 +49,12 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) + end }) end From 2d8bb12fadc9eb4cc5f53e0d12de4d201e0d3d6b Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:08:38 +0200 Subject: [PATCH 207/273] Add bonemealing callback to carrots. * Adds a _mcl_on_bonemealing callback to the unripe carrot plants. --- mods/ITEMS/mcl_farming/carrots.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index 6f7d7a6aa..a008f73ed 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -45,6 +45,12 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) + end }) end From 5d2fa8072a4ad7521970d225d4e79c582b9a2d64 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:12:45 +0200 Subject: [PATCH 208/273] Add bonemealing callback to pumpkins. * Adds a _mcl_on_bonemealing callback to the unripe pumpkin plants. --- mods/ITEMS/mcl_farming/pumpkin.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 1befef8a8..3d6062f0b 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -79,6 +79,12 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) + end }) end From d07e8d95364e9067b57d95fc454424806b57eac1 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:19:16 +0200 Subject: [PATCH 209/273] Add bonemealing callback to melons. * Adds a _mcl_on_bonemealing callback to the unripe melon plants. --- mods/ITEMS/mcl_farming/melon.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 205150b6e..deda6ba10 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -109,6 +109,12 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + local stages = math.random(2, 5) + return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) + end }) end From 17f2d85de90e243a4d64ce7de37011c7862b713e Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:36:09 +0200 Subject: [PATCH 210/273] Refactor beetroots and add bonemealing callback. * Abstract unripe beetroot plant node registrations into a single indexed definition and do the registration in a loop. * Adds a _mcl_on_bonemealing callback to the unripe melon plants. --- mods/ITEMS/mcl_farming/beetroot.lua | 104 ++++++++++------------------ 1 file changed, 35 insertions(+), 69 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 4c77f3dad..2ee7037f0 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -13,78 +13,44 @@ minetest.register_craftitem("mcl_farming:beetroot_seeds", { end }) -minetest.register_node("mcl_farming:beetroot_0", { - description = S("Premature Beetroot Plant (Stage 1)"), - _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), - _doc_items_entry_name = S("Premature Beetroot Plant"), - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_0.png"}, - inventory_image = "mcl_farming_beetroot_0.png", - wield_image = "mcl_farming_beetroot_0.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} - }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) +local size = {[0]=-5, -3, 2} -minetest.register_node("mcl_farming:beetroot_1", { - description = S("Premature Beetroot Plant (Stage 2)"), - _doc_items_create_entry = false, - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_1.png"}, - inventory_image = "mcl_farming_beetroot_1.png", - wield_image = "mcl_farming_beetroot_1.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -4/16, 0.5} +for i = 0, 2 do + minetest.register_node("mcl_farming:beetroot_".. i, { + description = S("Premature Beetroot Plant (Stage ".. i + 1 ..")"), + _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), + _doc_items_entry_name = S("Premature Beetroot Plant"), + paramtype = "light", + paramtype2 = "meshoptions", + sunlight_propagates = true, + place_param2 = 3, + walkable = false, + drawtype = "plantlike", + drop = "mcl_farming:beetroot_seeds", + tiles = {"mcl_farming_beetroot_".. i ..".png"}, + inventory_image = "mcl_farming_beetroot_".. i ..".png", + wield_image = "mcl_farming_beetroot_".. i ..".png", + selection_box = { + type = "fixed", + fixed = { {-0.5, -0.5, -0.5, 0.5, size[i]/16, 0.5} }, }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) - -minetest.register_node("mcl_farming:beetroot_2", { - description = S("Premature Beetroot Plant (Stage 3)"), - _doc_items_create_entry = false, - paramtype = "light", - paramtype2 = "meshoptions", - sunlight_propagates = true, - place_param2 = 3, - walkable = false, - drawtype = "plantlike", - drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_2.png"}, - inventory_image = "mcl_farming_beetroot_2.png", - wield_image = "mcl_farming_beetroot_2.png", - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -3/16, 0.5} + groups = { + dig_immediate=3, not_in_creative_inventory=1, + plant=1, attached_node=1, dig_by_water=1, + destroy_by_lava_flow=1,dig_by_piston=1 }, - }, - groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 0, -}) + sounds = mcl_sounds.node_sound_leaves_defaults(), + _mcl_blast_resistance = 0, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- 75% chance to advance to next stage + if math.random(1, 100) <= 75 then + return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) + end + end + }) +end minetest.register_node("mcl_farming:beetroot", { description = S("Mature Beetroot Plant"), From f644d37332305f11668c00af81189250a78afd78 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 18 Mar 2024 17:59:37 +0000 Subject: [PATCH 211/273] Keep same selection box size --- mods/ITEMS/mcl_farming/beetroot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 2ee7037f0..605c41005 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -13,7 +13,7 @@ minetest.register_craftitem("mcl_farming:beetroot_seeds", { end }) -local size = {[0]=-5, -3, 2} +local size = {[0]=-5, -4, -3} for i = 0, 2 do minetest.register_node("mcl_farming:beetroot_".. i, { From bde0d9b238ed884427c500379aafa4d7fdfee3ae Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 06:54:07 +0200 Subject: [PATCH 212/273] Add bonemealing callback to cocoa. * Adds a _mcl_on_bonemealing callback to the unripe cocoa pods. --- mods/ITEMS/mcl_cocoas/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 0792972be..0d5491bb8 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -100,6 +100,11 @@ local crop_def = { on_rotate = false, _mcl_blast_resistance = 3, _mcl_hardness = 0.2, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + mcl_cocoas.grow(pos) + return true + end } -- 2nd stage @@ -145,6 +150,7 @@ crop_def.selection_box = { }, } crop_def.drop = "mcl_cocoas:cocoa_beans 3" +crop_def._mcl_on_bonemealing = nil minetest.register_node("mcl_cocoas:cocoa_3", table.copy(crop_def)) minetest.register_craftitem("mcl_cocoas:cocoa_beans", { From fdc7f4634db5feca2e423f5e9427b0268196a175 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 30 Apr 2022 17:34:15 +0200 Subject: [PATCH 213/273] Add bonemealing callback for dirt with grass. * Add new file mcl_flowers/bonemeal.lua, containing the bonemealing callback for "mcl_core:dirt_with_grass". * Override "mcl_core:dirt_with_grass" with a _mcl_on_bonemealing handler calling a function defined in mcl_flowers. This sidesteps the problem that bonemealing a node from mcl_core needs knowledge of mcl_flowers, which would create a circular dependency. H/t to cora for suggesting this solution. H/t to wsor for suggesting a solution that also works. --- mods/ITEMS/mcl_flowers/bonemealing.lua | 123 +++++++++++++++++++++++++ mods/ITEMS/mcl_flowers/init.lua | 3 + 2 files changed, 126 insertions(+) create mode 100644 mods/ITEMS/mcl_flowers/bonemealing.lua diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua new file mode 100644 index 000000000..24c4fbdb8 --- /dev/null +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -0,0 +1,123 @@ +-- bonemealing grass nodes +-- +-- When bonemealing "mcl_core:dirt_with_grass", it spawns grass and flowers +-- over a 7x7 patch of adjacent grassy nodes. +-- +-- Because of potential dependency complications it is not advisable to add +-- callbacks to mcl_core that create dependencies on mods that depend on +-- mcl_core, such as mcl_flowers. +-- +-- To work around this restriction, the bonemealing callback is defined here +-- and the _mcl_on_bonemealing callback in "mcl_core:dirt_with_grass" node +-- definition is overwritten with it. + +local mg_name = minetest.get_mapgen_setting("mg_name") + +local flowers_table_simple = { + "mcl_flowers:dandelion", + "mcl_flowers:poppy", +} +local flowers_table_plains = { + "mcl_flowers:dandelion", + "mcl_flowers:dandelion", + "mcl_flowers:poppy", + "mcl_flowers:oxeye_daisy", + "mcl_flowers:tulip_orange", + "mcl_flowers:tulip_red", + "mcl_flowers:tulip_white", + "mcl_flowers:tulip_pink", + "mcl_flowers:azure_bluet", +} +local flowers_table_swampland = { + "mcl_flowers:blue_orchid", +} +local flowers_table_flower_forest = { + "mcl_flowers:dandelion", + "mcl_flowers:poppy", + "mcl_flowers:oxeye_daisy", + "mcl_flowers:tulip_orange", + "mcl_flowers:tulip_red", + "mcl_flowers:tulip_white", + "mcl_flowers:tulip_pink", + "mcl_flowers:azure_bluet", + "mcl_flowers:allium", +} + +local biome_flowers_tables = { + ["Plains"] = flowers_table_plains, + ["Plains_beach"] = flowers_table_plains, + ["Plains_ocean"] = flowers_table_plains, + ["Plains_deep_ocean"] = flowers_table_plains, + ["Plains_underground"] = flowers_table_plains, + ["SunflowerPlains"] = flowers_table_plains, + ["SunflowerPlains_ocean"] = flowers_table_plains, + ["SunflowerPlains_deep_ocean"] = flowers_table_plains, + ["SunflowerPlains_underground"] = flowers_table_plains, + ["Swampland"] = flowers_table_swampland, + ["Swampland_shore"] = flowers_table_swampland, + ["Swampland_ocean"] = flowers_table_swampland, + ["Swampland_deep_ocean"] = flowers_table_swampland, + ["Swampland_underground"] = flowers_table_swampland, + ["FlowerForest"] = flowers_table_flower_forest, + ["FlowerForest_beach"] = flowers_table_flower_forest, + ["FlowerForest_ocean"] = flowers_table_flower_forest, + ["FlowerForest_deep_ocean"] = flowers_table_flower_forest, + ["FlowerForest_underground"] = flowers_table_flower_forest, +} + +-- Randomly generate flowers, tall grass or nothing +-- pos: node to place into +-- color: param2 value for tall grass +-- +local function add_random_flower(pos, color) + -- 90% tall grass, 10% flower + if math.random(1,100) <= 90 then + minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=color}) + else + local flowers_table + if mg_name == "v6" then + flowers_table = flowers_table_plains + else + local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) + flowers_table = biome_flowers_tables[biome] or flowers_table_simple + end + minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) + end +end + +--- Generate tall grass and random flowers in a 7x7 area +-- Bonemealing callback handler for "mcl_core:dirt_with_grass" +-- +local function bonemeal_grass(pointed_thing, placer) + local pos, below, r, color + for i = -7, 7 do for j = -7, 7 do for y = -1, 1 do + pos = vector.offset(pointed_thing.above, i, y, j) + if minetest.get_node(pos).name == "air" then + below = minetest.get_node(vector.offset(pos, 0, -1, 0)) + r = ((math.abs(i) + math.abs(j)) / 2) + if (minetest.get_item_group(below.name, "grass_block_no_snow") == 1) and + math.random(1, 100) <= 90 / r then + color = below.param2 + add_random_flower(pos, color) + end + end + end end end + return true +end + +-- Overwrite "mcl_core:dirt_with_grass" bonemealing handler. +local nodename = "mcl_core:dirt_with_grass" +local olddef = minetest.registered_nodes[nodename] +if not olddef then + minetest.log("warning", "'mcl_core:dirt_with_grass' not registered, cannot add override!") +else + local oldhandler = olddef._mcl_on_bonemealing + local newdef = table.copy(olddef) + newdef._mcl_on_bonemealing = function (pointed_thing, placer) + bonemeal_grass(pointed_thing, placer) + if oldhandler then + oldhandler(pointed_thing, placer) + end + end + minetest.register_node(":" .. nodename, newdef) +end diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 85a65a165..e4ef5a55c 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -572,3 +572,6 @@ if mod_mcimport and mg_name == "singlenode" and fix_doubleplants == true then end dofile(modpath.."/register.lua") + +-- Bonemealing handler and override for "mcl_core:dirt_with_grass": +dofile(modpath.."/bonemealing.lua") From ea1d52baaba2527a635653a842a9168650b92b44 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 00:05:30 +0200 Subject: [PATCH 214/273] Add bonemealing callback for double flowers. * Adds a _mcl_on_bonemealing callback to the double flowers. --- mods/ITEMS/mcl_flowers/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index e4ef5a55c..0e0a61135 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -243,10 +243,16 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im if name == "double_grass" then bottom_groups.compostability = 50 end + local on_bonemealing if is_flower then bottom_groups.flower = 1 bottom_groups.place_flowerlike = 1 bottom_groups.dig_immediate = 3 + on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + minetest.add_item(pos, "mcl_flowers:"..name) + return true + end else bottom_groups.place_flowerlike = 2 bottom_groups.handy = 1 @@ -381,6 +387,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(top) end end, + _mcl_on_bonemealing = on_bonemealing, groups = bottom_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), mesh = mesh @@ -419,6 +426,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(bottom) end end, + _mcl_on_bonemealing = on_bonemealing, groups = top_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), }) From 21900808325960b95065cbbc61a41c9579c9c6fd Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 00:15:40 +0200 Subject: [PATCH 215/273] Add bonemealing callback for tall grass. * Adds a _mcl_on_bonemealing callback to tall grass. --- mods/ITEMS/mcl_flowers/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 0e0a61135..084975a36 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -162,6 +162,18 @@ local def_tallgrass = { _mcl_fortune_drop = fortune_wheat_seed_drop, node_placement_prediction = "", on_place = on_place_flower, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Grow into double tallgrass + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 }) + minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 }) + return true + end + end, _mcl_blast_resistance = 0, _mcl_hardness = 0, } From f6235e8e92598febbfc0127814ddb243361e36c5 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 00:20:00 +0200 Subject: [PATCH 216/273] Add bonemealing callback for fern. * Adds a _mcl_on_bonemealing callback to fern. --- mods/ITEMS/mcl_flowers/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 084975a36..20c153dfa 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -192,6 +192,18 @@ def_fern.selection_box = { fixed = { -6/16, -0.5, -6/16, 6/16, 5/16, 6/16 }, } def_fern.groups.compostability = 65 +def_fern._mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local n = minetest.get_node(pos) + -- Grow into double fern. + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 }) + minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 }) + return true + end + end minetest.register_node("mcl_flowers:fern", def_fern) From 3889abbaf4ea980ea8a39846724bade0f4974ef7 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 12:33:19 +0200 Subject: [PATCH 217/273] Add mcl_bone_meal. * New mod mcl_bone_meal, replacing bone meal functionality previously held in mcl_dye. * Improve bonemealing API using callbacks in the nodes that support bonemealing. * Rename bone meal item to `"mcl_bone_meal:bone_meal"` and updated its crafting recipe. * Implement legacy compatibility for older bone meal API. * Remove all non dye-related bone meal code, texture and translations from mcl_dye. * Add legacy compatibility shims to mcl_dye that refer to mcl_bone_meal. * Add an alias for "mcl_dye:white" to keep mcl_dye and its API working uniterrupted. * Update mod depends in mcl_dye mod.conf. --- mods/ITEMS/mcl_bone_meal/API.md | 54 ++++ mods/ITEMS/mcl_bone_meal/init.lua | 159 ++++++++++ mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr | 4 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr | 5 + .../mcl_bone_meal/locale/mcl_dye.zh_TW.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/template.txt | 6 + mods/ITEMS/mcl_bone_meal/mod.conf | 3 + .../mcl_bone_meal/textures/mcl_bone_meal.png | Bin mods/ITEMS/mcl_dye/init.lua | 276 +----------------- mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr | 3 - mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr | 3 - mods/ITEMS/mcl_dye/locale/template.txt | 4 - mods/ITEMS/mcl_dye/mod.conf | 3 +- 19 files changed, 259 insertions(+), 293 deletions(-) create mode 100644 mods/ITEMS/mcl_bone_meal/API.md create mode 100644 mods/ITEMS/mcl_bone_meal/init.lua create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/template.txt create mode 100644 mods/ITEMS/mcl_bone_meal/mod.conf rename textures/mcl_bone_meal_bone_meal.png => mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png (100%) diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md new file mode 100644 index 000000000..f0402aae3 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -0,0 +1,54 @@ + +# Bone meal API +Bonemealing callbacks and particle functions. + + +## _mcl_on_bonemealing(pointed_thing, placer) +The bone meal API provides a callback definition that nodes can use to +register a handler that is executed when a bone meal item is used on it. + +Nodes that wish to use the bone meal API should in their node registration +define a callback handler named `_mcl_on_bonemealing`. This handler is a + + `function(pointed_thing, placer)` + +Its arguments are: +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! + +The function should return `true` if the bonemealing was succesful. + +It is for all intents and purposes up to the callback defined in the node to +decide how to handle the effect that bone meal has on that particular node. + +The `on_place` code in the bone meal item will spawn bone meal particles and +decrease the bone meal itemstack if the handler returned `true` and the +`placer` is not in creative mode. + + +## mcl_bone_meal.add_bone_meal_particle(pos, def) +Spawns standard or custom bone meal particles. +* `pos`: position, is ignored if you define def.minpos and def.maxpos +* `def`: (optional) particle definition; see minetest.add_particlespawner() + for more details. + + +# Legacy API +The bone meal API also provides a legacy compatibility function. This +function is not meant to be continued and callers should migrate to the +newer bonemealing API. + +## mcl_bone_meal.register_on_bone_meal_apply(function(pointed_thing, placer)) +Called when the bone meal is applied anywhere. +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +This function is deprecated and will be removed at some time in the future. + +## mcl_dye.add_bone_meal_particle(pos, def) +## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) +These shims in mcl_dye that point to corresponding legacy compatibility +functions in mcl_bone_meal remain for legacy callers that have not yet been +updated to the new API. These shims will be removed at some time in the +future. diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua new file mode 100644 index 000000000..a5487d57e --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -0,0 +1,159 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +local longdesc = S( + "Bone meal is a white dye and also useful as a fertilizer to " .. + "speed up the growth of many plants." +) +local 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." +) + +mcl_bone_meal = {} + +-- Bone meal particle api: + +--- Spawns bone meal particles. +-- pos: where the particles spawn +-- def: particle spawner parameters, see minetest.add_particlespawner() for +-- details on these parameters. +-- +function mcl_bone_meal.add_bone_meal_particle(pos, def) + if not def then + def = {} + end + minetest.add_particlespawner({ + amount = def.amount or 10, + time = def.time or 0.1, + minpos = def.minpos or vector.subtract(pos, 0.5), + maxpos = def.maxpos or vector.add(pos, 0.5), + minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), + maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), + minacc = def.minacc or vector.new(0, 0, 0), + maxacc = def.maxacc or vector.new(0, 0, 0), + minexptime = def.minexptime or 1, + maxexptime = def.maxexptime or 4, + minsize = def.minsize or 0.7, + maxsize = def.maxsize or 2.4, + texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color + glow = def.glow or 1, + }) +end + +-- Begin legacy bone meal API. +-- +-- Compatibility code for legacy users of the old bone meal API. +-- This code will be removed at some time in the future. +-- +mcl_bone_meal.bone_meal_callbacks = {} + +-- Shims for the old API are still available in mcl_dye and refer to +-- the real functions in mcl_bone_meal. +-- +function mcl_bone_meal.register_on_bone_meal_apply(func) + minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!") + table.insert(mcl_bone_meal.bone_meal_callbacks, func) +end + +-- Legacy registered users of the old API are handled through this function. +-- +local function apply_bone_meal(pointed_thing, placer) + for _, func in pairs(mcl_bone_meal.bone_meal_callbacks) do + if func(pointed_thing, placer) then + return true + end + end + + local pos = pointed_thing.under + local n = minetest.get_node(pos) + if n.name == "" then return false end + + -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages + if string.find(n.name, "mcl_farming:sweet_berry_bush_") then + mcl_dye.add_bone_meal_particle(pos) + if n.name == "mcl_farming:sweet_berry_bush_3" then + return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") + else + return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true) + end + return true +--[[ + Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. + -- Handle applying bonemeal to bamboo. + elseif mcl_bamboo.is_bamboo(n.name) then + local success = mcl_bamboo.grow_bamboo(pos, true) + if success then + mcl_dye.add_bone_meal_particle(pos) + end + return success +--]] + end + + return false +end +-- End legacy bone meal API + +minetest.register_craftitem("mcl_bone_meal:bone_meal", { + inventory_image = "mcl_bone_meal.png", + description = S("Bone Meal"), + _tt_help = S("Speeds up plant growth"), + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, + stack_max = 64, + groups = {craftitem=1, dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + -- Use pointed node's on_rightclick function first, if present. + if placer and not placer:get_player_control().sneak then + if ndef and ndef.on_rightclick then + return ndef.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack + end + end + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._mcl_on_bonemealing then + if ndef._mcl_on_bonemealing(pointed_thing, placer) then + mcl_bone_meal.add_bone_meal_particle(pos) + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + end + -- Otherwise try the legacy API. + elseif apply_bone_meal(pointed_thing, placer) and + not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + return itemstack + end, + _on_dispense = function(itemstack, pos, droppos, dropnode, dropdir) + local pointed_thing + if dropnode.name == "air" then + pointed_thing = {above = droppos, under = vector.offset(droppos, 0, -1 ,0)} + else + pointed_thing = {above = pos, under = droppos} + end + local node = minetest.get_node(pointed_thing.under) + local ndef = minetest.registered_nodes[node.name] + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._mcl_on_bonemealing then + if ndef._mcl_on_bonemealing(pointed_thing, nil) then + itemstack:take_item() + end + else + -- Otherwise try the legacy API. + if apply_bone_meal(pointed_thing, nil) then + itemstack:take_item() + end + end + return itemstack + end, + _dispense_into_walkable = true +}) + +minetest.register_craft({ + output = "mcl_bone_meal:bone_meal 3", + recipe = {{"mcl_mobitems:bone"}}, +}) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr new file mode 100644 index 000000000..22aad0ae5 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Knochenmehl +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. +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.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. +Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr new file mode 100644 index 000000000..267f244bb --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_bone_meal +Bone Meal=Harina de hueso +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. +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.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr new file mode 100644 index 000000000..5cb6c42b6 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Farine d'Os +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. +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.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. +Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr new file mode 100644 index 000000000..7c17c4032 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Mączka kostna +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. +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.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. +Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr new file mode 100644 index 000000000..83b9fbe02 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Костная мука +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Костная мука является белым красителем. Она также полезна в качестве удобрения, чтобы увеличить скорость роста многих растений. +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.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы. +Speeds up plant growth=Ускоряет рост растений diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr new file mode 100644 index 000000000..e9c240d19 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=骨粉 +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 +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.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 +Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_bone_meal/locale/template.txt b/mods/ITEMS/mcl_bone_meal/locale/template.txt new file mode 100644 index 000000000..4e295dc57 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/template.txt @@ -0,0 +1,6 @@ +# textdomain: mcl_bone_meal +Bone Meal= +Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= +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.= +Speeds up plant growth= diff --git a/mods/ITEMS/mcl_bone_meal/mod.conf b/mods/ITEMS/mcl_bone_meal/mod.conf new file mode 100644 index 000000000..439973540 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/mod.conf @@ -0,0 +1,3 @@ +name = mcl_bone_meal +description = Bone meal can be used as a fertilizer and as a dye. +author = kabou diff --git a/textures/mcl_bone_meal_bone_meal.png b/mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png similarity index 100% rename from textures/mcl_bone_meal_bone_meal.png rename to mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index b35904fc4..40f75e252 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -15,7 +15,6 @@ mcl_dye = {} local S = minetest.get_translator(minetest.get_current_modname()) -local math = math local string = string -- Base color groups: @@ -115,279 +114,19 @@ for _, row in pairs(dyes) do }) end --- Bone meal code to be moved into its own mod. +-- Legacy support for things now in mcl_bone_meal. +-- These shims will at some time in the future be removed. -- function mcl_dye.add_bone_meal_particle(pos, def) - if not def then - def = {} - end - minetest.add_particlespawner({ - amount = def.amount or 10, - time = def.time or 0.1, - minpos = def.minpos or vector.subtract(pos, 0.5), - maxpos = def.maxpos or vector.add(pos, 0.5), - minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), - maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), - minacc = def.minacc or vector.new(0, 0, 0), - maxacc = def.maxacc or vector.new(0, 0, 0), - minexptime = def.minexptime or 1, - maxexptime = def.maxexptime or 4, - minsize = def.minsize or 0.7, - maxsize = def.maxsize or 2.4, - texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color - glow = def.glow or 1, - }) + minetest.log("warning", "mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md!") + mcl_bone_meal.add_bone_meal_particle(pos, def) end -mcl_dye.bone_meal_callbacks = {} - function mcl_dye.register_on_bone_meal_apply(func) - table.insert(mcl_dye.bone_meal_callbacks, func) + minetest.log("warning", "mcl_dye.register_on_bone_meal_apply() is deprecated. Read mcl_bone_meal/API.md!") + mcl_bone_meal.register_on_bone_meal_apply(func) end -local function apply_bone_meal(pointed_thing, user) - -- Bone meal currently spawns all flowers found in the plains. - local flowers_table_plains = { - "mcl_flowers:dandelion", - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - } - local flowers_table_simple = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - } - local flowers_table_swampland = { - "mcl_flowers:blue_orchid", - } - local flowers_table_flower_forest = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - "mcl_flowers:allium", - } - - local pos = pointed_thing.under - local n = minetest.get_node(pos) - if n.name == "" then return false end - - if mcl_util.check_area_protection(pos, pointed_thing.above, user) then - return false - end - - for _, func in pairs(mcl_dye.bone_meal_callbacks) do - if func(pointed_thing, user) then - return true - end - end - - if minetest.get_item_group(n.name, "sapling") >= 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Saplings: 45% chance to advance growth stage - if math.random(1, 100) <= 45 then - if n.name == "mcl_cherry_blossom:cherrysapling" then - return mcl_cherry_blossom.generate_cherry_tree(pos) -- If cherry blossom sapling, run that callback instead. - else - return mcl_core.grow_sapling(pos, n) - end - end - elseif minetest.get_item_group(n.name, "mushroom") == 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Try to grow huge mushroom - - -- Must be on a dirt-type block - local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) - if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and minetest.get_item_group(below.name, "grass_block") ~= 1 and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then - return false - end - - -- Select schematic - local schematic, offset, height - if n.name == "mcl_mushrooms:mushroom_brown" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_brown.mts" - offset = { x = -3, y = -1, z = -3 } - height = 8 - elseif n.name == "mcl_mushrooms:mushroom_red" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_red.mts" - offset = { x = -2, y = -1, z = -2 } - height = 8 - else - return false - end - -- 40% chance - if math.random(1, 100) <= 40 then - -- Check space requirements - for i=1,3 do - local cpos = vector.add(pos, {x=0, y=i, z=0}) - if minetest.get_node(cpos).name ~= "air" then - return false - end - end - local yoff = 3 - local minp, maxp = {x=pos.x-3, y=pos.y+yoff, z=pos.z-3}, {x=pos.x+3, y=pos.y+yoff+(height-3), z=pos.z+3} - local diff = vector.subtract(maxp, minp) - diff = vector.add(diff, {x=1,y=1,z=1}) - local totalnodes = diff.x * diff.y * diff.z - local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"}) - if #goodnodes < totalnodes then - return false - end - - -- Place the huge mushroom - minetest.remove_node(pos) - local place_pos = vector.add(pos, offset) - local ok = minetest.place_schematic(place_pos, schematic, 0, nil, false) - return ok ~= nil - end - return false - -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages - elseif string.find(n.name, "mcl_farming:wheat_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:potato_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:carrot_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:pumpkin_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:melontige_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:beetroot_") then - mcl_dye.add_bone_meal_particle(pos) - -- Beetroot: 75% chance to advance to next stage - if math.random(1, 100) <= 75 then - return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) - end - elseif string.find(n.name, "mcl_farming:sweet_berry_bush_") then - mcl_dye.add_bone_meal_particle(pos) - if n.name == "mcl_farming:sweet_berry_bush_3" then - return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") - else - return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 1, true) - end - elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then - mcl_dye.add_bone_meal_particle(pos) - -- Cocoa: Advance by 1 stage - mcl_cocoas.grow(pos) - return true - elseif minetest.get_item_group(n.name, "grass_block") == 1 then - -- Grass Block: Generate tall grass and random flowers all over the place - for i = -7, 7 do - for j = -7, 7 do - for y = -1, 1 do - pos = vector.offset(pointed_thing.above, i, y, j) - n = minetest.get_node(pos) - local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0)) - - if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then - -- Randomly generate flowers, tall grass or nothing - if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then - -- 90% tall grass, 10% flower - mcl_dye.add_bone_meal_particle(pos, {amount = 4}) - if math.random(1,100) <= 90 then - local col = n2.param2 - minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) - else - local flowers_table - if mg_name == "v6" then - flowers_table = flowers_table_plains - else - local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) - if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then - flowers_table = flowers_table_swampland - elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then - flowers_table = flowers_table_flower_forest - elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then - flowers_table = flowers_table_plains - else - flowers_table = flowers_table_simple - end - end - minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) - end - end - end - end - end - end - return true - - -- Double flowers: Drop corresponding item - elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:rose_bush") - return true - elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:peony") - return true - elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:lilac") - return true - elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:sunflower") - return true - - elseif n.name == "mcl_flowers:tallgrass" then - mcl_dye.add_bone_meal_particle(pos) - -- Tall Grass: Grow into double tallgrass - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 }) - return true - end - ---[[ - Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. - -- Handle applying bonemeal to bamboo. - elseif mcl_bamboo.is_bamboo(n.name) then - local success = mcl_bamboo.grow_bamboo(pos, true) - if success then - mcl_dye.add_bone_meal_particle(pos) - end - return success ---]] - elseif n.name == "mcl_flowers:fern" then - mcl_dye.add_bone_meal_particle(pos) - -- Fern: Grow into large fern - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 }) - return true - end - end - - return false -end - -mcl_dye.apply_bone_meal = apply_bone_meal - -- Bone meal item registration. -- -- To be moved into its own mod. @@ -609,19 +348,16 @@ minetest.register_craft({ output = "mcl_dye:magenta 2", recipe = {"mcl_dye:violet", "mcl_dye:pink"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:pink 2", recipe = {"mcl_dye:red", "mcl_dye:white"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:cyan 2", recipe = {"mcl_dye:blue", "mcl_dye:dark_green"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:violet 2", diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr index 92be50c17..a2769934a 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr @@ -17,11 +17,7 @@ Magenta Dye=Magenta Farbstoff Pink Dye=Rosa Farbstoff This item is a dye which is used for dyeing and crafting.=Dieser Gegenstand ist ein Farbstoff, der zum Einfärben und in der Herstellung benutzt werden kann. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Rechtsklicken Sie auf ein Schaf, um seine Wolle zu färben. Andere Dinge werden mit der Fertigung eingefärbt. -Bone Meal=Knochenmehl -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. -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.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. Cocoa beans are a brown dye and can be used to plant cocoas.=Kakaobohnen sind ein brauner Farbstoff und werden benutzt, um Kakao anzupflanzen. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. Cocoa Beans=Kakaobohnen Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen -Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr index a829d5386..e363a63b5 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr @@ -17,9 +17,6 @@ Magenta Dye=Tinte magenta Pink Dye=Tinte rosado This item is a dye which is used for dyeing and crafting.=Este artículo es un tinte que se utiliza para teñir y elaborar. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Haga clic derecho sobre una oveja para teñir su lana. Otras cosas pueden ser teñidas mediante la elaboración. -Bone Meal=Harina de hueso -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. -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.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. Cocoa beans are a brown dye and can be used to plant cocoas.=Los granos de cacao son un tinte marrón y se pueden usar para plantar cacao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. Cocoa Beans=Granos de cacao diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr index 761511c5b..efb8d5bb9 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr @@ -17,11 +17,7 @@ Magenta Dye=Teinture Magenta Pink Dye=Teinture Rose This item is a dye which is used for dyeing and crafting.=Cet objet est un colorant utilisé pour la teinture et l'artisanat. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Clic droit sur un mouton pour teindre sa laine. D'autres choses sont teintes par l'artisanat. -Bone Meal=Farine d'Os -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. -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.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. Cocoa beans are a brown dye and can be used to plant cocoas.=Les fèves de cacao ont une teinture brune et peuvent être utilisées pour planter du cacao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. Cocoa Beans=Fèves de Cacao Grows at the side of jungle trees=Pousse à côté des arbres de la jungle -Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr index 85e5b9605..ae8d00641 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr @@ -17,11 +17,7 @@ Magenta Dye=Karmazynowa farba Pink Dye=Różowa farba This item is a dye which is used for dyeing and crafting.=Ten przedmiot to farba wykorzystywana to farbowania i wytwarzania. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Kliknij prawym na owcę aby zafarbować jej wełnę. Inne rzeczy mogą być zafarbowane przy wytwarzaniu. -Bone Meal=Mączka kostna -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. -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.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. Cocoa beans are a brown dye and can be used to plant cocoas.=Ziarna kakaowe mogą być wykorzystane do sadzenia kakao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. Cocoa Beans=Ziarna kakaowe Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew -Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr index 86dc708e2..4552c5ce5 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr @@ -17,9 +17,6 @@ Magenta Dye=洋紅色染料 Pink Dye=粉紅色染料 This item is a dye which is used for dyeing and crafting.=這個物品是一種用於染色和合成的染料。 Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=右鍵單擊綿羊以染它的毛。其他東西是通過合成染色的。 -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 -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.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 Cocoa beans are a brown dye and can be used to plant cocoas.=可可豆是一種棕色染料,也可用於種植可可。 Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 Grows at the side of jungle trees=在叢林木側生長 -Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_dye/locale/template.txt b/mods/ITEMS/mcl_dye/locale/template.txt index 84bac96af..123df4514 100644 --- a/mods/ITEMS/mcl_dye/locale/template.txt +++ b/mods/ITEMS/mcl_dye/locale/template.txt @@ -17,11 +17,7 @@ Magenta Dye= Pink Dye= This item is a dye which is used for dyeing and crafting.= Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= -Bone Meal= -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= -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.= Cocoa beans are a brown dye and can be used to plant cocoas.= Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= Cocoa Beans= Grows at the side of jungle trees= -Speeds up plant growth= diff --git a/mods/ITEMS/mcl_dye/mod.conf b/mods/ITEMS/mcl_dye/mod.conf index fe93278fc..f570211b2 100644 --- a/mods/ITEMS/mcl_dye/mod.conf +++ b/mods/ITEMS/mcl_dye/mod.conf @@ -1,2 +1,3 @@ name = mcl_dye -depends = mcl_core, mcl_flowers, mcl_mobitems, mcl_cocoas +description = Adds color to your world! +depends = mcl_bone_meal, mcl_cocoas From 8855246dd40ae63041a4f5d1d0385557876d8f58 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 16:16:28 +0200 Subject: [PATCH 218/273] Update to new bone meal API. * Update to use new mcl_bone_meal API: * Use new bone meal item and remove related comment. * Update mod depends in mod.conf * Spelling fixes: s/bonemeal/bone meal/g --- mods/ITEMS/mcl_composters/init.lua | 10 ++++------ mods/ITEMS/mcl_composters/locale/template.txt | 6 +++--- mods/ITEMS/mcl_composters/mod.conf | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index efa08c75c..b635760ca 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -11,7 +11,7 @@ local composter_description = S( "Composter" ) local composter_longdesc = S( - "Composters can convert various organic items into bonemeal." + "Composters can convert various organic items into bone meal." ) local composter_usagehelp = S( "Use organic items on the composter to fill it with layers of compost. " .. @@ -97,7 +97,7 @@ function composter_progress_chance(pos, node, chance) -- get current compost level local level = registered_nodes[node.name]["_mcl_compost_level"] -- spawn green particles above new layer - mcl_dye.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) + mcl_bone_meal.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) -- update composter block if level < 7 then level = level + 1 @@ -114,9 +114,7 @@ function composter_progress_chance(pos, node, chance) -- the block will get updated by the node timer callback set in node reg def if level == 7 then local timer = get_node_timer(pos) - if not timer:is_started() then - timer:start(1) - end + timer:start(1) end end end @@ -203,7 +201,7 @@ end -- minetest.register_node("mcl_composters:composter", { description = composter_description, - _tt_help = S("Converts organic items into bonemeal"), + _tt_help = S("Converts organic items into bone meal"), _doc_items_longdesc = composter_longdesc, _doc_items_usagehelp = composter_usagehelp, paramtype = "light", diff --git a/mods/ITEMS/mcl_composters/locale/template.txt b/mods/ITEMS/mcl_composters/locale/template.txt index f3329719a..5d8df6fdb 100644 --- a/mods/ITEMS/mcl_composters/locale/template.txt +++ b/mods/ITEMS/mcl_composters/locale/template.txt @@ -1,7 +1,7 @@ # textdomain: mcl_composters Composter= -Composters can convert various organic items into bonemeal.= -Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.= +Composters can convert various organic items into bone meal.= +Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter."= filled= ready for harvest= -Converts organic items into bonemeal= +Converts organic items into bone meal= diff --git a/mods/ITEMS/mcl_composters/mod.conf b/mods/ITEMS/mcl_composters/mod.conf index ed6119d3a..f7f229fbc 100644 --- a/mods/ITEMS/mcl_composters/mod.conf +++ b/mods/ITEMS/mcl_composters/mod.conf @@ -1,5 +1,5 @@ name = mcl_composters author = kabou description = Composters can convert various organic items into bonemeal. -depends = mcl_core, mcl_sounds, mcl_dye, mcl_hoppers +depends = mcl_core, mcl_sounds, mcl_bone_meal, mcl_hoppers optional_depends = doc From e8d965e21ae224dcc854763b94c673045cec3748 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 16:30:30 +0200 Subject: [PATCH 219/273] Add more particles when bonemealing grass. * Bonemealing dirt_with_grass spawns new growth over a wide area, so it looks better if we spawn a few more extra bone meal particles. * Update mod.conf depends to mcl_bone_meal. --- mods/ITEMS/mcl_flowers/bonemealing.lua | 3 +++ mods/ITEMS/mcl_flowers/mod.conf | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua index 24c4fbdb8..a478ec458 100644 --- a/mods/ITEMS/mcl_flowers/bonemealing.lua +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -99,6 +99,9 @@ local function bonemeal_grass(pointed_thing, placer) math.random(1, 100) <= 90 / r then color = below.param2 add_random_flower(pos, color) + if math.random(1,5) == 1 then + mcl_bone_meal.add_bone_meal_particle(pos) + end end end end end end diff --git a/mods/ITEMS/mcl_flowers/mod.conf b/mods/ITEMS/mcl_flowers/mod.conf index b309ac22e..cd67070da 100644 --- a/mods/ITEMS/mcl_flowers/mod.conf +++ b/mods/ITEMS/mcl_flowers/mod.conf @@ -1,3 +1,3 @@ name=mcl_flowers -depends=mcl_core, mcl_util, mcl_sounds -optional_depends=screwdriver, doc, mcl_flowerpots \ No newline at end of file +depends=mcl_core, mcl_util, mcl_sounds, mcl_bone_meal +optional_depends=screwdriver, doc, mcl_flowerpots From 7ddcf3f93fd42571be9a6b9e559f6e8953a299da Mon Sep 17 00:00:00 2001 From: kabou Date: Mon, 2 May 2022 01:35:47 +0200 Subject: [PATCH 220/273] Use better override mechanism. * Use `minetest.override_item()` instead of re-registering the node with ":" prefixed to its name. Thanks again to wsor for mentioning this. --- mods/ITEMS/mcl_flowers/bonemealing.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua index a478ec458..297c297e8 100644 --- a/mods/ITEMS/mcl_flowers/bonemealing.lua +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -108,19 +108,18 @@ local function bonemeal_grass(pointed_thing, placer) return true end --- Overwrite "mcl_core:dirt_with_grass" bonemealing handler. +-- Override "mcl_core:dirt_with_grass" bonemealing handler. local nodename = "mcl_core:dirt_with_grass" local olddef = minetest.registered_nodes[nodename] if not olddef then minetest.log("warning", "'mcl_core:dirt_with_grass' not registered, cannot add override!") else local oldhandler = olddef._mcl_on_bonemealing - local newdef = table.copy(olddef) - newdef._mcl_on_bonemealing = function (pointed_thing, placer) + local newhandler = function (pointed_thing, placer) bonemeal_grass(pointed_thing, placer) if oldhandler then oldhandler(pointed_thing, placer) end end - minetest.register_node(":" .. nodename, newdef) + minetest.override_item(nodename, {_mcl_on_bonemealing = newhandler}) end From ae56a864d0e633e8cd2b0662a9b8ce0f5ac0a01f Mon Sep 17 00:00:00 2001 From: kabou Date: Tue, 3 May 2022 10:31:55 +0200 Subject: [PATCH 221/273] Remove stray line from locale template. * Removed a line from the mcl_bone_meal locale template that had by accident put there during the bone meal <-> white dye changes. --- mods/ITEMS/mcl_bone_meal/locale/template.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_bone_meal/locale/template.txt b/mods/ITEMS/mcl_bone_meal/locale/template.txt index 4e295dc57..9ecc61044 100644 --- a/mods/ITEMS/mcl_bone_meal/locale/template.txt +++ b/mods/ITEMS/mcl_bone_meal/locale/template.txt @@ -1,6 +1,5 @@ # textdomain: mcl_bone_meal Bone Meal= -Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= 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.= Speeds up plant growth= From 810051c5918c5e5eff43b05cedf90fa37f61c486 Mon Sep 17 00:00:00 2001 From: kabou Date: Mon, 2 May 2022 00:58:31 +0200 Subject: [PATCH 222/273] Move cocoa beans item to mcl_cocoas. * Add `mcl_cocoas:coca_beans` craftitem to mcl_cocoas. * Remove `mcl_dye:brown` craftitem from mcl_dye. * Move cocoa beans translations from mcl_dye to mcl_cocoas. * Add `mcl_dye:brown` alias for `mcl_cocoas:cocoa_beans` to mcl_dye. * Abstract cocoa pod node registration into a loop. * Update chocolate cookies crafting recipe in mcl_farming. --- mods/ITEMS/mcl_cocoas/init.lua | 225 ++++++++++-------- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr | 3 +- .../mcl_cocoas/locale/mcl_cocoas.zh_TW.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/template.txt | 2 +- mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr | 3 - mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr | 3 - mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr | 3 - mods/ITEMS/mcl_dye/locale/template.txt | 4 - ...as_cocoa_beans.png => mcl_cocoa_beans.png} | Bin 16 files changed, 132 insertions(+), 133 deletions(-) rename textures/{mcl_cocoas_cocoa_beans.png => mcl_cocoa_beans.png} (100%) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 0d5491bb8..dc065f0ca 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -2,29 +2,33 @@ local S = minetest.get_translator(minetest.get_current_modname()) mcl_cocoas = {} --- Place cocoa -local function cocoa_place(itemstack, placer, pt, plantname) +--- Place a cocoa pod. +-- Attempt to place a cocoa pod on a jungle tree. Checks if attachment +-- point is a jungle tree and sets the correct orientation of the stem. +-- +function mcl_cocoas.place(itemstack, placer, pt, plantname) -- check if pointing at a node if not pt or pt.type ~= "node" then return end - local under = minetest.get_node(pt.under) + local node = minetest.get_node(pt.under) -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then + local def = minetest.registered_nodes[node.name] + if not def then return end -- Am I right-clicking on something that has a custom on_rightclick set? if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then - return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack) or itemstack + if def and def.on_rightclick then + return def.on_rightclick(pt.under, node, placer, itemstack) or itemstack end end -- Check if pointing at jungle tree - if under.name ~= "mcl_core:jungletree" + if node.name ~= "mcl_core:jungletree" or minetest.get_node(pt.above).name ~= "air" then return end @@ -39,9 +43,7 @@ local function cocoa_place(itemstack, placer, pt, plantname) -- Add the node, set facedir and remove 1 item from the itemstack minetest.set_node(pt.above, {name = plantname, param2 = minetest.dir_to_facedir(clickdir)}) - minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true) - if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end @@ -49,117 +51,138 @@ local function cocoa_place(itemstack, placer, pt, plantname) return itemstack end --- Attempts to grow a cocoa at pos, returns true when grown, returns false if there's no cocoa --- or it is already at full size +--- Grows cocoa pod one size larger. +-- Attempts to grow a cocoa at pos, returns true when grown, returns false +-- if there's no cocoa or it is already at full size. +-- function mcl_cocoas.grow(pos) local node = minetest.get_node(pos) if node.name == "mcl_cocoas:cocoa_1" then minetest.set_node(pos, {name = "mcl_cocoas:cocoa_2", param2 = node.param2}) elseif node.name == "mcl_cocoas:cocoa_2" then minetest.set_node(pos, {name = "mcl_cocoas:cocoa_3", param2 = node.param2}) - return true + else + return false end - return false + return true end --- Cocoa definition --- 1st stage -local crop_def = { - description = S("Premature Cocoa Pod"), - _doc_items_create_entry = true, - _doc_items_longdesc = S("Cocoa pods grow on the side of jungle trees in 3 stages."), - drawtype = "mesh", - mesh = "mcl_cocoas_cocoa_stage_0.obj", - tiles = {"mcl_cocoas_cocoa_stage_0.png"}, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "facedir", - walkable = true, - drop = "mcl_cocoas:cocoa_beans", - collision_box = { - type = "fixed", - fixed = { - {-0.125, -0.0625, 0.1875, 0.125, 0.25, 0.4375}, -- Pod +-- only caller was mcl_dye, now these can be local functions. +-- TODO: remove aliases, replace global functions with local functions. +local cocoa_place = mcl_cocoas.place +local cocoa_grow = mcl_cocoas.grow + +-- Cocoa pod variant definitions. +--[[ TODO: Use a mesh for cocoas for perfect texture compability. ]] +local podinfo = { + { desc = S("Premature Cocoa Pod"), + longdesc = S("Cocoa pods grow on the side of jungle trees in 3 stages."), + tiles = { + "[combine:16x16:6,1=mcl_cocoas_cocoa_stage_0.png", + "[combine:16x16:6,11=mcl_cocoas_cocoa_stage_0.png", + "mcl_cocoas_cocoa_stage_0.png", + "mcl_cocoas_cocoa_stage_0.png^[transformFX", + "[combine:16x16:-5,0=mcl_cocoas_cocoa_stage_0.png", + "[combine:16x16:-5,0=mcl_cocoas_cocoa_stage_0.png", }, + n_box = {-0.125, -0.0625, 0.1875, 0.125, 0.25, 0.4375}, + s_box = {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5 }, }, - selection_box = { - type = "fixed", - fixed = { - {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5}, -- Pod + { desc = S("Medium Cocoa Pod"), + tiles = { + "[combine:16x16:5,1=mcl_cocoas_cocoa_stage_1.png", + "[combine:16x16:5,9=mcl_cocoas_cocoa_stage_1.png", + "mcl_cocoas_cocoa_stage_1.png", + "mcl_cocoas_cocoa_stage_1.png^[transformFX", + "[combine:16x16:-4,0=mcl_cocoas_cocoa_stage_1.png", + "[combine:16x16:-4,0=mcl_cocoas_cocoa_stage_1.png", }, + n_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.25, 0.4375}, + s_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5 }, }, - groups = { - handy = 1, axey = 1, - dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, - attached_node_facedir=1, - not_in_creative_inventory=1, - cocoa=1 + { desc = S("Mature Cocoa Pod"), + longdesc = S("A mature cocoa pod grew on a jungle tree to its full size and it is ready to be harvested for cocoa beans. It won't grow any further."), + tiles = { + -- The following 2 textures were derived from the original + -- because the size of the top/bottom is slightly different :-( + -- TODO: Find a way to *only* use the base texture + "mcl_cocoas_cocoa_top_stage_2.png", + "mcl_cocoas_cocoa_top_stage_2.png^[transformFY", + "mcl_cocoas_cocoa_stage_2.png", + "mcl_cocoas_cocoa_stage_2.png^[transformFX", + "[combine:16x16:-3,0=mcl_cocoas_cocoa_stage_2.png", + "[combine:16x16:-3,0=mcl_cocoas_cocoa_stage_2.png", + }, + n_box = {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, + s_box = {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5 }, }, - sounds = mcl_sounds.node_sound_wood_defaults(), - on_rotate = false, - _mcl_blast_resistance = 3, - _mcl_hardness = 0.2, - _mcl_on_bonemealing = function(pointed_thing, placer) - local pos = pointed_thing.under - mcl_cocoas.grow(pos) - return true +} + +for i = 1, 3 do + local def = { + description = podinfo[i].desc, + _doc_items_create_entry = true, + _doc_items_longdesc = podinfo[i].longdesc, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + tiles = podinfo[i].tiles, + use_texture_alpha = "clip", + node_box = { + type = "fixed", + fixed = { + podinfo[i].n_box, -- Pod + -- FIXME: This has a thickness of 0. Is this OK in Minetest? + { 0, 0.25, 0.25, 0, 0.5, 0.5 }, }, -- Stem + }, + collision_box = { + type = "fixed", + fixed = podinfo[i].n_box + }, + selection_box = { + type = "fixed", + fixed = podinfo[i].s_box + }, + groups = { + handy = 1, axey = 1, attached_node_facedir = 1, + dig_by_water = 1, destroy_by_lava_flow = 1, dig_by_piston = 1, + cocoa = i, not_in_creative_inventory = 1, + }, + sunlight_propagates = true, + walkable = true, + drop = "mcl_cocoas:cocoa_beans", + sounds = mcl_sounds.node_sound_wood_defaults(), + on_rotate = false, + _mcl_blast_resistance = 3, + _mcl_hardness = 0.2, + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + return cocoa_grow(pos) + end, + } + + if i == 2 then + def._doc_items_longdesc = nil + def._doc_items_create_entry = false + end + if i == 3 then + def.drop = "mcl_cocoas:cocoa_beans 3" end -} --- 2nd stage -minetest.register_node("mcl_cocoas:cocoa_1", table.copy(crop_def)) - -crop_def.description = S("Medium Cocoa Pod") -crop_def._doc_items_create_entry = false -crop_def.groups.cocoa = 2 -crop_def.mesh = "mcl_cocoas_cocoa_stage_1.obj" -crop_def.tiles = {"mcl_cocoas_cocoa_stage_1.png"} -crop_def.collision_box = { - type = "fixed", - fixed = { - {-0.1875, -0.1875, 0.0625, 0.1875, 0.25, 0.4375}, -- Pod - }, -} -crop_def.selection_box = { - type = "fixed", - fixed = { - {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5}, - }, -} - -minetest.register_node("mcl_cocoas:cocoa_2", table.copy(crop_def)) - --- Final stage -crop_def.description = S("Mature Cocoa Pod") -crop_def._doc_items_longdesc = S("A mature cocoa pod grew on a jungle tree to its full size and it is ready to be harvested for cocoa beans. It won't grow any further.") -crop_def._doc_items_create_entry = true -crop_def.groups.cocoa = 3 -crop_def.mesh = "mcl_cocoas_cocoa_stage_2.obj" -crop_def.tiles = {"mcl_cocoas_cocoa_stage_2.png"} -crop_def.collision_box = { - type = "fixed", - fixed = { - {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, -- Pod - }, -} -crop_def.selection_box = { - type = "fixed", - fixed = { - {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5}, - }, -} -crop_def.drop = "mcl_cocoas:cocoa_beans 3" -crop_def._mcl_on_bonemealing = nil -minetest.register_node("mcl_cocoas:cocoa_3", table.copy(crop_def)) + minetest.register_node("mcl_cocoas:cocoa_" .. i, table.copy(def)) +end minetest.register_craftitem("mcl_cocoas:cocoa_beans", { - description = S("Cocoa Beans"), + inventory_image = "mcl_cocoa_beans.png", _tt_help = S("Grows at the side of jungle trees"), - _doc_items_longdesc = S("Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye."), - _doc_items_usagehelp = S("Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa."), - inventory_image = "mcl_cocoas_cocoa_beans.png", - groups = {craftitem = 1, compostability = 65}, + _doc_items_longdesc = S("Cocoa beans can be used to plant cocoa, bake cookies or cract brown dye."), + _doc_items_usagehelp = S("Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa."), + description = S("Cocoa Beans"), + stack_max = 64, + groups = { + dye = 1, craftitem = 1, compostability = 65, + basecolor_brown = 1, excolor_orange = 1, unicolor_dark_orange = 1, + }, on_place = function(itemstack, placer, pointed_thing) return cocoa_place(itemstack, placer, pointed_thing, "mcl_cocoas:cocoa_1") end, diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr index 3740c41cf..ba0eb433e 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.de.tr @@ -2,7 +2,7 @@ Cocoa Beans=Kakaobohnen Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen Cocoa beans can be used to plant cocoa pods, bake chocolate cookies or craft brown dye.=Kakaobohnen können benutzt werden, um Kakao anzupflanzen, Kekse zu backen oder braune Farbstoffe herzustellen. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. Premature Cocoa Pod=Junge Kakaoschote Cocoa pods grow on the side of jungle trees in 3 stages.=Kakaoschoten wachsen an der Seite von Dschungelbäumen in 3 Stufen. Medium Cocoa Pod=Mittelgroße Kakaoschote diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr index c76fc512f..c110a1a9a 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr @@ -2,7 +2,7 @@ Cocoa Beans=Granos de cacao Grows at the side of jungle trees=Crece al lado de los árboles de la jungla Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Los granos de cacao se pueden usar para plantar cacao, hornear galletas o hacer tintes marrones. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en el costado del tronco de un árbol de la jungla para plantar un cacao joven. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. Premature Cocoa Pod=Vaina de cacao prematura Cocoa pods grow on the side of jungle trees in 3 stages.=Las vainas de cacao crecen al lado de los árboles de jungla en 3 etapas. Medium Cocoa Pod=Vaina de cacao mediana diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr index 5d64eb5be..2cd11dc93 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.fr.tr @@ -2,7 +2,7 @@ Cocoa Beans=Fèves de Cacao Grows at the side of jungle trees=Pousse à côté des arbres de la jungle Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Les fèves de cacao peuvent être utilisées pour planter du cacao, faire des biscuits ou fabriquer de la teinture brune. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacaoyer. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. Premature Cocoa Pod=Gousse de cacao prématurée Cocoa pods grow on the side of jungle trees in 3 stages.=Les cabosses de cacao poussent sur le côté des arbres d'Acajou en 3 étapes. Medium Cocoa Pod=Gousse de cacao moyenne diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr index 83df9be7a..5e33ca727 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.pl.tr @@ -2,7 +2,7 @@ Cocoa Beans=Ziarna kakaowe Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Ziarna kakaowe mogą być używane do sadzenia kakao, pieczenia ciasteczek lub robienia brązowego barwnika. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. Premature Cocoa Pod=Niedojrzała roślina kakao Cocoa pods grow on the side of jungle trees in 3 stages.=Roślina kakao rośnie na bokach tropikalnych drzew w 3 etapach Medium Cocoa Pod=Średnio-dojrzała roślina kakao diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr index acce2fa83..2e36baadb 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr @@ -2,7 +2,8 @@ Cocoa Beans=Какао-бобы Grows at the side of jungle trees=Растут на стволах тропических деревьев Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Какао-бобы можно использовать для посадки какао, выпечки печенья или изготовления коричневого красителя. -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола дерева джунглей, что +>>>>>>> 195f0dfba (Move cocoa beans item to mcl_cocoas.) Premature Cocoa Pod=Молодой стручок какао Cocoa pods grow on the side of jungle trees in 3 stages.=Стручки какао растут на деревьях джунглей в 3 этапа. Medium Cocoa Pod=Средний стручок какао diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr index 038746155..d7eec03bc 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.zh_TW.tr @@ -2,7 +2,7 @@ Cocoa Beans=可可豆 Grows at the side of jungle trees=在叢林木側生長 Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=可可豆可用於種植可可、烘烤餅乾或製作棕色染料。 -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊叢林木的一側,可以種植一個可可。 +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 Premature Cocoa Pod=成長中的可可豆莢(第1階段) Cocoa pods grow on the side of jungle trees in 3 stages.=可可莢果分3個階段生長在叢林樹的側面。 Medium Cocoa Pod=成長中的可可豆莢(第2階段) diff --git a/mods/ITEMS/mcl_cocoas/locale/template.txt b/mods/ITEMS/mcl_cocoas/locale/template.txt index cb8c5bbfd..06d6e2480 100644 --- a/mods/ITEMS/mcl_cocoas/locale/template.txt +++ b/mods/ITEMS/mcl_cocoas/locale/template.txt @@ -2,7 +2,7 @@ Cocoa Beans= Grows at the side of jungle trees= Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.= -Right click on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= Premature Cocoa Pod= Cocoa pods grow on the side of jungle trees in 3 stages.= Medium Cocoa Pod= diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr index a2769934a..2069d4d76 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr @@ -17,7 +17,3 @@ Magenta Dye=Magenta Farbstoff Pink Dye=Rosa Farbstoff This item is a dye which is used for dyeing and crafting.=Dieser Gegenstand ist ein Farbstoff, der zum Einfärben und in der Herstellung benutzt werden kann. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Rechtsklicken Sie auf ein Schaf, um seine Wolle zu färben. Andere Dinge werden mit der Fertigung eingefärbt. -Cocoa beans are a brown dye and can be used to plant cocoas.=Kakaobohnen sind ein brauner Farbstoff und werden benutzt, um Kakao anzupflanzen. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. -Cocoa Beans=Kakaobohnen -Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr index e363a63b5..542e367f9 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr @@ -17,6 +17,3 @@ Magenta Dye=Tinte magenta Pink Dye=Tinte rosado This item is a dye which is used for dyeing and crafting.=Este artículo es un tinte que se utiliza para teñir y elaborar. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Haga clic derecho sobre una oveja para teñir su lana. Otras cosas pueden ser teñidas mediante la elaboración. -Cocoa beans are a brown dye and can be used to plant cocoas.=Los granos de cacao son un tinte marrón y se pueden usar para plantar cacao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. -Cocoa Beans=Granos de cacao diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr index efb8d5bb9..eddd5edf4 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr @@ -17,7 +17,3 @@ Magenta Dye=Teinture Magenta Pink Dye=Teinture Rose This item is a dye which is used for dyeing and crafting.=Cet objet est un colorant utilisé pour la teinture et l'artisanat. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Clic droit sur un mouton pour teindre sa laine. D'autres choses sont teintes par l'artisanat. -Cocoa beans are a brown dye and can be used to plant cocoas.=Les fèves de cacao ont une teinture brune et peuvent être utilisées pour planter du cacao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. -Cocoa Beans=Fèves de Cacao -Grows at the side of jungle trees=Pousse à côté des arbres de la jungle diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr index ae8d00641..c665b2b43 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr @@ -17,7 +17,3 @@ Magenta Dye=Karmazynowa farba Pink Dye=Różowa farba This item is a dye which is used for dyeing and crafting.=Ten przedmiot to farba wykorzystywana to farbowania i wytwarzania. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Kliknij prawym na owcę aby zafarbować jej wełnę. Inne rzeczy mogą być zafarbowane przy wytwarzaniu. -Cocoa beans are a brown dye and can be used to plant cocoas.=Ziarna kakaowe mogą być wykorzystane do sadzenia kakao. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. -Cocoa Beans=Ziarna kakaowe -Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr index d595bb6a1..fa1d031c4 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.ru.tr @@ -22,6 +22,3 @@ Bone meal is a white dye and also useful as a fertilizer to speed up the growth 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.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы. Cocoa beans are a brown dye and can be used to plant cocoas.=Какао-бобы являются коричневым красителем. Их также можно использовать, чтобы посадить какао. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. -Cocoa Beans=Какао-бобы -Grows at the side of jungle trees=Растут на стволах тропических деревьев -Speeds up plant growth=Ускоряет рост растений diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr index 4552c5ce5..7ea308119 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr @@ -17,6 +17,3 @@ Magenta Dye=洋紅色染料 Pink Dye=粉紅色染料 This item is a dye which is used for dyeing and crafting.=這個物品是一種用於染色和合成的染料。 Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=右鍵單擊綿羊以染它的毛。其他東西是通過合成染色的。 -Cocoa beans are a brown dye and can be used to plant cocoas.=可可豆是一種棕色染料,也可用於種植可可。 -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 -Grows at the side of jungle trees=在叢林木側生長 diff --git a/mods/ITEMS/mcl_dye/locale/template.txt b/mods/ITEMS/mcl_dye/locale/template.txt index 123df4514..e07f6ef54 100644 --- a/mods/ITEMS/mcl_dye/locale/template.txt +++ b/mods/ITEMS/mcl_dye/locale/template.txt @@ -17,7 +17,3 @@ Magenta Dye= Pink Dye= This item is a dye which is used for dyeing and crafting.= Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= -Cocoa beans are a brown dye and can be used to plant cocoas.= -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= -Cocoa Beans= -Grows at the side of jungle trees= diff --git a/textures/mcl_cocoas_cocoa_beans.png b/textures/mcl_cocoa_beans.png similarity index 100% rename from textures/mcl_cocoas_cocoa_beans.png rename to textures/mcl_cocoa_beans.png From e5cf4bd225ac726c686b962723b490f57b6a0f05 Mon Sep 17 00:00:00 2001 From: kabou Date: Tue, 3 May 2022 13:29:37 +0200 Subject: [PATCH 223/273] Add missing es translation to mcl_bone_meal. --- mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr index 267f244bb..4d991624f 100644 --- a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr @@ -2,3 +2,4 @@ Bone Meal=Harina de hueso Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. 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.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. +Speeds up plant growth=Acelera el crecimiento de las plantas From c2c7df820fe61e9d589c6df12bdc03608f2c6804 Mon Sep 17 00:00:00 2001 From: kabou Date: Tue, 3 May 2022 15:05:10 +0200 Subject: [PATCH 224/273] Improve mcl_bone_meal fr translations. * Changed the wording after suggestions by AFCMS. --- mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr index 5cb6c42b6..61df77d59 100644 --- a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr @@ -1,5 +1,6 @@ # textdomain: mcl_bone_meal Bone Meal=Farine d'Os -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. -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.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes. +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.= +Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour. Speeds up plant growth=Accélère la croissance des plantes From 8acddab74f42d9b170c4a519e9f7e7505ef844d6 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 4 May 2022 12:17:51 +0200 Subject: [PATCH 225/273] Bonemealing mechanics bugfix. When applying bonemeal to eg. farm crops, these have a chance to grow in response to the application of bone meal. When a node can be bonemealed, the applied bone meal item should always be spent after using it, regardless of the results. Currently this does not work correctly, if the result of bonemealing has no effect on the node, the used bone meal item is not spent. This commit fixes the behavior of the bone meal item to always be taken when used on a node that defines a `_mcl_on_bonemealing()` callback. The nodes that implement the callback imay use the handler's return value only to signal if the bonemealing was succesful, not to signal if it was at all possible. For this reason, some nodes need to be made more strictly conforming to the API. * Always take the used bone meal item (if user is not in creative mode), regardless of whether the bonemealed node's handler returned `true`. * Make dispensers spawn particles after succesful bonemealing. * Trivial comment fix. * Ripe cocoa pod cannot be bonemealed. * Update API.md to describe the stricter API semantics. --- mods/ITEMS/mcl_bone_meal/API.md | 19 ++++++++++++++----- mods/ITEMS/mcl_bone_meal/init.lua | 11 ++++++----- mods/ITEMS/mcl_cocoas/init.lua | 1 + 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md index f0402aae3..46a28fadb 100644 --- a/mods/ITEMS/mcl_bone_meal/API.md +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -8,7 +8,17 @@ The bone meal API provides a callback definition that nodes can use to register a handler that is executed when a bone meal item is used on it. Nodes that wish to use the bone meal API should in their node registration -define a callback handler named `_mcl_on_bonemealing`. This handler is a +define a callback handler named `_mcl_on_bonemealing`. + +Note that by registering the callback handler, the node declares that bone +meal can be used on it and as a result, when the user is not in creative +mode, the used bone meal is spent and taken from the itemstack passed to +the `on_place()` handler of the bone meal item used. + +It is for all intents and purposes up to the callback defined in the node to +decide how to handle the specific effect that bone meal has on that node. + +The `_mcl_on_bonemealing` callback handler is a `function(pointed_thing, placer)` @@ -17,10 +27,9 @@ Its arguments are: bone meal is applied * `placer`: ObjectRef of the player who aplied the bone meal, can be nil! -The function should return `true` if the bonemealing was succesful. - -It is for all intents and purposes up to the callback defined in the node to -decide how to handle the effect that bone meal has on that particular node. +The return value of the handler function indicates if the bonemealing had +its intended effect. If `true`, 'bone meal particles' are spawned at the +position of the bonemealed node. The `on_place` code in the bone meal item will spawn bone meal particles and decrease the bone meal itemstack if the handler returned `true` and the diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index a5487d57e..8898b9e5a 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -49,7 +49,7 @@ end -- mcl_bone_meal.bone_meal_callbacks = {} --- Shims for the old API are still available in mcl_dye and refer to +-- Shims for the old API are still available in mcl_dye and defer to -- the real functions in mcl_bone_meal. -- function mcl_bone_meal.register_on_bone_meal_apply(func) @@ -117,9 +117,9 @@ minetest.register_craftitem("mcl_bone_meal:bone_meal", { if ndef and ndef._mcl_on_bonemealing then if ndef._mcl_on_bonemealing(pointed_thing, placer) then mcl_bone_meal.add_bone_meal_particle(pos) - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() end -- Otherwise try the legacy API. elseif apply_bone_meal(pointed_thing, placer) and @@ -140,8 +140,9 @@ minetest.register_craftitem("mcl_bone_meal:bone_meal", { -- If the pointed node can be bonemealed, let it handle the processing. if ndef and ndef._mcl_on_bonemealing then if ndef._mcl_on_bonemealing(pointed_thing, nil) then - itemstack:take_item() + mcl_bone_meal.add_bone_meal_particle(pos) end + itemstack:take_item() else -- Otherwise try the legacy API. if apply_bone_meal(pointed_thing, nil) then diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index dc065f0ca..726c72feb 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -167,6 +167,7 @@ for i = 1, 3 do end if i == 3 then def.drop = "mcl_cocoas:cocoa_beans 3" + def._mcl_on_bonemealing = nil end minetest.register_node("mcl_cocoas:cocoa_" .. i, table.copy(def)) From 7938fba4a5fd2ddeca0ea81d2f06b3df7472fac1 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 4 May 2022 13:50:52 +0200 Subject: [PATCH 226/273] Remove expired bone meal API.md from mcl_dye. --- mods/ITEMS/mcl_dye/API.md | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 mods/ITEMS/mcl_dye/API.md diff --git a/mods/ITEMS/mcl_dye/API.md b/mods/ITEMS/mcl_dye/API.md deleted file mode 100644 index 04169f966..000000000 --- a/mods/ITEMS/mcl_dye/API.md +++ /dev/null @@ -1,14 +0,0 @@ -# mcl_dye - -# Bone meal API -Callback and particle functions. - -## mcl_dye.add_bone_meal_particle(pos, def) -Spawns standard or custom bone meal particles. -* `pos`: position, is ignored if you define def.minpos and def.maxpos -* `def`: (optional) particle definition - -## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) -Called when the bone meal is applied anywhere. -* `pointed_thing`: exact pointing location (see Minetest API), where the bone meal is applied -* `user`: ObjectRef of the player who aplied the bone meal, can be nil! \ No newline at end of file From ba1e0e4301b9810b7b0654841e77163c40768e84 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 4 May 2022 14:55:19 +0200 Subject: [PATCH 227/273] Also generate double grass when bonemealing grass blocks. --- mods/ITEMS/mcl_flowers/bonemealing.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua index 297c297e8..26fc8a44c 100644 --- a/mods/ITEMS/mcl_flowers/bonemealing.lua +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -71,8 +71,18 @@ local biome_flowers_tables = { -- local function add_random_flower(pos, color) -- 90% tall grass, 10% flower - if math.random(1,100) <= 90 then + local rnd = math.random(1,100) + if rnd <= 60 then minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=color}) + elseif rnd <= 80 then + -- double tallgrass + local toppos = vector.offset(pos, 0, 1, 0) + local topnode = minetest.get_node(toppos) + if minetest.registered_nodes[topnode.name].buildable_to then + minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = color }) + minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = color }) + return true + end else local flowers_table if mg_name == "v6" then From 4449f747425c29c9907d5793e6679d684899d73c Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 5 May 2022 13:51:05 +0200 Subject: [PATCH 228/273] Remove color specifications from cocoa beans. * The cocoa beans craftitem definition still had color specifications from its past as a dye substitute. These can be removed now. --- mods/ITEMS/mcl_cocoas/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 726c72feb..d23c06a7e 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -181,8 +181,7 @@ minetest.register_craftitem("mcl_cocoas:cocoa_beans", { description = S("Cocoa Beans"), stack_max = 64, groups = { - dye = 1, craftitem = 1, compostability = 65, - basecolor_brown = 1, excolor_orange = 1, unicolor_dark_orange = 1, + craftitem = 1, compostability = 65, }, on_place = function(itemstack, placer, pointed_thing) return cocoa_place(itemstack, placer, pointed_thing, "mcl_cocoas:cocoa_1") From f61a7ab4cb7e4f4b5c14efa8015717b5e933e68e Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 5 May 2022 13:58:12 +0200 Subject: [PATCH 229/273] Remove color specifications from bone meal. * The bone meal craftitem definition still had color specifications from its past as a dye substitute. These can be removed now. * Also remove default stack_max setting. --- mods/ITEMS/mcl_bone_meal/init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 8898b9e5a..e989d47f1 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -96,13 +96,12 @@ end -- End legacy bone meal API minetest.register_craftitem("mcl_bone_meal:bone_meal", { - inventory_image = "mcl_bone_meal.png", description = S("Bone Meal"), _tt_help = S("Speeds up plant growth"), _doc_items_longdesc = longdesc, _doc_items_usagehelp = usagehelp, - stack_max = 64, - groups = {craftitem=1, dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, + inventory_image = "mcl_bone_meal.png", + groups = {craftitem=1}, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local node = minetest.get_node(pos) From 5b1fcf76f6f5d1f4255bc0b82a87243c21ec25ed Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 19 Mar 2024 07:12:04 +0000 Subject: [PATCH 230/273] Fix mod dependencies --- mods/ITEMS/mcl_beds/mod.conf | 2 +- mods/ITEMS/mcl_signs/mod.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beds/mod.conf b/mods/ITEMS/mcl_beds/mod.conf index fc6d54f1f..fd54cd7e1 100644 --- a/mods/ITEMS/mcl_beds/mod.conf +++ b/mods/ITEMS/mcl_beds/mod.conf @@ -2,4 +2,4 @@ name = mcl_beds author = BlockMen description = depends = playerphysics -optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mesecons \ No newline at end of file +optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mesecons, mesecons_mvps diff --git a/mods/ITEMS/mcl_signs/mod.conf b/mods/ITEMS/mcl_signs/mod.conf index e2fe9d40a..878d8d2f7 100644 --- a/mods/ITEMS/mcl_signs/mod.conf +++ b/mods/ITEMS/mcl_signs/mod.conf @@ -1,4 +1,4 @@ name = mcl_signs description = New and Improved signs - can be colored and made to glow. -depends = mcl_core, mcl_sounds, mcl_dye, mcl_colors, mcl_util +depends = mcl_core, mcl_sounds, mcl_dye, mcl_colors, mcl_util, mesecons_mvps optional_depends = doc From f44102c23838f4b42a42fd4920320ac612de178b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 19 Mar 2024 07:12:42 +0000 Subject: [PATCH 231/273] Display call stack to assist in removing deprecated function calls --- mods/ITEMS/mcl_bone_meal/init.lua | 1 + mods/ITEMS/mcl_dye/init.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index e989d47f1..a32f2d253 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -54,6 +54,7 @@ mcl_bone_meal.bone_meal_callbacks = {} -- function mcl_bone_meal.register_on_bone_meal_apply(func) minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!") + print(debug.traceback()) table.insert(mcl_bone_meal.bone_meal_callbacks, func) end diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 40f75e252..b8c5dbf26 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -119,6 +119,7 @@ end -- function mcl_dye.add_bone_meal_particle(pos, def) minetest.log("warning", "mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md!") + print(debug.traceback()) mcl_bone_meal.add_bone_meal_particle(pos, def) end From 1e0f7618ba292bdba7dac43839a0157cc9374f5a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 19 Mar 2024 07:25:04 +0000 Subject: [PATCH 232/273] Remove bone meal definition in mcl_dye, make textures in mcl_cocoas match master branch --- mods/ITEMS/mcl_cocoas/init.lua | 18 -------------- mods/ITEMS/mcl_dye/init.lua | 43 ---------------------------------- 2 files changed, 61 deletions(-) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index d23c06a7e..91026ce83 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -78,24 +78,14 @@ local podinfo = { { desc = S("Premature Cocoa Pod"), longdesc = S("Cocoa pods grow on the side of jungle trees in 3 stages."), tiles = { - "[combine:16x16:6,1=mcl_cocoas_cocoa_stage_0.png", - "[combine:16x16:6,11=mcl_cocoas_cocoa_stage_0.png", "mcl_cocoas_cocoa_stage_0.png", - "mcl_cocoas_cocoa_stage_0.png^[transformFX", - "[combine:16x16:-5,0=mcl_cocoas_cocoa_stage_0.png", - "[combine:16x16:-5,0=mcl_cocoas_cocoa_stage_0.png", }, n_box = {-0.125, -0.0625, 0.1875, 0.125, 0.25, 0.4375}, s_box = {-0.125, -0.0625, 0.1875, 0.125, 0.5, 0.5 }, }, { desc = S("Medium Cocoa Pod"), tiles = { - "[combine:16x16:5,1=mcl_cocoas_cocoa_stage_1.png", - "[combine:16x16:5,9=mcl_cocoas_cocoa_stage_1.png", "mcl_cocoas_cocoa_stage_1.png", - "mcl_cocoas_cocoa_stage_1.png^[transformFX", - "[combine:16x16:-4,0=mcl_cocoas_cocoa_stage_1.png", - "[combine:16x16:-4,0=mcl_cocoas_cocoa_stage_1.png", }, n_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.25, 0.4375}, s_box = {-0.1875, -0.1875, 0.0625, 0.1875, 0.5, 0.5 }, @@ -103,15 +93,7 @@ local podinfo = { { desc = S("Mature Cocoa Pod"), longdesc = S("A mature cocoa pod grew on a jungle tree to its full size and it is ready to be harvested for cocoa beans. It won't grow any further."), tiles = { - -- The following 2 textures were derived from the original - -- because the size of the top/bottom is slightly different :-( - -- TODO: Find a way to *only* use the base texture - "mcl_cocoas_cocoa_top_stage_2.png", - "mcl_cocoas_cocoa_top_stage_2.png^[transformFY", "mcl_cocoas_cocoa_stage_2.png", - "mcl_cocoas_cocoa_stage_2.png^[transformFX", - "[combine:16x16:-3,0=mcl_cocoas_cocoa_stage_2.png", - "[combine:16x16:-3,0=mcl_cocoas_cocoa_stage_2.png", }, n_box = {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.4375}, s_box = {-0.25, -0.3125, -0.0625, 0.25, 0.5, 0.5 }, diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index b8c5dbf26..4836435fc 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -128,49 +128,6 @@ function mcl_dye.register_on_bone_meal_apply(func) mcl_bone_meal.register_on_bone_meal_apply(func) end --- Bone meal item registration. --- --- To be moved into its own mod. --- -minetest.register_craftitem(":mcl_bone_meal:bone_meal", { - inventory_image = "mcl_bone_meal_bone_meal.png", - description = S("Bone Meal"), - _tt_help = S("Speeds up plant growth"), - _doc_items_longdesc = S("Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants."), - _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, - 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 - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack - end - end - - -- Use the bone meal on the ground - if (apply_bone_meal(pointed_thing, user) and (not minetest.is_creative_enabled(user:get_player_name()))) then - itemstack:take_item() - end - return itemstack - end, - _on_dispense = function(stack, pos, droppos, dropnode, dropdir) - -- Apply bone meal, if possible - local pointed_thing - if dropnode.name == "air" then - pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } } - else - pointed_thing = { above = pos, under = droppos } - end - local success = apply_bone_meal(pointed_thing, nil) - if success then - stack:take_item() - end - return stack - end, - _dispense_into_walkable = true -}) - minetest.register_craft({ output = "mcl_bone_meal:bone_meal 3", recipe = {{"mcl_mobitems:bone"}}, From a4f1ccd0eef57b612529e4ea38892466f6ca22c9 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 19 Mar 2024 07:57:58 +0000 Subject: [PATCH 233/273] Update mcl_crimson to use bonemealing API --- mods/ITEMS/mcl_crimson/init.lua | 72 +++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 9ec326a3c..1d4194e60 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -83,17 +83,20 @@ minetest.register_node("mcl_crimson:warped_fungus", { light_source = 1, sounds = mcl_sounds.node_sound_leaves_defaults(), node_placement_prediction = "", - on_rightclick = function(pos, node, pointed_thing, player, itemstack) - if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - local nodepos = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) - if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then - local random = math.random(1, 5) - if random == 1 then - minetest.remove_node(pos) - generate_warped_tree(pos) - end + _mcl_on_bonemealing = function(pointed_thing, player) + local pos = pointed_thing.under + local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) + + if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then + local random = math.random(1, 5) + if random == 1 then + minetest.remove_node(pos) + generate_warped_tree(pos) + return true end end + + return false end, _mcl_blast_resistance = 0, }) @@ -102,6 +105,12 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", { name = "warped_fungus", desc = S("Warped Fungus"), image = "mcl_crimson_warped_fungus.png", + _mcl_on_bonemealing = function(pt,user) + local n = has_nylium_neighbor(pt.under) + if n then + minetest.set_node(pt.under,n) + end + end, }) minetest.register_node("mcl_crimson:twisting_vines", { @@ -393,6 +402,11 @@ minetest.register_node("mcl_crimson:warped_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, + _mcl_on_bonemealing = function(pt,user) + local node = minetest.get_node(pt.under) + spread_nether_plants(pt.under,node) + return true + end, }) --Stem bark, stripped stem and bark @@ -525,17 +539,21 @@ minetest.register_node("mcl_crimson:crimson_fungus", { fixed = { -3/16, -0.5, -3/16, 3/16, -2/16, 3/16 }, }, node_placement_prediction = "", - on_rightclick = function(pos, node, pointed_thing, player) - if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) - if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then - local random = math.random(1, 5) - if random == 1 then - minetest.remove_node(pos) - generate_crimson_tree(pos) - end + _mcl_on_bonemealing = function(pointed_thing, player) + local pos = pointed_thing.under + local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) + if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then + local random = math.random(1, 5) + if random == 1 then + minetest.remove_node(pos) + generate_crimson_tree(pos) + + return true end end + + -- Failed to spread nylium + return false end, _mcl_blast_resistance = 0, }) @@ -682,6 +700,11 @@ minetest.register_node("mcl_crimson:crimson_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, + _mcl_on_bonemealing = function(pt,user) + local node = minetest.get_node(pt.under) + spread_nether_plants(pt.under,node) + return true + end, }) minetest.register_craft({ @@ -723,19 +746,6 @@ minetest.register_craft({ mcl_stairs.register_stair("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_stair_groups, false, S("Crimson Stair")) mcl_stairs.register_slab("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_slab_groups, false, S("Crimson Slab")) -mcl_dye.register_on_bone_meal_apply(function(pt,user) - if not pt.type == "node" then return end - local node = minetest.get_node(pt.under) - if node.name == "mcl_nether:netherrack" then - local n = has_nylium_neighbor(pt.under) - if n then - minetest.set_node(pt.under,n) - end - elseif node.name == "mcl_crimson:warped_nylium" or node.name == "mcl_crimson:crimson_nylium" then - spread_nether_plants(pt.under,node) - end -end) - minetest.register_abm({ label = "Turn Crimson Nylium and Warped Nylium below solid block into Netherrack", nodenames = {"mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium"}, From d5684ca305be400c29091ae647ba216232a96362 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 20 Mar 2024 07:42:29 +0000 Subject: [PATCH 234/273] Add new API call mcl_bone_meal.use_bone_meal and use this to remove duplicate code, update mcl_farming:sweet_berries to use bonemeal API, add stub for bonemeal mod compatibility --- mods/ITEMS/mcl_bone_meal/API.md | 9 +++ mods/ITEMS/mcl_bone_meal/init.lua | 82 ++++++++++++-------------- mods/ITEMS/mcl_farming/sweet_berry.lua | 30 ++++++++-- mods/MISC/bonemeal/init.lua | 0 mods/MISC/bonemeal/mod.conf | 4 ++ 5 files changed, 77 insertions(+), 48 deletions(-) create mode 100644 mods/MISC/bonemeal/init.lua create mode 100644 mods/MISC/bonemeal/mod.conf diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md index 46a28fadb..a404d29a9 100644 --- a/mods/ITEMS/mcl_bone_meal/API.md +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -42,6 +42,15 @@ Spawns standard or custom bone meal particles. * `def`: (optional) particle definition; see minetest.add_particlespawner() for more details. +## mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) +For use in on_rightclick handlers that need support bone meal processing in addition +to other behaviors. Before calling, verify that the player is wielding bone meal. +* `itemstack`: The stack of bone meal being used +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied + +Returns itemstack with one bone meal consumed if not in creative mode. # Legacy API The bone meal API also provides a legacy compatibility function. This diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index a32f2d253..23c66ea98 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -60,26 +60,14 @@ end -- Legacy registered users of the old API are handled through this function. -- -local function apply_bone_meal(pointed_thing, placer) +local function legacy_apply_bone_meal(pointed_thing, placer) + -- Legacy API support for _, func in pairs(mcl_bone_meal.bone_meal_callbacks) do if func(pointed_thing, placer) then return true end end - local pos = pointed_thing.under - local n = minetest.get_node(pos) - if n.name == "" then return false end - - -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages - if string.find(n.name, "mcl_farming:sweet_berry_bush_") then - mcl_dye.add_bone_meal_particle(pos) - if n.name == "mcl_farming:sweet_berry_bush_3" then - return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") - else - return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true) - end - return true --[[ Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. -- Handle applying bonemeal to bamboo. @@ -90,12 +78,42 @@ local function apply_bone_meal(pointed_thing, placer) end return success --]] - end return false end -- End legacy bone meal API +mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + + -- Check protection + if mcl_util.check_area_protection(pos, pointed_thing.above, placer) then return false end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + local success = false + + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._mcl_on_bonemealing then + success = ndef._mcl_on_bonemealing(pointed_thing, placer) + else + -- Otherwise try the legacy API. + success = legacy_apply_bone_meal(pointed_thing, placer) + end + + -- Particle effects + if success then + mcl_bone_meal.add_bone_meal_particle(pos) + end + + -- Take the item + if not placer or not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack +end + minetest.register_craftitem("mcl_bone_meal:bone_meal", { description = S("Bone Meal"), _tt_help = S("Speeds up plant growth"), @@ -107,26 +125,15 @@ minetest.register_craftitem("mcl_bone_meal:bone_meal", { local pos = pointed_thing.under local node = minetest.get_node(pos) local ndef = minetest.registered_nodes[node.name] + -- Use pointed node's on_rightclick function first, if present. if placer and not placer:get_player_control().sneak then if ndef and ndef.on_rightclick then return ndef.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack end end - -- If the pointed node can be bonemealed, let it handle the processing. - if ndef and ndef._mcl_on_bonemealing then - if ndef._mcl_on_bonemealing(pointed_thing, placer) then - mcl_bone_meal.add_bone_meal_particle(pos) - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - -- Otherwise try the legacy API. - elseif apply_bone_meal(pointed_thing, placer) and - not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - return itemstack + + return mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) end, _on_dispense = function(itemstack, pos, droppos, dropnode, dropdir) local pointed_thing @@ -135,21 +142,8 @@ minetest.register_craftitem("mcl_bone_meal:bone_meal", { else pointed_thing = {above = pos, under = droppos} end - local node = minetest.get_node(pointed_thing.under) - local ndef = minetest.registered_nodes[node.name] - -- If the pointed node can be bonemealed, let it handle the processing. - if ndef and ndef._mcl_on_bonemealing then - if ndef._mcl_on_bonemealing(pointed_thing, nil) then - mcl_bone_meal.add_bone_meal_particle(pos) - end - itemstack:take_item() - else - -- Otherwise try the legacy API. - if apply_bone_meal(pointed_thing, nil) then - itemstack:take_item() - end - end - return itemstack + + return mcl_bone_meal.use_bone_meal(itemstack, nil, pointed_thing) end, _dispense_into_walkable = true }) diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index a03eee012..a768fab37 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -12,6 +12,25 @@ for i=0, 3 do local drop_berries = (i >= 2) local berries_to_drop = drop_berries and {i - 1, i} or nil + local on_bonemealing = nil + local function do_berry_drop(pos) + for j=1, berries_to_drop[math.random(2)] do + minetest.add_item(pos, "mcl_farming:sweet_berry") + end + minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"}) + end + if i ~= 3 then + on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + local node = minetest.get_node(pos) + return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, node, 0, true) + end + else + on_bonemealing = function(pointed_thing, placer) + do_berry_drop(pointed_thing.under) + end + end + minetest.register_node(node_name, { drawtype = "plantlike", tiles = {texture}, @@ -45,6 +64,7 @@ for i=0, 3 do sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, _mcl_hardness = 0, + _mcl_on_bonemealing = on_bonemealing, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(pos, pn) then @@ -60,11 +80,13 @@ for i=0, 3 do return end - if drop_berries then - for j=1, berries_to_drop[math.random(2)] do - minetest.add_item(pos, "mcl_farming:sweet_berry") + if i >= 2 then + do_berry_drop(pos) + else + -- Use bonemeal + if mcl_bone_meal and clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then + return mcl_bone_meal.use_bone_meal(itemstack, clicker, pointed_thing) end - minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"}) end return itemstack end, diff --git a/mods/MISC/bonemeal/init.lua b/mods/MISC/bonemeal/init.lua new file mode 100644 index 000000000..e69de29bb diff --git a/mods/MISC/bonemeal/mod.conf b/mods/MISC/bonemeal/mod.conf new file mode 100644 index 000000000..292cc0352 --- /dev/null +++ b/mods/MISC/bonemeal/mod.conf @@ -0,0 +1,4 @@ +name = bonemeal +author = teknomunk +description = Compatibility shim for WorldEdit-Additions bonemeal support +optional_depends = mcl_bone_meal From 57678e31bc565b58323fa0541bd20a112ec6f76e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 20 Mar 2024 08:01:34 +0000 Subject: [PATCH 235/273] Move commented out bamboo bone meal code into mods/ITEMS/mcl_bamboo/bamboo_base.lua --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 6 ++++++ mods/ITEMS/mcl_bone_meal/init.lua | 11 ----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index e1b8ba640..790ba1dcb 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -34,6 +34,12 @@ local bamboo_def = { wield_image = "mcl_bamboo_bamboo_shoot.png", _mcl_blast_resistance = 1, _mcl_hardness = 1, + --[[ + _mcl_on_bonemealing = function(pointed_thing, placer) + local pos = pointed_thing.under + return mcl_bamboo.grow_bamboo(pos, true) + end, + ]] node_box = { type = "fixed", fixed = { diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 23c66ea98..143753dc2 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -68,17 +68,6 @@ local function legacy_apply_bone_meal(pointed_thing, placer) end end ---[[ - Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. - -- Handle applying bonemeal to bamboo. - elseif mcl_bamboo.is_bamboo(n.name) then - local success = mcl_bamboo.grow_bamboo(pos, true) - if success then - mcl_dye.add_bone_meal_particle(pos) - end - return success ---]] - return false end -- End legacy bone meal API From 09bcf3d22bbc60b6a2e154d09c167a80b955e1f7 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 20 Mar 2024 21:16:09 +0000 Subject: [PATCH 236/273] Add untested bonemeal mod compatibility shim --- mods/MISC/bonemeal/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/MISC/bonemeal/init.lua b/mods/MISC/bonemeal/init.lua index e69de29bb..666319204 100644 --- a/mods/MISC/bonemeal/init.lua +++ b/mods/MISC/bonemeal/init.lua @@ -0,0 +1,12 @@ +bonemeal = {} + +function bonemeal:on_use(pos, strength, node) + -- Fake itemstack for bone meal + local itemstack = ItemStack("mcl_bone_meal:bone_meal") + + local pointed_thing = { + above = pos, + under = vector.offset(pos, 0, -1, 0) + } + mcl_bone_meal.use_bone_meal(itemstack, nil, pointed_thing) +end From 55b4d3d5eed6c409fef5187ee97987f5ae58d1f1 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 07:11:44 +0000 Subject: [PATCH 237/273] Rename localization files --- .../mcl_bone_meal/locale/{mcl_dye.de.tr => mcl_bonemeal.de.tr} | 0 .../mcl_bone_meal/locale/{mcl_dye.es.tr => mcl_bonemeal.es.tr} | 0 .../mcl_bone_meal/locale/{mcl_dye.fr.tr => mcl_bonemeal.fr.tr} | 0 .../mcl_bone_meal/locale/{mcl_dye.pl.tr => mcl_bonemeal.pl.tr} | 0 .../mcl_bone_meal/locale/{mcl_dye.ru.tr => mcl_bonemeal.ru.tr} | 0 .../locale/{mcl_dye.zh_TW.tr => mcl_bonemeal.zh_TW.tr} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.de.tr => mcl_bonemeal.de.tr} (100%) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.es.tr => mcl_bonemeal.es.tr} (100%) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.fr.tr => mcl_bonemeal.fr.tr} (100%) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.pl.tr => mcl_bonemeal.pl.tr} (100%) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.ru.tr => mcl_bonemeal.ru.tr} (100%) rename mods/ITEMS/mcl_bone_meal/locale/{mcl_dye.zh_TW.tr => mcl_bonemeal.zh_TW.tr} (100%) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.de.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.de.tr diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.es.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.es.tr diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.pl.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.pl.tr diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.ru.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.ru.tr diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.zh_TW.tr similarity index 100% rename from mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr rename to mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.zh_TW.tr From 4a865fa2df36b1b13425c4b70233e84aded51070 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 07:24:31 +0000 Subject: [PATCH 238/273] Enable bamboo bonemealing despite rightclick handling strangeness --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 790ba1dcb..3c0de0509 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -34,12 +34,10 @@ local bamboo_def = { wield_image = "mcl_bamboo_bamboo_shoot.png", _mcl_blast_resistance = 1, _mcl_hardness = 1, - --[[ _mcl_on_bonemealing = function(pointed_thing, placer) local pos = pointed_thing.under return mcl_bamboo.grow_bamboo(pos, true) end, - ]] node_box = { type = "fixed", fixed = { From 9e6d49dd38db122cdd243338bf51186f7a08717f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 07:35:51 +0000 Subject: [PATCH 239/273] Fix localization except mcl_composters.ru.tr --- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr | 1 - mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr | 2 +- mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr index 2e36baadb..59f1beeef 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr @@ -3,7 +3,6 @@ Cocoa Beans=Какао-бобы Grows at the side of jungle trees=Растут на стволах тропических деревьев Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Какао-бобы можно использовать для посадки какао, выпечки печенья или изготовления коричневого красителя. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола дерева джунглей, что ->>>>>>> 195f0dfba (Move cocoa beans item to mcl_cocoas.) Premature Cocoa Pod=Молодой стручок какао Cocoa pods grow on the side of jungle trees in 3 stages.=Стручки какао растут на деревьях джунглей в 3 этапа. Medium Cocoa Pod=Средний стручок какао diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr index 0f4e665e6..909b889e8 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.fr.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=Les composteurs peuv Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.=Utiliser des objets organiques sur le composteur pour le remplir de couches de compost. Chaque fois qu'un objet est mis dans le composteur, il y a une chance d'ajouter une nouvelle couche de compost au composteur. Certains objets ont une plus grande chance que d'autres d'ajouter une couche supplémentaire. Après l'avoir rempli de 7 couches de compost, le composteur est plein. Après un délai d'approximativement une seconde, le composteur est prêt et on peut récupérer la farine d'os. Cliquer droit le composteur permet de récupérer la farine d'os et de vider le composteur. filled=rempli ready for harvest=prêt pour la récolte -Converts organic items into bonemeal=Convertit les objets organiques en farine d'os. +Converts organic items into bone meal=Convertit les objets organiques en farine d'os. diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr index 6d8908486..115d53b17 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.ja.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=コンポスター Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter."=コンポスターに有機物を入れて、堆肥の層を作りましょう。コンポスターに有機物を入れるたびに、次の堆肥の層が追加されるチャンスが起きます。 追加される確率がより高くなっているアイテムもいくつかあります。 7層分の堆肥が充填されると、コンポスターは満杯となります。その約1秒後に、骨粉を取り出せる準備が完了します。右クリックして骨粉を取り出すと、コンポスターは空になります。 filled=充足 ready for harvest=収穫可能 -Converts organic items into bonemeal=有機物を骨粉に変える +Converts organic items into bone meal=有機物を骨粉に変える From 3c2f2593db8480c1833c66fe5a9f7f776ac0d808 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 18:11:36 +0000 Subject: [PATCH 240/273] Only consume bone meal if a _mcl_on_bonemealing callback is defined or the legacy API returns true, convert vines to use new bonemeal API --- mods/ITEMS/mcl_bone_meal/init.lua | 5 ++++- mods/ITEMS/mcl_crimson/init.lua | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 143753dc2..a402ab064 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -81,13 +81,16 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) local node = minetest.get_node(pos) local ndef = minetest.registered_nodes[node.name] local success = false + local consume -- If the pointed node can be bonemealed, let it handle the processing. if ndef and ndef._mcl_on_bonemealing then success = ndef._mcl_on_bonemealing(pointed_thing, placer) + consume = true else -- Otherwise try the legacy API. success = legacy_apply_bone_meal(pointed_thing, placer) + consume = success end -- Particle effects @@ -96,7 +99,7 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) end -- Take the item - if not placer or not minetest.is_creative_enabled(placer:get_player_name()) then + if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then itemstack:take_item() end diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 1d4194e60..d0620539f 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -28,9 +28,11 @@ function grow_vines(pos, moreontop ,vine, dir) minetest.set_node(vector.offset(pos,0,i*dir,0),{name=vine}) end end - break + return true end until n.name ~= "air" and n.name ~= vine + + return false end local nether_plants = { @@ -130,6 +132,9 @@ minetest.register_node("mcl_crimson:twisting_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", + _mcl_on_bonemealing = function(pointed_thing, placer) + return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:twisting_vines") + end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then @@ -150,10 +155,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - if not minetest.is_creative_enabled(clicker:get_player_name()) then - itemstack:take_item() - end - grow_vines(pos, math.random(1, 3),"mcl_crimson:twisting_vines") + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos}) end return itemstack end, @@ -220,6 +222,9 @@ minetest.register_node("mcl_crimson:weeping_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", + _mcl_on_bonemealing = function(pointed_thing, placer) + return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:weeping_vines") + end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then @@ -240,10 +245,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - if not minetest.is_creative_enabled(clicker:get_player_name()) then - itemstack:take_item() - end - grow_vines(pos, math.random(1, 3),"mcl_crimson:weeping_vines", -1) + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos}) end return itemstack end, From eb6131b037079c8afb4dfe0c5d81140a17389600 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 18:06:14 -0500 Subject: [PATCH 241/273] Fix localization errors --- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr | 2 +- mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr | 2 +- mods/ITEMS/mcl_composters/locale/template.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr index c110a1a9a..750cb2695 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.es.tr @@ -2,7 +2,7 @@ Cocoa Beans=Granos de cacao Grows at the side of jungle trees=Crece al lado de los árboles de la jungla Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Los granos de cacao se pueden usar para plantar cacao, hornear galletas o hacer tintes marrones. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de la jungla para plantar un cacao joven. Premature Cocoa Pod=Vaina de cacao prematura Cocoa pods grow on the side of jungle trees in 3 stages.=Las vainas de cacao crecen al lado de los árboles de jungla en 3 etapas. Medium Cocoa Pod=Vaina de cacao mediana diff --git a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr index 59f1beeef..7840c5e4a 100644 --- a/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr +++ b/mods/ITEMS/mcl_cocoas/locale/mcl_cocoas.ru.tr @@ -2,7 +2,7 @@ Cocoa Beans=Какао-бобы Grows at the side of jungle trees=Растут на стволах тропических деревьев Cocoa beans can be used to plant cocoa, bake cookies or craft brown dye.=Какао-бобы можно использовать для посадки какао, выпечки печенья или изготовления коричневого красителя. -Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола дерева джунглей, что +Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола тропического дерева, чтобы посадить молодое какао. Premature Cocoa Pod=Молодой стручок какао Cocoa pods grow on the side of jungle trees in 3 stages.=Стручки какао растут на деревьях джунглей в 3 этапа. Medium Cocoa Pod=Средний стручок какао diff --git a/mods/ITEMS/mcl_composters/locale/template.txt b/mods/ITEMS/mcl_composters/locale/template.txt index 5d8df6fdb..344e48c31 100644 --- a/mods/ITEMS/mcl_composters/locale/template.txt +++ b/mods/ITEMS/mcl_composters/locale/template.txt @@ -1,7 +1,7 @@ # textdomain: mcl_composters Composter= Composters can convert various organic items into bone meal.= -Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter."= +Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.= filled= ready for harvest= Converts organic items into bone meal= From 44d154f594291a86c6032ab013862595de30ca02 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 18:30:34 +0000 Subject: [PATCH 242/273] Modify backtrace listing to use minetest.log --- mods/ITEMS/mcl_bone_meal/init.lua | 5 ++++- mods/ITEMS/mcl_dye/init.lua | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index a402ab064..d92e1df4f 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -54,7 +54,10 @@ mcl_bone_meal.bone_meal_callbacks = {} -- function mcl_bone_meal.register_on_bone_meal_apply(func) minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!") - print(debug.traceback()) + local lines = string.split(debug.traceback(),"\n") + for _,line in ipairs(lines) do + minetest.log("warning",line) + end table.insert(mcl_bone_meal.bone_meal_callbacks, func) end diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 4836435fc..2c10c09f7 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -119,7 +119,10 @@ end -- function mcl_dye.add_bone_meal_particle(pos, def) minetest.log("warning", "mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md!") - print(debug.traceback()) + local lines = string.split(debug.traceback(),"\n") + for _,line in ipairs(lines) do + minetest.log("warning",line) + end mcl_bone_meal.add_bone_meal_particle(pos, def) end From 7f6d456a32b7a27e4e6fb6d422e4df848969a303 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 18:44:09 +0000 Subject: [PATCH 243/273] Remove bone to bone meal recipe from mcl_dye as it now resides in mcl_bone_meal --- mods/ITEMS/mcl_dye/init.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 2c10c09f7..8b1090498 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -131,12 +131,6 @@ function mcl_dye.register_on_bone_meal_apply(func) mcl_bone_meal.register_on_bone_meal_apply(func) end -minetest.register_craft({ - output = "mcl_bone_meal:bone_meal 3", - recipe = {{"mcl_mobitems:bone"}}, -}) - - -- Dye creation recipes. -- minetest.register_craft({ From c3a33ea2c2c01e9da83d25ab55a61c6a8c6e4f40 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 22 Mar 2024 05:39:45 +0000 Subject: [PATCH 244/273] Update mod authors, remove a TODO --- mods/ITEMS/mcl_bone_meal/init.lua | 2 +- mods/ITEMS/mcl_bone_meal/mod.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index d92e1df4f..2e79ab678 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -37,7 +37,7 @@ function mcl_bone_meal.add_bone_meal_particle(pos, def) maxexptime = def.maxexptime or 4, minsize = def.minsize or 0.7, maxsize = def.maxsize or 2.4, - texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color + texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", glow = def.glow or 1, }) end diff --git a/mods/ITEMS/mcl_bone_meal/mod.conf b/mods/ITEMS/mcl_bone_meal/mod.conf index 439973540..60dfaa59e 100644 --- a/mods/ITEMS/mcl_bone_meal/mod.conf +++ b/mods/ITEMS/mcl_bone_meal/mod.conf @@ -1,3 +1,3 @@ name = mcl_bone_meal description = Bone meal can be used as a fertilizer and as a dye. -author = kabou +author = kabou, teknomunk From 42d37210c55667a7ad61cd7a8e27ce3e093f237f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 21 Mar 2024 07:20:20 -0500 Subject: [PATCH 245/273] Fix mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr --- mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr b/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr index 39f172199..99dfa62eb 100644 --- a/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr +++ b/mods/ITEMS/mcl_composters/locale/mcl_composters.ru.tr @@ -4,4 +4,4 @@ Composters can convert various organic items into bonemeal.=Компостер Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter.=Используйте органические предметы на компостере, чтобы заполнить его слоями перегноя. Каждый раз когда в компостер попадает предмет, есть шанс что в компостере появится новый слой перегноя. Некоторые предметы имеют больший шанс на появление нового слоя. После заполнения 7 слоями перегноя, компостер можно опустошить, забрав из него костную муку. После задержки в одну секунду компостер будет готов и костная мука будет извлечена из него. Правым кликом по компостеру чтобы забрать костную муку. filled=заполнен ready for harvest=готов к сбору -Converts organic items into bonemeal=Перерабатывает органику в костную муку +Converts organic items into bone meal=Перерабатывает органику в костную муку From e6e13bdc6764ce912f507c8e6ce786fcc0099e0a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 23 Mar 2024 16:44:41 +0000 Subject: [PATCH 246/273] Change _mcl_on_bonemealing to _on_bone_meal, update API.md to reflect this --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 2 +- mods/ITEMS/mcl_bone_meal/API.md | 16 ++++++++++------ mods/ITEMS/mcl_bone_meal/init.lua | 4 ++-- mods/ITEMS/mcl_cocoas/init.lua | 4 ++-- mods/ITEMS/mcl_core/nodes_trees.lua | 2 +- mods/ITEMS/mcl_crimson/init.lua | 14 +++++++------- mods/ITEMS/mcl_farming/beetroot.lua | 2 +- mods/ITEMS/mcl_farming/carrots.lua | 2 +- mods/ITEMS/mcl_farming/melon.lua | 2 +- mods/ITEMS/mcl_farming/potatoes.lua | 2 +- mods/ITEMS/mcl_farming/pumpkin.lua | 2 +- mods/ITEMS/mcl_farming/sweet_berry.lua | 6 +++--- mods/ITEMS/mcl_farming/wheat.lua | 2 +- mods/ITEMS/mcl_flowers/bonemealing.lua | 10 +++++----- mods/ITEMS/mcl_flowers/init.lua | 10 +++++----- mods/ITEMS/mcl_mushrooms/small.lua | 4 ++-- 16 files changed, 44 insertions(+), 40 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 3c0de0509..15f9da5b0 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -34,7 +34,7 @@ local bamboo_def = { wield_image = "mcl_bamboo_bamboo_shoot.png", _mcl_blast_resistance = 1, _mcl_hardness = 1, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under return mcl_bamboo.grow_bamboo(pos, true) end, diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md index a404d29a9..b365c3900 100644 --- a/mods/ITEMS/mcl_bone_meal/API.md +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -3,29 +3,32 @@ Bonemealing callbacks and particle functions. -## _mcl_on_bonemealing(pointed_thing, placer) +## _on_bone_meal(itemstack, placer, pointed_thing) The bone meal API provides a callback definition that nodes can use to register a handler that is executed when a bone meal item is used on it. Nodes that wish to use the bone meal API should in their node registration -define a callback handler named `_mcl_on_bonemealing`. +define a callback handler named `_on_bone_meal`. Note that by registering the callback handler, the node declares that bone meal can be used on it and as a result, when the user is not in creative mode, the used bone meal is spent and taken from the itemstack passed to -the `on_place()` handler of the bone meal item used. +the `on_place()` handler of the bone meal item used regardless of whether +the bone meal had an effect on the node and regardless of the result of +the callback handler. It is for all intents and purposes up to the callback defined in the node to decide how to handle the specific effect that bone meal has on that node. -The `_mcl_on_bonemealing` callback handler is a +The `_on_bone_meal` callback handler is a - `function(pointed_thing, placer)` + `function(itemstack, placer, pointed_thing)` Its arguments are: +* `itemstack`: the stack of bonem eal being applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! * `pointed_thing`: exact pointing location (see Minetest API), where the bone meal is applied -* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! The return value of the handler function indicates if the bonemealing had its intended effect. If `true`, 'bone meal particles' are spawned at the @@ -63,6 +66,7 @@ Called when the bone meal is applied anywhere. bone meal is applied * `placer`: ObjectRef of the player who aplied the bone meal, can be nil! This function is deprecated and will be removed at some time in the future. +Bone meal is not consumed unless the provided function returns true. ## mcl_dye.add_bone_meal_particle(pos, def) ## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 2e79ab678..3a0309003 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -87,8 +87,8 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) local consume -- If the pointed node can be bonemealed, let it handle the processing. - if ndef and ndef._mcl_on_bonemealing then - success = ndef._mcl_on_bonemealing(pointed_thing, placer) + if ndef and ndef._on_bone_meal then + success = ndef._on_bone_meal(itemstack, placer, pointed_thing) consume = true else -- Otherwise try the legacy API. diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 91026ce83..1af306355 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -137,7 +137,7 @@ for i = 1, 3 do on_rotate = false, _mcl_blast_resistance = 3, _mcl_hardness = 0.2, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under return cocoa_grow(pos) end, @@ -149,7 +149,7 @@ for i = 1, 3 do end if i == 3 then def.drop = "mcl_cocoas:cocoa_beans 3" - def._mcl_on_bonemealing = nil + def._on_bone_mealing = nil end minetest.register_node("mcl_cocoas:cocoa_" .. i, table.copy(def)) diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 96b619f73..c71693408 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -280,7 +280,7 @@ function mcl_core.register_sapling(subname, description, longdesc, tt_help, text nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt" end), - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) -- Saplings: 45% chance to advance growth stage diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index d0620539f..1f8273b22 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -85,7 +85,7 @@ minetest.register_node("mcl_crimson:warped_fungus", { light_source = 1, sounds = mcl_sounds.node_sound_leaves_defaults(), node_placement_prediction = "", - _mcl_on_bonemealing = function(pointed_thing, player) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) @@ -107,7 +107,7 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", { name = "warped_fungus", desc = S("Warped Fungus"), image = "mcl_crimson_warped_fungus.png", - _mcl_on_bonemealing = function(pt,user) + _on_bone_meal = function(itemstack, placer, pointed_thing) local n = has_nylium_neighbor(pt.under) if n then minetest.set_node(pt.under,n) @@ -132,7 +132,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:twisting_vines") end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) @@ -222,7 +222,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 }, }, node_placement_prediction = "", - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:weeping_vines") end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) @@ -404,7 +404,7 @@ minetest.register_node("mcl_crimson:warped_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, - _mcl_on_bonemealing = function(pt,user) + _on_bone_meal = function(itemstack, placer, pointed_thing) local node = minetest.get_node(pt.under) spread_nether_plants(pt.under,node) return true @@ -541,7 +541,7 @@ minetest.register_node("mcl_crimson:crimson_fungus", { fixed = { -3/16, -0.5, -3/16, 3/16, -2/16, 3/16 }, }, node_placement_prediction = "", - _mcl_on_bonemealing = function(pointed_thing, player) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0)) if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then @@ -702,7 +702,7 @@ minetest.register_node("mcl_crimson:crimson_nylium", { _mcl_hardness = 0.4, _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, - _mcl_on_bonemealing = function(pt,user) + _on_bone_meal = function(itemstack, placer, pointed_thing) local node = minetest.get_node(pt.under) spread_nether_plants(pt.under,node) return true diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 605c41005..66d47d461 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -41,7 +41,7 @@ for i = 0, 2 do }, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) -- 75% chance to advance to next stage diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index a008f73ed..119d108af 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -45,7 +45,7 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index deda6ba10..2dcaaf835 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -109,7 +109,7 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index da837009a..eae52abcd 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -49,7 +49,7 @@ for i=1, 7 do groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 3d6062f0b..df01d0124 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -79,7 +79,7 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_mealing = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index a768fab37..769e7b6cf 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -20,13 +20,13 @@ for i=0, 3 do minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"}) end if i ~= 3 then - on_bonemealing = function(pointed_thing, placer) + on_bonemealing = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local node = minetest.get_node(pos) return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, node, 0, true) end else - on_bonemealing = function(pointed_thing, placer) + on_bonemealing = function(itemstack, placer, pointed_thing) do_berry_drop(pointed_thing.under) end end @@ -64,7 +64,7 @@ for i=0, 3 do sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, _mcl_hardness = 0, - _mcl_on_bonemealing = on_bonemealing, + _on_bone_meal = on_bonemealing, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() if clicker:is_player() and minetest.is_protected(pos, pn) then diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index d8ed0d0fb..c0013e2ce 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -60,7 +60,7 @@ for i=1,7 do dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua index 26fc8a44c..d64bfe092 100644 --- a/mods/ITEMS/mcl_flowers/bonemealing.lua +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -8,7 +8,7 @@ -- mcl_core, such as mcl_flowers. -- -- To work around this restriction, the bonemealing callback is defined here --- and the _mcl_on_bonemealing callback in "mcl_core:dirt_with_grass" node +-- and the _on_bone_meal callback in "mcl_core:dirt_with_grass" node -- definition is overwritten with it. local mg_name = minetest.get_mapgen_setting("mg_name") @@ -124,12 +124,12 @@ local olddef = minetest.registered_nodes[nodename] if not olddef then minetest.log("warning", "'mcl_core:dirt_with_grass' not registered, cannot add override!") else - local oldhandler = olddef._mcl_on_bonemealing - local newhandler = function (pointed_thing, placer) + local oldhandler = olddef._on_bone_meal + local newhandler = function(itemstack, placer, pointed_thing) bonemeal_grass(pointed_thing, placer) if oldhandler then - oldhandler(pointed_thing, placer) + oldhandler(itemstack, placer, pointed_thing) end end - minetest.override_item(nodename, {_mcl_on_bonemealing = newhandler}) + minetest.override_item(nodename, {_on_bone_meal = newhandler}) end diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 20c153dfa..311b7d8ce 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -162,7 +162,7 @@ local def_tallgrass = { _mcl_fortune_drop = fortune_wheat_seed_drop, node_placement_prediction = "", on_place = on_place_flower, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) -- Grow into double tallgrass @@ -192,7 +192,7 @@ def_fern.selection_box = { fixed = { -6/16, -0.5, -6/16, 6/16, 5/16, 6/16 }, } def_fern.groups.compostability = 65 -def_fern._mcl_on_bonemealing = function(pointed_thing, placer) +def_fern._on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) -- Grow into double fern. @@ -272,7 +272,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im bottom_groups.flower = 1 bottom_groups.place_flowerlike = 1 bottom_groups.dig_immediate = 3 - on_bonemealing = function(pointed_thing, placer) + on_bonemealing = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under minetest.add_item(pos, "mcl_flowers:"..name) return true @@ -411,7 +411,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(top) end end, - _mcl_on_bonemealing = on_bonemealing, + _on_bone_meal = on_bonemealing, groups = bottom_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), mesh = mesh @@ -450,7 +450,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im minetest.remove_node(bottom) end end, - _mcl_on_bonemealing = on_bonemealing, + _on_bone_meal = on_bonemealing, groups = top_groups, sounds = mcl_sounds.node_sound_leaves_defaults(), }) diff --git a/mods/ITEMS/mcl_mushrooms/small.lua b/mods/ITEMS/mcl_mushrooms/small.lua index 260fe700a..a32507e78 100644 --- a/mods/ITEMS/mcl_mushrooms/small.lua +++ b/mods/ITEMS/mcl_mushrooms/small.lua @@ -88,7 +88,7 @@ minetest.register_node("mcl_mushrooms:mushroom_brown", { }, node_placement_prediction = "", on_place = on_place, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local schematic = schempath .. "mcl_mushrooms_huge_brown.mts" local offset = vector.new(-3, -1, -3) return apply_bonemeal(pointed_thing.under, schematic, offset) @@ -120,7 +120,7 @@ minetest.register_node("mcl_mushrooms:mushroom_red", { }, node_placement_prediction = "", on_place = on_place, - _mcl_on_bonemealing = function(pointed_thing, placer) + _on_bone_meal = function(itemstack, placer, pointed_thing) local schematic = schempath .. "mcl_mushrooms_huge_red.mts" local offset = vector.new(-2, -1, -2) return apply_bonemeal(pointed_thing.under, schematic, offset) From 7112369917956f0a7c9247574a6af53ab50848cb Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 18 Apr 2024 23:27:08 +0000 Subject: [PATCH 247/273] Fix crashes when using bonemeal on nether nodes --- mods/ITEMS/mcl_crimson/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 1f8273b22..64a1e35e0 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -108,9 +108,9 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", { desc = S("Warped Fungus"), image = "mcl_crimson_warped_fungus.png", _on_bone_meal = function(itemstack, placer, pointed_thing) - local n = has_nylium_neighbor(pt.under) + local n = has_nylium_neighbor(pointed_thing.under) if n then - minetest.set_node(pt.under,n) + minetest.set_node(pointed_thing.under,n) end end, }) @@ -405,7 +405,7 @@ minetest.register_node("mcl_crimson:warped_nylium", { _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, _on_bone_meal = function(itemstack, placer, pointed_thing) - local node = minetest.get_node(pt.under) + local node = minetest.get_node(pointed_thing.under) spread_nether_plants(pt.under,node) return true end, @@ -703,8 +703,8 @@ minetest.register_node("mcl_crimson:crimson_nylium", { _mcl_blast_resistance = 0.4, _mcl_silk_touch_drop = true, _on_bone_meal = function(itemstack, placer, pointed_thing) - local node = minetest.get_node(pt.under) - spread_nether_plants(pt.under,node) + local node = minetest.get_node(pointed_thing.under) + spread_nether_plants(pointed_thing.under,node) return true end, }) From cf1325d466d9b75b30f8c9c4429d76f029d08c9b Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 18 Apr 2024 23:28:58 +0000 Subject: [PATCH 248/273] Fix crash at one more spot --- mods/ITEMS/mcl_crimson/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 64a1e35e0..3f68921d1 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -406,7 +406,7 @@ minetest.register_node("mcl_crimson:warped_nylium", { _mcl_silk_touch_drop = true, _on_bone_meal = function(itemstack, placer, pointed_thing) local node = minetest.get_node(pointed_thing.under) - spread_nether_plants(pt.under,node) + spread_nether_plants(pointed_thing.under,node) return true end, }) From 354160e9e60581c1b298109a3483ae0c672a845e Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 19 Apr 2024 10:31:45 +0000 Subject: [PATCH 249/273] Check both above and below in pointed_thing for bonemealing (and pass thru the position as .under), make crimson vines and twisting vines compostable by rightclicking on the composter --- mods/ITEMS/mcl_bone_meal/init.lua | 51 +++++++++++++++++-------------- mods/ITEMS/mcl_crimson/init.lua | 30 ++++++++++++------ 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 3a0309003..2b3bf7041 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -76,34 +76,39 @@ end -- End legacy bone meal API mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.under + local positions = {pointed_thing.under, pointed_thing.above} + for i = 1,2 do + local pos = positions[i] - -- Check protection - if mcl_util.check_area_protection(pos, pointed_thing.above, placer) then return false end + -- Check protection + if mcl_util.check_area_protection(pos, pointed_thing.above, placer) then return false end - local node = minetest.get_node(pos) - local ndef = minetest.registered_nodes[node.name] - local success = false - local consume + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + local success = false + local consume - -- If the pointed node can be bonemealed, let it handle the processing. - if ndef and ndef._on_bone_meal then - success = ndef._on_bone_meal(itemstack, placer, pointed_thing) - consume = true - else - -- Otherwise try the legacy API. - success = legacy_apply_bone_meal(pointed_thing, placer) - consume = success - end + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._on_bone_meal then + success = ndef._on_bone_meal(itemstack, placer, {under = pos, above = vector.offset(pos, 0, 1, 0)}) + consume = true + else + -- Otherwise try the legacy API. + success = legacy_apply_bone_meal(pointed_thing, placer) + consume = success + end - -- Particle effects - if success then - mcl_bone_meal.add_bone_meal_particle(pos) - end + -- Particle effects + if success then + mcl_bone_meal.add_bone_meal_particle(pos) + end - -- Take the item - if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then - itemstack:take_item() + -- Take the item + if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then + itemstack:take_item() + end + + if success then return itemstack end end return itemstack diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 3f68921d1..e5c86841f 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -161,17 +161,22 @@ minetest.register_node("mcl_crimson:twisting_vines", { end, on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under - local above = pointed_thing.above local unode = minetest.get_node(under) + local unode_def = minetest.registered_nodes[unode.name] + + local above = pointed_thing.above + local anode = minetest.get_node(above) + local anode_def = minetest.registered_nodes[anode.name] + if under.y < above.y then minetest.set_node(above, {name = "mcl_crimson:twisting_vines"}) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end - else - if unode.name == "mcl_crimson:twisting_vines" then - return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing) - end + elseif unode_def and unode_def.on_rightclick then + return unode_def.on_rightclick(under, unode, placer, itemstack, pointed_thing) + elseif anode_def and anode_def.on_rightclick then + return unode_def.on_rightclick(above, anode, placer, itemstack, pointed_thing) end return itemstack end, @@ -251,17 +256,22 @@ minetest.register_node("mcl_crimson:weeping_vines", { end, on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under - local above = pointed_thing.above local unode = minetest.get_node(under) + local unode_def = minetest.registered_nodes[unode.name] + + local above = pointed_thing.above + local anode = minetest.get_node(above) + local anode_def = minetest.registered_nodes[anode.name] + if under.y > above.y then minetest.set_node(above, {name = "mcl_crimson:weeping_vines"}) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end - else - if unode.name == "mcl_crimson:weeping_vines" then - return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing) - end + elseif unode_def and unode_def.on_rightclick then + return unode_def.on_rightclick(under, unode, placer, itemstack, pointed_thing) + elseif anode_def and anode_def.on_rightclick then + return unode_def.on_rightclick(above, anode, placer, itemstack, pointed_thing) end return itemstack end, From d09791db7b8efa8144b7bbe2248bbe89f9f9f2bc Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 20 May 2024 07:21:52 +0000 Subject: [PATCH 250/273] Fix typo that prevented bone mealing pumpkin plants --- mods/ITEMS/mcl_farming/pumpkin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index df01d0124..998a82c18 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -79,7 +79,7 @@ for s=1,7 do groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, - _on_bone_mealing = function(itemstack, placer, pointed_thing) + _on_bone_meal = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) local stages = math.random(2, 5) From 6741c5a8093aca0b95bb25f29b4406e845997ef5 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 26 May 2024 17:12:44 +0000 Subject: [PATCH 251/273] Make composter_progress_chance local, as it is not used anywhere except in mcl_composters --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index b635760ca..69065d927 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -90,7 +90,7 @@ end ---@param pos Vector Position of the node ---@param node node ---@param chance integer Value of "compostability" group of inserted item -function composter_progress_chance(pos, node, chance) +local function composter_progress_chance(pos, node, chance) -- calculate leveling up chance local rand = math.random(0,100) if chance >= rand then From 70e8ba9a8999379ee8ddd9c2cb8fc309bdbf0764 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 8 Jun 2024 14:51:29 -0500 Subject: [PATCH 252/273] Remove TODO pending future discussions, revert timer change in composter code --- mods/ITEMS/mcl_cocoas/init.lua | 3 +-- mods/ITEMS/mcl_composters/init.lua | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 1af306355..970090a1c 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -67,8 +67,7 @@ function mcl_cocoas.grow(pos) return true end --- only caller was mcl_dye, now these can be local functions. --- TODO: remove aliases, replace global functions with local functions. +-- only caller was mcl_dye, consider converting these into local functions. local cocoa_place = mcl_cocoas.place local cocoa_grow = mcl_cocoas.grow diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 69065d927..7d4d135bd 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -114,7 +114,9 @@ local function composter_progress_chance(pos, node, chance) -- the block will get updated by the node timer callback set in node reg def if level == 7 then local timer = get_node_timer(pos) - timer:start(1) + if not timer:is_started() then + timer:start(1) + end end end end From 8f53074b58158a387ba0867a39063336394fad34 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 8 Jul 2024 21:40:11 -0500 Subject: [PATCH 253/273] Reorder functions to prevent crash --- mods/ITEMS/mcl_composters/init.lua | 70 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 7d4d135bd..28883dc48 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -48,6 +48,41 @@ local vector_offset = vector.offset local is_protected = minetest.is_protected local record_protection_violation = minetest.record_protection_violation +--- Math and node swap during compost progression +---@param pos Vector Position of the node +---@param node node +---@param chance integer Value of "compostability" group of inserted item +local function composter_progress_chance(pos, node, chance) + -- calculate leveling up chance + local rand = math.random(0,100) + if chance >= rand then + -- get current compost level + local level = registered_nodes[node.name]["_mcl_compost_level"] + -- spawn green particles above new layer + mcl_bone_meal.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) + -- update composter block + if level < 7 then + level = level + 1 + else + level = "ready" + end + swap_node(pos, {name = "mcl_composters:composter_" .. level}) + minetest.sound_play({name="default_grass_footstep", gain=0.4}, { + pos = pos, + gain= 0.4, + max_hear_distance = 16, + }, true) + -- a full composter becomes ready for harvest after one second + -- the block will get updated by the node timer callback set in node reg def + if level == 7 then + local timer = get_node_timer(pos) + if not timer:is_started() then + timer:start(1) + end + end + end +end + --- Fill the composter when rightclicked. -- -- `on_rightclick` handler for composter blocks of all fill levels except @@ -86,41 +121,6 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) return itemstack end ---- Math and node swap during compost progression ----@param pos Vector Position of the node ----@param node node ----@param chance integer Value of "compostability" group of inserted item -local function composter_progress_chance(pos, node, chance) - -- calculate leveling up chance - local rand = math.random(0,100) - if chance >= rand then - -- get current compost level - local level = registered_nodes[node.name]["_mcl_compost_level"] - -- spawn green particles above new layer - mcl_bone_meal.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) - -- update composter block - if level < 7 then - level = level + 1 - else - level = "ready" - end - swap_node(pos, {name = "mcl_composters:composter_" .. level}) - minetest.sound_play({name="default_grass_footstep", gain=0.4}, { - pos = pos, - gain= 0.4, - max_hear_distance = 16, - }, true) - -- a full composter becomes ready for harvest after one second - -- the block will get updated by the node timer callback set in node reg def - if level == 7 then - local timer = get_node_timer(pos) - if not timer:is_started() then - timer:start(1) - end - end - end -end - --- Update a full composter block to ready for harvesting. -- -- `on_timer` handler. The timer is set in function 'composter_add_item' From afc270195aae7522df670649cbe40765c0dc20ae Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 18 Aug 2024 21:31:01 -0500 Subject: [PATCH 254/273] Fix crash when bonemealing weaping and twisting vines, fix weaping vine growth --- mods/ITEMS/mcl_crimson/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index e5c86841f..4bc97c743 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -155,7 +155,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos}) + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos, above=pos}) end return itemstack end, @@ -228,7 +228,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { }, node_placement_prediction = "", _on_bone_meal = function(itemstack, placer, pointed_thing) - return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:weeping_vines") + return grow_vines(pointed_thing.under, math.random(1, 3),"mcl_crimson:weeping_vines", -1) end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local pn = clicker:get_player_name() @@ -250,7 +250,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { end elseif clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then - return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos}) + return mcl_bone_meal.use_bone_meal(itemstack, clicker, {under=pos, above=pos}) end return itemstack end, From 4eda77acd1d37b0b15ebf8439cb0e745acf0f487 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 21 Aug 2024 22:22:19 -0500 Subject: [PATCH 255/273] Prevent bonemealing grass from making flowers and also bonemealing the block above the grass --- mods/ITEMS/mcl_flowers/bonemealing.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_flowers/bonemealing.lua b/mods/ITEMS/mcl_flowers/bonemealing.lua index d64bfe092..44bce6eef 100644 --- a/mods/ITEMS/mcl_flowers/bonemealing.lua +++ b/mods/ITEMS/mcl_flowers/bonemealing.lua @@ -126,10 +126,11 @@ if not olddef then else local oldhandler = olddef._on_bone_meal local newhandler = function(itemstack, placer, pointed_thing) - bonemeal_grass(pointed_thing, placer) + local res = bonemeal_grass(pointed_thing, placer) if oldhandler then - oldhandler(itemstack, placer, pointed_thing) + res = oldhandler(itemstack, placer, pointed_thing) or res end + return res end minetest.override_item(nodename, {_on_bone_meal = newhandler}) end From 66b5a369f1198552e60ea33debe20e8e0d6861d8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 22 Aug 2024 06:58:39 -0500 Subject: [PATCH 256/273] Add mcl_util.trace_node(), rewrite bamboo growth code to fix bone meal growth --- mods/CORE/mcl_util/init.lua | 22 ++++ mods/ITEMS/mcl_bamboo/globals.lua | 212 +++++++++--------------------- 2 files changed, 84 insertions(+), 150 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 6143bfb41..bdb0303c3 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1131,3 +1131,25 @@ if not vector.in_area then (pos.z >= min.z) and (pos.z <= max.z) end end + +-- Traces along a line of nodes vertically to find the next possition that isn't an allowed node +---@param pos The position to start tracing from +---@param dir The direction to trace in (1 is up, -1 is down) +---@param allowed_nodes A table of node names to trace along +---@param limit The maximum number of steps to make. Defaults to 16 if nil or missing +---@return Three return values: +--- the position of the next node that isn't allowed or nil if no such node was found, +--- the distance from the start where that node was found, +--- the node table if a node was found +function mcl_util.trace_nodes(pos, dir, allowed_nodes, limit) + if not dir or dir == 0 or #allowed_nodes == 0 then return nil, 0, nil end + limit = limit or 16 + + for i = 1,limit do + pos = vector.offset(pos, 0, dir, 0) + local node = minetest.get_node(pos) + if table.indexof(allowed_nodes, node.name) == -1 then return pos, i, node end + end + + return nil, limit, nil +end diff --git a/mods/ITEMS/mcl_bamboo/globals.lua b/mods/ITEMS/mcl_bamboo/globals.lua index 9c7db5486..250f9b926 100644 --- a/mods/ITEMS/mcl_bamboo/globals.lua +++ b/mods/ITEMS/mcl_bamboo/globals.lua @@ -94,172 +94,84 @@ end --]] function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) + local log = mcl_bamboo.mcl_log local node_above = minetest.get_node(vector.offset(pos, 0, 1, 0)) - mcl_bamboo.mcl_log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied)) + log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied)) - if not bonemeal_applied and mcl_bamboo.is_bamboo(node_above.name) ~= false then - return false -- short circuit this function if we're trying to grow (std) the bamboo and it's not the top shoot. + if not bonemeal_applied then + -- Only allow natural growth at the top of the bamboo + if mcl_bamboo.is_bamboo(node_above.name) ~= false then return false end + + -- Don't perform natual growth in low light + if minetest.get_node_light(pos) < 8 then return false end end - if minetest.get_node_light(pos) < 8 then + + -- Determine the location of soil + local soil_pos + soil_pos,a,b = mcl_util.trace_nodes(pos, -1, mcl_bamboo.bamboo_index, BAMBOO_MAX_HEIGHT - 1) + + -- No soil found, return false so that bonemeal isn't used + if not soil_pos then return false end + log("Grow bamboo; soil found. ") + + -- Find the first bamboo shoot and retrieve data about it + local first_shoot = vector.offset(soil_pos, 0, 1, 0) + local first_shoot_meta = minetest.get_meta(first_shoot) + + -- Get or initialize bamboo height + local height = (first_shoot_meta and first_shoot_meta:get_int("height", -1)) or -1 + if height == -1 then + height = rand(BAM_MAX_HEIGHT_STPCHK + 1, BAM_MAX_HEIGHT_TOP + 1) + first_shoot_meta:set_int("height", height) + end + log("Grow bamboo; height: " .. height) + + -- Locate the bamboo tip + local bamboo_tip,actual_height,bamboo_tip_node = mcl_util.trace_nodes(first_shoot, 1, mcl_bamboo.bamboo_index, height - 1) + log("Current height: "..tostring(actual_height)) + + -- Short circuit growth if the bamboo is already finished growing + if not bamboo_tip or not actual_height or actual_height >= height then + log("Bamboo is already as large as it can grow") return false end - -- variables used in more than one spot. - local first_shoot - local chk_pos - local soil_pos - local node_name = "" - local dist = 0 - local node_below - -- ------------------- + -- Now that we are actually going to add nodes, initialize some more information + local first_shoot_node_name = minetest.get_node(first_shoot).name - mcl_bamboo.mcl_log("Grow bamboo; checking for soil: ") - -- the soil node below the bamboo. - for py = -1, BAMBOO_SOIL_DIST, -1 do - chk_pos = vector.offset(pos, 0, py, 0) - node_name = minetest.get_node(chk_pos).name - if mcl_bamboo.is_dirt(node_name) then - soil_pos = chk_pos - break - end - if mcl_bamboo.is_bamboo(node_name) == false then - break - end - end - -- requires knowing where the soil node is. - if soil_pos == nil then - return false -- returning false means don't use up the bonemeal. - end - - mcl_bamboo.mcl_log("Grow bamboo; soil found. ") - local grow_amount = rand(1, GROW_DOUBLE_CHANCE) - grow_amount = rand(1, GROW_DOUBLE_CHANCE) - grow_amount = rand(1, GROW_DOUBLE_CHANCE) -- because yeah, not truly random, or even a good prng. - grow_amount = rand(1, GROW_DOUBLE_CHANCE) - local init_height = rand(BAM_MAX_HEIGHT_STPCHK + 1, BAM_MAX_HEIGHT_TOP + 1) - mcl_bamboo.mcl_log("Grow bamboo; random height: " .. init_height) - - node_name = "" - - -- update: add randomized max height to first node's meta data. - first_shoot = vector.offset(soil_pos, 0, 1, 0) - local meta = minetest.get_meta(first_shoot) - node_below = minetest.get_node(first_shoot).name - - mcl_bamboo.mcl_log("Grow bamboo; checking height meta ") - -- check the meta data for the first node, to see how high to make the stalk. - if not meta then - -- if no metadata, set the metadata!!! - meta:set_int("height", init_height) - end - local height = meta:get_int("height", -1) - mcl_bamboo.mcl_log("Grow bamboo; meta-height: " .. height) - if height <= 10 then - height = init_height - meta:set_int("height", init_height) - end - - mcl_bamboo.mcl_log("Grow bamboo; height: " .. height) - - -- Bonemeal: Grows the bamboo by 1-2 stems. (per the minecraft wiki.) + -- If applying bonemeal, randomly grow two segments instead of one + local grow_amount = 1 if bonemeal_applied then - -- handle applying bonemeal. - for py = 1, BAM_MAX_HEIGHT_TOP do - -- find the top node of bamboo. - chk_pos = vector.offset(pos, 0, py, 0) - node_name = minetest.get_node(chk_pos).name - dist = vector.distance(soil_pos, chk_pos) - if mcl_bamboo.is_bamboo(node_name) == false or node_name == BAMBOO_ENDCAP_NAME then - break - end - end - - mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist) - - if node_name == BAMBOO_ENDCAP_NAME then - -- prevent overgrowth - return false - end - - -- check to see if we have a full stalk of bamboo. - if dist >= height - 1 then - if dist == height - 1 then - -- equals top of the stalk before the cap - if node_name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") - minetest.set_node(vector.offset(chk_pos, 0, 1, 0), { name = BAMBOO_ENDCAP_NAME }) - return true -- returning true means use up the bonemeal. - else - return false - end - else - -- okay, we're higher than the end cap, fail out. - return false -- returning false means don't use up the bonemeal. - end - end - - -- and now, the meat of the section... add bamboo to the stalk. - -- at this point, we should be lower than the generated maximum height. ~ about height -2 or lower. - if dist <= height - 2 then - if node_name == "air" then - -- here we can check to see if we can do up to 2 bamboo shoots onto the stalk - mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") - minetest.set_node(chk_pos, { name = node_below }) - -- handle growing a second node. - if grow_amount == 2 then - chk_pos = vector.offset(chk_pos, 0, 1, 0) - if minetest.get_node(chk_pos).name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") - minetest.set_node(chk_pos, { name = node_below }) - end - end - return true -- exit out with a success. We've added 1-2 nodes, per the wiki. - end + local rng = PcgRandom(minetest.hash_node_position(pos) + minetest.get_us_time()) + if rng:next(1, GROW_DOUBLE_CHANGE) == 1 then + grow_amount = 2 end end + log("Growing up to "..grow_amount.." segments") - -- Non-Bonemeal growth. - for py = 1, BAM_MAX_HEIGHT_TOP do - -- Find the topmost node above the stalk, and check it for "air" - chk_pos = vector.offset(pos, 0, py, 0) - node_below = minetest.get_node(pos).name - node_name = minetest.get_node(chk_pos).name - dist = vector.distance(soil_pos, chk_pos) - - if node_name ~= "air" and mcl_bamboo.is_bamboo(node_name) == false then - break + -- Perform bamboo growth + for i = 1,grow_amount do + -- Check for air to grow into + local bamboo_tip_node = minetest.get_node(bamboo_tip) + if not bamboo_tip_node or bamboo_tip_node.name ~= "air" then + -- Something is blocking growth, stop and signal that use bonemeal has been used if at least on segment has grown + return i ~= 1 end - -- stop growing check. ie, handle endcap placement. - if dist >= height - 1 then - local above_node_name = minetest.get_node(vector.offset(chk_pos, 0, 1, 0)).name - if node_name == "air" and above_node_name == "air" then - if height - 1 == dist then - mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") - minetest.set_node(chk_pos, { name = BAMBOO_ENDCAP_NAME }) - end - end - break + if actual_height + 1 == height then + -- This is the end cap + minetest.set_node(bamboo_tip, { name = BAMBOO_ENDCAP_NAME }) + return true + else + -- This isn't the end cap, add a bamboo segment + minetest.set_node(bamboo_tip, { name = first_shoot_node_name }) + actual_height = actual_height + 1 end - -- handle regular node placement. - -- find the air node above the top shoot. place a node. And then, if short enough, - -- check for second node placement. - if node_name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist) - mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") - minetest.set_node(chk_pos, { name = node_below }) - -- handle growing a second node. (1 in 32 chance.) - if grow_amount == 2 and dist <= height - 2 then - chk_pos = vector.offset(chk_pos, 0, 1, 0) - if minetest.get_node(chk_pos).name == "air" then - mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") - minetest.set_node(chk_pos, { name = node_below }) - end - end - break - end + bamboo_tip = vector.offset(bamboo_tip, 0, 1, 0) end + + return true end -- Add Groups function, courtesy of Warr1024. From 981cddddd4ca69eefd5850afe45b78463f96ee6c Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 22 Aug 2024 07:29:35 -0500 Subject: [PATCH 257/273] Add growth limits to crimson/twisting vines --- mods/ITEMS/mcl_crimson/init.lua | 44 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 4bc97c743..bf1b0ca80 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -5,6 +5,8 @@ local modpath = minetest.get_modpath(modname) -- by debiankaios -- adapted for mcl2 by cora +local MAXIMUM_VINE_HEIGHT = 25 + local wood_slab_groups = {handy = 1, axey = 1, material_wood = 1, wood_slab = 1} local wood_stair_groups = {handy = 1, axey = 1, material_wood = 1, wood_stairs = 1} @@ -16,23 +18,35 @@ function generate_crimson_tree(pos) minetest.place_schematic(pos,modpath.."/schematics/crimson_fungus_1.mts","random",nil,false,"place_center_x,place_center_z") end -function grow_vines(pos, moreontop ,vine, dir) +function grow_vines(pos, moreontop, vine, dir) + -- Sanity checks if dir == nil then dir = 1 end - local n - repeat - pos = vector.offset(pos,0,dir,0) - n = minetest.get_node(pos) - if n.name == "air" then - for i=0,math.max(moreontop,1) do - if minetest.get_node(pos).name == "air" then - minetest.set_node(vector.offset(pos,0,i*dir,0),{name=vine}) - end - end - return true - end - until n.name ~= "air" and n.name ~= vine + if not moreontop or moreontop < 1 then return false end - return false + local allowed_nodes = {vine} + + -- Find the root, tip and calculate height + local root,_,root_node = mcl_util.trace_nodes(pos, -dir, allowed_nodes, MAXIMUM_VINE_HEIGHT) + if not root then return false end + local tip,height,tip_node = mcl_util.trace_nodes(vector.offset(root, 0, dir, 0), dir, allowed_nodes, MAXIMUM_VINE_HEIGHT) + if not tip then return false end + + local res = false + for i = 1,moreontop do + -- Check if we can grow into this position + if height >= MAXIMUM_VINE_HEIGHT then return res end + if tip_node.name ~= "air" then return res end + + -- Update world map data + minetest.set_node(tip, {name = vine}) + + -- Move to the next position and flag that growth has occured + tip = vector.offset(tip, 0, dir, 0) + tip_node = minetest.get_node(tip) + height = height + 1 + res = true + end + return res end local nether_plants = { From 189a2c62adef3549a10640a42b2560884c1e7b88 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 24 Aug 2024 10:27:34 -0500 Subject: [PATCH 258/273] Address review comments on mcl_util.trace_nodes --- mods/CORE/mcl_util/init.lua | 8 ++++---- mods/ITEMS/mcl_bamboo/globals.lua | 8 ++++++-- mods/ITEMS/mcl_crimson/init.lua | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index bdb0303c3..a9d815f58 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1134,21 +1134,21 @@ end -- Traces along a line of nodes vertically to find the next possition that isn't an allowed node ---@param pos The position to start tracing from ----@param dir The direction to trace in (1 is up, -1 is down) ----@param allowed_nodes A table of node names to trace along +---@param dir The direction to trace in. 1 is up, -1 is down, all other values are not allowed. +---@param allowed_nodes A set of node names to trace along. ---@param limit The maximum number of steps to make. Defaults to 16 if nil or missing ---@return Three return values: --- the position of the next node that isn't allowed or nil if no such node was found, --- the distance from the start where that node was found, --- the node table if a node was found function mcl_util.trace_nodes(pos, dir, allowed_nodes, limit) - if not dir or dir == 0 or #allowed_nodes == 0 then return nil, 0, nil end + if ( dir ~= -1 ) and ( dir ~= 1 ) then return nil, 0, nil end limit = limit or 16 for i = 1,limit do pos = vector.offset(pos, 0, dir, 0) local node = minetest.get_node(pos) - if table.indexof(allowed_nodes, node.name) == -1 then return pos, i, node end + if not allowed_nodes[node.name] then return pos, i, node end end return nil, limit, nil diff --git a/mods/ITEMS/mcl_bamboo/globals.lua b/mods/ITEMS/mcl_bamboo/globals.lua index 250f9b926..eea779b90 100644 --- a/mods/ITEMS/mcl_bamboo/globals.lua +++ b/mods/ITEMS/mcl_bamboo/globals.lua @@ -44,6 +44,10 @@ mcl_bamboo.bamboo_index = { "mcl_bamboo:bamboo_2", "mcl_bamboo:bamboo_3", } +mcl_bamboo.bamboo_set = {} +for _,key in pairs(mcl_bamboo.bamboo_index) do + mcl_bamboo.bamboo_set[key] = true +end function mcl_bamboo.is_bamboo(node_name) local index = table.indexof(mcl_bamboo.bamboo_index, node_name) @@ -108,7 +112,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) -- Determine the location of soil local soil_pos - soil_pos,a,b = mcl_util.trace_nodes(pos, -1, mcl_bamboo.bamboo_index, BAMBOO_MAX_HEIGHT - 1) + soil_pos,a,b = mcl_util.trace_nodes(pos, -1, mcl_bamboo.bamboo_set, BAMBOO_MAX_HEIGHT - 1) -- No soil found, return false so that bonemeal isn't used if not soil_pos then return false end @@ -127,7 +131,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) log("Grow bamboo; height: " .. height) -- Locate the bamboo tip - local bamboo_tip,actual_height,bamboo_tip_node = mcl_util.trace_nodes(first_shoot, 1, mcl_bamboo.bamboo_index, height - 1) + local bamboo_tip,actual_height,bamboo_tip_node = mcl_util.trace_nodes(first_shoot, 1, mcl_bamboo.bamboo_set, height - 1) log("Current height: "..tostring(actual_height)) -- Short circuit growth if the bamboo is already finished growing diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index bf1b0ca80..6920c4dc6 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -23,7 +23,8 @@ function grow_vines(pos, moreontop, vine, dir) if dir == nil then dir = 1 end if not moreontop or moreontop < 1 then return false end - local allowed_nodes = {vine} + local allowed_nodes = {} + allowed_nodes[vine] = true -- Find the root, tip and calculate height local root,_,root_node = mcl_util.trace_nodes(pos, -dir, allowed_nodes, MAXIMUM_VINE_HEIGHT) From 6ada1a34772c89aae77a1465c34d6ec67b9e298f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 24 Aug 2024 18:07:27 -0500 Subject: [PATCH 259/273] Remove check with mcl_core.check_vines_supported for twisted and crimson vines --- mods/ITEMS/mcl_crimson/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index 6920c4dc6..919538860 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -199,7 +199,7 @@ minetest.register_node("mcl_crimson:twisting_vines", { local above = vector.offset(pos,0,1,0) local abovenode = minetest.get_node(above) minetest.node_dig(pos, node, digger) - if abovenode.name == node.name and (not mcl_core.check_vines_supported(above, abovenode)) then + if abovenode.name == node.name then minetest.registered_nodes[node.name].on_dig(above, node, digger) end end, @@ -294,7 +294,7 @@ minetest.register_node("mcl_crimson:weeping_vines", { local below = vector.offset(pos,0,-1,0) local belownode = minetest.get_node(below) minetest.node_dig(pos, node, digger) - if belownode.name == node.name and (not mcl_core.check_vines_supported(below, belownode)) then + if belownode.name == node.name then minetest.registered_nodes[node.name].on_dig(below, node, digger) end end, From 49c8ae2fa01132f467a1f73792f72de7d085072d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 20 Sep 2024 06:22:44 -0500 Subject: [PATCH 260/273] Quick patch to get cherry saplings growing pending inclusing of a proper tree API --- mods/ITEMS/mcl_core/functions.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 399b2d15c..49395b588 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -962,6 +962,7 @@ end -- pos: Position -- node: Node table of the node at this position, from minetest.get_node -- Returns true on success and false on failure +-- TODO: replace this with a proper tree API function mcl_core.grow_sapling(pos, node) if node.name == "mcl_core:sapling" then grow_oak(pos) @@ -975,6 +976,8 @@ function mcl_core.grow_sapling(pos, node) grow_spruce(pos) elseif node.name == "mcl_core:birchsapling" then grow_birch(pos) + elseif node.name == "mcl_cherry_blossom:cherrysapling" then + return mcl_cherry_blossom.generate_cherry_tree(pos) else return false end From cfdef2435a3adcecd11f9448786f301341489725 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 20 Sep 2024 06:51:56 -0500 Subject: [PATCH 261/273] Show particles regardless of success --- mods/ITEMS/mcl_bone_meal/init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 2b3bf7041..319f6cce2 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -99,9 +99,7 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) end -- Particle effects - if success then - mcl_bone_meal.add_bone_meal_particle(pos) - end + mcl_bone_meal.add_bone_meal_particle(pos) -- Take the item if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then From 6b1aa43238c838823a9d3135958f34cf03c79b73 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 20 Sep 2024 07:05:14 -0500 Subject: [PATCH 262/273] Only show particles if bone meal is consumed, don't continue testing positions if bonemeal was used on the first check position --- mods/ITEMS/mcl_bone_meal/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index 319f6cce2..dd13f6e58 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -99,7 +99,9 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) end -- Particle effects - mcl_bone_meal.add_bone_meal_particle(pos) + if consume then + mcl_bone_meal.add_bone_meal_particle(pos) + end -- Take the item if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then @@ -107,6 +109,7 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) end if success then return itemstack end + if consume then return itemstack end end return itemstack From 94d9e4c881736b477aa7bf0b0f7768bf6c49a042 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 20 Sep 2024 08:39:11 -0500 Subject: [PATCH 263/273] Address review comments --- mods/CORE/mcl_util/init.lua | 2 +- mods/ITEMS/mcl_bone_meal/init.lua | 33 ++++++++++++++++--------------- mods/ITEMS/mcl_cocoas/init.lua | 3 ++- mods/ITEMS/mcl_cocoas/mod.conf | 4 ++-- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index a9d815f58..2d2b8a609 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1142,7 +1142,7 @@ end --- the distance from the start where that node was found, --- the node table if a node was found function mcl_util.trace_nodes(pos, dir, allowed_nodes, limit) - if ( dir ~= -1 ) and ( dir ~= 1 ) then return nil, 0, nil end + if (dir ~= -1) and (dir ~= 1) then return nil, 0, nil end limit = limit or 16 for i = 1,limit do diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua index dd13f6e58..e899ca765 100644 --- a/mods/ITEMS/mcl_bone_meal/init.lua +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -13,7 +13,7 @@ local usagehelp = S( mcl_bone_meal = {} --- Bone meal particle api: +-- Bone meal particle API: --- Spawns bone meal particles. -- pos: where the particles spawn @@ -21,9 +21,7 @@ mcl_bone_meal = {} -- details on these parameters. -- function mcl_bone_meal.add_bone_meal_particle(pos, def) - if not def then - def = {} - end + def = def or {} minetest.add_particlespawner({ amount = def.amount or 10, time = def.time or 0.1, @@ -65,8 +63,9 @@ end -- local function legacy_apply_bone_meal(pointed_thing, placer) -- Legacy API support - for _, func in pairs(mcl_bone_meal.bone_meal_callbacks) do - if func(pointed_thing, placer) then + local callbacks = mcl_bone_meal.bone_meal_callbacks + for i = 1,#callbacks do + if callbacks[i](pointed_thing, placer) then return true end end @@ -75,7 +74,7 @@ local function legacy_apply_bone_meal(pointed_thing, placer) end -- End legacy bone meal API -mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) +function mcl_bone_meal.use_bone_meal(itemstack, placer, pointed_thing) local positions = {pointed_thing.under, pointed_thing.above} for i = 1,2 do local pos = positions[i] @@ -98,18 +97,19 @@ mcl_bone_meal.use_bone_meal = function(itemstack, placer, pointed_thing) consume = success end - -- Particle effects - if consume then - mcl_bone_meal.add_bone_meal_particle(pos) - end - -- Take the item - if consume and ( not placer or not minetest.is_creative_enabled(placer:get_player_name()) ) then - itemstack:take_item() + if consume then + -- Particle effects + mcl_bone_meal.add_bone_meal_particle(pos) + + if not placer or not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack end if success then return itemstack end - if consume then return itemstack end end return itemstack @@ -130,7 +130,8 @@ minetest.register_craftitem("mcl_bone_meal:bone_meal", { -- Use pointed node's on_rightclick function first, if present. if placer and not placer:get_player_control().sneak then if ndef and ndef.on_rightclick then - return ndef.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then return new_stack end end end diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 970090a1c..2d1a0efd6 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -23,7 +23,8 @@ function mcl_cocoas.place(itemstack, placer, pt, plantname) -- Am I right-clicking on something that has a custom on_rightclick set? if placer and not placer:get_player_control().sneak then if def and def.on_rightclick then - return def.on_rightclick(pt.under, node, placer, itemstack) or itemstack + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pt) + if new_stack and new_stack ~= itemstack then return new_stack end end end diff --git a/mods/ITEMS/mcl_cocoas/mod.conf b/mods/ITEMS/mcl_cocoas/mod.conf index 867636191..fb084f39a 100644 --- a/mods/ITEMS/mcl_cocoas/mod.conf +++ b/mods/ITEMS/mcl_cocoas/mod.conf @@ -1,4 +1,4 @@ name = mcl_cocoas description = Cocoa pods which grow at jungle trees. Does not include cocoa beans. -depends = mcl_sounds, mcl_core -optional_depends = doc \ No newline at end of file +depends = mcl_sounds, mcl_core, mcl_util +optional_depends = doc From 3514fe211f5e403b37f02406b3c6232f803b4270 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 23 Sep 2024 06:31:02 -0500 Subject: [PATCH 264/273] Implement more bonemeal mod shim, update bonemeal dependencies --- mods/MISC/bonemeal/init.lua | 23 ++++++++++++++++++++++- mods/MISC/bonemeal/mod.conf | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mods/MISC/bonemeal/init.lua b/mods/MISC/bonemeal/init.lua index 666319204..40c60878a 100644 --- a/mods/MISC/bonemeal/init.lua +++ b/mods/MISC/bonemeal/init.lua @@ -1,4 +1,12 @@ -bonemeal = {} +bonemeal = { + item_list = { + bucket_water = "mcl_buckets:bucket_water", + bucket_empty = "mcl_buckets:bucket_empty", + dirt = "mcl_core:dirt", + torch = "mcl_torches:torch", + coral = "mcl_ocean:dead_horn_coral_block" + } +} function bonemeal:on_use(pos, strength, node) -- Fake itemstack for bone meal @@ -10,3 +18,16 @@ function bonemeal:on_use(pos, strength, node) } mcl_bone_meal.use_bone_meal(itemstack, nil, pointed_thing) end + +function bonemeal:is_creative(player_name) + return minetest.is_creative_enabled(player_name) +end + +function bonemeal:add_deco(list) + minetest.log("TODO: implement bonemeal:add_deco("..dump(list).."..)") + for i = 1,#list do + local item = list[i] + end +end + +minetest.register_alias("mcl_mobitems:bone", "bonemeal:bone") diff --git a/mods/MISC/bonemeal/mod.conf b/mods/MISC/bonemeal/mod.conf index 292cc0352..3117bd1ed 100644 --- a/mods/MISC/bonemeal/mod.conf +++ b/mods/MISC/bonemeal/mod.conf @@ -1,4 +1,4 @@ name = bonemeal author = teknomunk description = Compatibility shim for WorldEdit-Additions bonemeal support -optional_depends = mcl_bone_meal +depends = mcl_bone_meal, mcl_mobitems, mcl_flowers From a46833eaa4564603b213c636a8d7e27d6c8d638a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 23 Sep 2024 06:33:05 -0500 Subject: [PATCH 265/273] Fix alias --- mods/MISC/bonemeal/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MISC/bonemeal/init.lua b/mods/MISC/bonemeal/init.lua index 40c60878a..13f52e7fe 100644 --- a/mods/MISC/bonemeal/init.lua +++ b/mods/MISC/bonemeal/init.lua @@ -30,4 +30,4 @@ function bonemeal:add_deco(list) end end -minetest.register_alias("mcl_mobitems:bone", "bonemeal:bone") +minetest.register_alias("bonemeal:bone", "mcl_mobitems:bone") From f6f5481f30e685446539c40ed71294e5e7dda8fc Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 10 Nov 2024 11:41:19 +0100 Subject: [PATCH 266/273] Attempt to fix chest minecarts, at least for 5.9 (#4684) Not using the `RecheckCartHack` on >5.9 seems to help with #4670 - not tested on older minetest; chest minecarts might still be empty there when the block is unloaded in the meantime. For <5.9, maybe it helps to decrease the time interval, 3 seconds seems to fairly long. This also makes the minecarts random: 40% minecart, 40% chest minecart, 20% tnt minecart. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4684 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/MAPGEN/tsm_railcorridors/gameconfig.lua | 14 ++++++++++---- mods/MAPGEN/tsm_railcorridors/init.lua | 13 ++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua index 2e80c60c8..9f924f00b 100644 --- a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua +++ b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua @@ -36,7 +36,11 @@ else end end -tsm_railcorridors.carts = { "mcl_minecarts:chest_minecart" } +tsm_railcorridors.carts = { + "mcl_minecarts:minecart", "mcl_minecarts:minecart", + "mcl_minecarts:chest_minecart", "mcl_minecarts:chest_minecart", + "mcl_minecarts:tnt_minecart" +} -- This is called after a spawner has been placed by the game. -- Use this to properly set up the metadata and stuff. @@ -54,9 +58,11 @@ end function tsm_railcorridors.on_construct_cart(_, cart, pr_carts) local l = cart:get_luaentity() local inv = mcl_entity_invs.load_inv(l,27) - local items = tsm_railcorridors.get_treasures(pr_carts) - mcl_loot.fill_inventory(inv, "main", items, pr_carts) - mcl_entity_invs.save_inv(l) + if inv then -- otherwise probably not a chest minecart + local items = tsm_railcorridors.get_treasures(pr_carts) + mcl_loot.fill_inventory(inv, "main", items, pr_carts) + mcl_entity_invs.save_inv(l) + end end -- Fallback function. Returns a random treasure. This function is called for chests diff --git a/mods/MAPGEN/tsm_railcorridors/init.lua b/mods/MAPGEN/tsm_railcorridors/init.lua index 66b4d779b..9895ab44c 100644 --- a/mods/MAPGEN/tsm_railcorridors/init.lua +++ b/mods/MAPGEN/tsm_railcorridors/init.lua @@ -397,7 +397,9 @@ end -- This is a workaround thanks to the fact that minetest.add_entity is unreliable as fuck -- See: https://github.com/minetest/minetest/issues/4759 -- FIXME: Kill this horrible hack with fire as soon you can. -local function RecheckCartHack(params) +local RecheckCartHack = nil +if not minetest.features.random_state_restore then -- proxy for minetest > 5.9.0, this feature will not be removed +RecheckCartHack = function(params) local pos = params[1] local cart_id = params[2] -- Find cart @@ -412,6 +414,7 @@ local function RecheckCartHack(params) end minetest.log("info", "[tsm_railcorridors] Cart spawn FAILED: "..minetest.pos_to_string(pos)) end +end -- Try to place a cobweb. -- pos: Position of cobweb @@ -935,13 +938,17 @@ local function spawn_carts() -- See local cart_id = tsm_railcorridors.carts[cart_type] minetest.log("info", "[tsm_railcorridors] Cart spawn attempt: "..minetest.pos_to_string(cpos)) - minetest.add_entity(cpos, cart_id) + local obj = minetest.add_entity(cpos, cart_id) -- This checks if the cart is actually spawned, it's a giant hack! -- Note that the callback function is also called there. -- TODO: Move callback function to this position when the -- minetest.add_entity bug has been fixed (supposedly in 5.9.0?) - minetest.after(3, RecheckCartHack, {cpos, cart_id}) + if RecheckCartHack then + minetest.after(3, RecheckCartHack, {cpos, cart_id}) + else + tsm_railcorridors.on_construct_cart(cpos, obj, pr_carts) + end end end carts_table = {} From fb3c85e289bd4a4a16926861455603b53de11849 Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 10 Nov 2024 12:02:20 +0100 Subject: [PATCH 267/273] Improve stalker textures (#4674) - don't change back to default texture when falling, but rather keep the previous texture - use a colorized default texture for gaps in the texture Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4674 Reviewed-by: the-real-herowl Co-authored-by: kno10 Co-committed-by: kno10 --- mods/ENTITIES/mobs_mc/stalker.lua | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/stalker.lua b/mods/ENTITIES/mobs_mc/stalker.lua index 962fbdea9..bcb5a5d7e 100644 --- a/mods/ENTITIES/mobs_mc/stalker.lua +++ b/mods/ENTITIES/mobs_mc/stalker.lua @@ -7,12 +7,13 @@ local S = minetest.get_translator("mobs_mc") --################### -local function get_texture(self) - local on_name = self.standing_on +local function get_texture(self, prev) + local standing_on = minetest.registered_nodes[self.standing_on] + -- TODO: we do not have access to param2 here (color palette index) yet local texture local texture_suff = "" - if on_name and on_name ~= "air" then - local tiles = minetest.registered_nodes[on_name].tiles + if standing_on and (standing_on.walkable or standing_on.groups.liquid) then + local tiles = standing_on.tiles if tiles then local tile = tiles[1] local color @@ -25,7 +26,7 @@ local function get_texture(self) texture = tile end if not color then - color = minetest.colorspec_to_colorstring(minetest.registered_nodes[on_name].color) + color = minetest.colorspec_to_colorstring(standing_on.color) end if color then texture_suff = "^[multiply:" .. color .. "^[hsl:0:0:20" @@ -33,14 +34,19 @@ local function get_texture(self) end end if not texture or texture == "" then + -- try to keep last texture when, e.g., falling + if prev and (not (not self.attack)) == (string.find(prev, "vl_mobs_stalker_overlay_angry.png") ~= nil) then + return prev + end texture = "vl_stalker_default.png" - end - texture = texture:gsub("([\\^:\\[])","\\%1") -- escape texture modifiers - texture = "([combine:16x24:0,0=(" .. texture .. "):0,16=(" .. texture ..")".. texture_suff - if self.attack then - texture = texture .. ")^vl_mobs_stalker_overlay_angry.png" else - texture = texture .. ")^vl_mobs_stalker_overlay.png" + texture = texture:gsub("([\\^:\\[])", "\\%1") -- escape texture modifiers + texture = "(vl_stalker_default.png^[combine:16x24:0,0=(" .. texture .. "):0,16=(" .. texture .. ")" .. texture_suff .. ")" + end + if self.attack then + texture = texture .. "^vl_mobs_stalker_overlay_angry.png" + else + texture = texture .. "^vl_mobs_stalker_overlay.png" end return texture end @@ -132,7 +138,7 @@ mcl_mobs.register_mob("mobs_mc:stalker", { self:boom(mcl_util.get_object_center(self.object), self.explosion_strength) end end - local new_texture = get_texture(self) + local new_texture = get_texture(self, self._stalker_texture) if self._stalker_texture ~= new_texture then self.object:set_properties({textures={new_texture, "mobs_mc_empty.png"}}) self._stalker_texture = new_texture From bd9ab16762fdcf9519cd0f29030d26e3b46a8ee1 Mon Sep 17 00:00:00 2001 From: grorp Date: Wed, 25 Sep 2024 18:30:59 +0200 Subject: [PATCH 268/273] Add touch_interaction to (cross)bow and spyglass --- mods/ITEMS/mcl_bows/bow.lua | 2 ++ mods/ITEMS/mcl_bows/crossbow.lua | 3 +++ mods/ITEMS/mcl_spyglass/init.lua | 1 + 3 files changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 34784ab07..88bea6444 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -169,6 +169,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula return itemstack end, groups = {weapon=1,weapon_ranged=1,bow=1,cannot_block=1,enchantability=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) @@ -235,6 +236,7 @@ for level=0, 2 do on_place = function(itemstack) return itemstack end, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) end diff --git a/mods/ITEMS/mcl_bows/crossbow.lua b/mods/ITEMS/mcl_bows/crossbow.lua index b6dc31dd0..0810e6a8c 100644 --- a/mods/ITEMS/mcl_bows/crossbow.lua +++ b/mods/ITEMS/mcl_bows/crossbow.lua @@ -159,6 +159,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula return itemstack end, groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 326, }) @@ -194,6 +195,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula return itemstack end, groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1,not_in_creative_inventory=1}, + touch_interaction = "short_dig_long_place", _mcl_uses = 326, }) @@ -257,6 +259,7 @@ for level=0, 2 do on_place = function(itemstack) return itemstack end, + touch_interaction = "short_dig_long_place", _mcl_uses = 385, }) end diff --git a/mods/ITEMS/mcl_spyglass/init.lua b/mods/ITEMS/mcl_spyglass/init.lua index afa7adaf4..c0854d3b6 100644 --- a/mods/ITEMS/mcl_spyglass/init.lua +++ b/mods/ITEMS/mcl_spyglass/init.lua @@ -6,6 +6,7 @@ minetest.register_tool("mcl_spyglass:spyglass",{ inventory_image = "mcl_spyglass.png", stack_max = 1, _mcl_toollike_wield = true, + touch_interaction = "short_dig_long_place", }) minetest.register_craft({ From cb624fe1d95c642209e2ecefc7bc5bb6106d967f Mon Sep 17 00:00:00 2001 From: grorp Date: Wed, 25 Sep 2024 19:31:27 +0200 Subject: [PATCH 269/273] Creative inventory: Make the whole tab button clickable Previously, only the tab icon was clickable. Clicking next to the icon would just close the inventory. The icon is still kept clickable too since that gives a nicer press animation. I didn't end up using image_button because that resulted in a different image size and position, even with the exact same coordinates. --- mods/HUD/mcl_inventory/creative.lua | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 4ddbd0823..7ae4a1098 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -566,8 +566,10 @@ function mcl_inventory.set_creative_formspec(player) bg_img = "crafting_creative_inactive" .. button_bg_postfix[this_tab] .. ".png" end return table.concat({ - "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]", - "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]", + "style[" .. this_tab .. ";border=false;noclip=true;bgimg=;bgimg_pressed=]", + "style[" .. this_tab .. "_outer;border=false;noclip=true;bgimg=" .. bg_img .. + ";bgimg_pressed=" .. bg_img .. "]", + "button[" .. offset[this_tab] .. ";1.5,1.44;" .. this_tab .. "_outer;]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", }) end @@ -581,8 +583,6 @@ function mcl_inventory.set_creative_formspec(player) "formspec_version[6]", "size[13,8.75]", - "style_type[image;noclip=true]", - -- Hotbar mcl_formspec.get_itemslot_bg_v4(0.375, 7.375, 9, 1), "list[current_player;main;0.375,7.375;9,1;]", @@ -655,54 +655,54 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local name = player:get_player_name() - if fields.blocks then + if fields.blocks or fields.blocks_outer then if players[name].page == "blocks" then return end set_inv_page("blocks", player) page = "blocks" - elseif fields.deco then + elseif fields.deco or fields.deco_outer then if players[name].page == "deco" then return end set_inv_page("deco", player) page = "deco" - elseif fields.redstone then + elseif fields.redstone or fields.redstone_outer then if players[name].page == "redstone" then return end set_inv_page("redstone", player) page = "redstone" - elseif fields.rail then + elseif fields.rail or fields.rail_outer then if players[name].page == "rail" then return end set_inv_page("rail", player) page = "rail" - elseif fields.misc then + elseif fields.misc or fields.misc_outer then if players[name].page == "misc" then return end set_inv_page("misc", player) page = "misc" - elseif fields.nix then + elseif fields.nix or fields.nix_outer then set_inv_page("all", player) page = "nix" - elseif fields.food then + elseif fields.food or fields.food_outer then if players[name].page == "food" then return end set_inv_page("food", player) page = "food" - elseif fields.tools then + elseif fields.tools or fields.tools_outer then if players[name].page == "tools" then return end set_inv_page("tools", player) page = "tools" - elseif fields.combat then + elseif fields.combat or fields.combat_outer then if players[name].page == "combat" then return end set_inv_page("combat", player) page = "combat" - elseif fields.mobs then + elseif fields.mobs or fields.mobs_outer then if players[name].page == "mobs" then return end set_inv_page("mobs", player) page = "mobs" - elseif fields.brew then + elseif fields.brew or fields.brew_outer then if players[name].page == "brew" then return end set_inv_page("brew", player) page = "brew" - elseif fields.matr then + elseif fields.matr or fields.matr_outer then if players[name].page == "matr" then return end set_inv_page("matr", player) page = "matr" - elseif fields.inv then + elseif fields.inv or fields.inv_outer then if players[name].page == "inv" then return end page = "inv" elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then From 02b354f54ac9894237ee987558f9d56098a4a58b Mon Sep 17 00:00:00 2001 From: grorp Date: Wed, 25 Sep 2024 19:53:20 +0200 Subject: [PATCH 270/273] Avoid tab buttons going off-screen with high scaling values --- mods/HUD/mcl_inventory/creative.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 7ae4a1098..0effcc1bc 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -566,8 +566,8 @@ function mcl_inventory.set_creative_formspec(player) bg_img = "crafting_creative_inactive" .. button_bg_postfix[this_tab] .. ".png" end return table.concat({ - "style[" .. this_tab .. ";border=false;noclip=true;bgimg=;bgimg_pressed=]", - "style[" .. this_tab .. "_outer;border=false;noclip=true;bgimg=" .. bg_img .. + "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=]", + "style[" .. this_tab .. "_outer;border=false;bgimg=" .. bg_img .. ";bgimg_pressed=" .. bg_img .. "]", "button[" .. offset[this_tab] .. ";1.5,1.44;" .. this_tab .. "_outer;]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", @@ -581,7 +581,13 @@ function mcl_inventory.set_creative_formspec(player) local formspec = table.concat({ "formspec_version[6]", - "size[13,8.75]", + -- Original formspec height was 8.75, increased to include tab buttons. + -- This avoids tab buttons going off-screen with high scaling values. + "size[13,11.43]", + + "no_prepend[]", mcl_vars.gui_nonbg, mcl_vars.gui_bg_color, + "background9[0,1.34;13,8.75;mcl_base_textures_background9.png;;7]", + "container[0,1.34]", -- Hotbar mcl_formspec.get_itemslot_bg_v4(0.375, 7.375, 9, 1), @@ -638,6 +644,7 @@ function mcl_inventory.set_creative_formspec(player) "set_focus[search;true]", }) end + formspec = formspec .. "container_end[]" if pagenum then formspec = formspec .. "p" .. tostring(pagenum) end player:set_inventory_formspec(formspec) end From 3954acdfb7c86970a03f00d37dff6403e74c4879 Mon Sep 17 00:00:00 2001 From: grorp Date: Wed, 25 Sep 2024 20:56:59 +0200 Subject: [PATCH 271/273] Creative inventory: padding[-0.015,-0.015] on mobile - less wasted screen space - matches old layout --- mods/HUD/mcl_inventory/creative.lua | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 0effcc1bc..ece965156 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -418,6 +418,18 @@ minetest.register_on_joinplayer(function(player) end end) +---@param player mt.PlayerObjectRef +local function is_touch_enabled(playername) + -- Minetest < 5.7.0 support + if not minetest.get_player_window_information then + return false + end + local window = minetest.get_player_window_information(playername) + -- Always return a boolean (not nil) to avoid false-negatives when + -- comparing to a boolean later. + return window and window.touch_controls or false +end + ---@param player mt.PlayerObjectRef function mcl_inventory.set_creative_formspec(player) local playername = player:get_player_name() @@ -579,11 +591,17 @@ function mcl_inventory.set_creative_formspec(player) caption = "label[0.375,0.375;" .. F(C(mcl_formspec.label_color, filtername[name])) .. "]" end + local touch_enabled = is_touch_enabled(playername) + players[playername].last_touch_enabled = touch_enabled + local formspec = table.concat({ "formspec_version[6]", -- Original formspec height was 8.75, increased to include tab buttons. -- This avoids tab buttons going off-screen with high scaling values. "size[13,11.43]", + -- Use as much space as possible on mobile - the tab buttons are a lot + -- of padding already. + touch_enabled and "padding[-0.015,-0.015]" or "", "no_prepend[]", mcl_vars.gui_nonbg, mcl_vars.gui_bg_color, "background9[0,1.34;13,8.75;mcl_base_textures_background9.png;;7]", @@ -825,3 +843,17 @@ minetest.register_on_player_inventory_action(function(player, action, inventory, player:get_inventory():set_stack("main", inventory_info.index, stack) end end) + +-- This is necessary because get_player_window_information may return nil in +-- on_joinplayer. +-- (Also, Minetest plans to add support for toggling touchscreen mode in-game.) +mcl_player.register_globalstep_slow(function(player) + local name = player:get_player_name() + + if minetest.is_creative_enabled(name) then + local touch_enabled = is_touch_enabled(name) + if touch_enabled ~= players[name].last_touch_enabled then + mcl_inventory.set_creative_formspec(player) + end + end +end) From 88c3c4558bf2e5bfcd7aa08863c779ec2dcff63b Mon Sep 17 00:00:00 2001 From: grorp Date: Thu, 17 Oct 2024 14:05:51 +0200 Subject: [PATCH 272/273] Fix for VoxeLibre --- mods/HUD/mcl_inventory/creative.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index ece965156..18b3b4c5e 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -847,13 +847,15 @@ end) -- This is necessary because get_player_window_information may return nil in -- on_joinplayer. -- (Also, Minetest plans to add support for toggling touchscreen mode in-game.) -mcl_player.register_globalstep_slow(function(player) - local name = player:get_player_name() +minetest.register_globalstep(function(dtime) + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() - if minetest.is_creative_enabled(name) then - local touch_enabled = is_touch_enabled(name) - if touch_enabled ~= players[name].last_touch_enabled then - mcl_inventory.set_creative_formspec(player) + if minetest.is_creative_enabled(name) then + local touch_enabled = is_touch_enabled(name) + if touch_enabled ~= players[name].last_touch_enabled then + mcl_inventory.set_creative_formspec(player) + end end end end) From 4dc5d0939c499e5f9e5b29ef14bd1e91f8b0419a Mon Sep 17 00:00:00 2001 From: marro Date: Mon, 11 Nov 2024 03:49:43 +0100 Subject: [PATCH 273/273] Whitespace fix in translation (#4701) Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4701 Reviewed-by: the-real-herowl Co-authored-by: marro Co-committed-by: marro --- mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr index 61df77d59..197151a36 100644 --- a/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_bonemeal.fr.tr @@ -1,6 +1,5 @@ # textdomain: mcl_bone_meal Bone Meal=Farine d'Os Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes. -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.= -Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour. +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.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour. Speeds up plant growth=Accélère la croissance des plantes