From a65db15b5caf92e1e18c07880ea62b8ff5ce61ff Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 29 May 2021 19:21:15 +0000 Subject: [PATCH 01/14] Totem particle textures --- .../textures/mcl_particles_totem1.png | Bin 0 -> 148 bytes .../textures/mcl_particles_totem2.png | Bin 0 -> 154 bytes .../textures/mcl_particles_totem3.png | Bin 0 -> 155 bytes .../textures/mcl_particles_totem4.png | Bin 0 -> 165 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem1.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem2.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem3.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem4.png diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem1.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem1.png new file mode 100644 index 0000000000000000000000000000000000000000..15fe082e104d5d524ab2fa7b9af63c29c196756d GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;#OCqL&81_lO2PZ!4!iOb0e3$znlp8fg% p|G#}q(?mhN<1Rg(K0M9*3=B?(SlHg|7mxs%?&<31vd$@?2>=a_CAk0q literal 0 HcmV?d00001 diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem2.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem2.png new file mode 100644 index 0000000000000000000000000000000000000000..2ab88983d5bc683b0c80841c53d820b10179f03b GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;$n1ED%d@dG_c3 x|Nr(eO%o>yIty-MDrxmO5^>zc)I5-%fnoW79u9Av_rV}bJYD@<);T3K0RWENDmwrG literal 0 HcmV?d00001 diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem4.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem4.png new file mode 100644 index 0000000000000000000000000000000000000000..d6e6502b7fd0c0d1a68c8afdcea112d4693e07db GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;#b(3S&w3=9lLo-U3d5|@(`6qpQ@ivRup z|6gA3;E59*3ppYgcR9Jma7_?35`3(tHc7_sf^SQWy9fh=F1HAmbMc|+AnQC`{an^L HB{Ts5&IT&{ literal 0 HcmV?d00001 From 75e263debca16802eabb977cbae1f1895dd32bc5 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 29 May 2021 19:24:16 +0000 Subject: [PATCH 02/14] Add code for totem partciles --- mods/ITEMS/mcl_totems/init.lua | 48 ++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 499d7362d..e64404c2c 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -4,6 +4,41 @@ minetest.register_on_leaveplayer(function(player) hud_totem[player] = nil end) +-- Totem particle registration +-- TODO: real MC colors, these are randomly selected colors: +local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} +for c, color in pairs(colors) do + local colorizing = ".png^[colorize:"..color + for n = 1, 4 do + minetest.register_entity("mcl_totems:totem_particle"..n.."_color"..c, { + physical = true, + collide_with_objects = false, + collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + pointable = false, + visual = "sprite", + visual_size = {x=0.2, y=0.2}, + textures = {"mcl_particles_totem"..n..colorizing}, + spritediv = {x=1, y=1}, + initial_sprite_basepos = {x=0, y=0}, + static_save = false, + glow = 5, + on_activate = function(self, staticdata) + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + minetest.after(0.3, function() + self.object:set_acceleration({x=0, y=-4, z=0}) + self.object:set_velocity({x=0, y=0, z=0}) + end) + end, + on_step = function(self, dtime) + local r = math.random(1,80) + if r == 1 then + self.object:remove() + end + end + }) + end +end + -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) if obj:is_player() then @@ -32,7 +67,16 @@ mcl_damage.register_modifier(function(obj, damage, reason) -- Effects minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) - -- Big totem overlay + --Particles + for i = 1, 200 do + local particle = "mcl_totems:totem_particle"..math.random(1, 4).."_color"..math.random(1, 5) + minetest.after(math.random(1, 2)*math.random(), function() + local new_pos = obj:get_pos() + minetest.add_entity({x=new_pos.x, y=new_pos.y + 1, z=new_pos.z}, particle) + end) + end + + -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", @@ -55,4 +99,4 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end end -end, 1000) +end, 1000) \ No newline at end of file From ee21a24fb61705bedfee8b2ad935b1e389018a58 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 7 Jun 2021 17:13:50 +0000 Subject: [PATCH 03/14] Don't register a separate entity for every particle --- mods/ITEMS/mcl_totems/init.lua | 60 ++++++++++++++++------------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index e64404c2c..a6429f7b8 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -7,37 +7,34 @@ end) -- Totem particle registration -- TODO: real MC colors, these are randomly selected colors: local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} -for c, color in pairs(colors) do - local colorizing = ".png^[colorize:"..color - for n = 1, 4 do - minetest.register_entity("mcl_totems:totem_particle"..n.."_color"..c, { - physical = true, - collide_with_objects = false, - collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, - pointable = false, - visual = "sprite", - visual_size = {x=0.2, y=0.2}, - textures = {"mcl_particles_totem"..n..colorizing}, - spritediv = {x=1, y=1}, - initial_sprite_basepos = {x=0, y=0}, - static_save = false, - glow = 5, - on_activate = function(self, staticdata) - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) - minetest.after(0.3, function() - self.object:set_acceleration({x=0, y=-4, z=0}) - self.object:set_velocity({x=0, y=0, z=0}) - end) - end, - on_step = function(self, dtime) - local r = math.random(1,80) - if r == 1 then - self.object:remove() - end - end +minetest.register_entity("mcl_totems:totem_particle", { + physical = true, + collide_with_objects = false, + collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + pointable = false, + visual = "sprite", + visual_size = {x=0.2, y=0.2}, + spritediv = {x=1, y=1}, + initial_sprite_basepos = {x=0, y=0}, + static_save = false, + glow = 5, + on_activate = function(self, staticdata) + self.object:set_properties({ + textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} }) + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + minetest.after(0.3, function() + self.object:set_acceleration({x=0, y=-4, z=0}) + self.object:set_velocity({x=0, y=0, z=0}) + end) + end, + on_step = function(self, dtime) + local r = math.random(1,50) + if r == 1 then + self.object:remove() + end end -end +}) -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) @@ -68,11 +65,10 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) --Particles - for i = 1, 200 do - local particle = "mcl_totems:totem_particle"..math.random(1, 4).."_color"..math.random(1, 5) + for i = 1, 150 do minetest.after(math.random(1, 2)*math.random(), function() local new_pos = obj:get_pos() - minetest.add_entity({x=new_pos.x, y=new_pos.y + 1, z=new_pos.z}, particle) + minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") end) end From 99ccd9ea4c77d09a7e4062f16819a3bbdff9fe53 Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 8 Jun 2021 15:13:00 +0000 Subject: [PATCH 04/14] Fix possible crash --- mods/ITEMS/mcl_totems/init.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index a6429f7b8..1847d579b 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -22,8 +22,11 @@ minetest.register_entity("mcl_totems:totem_particle", { self.object:set_properties({ textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} }) - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) - minetest.after(0.3, function() + local t = math.random(1, 2)*math.random() + minetest.after(t, function() + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + end) + minetest.after(0.3 + t, function() self.object:set_acceleration({x=0, y=-4, z=0}) self.object:set_velocity({x=0, y=0, z=0}) end) @@ -65,12 +68,14 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) --Particles - for i = 1, 150 do - minetest.after(math.random(1, 2)*math.random(), function() - local new_pos = obj:get_pos() + + minetest.after(0.1, function() + local new_pos = obj:get_pos() + if not new_pos then return end + for i = 1, 150 do minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") - end) - end + end + end) -- Big totem overlay if not hud_totem[obj] then From ee2fa60cae6f151720c1ac7949218f7fee6d4013 Mon Sep 17 00:00:00 2001 From: NO11 Date: Wed, 9 Jun 2021 14:47:42 +0000 Subject: [PATCH 05/14] local totem particle position --- mods/ITEMS/mcl_totems/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 1847d579b..ecdc20da0 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -72,8 +72,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.after(0.1, function() local new_pos = obj:get_pos() if not new_pos then return end + local particlepos = {x = new_pos.x, y = new_pos.y + 1, z = new_pos.z} for i = 1, 150 do - minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") + minetest.add_entity(particlepos, "mcl_totems:totem_particle") end end) From 509568b4b01e7529af9c8ad1e00980eba7bbd648 Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 8 Jul 2021 16:49:19 +0000 Subject: [PATCH 06/14] Use real Minecraft colors for totem particles! --- mods/ITEMS/mcl_totems/init.lua | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index ecdc20da0..2311e88d7 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -5,8 +5,32 @@ minetest.register_on_leaveplayer(function(player) end) -- Totem particle registration --- TODO: real MC colors, these are randomly selected colors: -local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} +function rgb_to_hex(rgb) + local hexadecimal = "#" + + for key, value in pairs(rgb) do + local hex = "" + + while value > 0 do + local index = math.fmod(value, 16) + 1 + value = math.floor(value / 16) + hex = string.sub("0123456789ABCDEF", index, index) .. hex + end + + local len = string.len(hex) + + if len == 0 then + hex = "00" + elseif len == 1 then + hex = "0" .. hex + end + + hexadecimal = hexadecimal .. hex + end + + return hexadecimal +end + minetest.register_entity("mcl_totems:totem_particle", { physical = true, collide_with_objects = false, @@ -17,10 +41,16 @@ minetest.register_entity("mcl_totems:totem_particle", { spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, static_save = false, - glow = 5, + glow = 14, on_activate = function(self, staticdata) + local color + if math.random(0, 3) == 0 then + color = rgb_to_hex({ (0.6 + math.random() * 0.2) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + else + color = rgb_to_hex({ (0.1 + math.random() * 0.4) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + end self.object:set_properties({ - textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} + textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..color } }) local t = math.random(1, 2)*math.random() minetest.after(t, function() From 5ceb48fcb13ae20a4295cc7c0d4cbcfa30c26a8c Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 12 Jul 2021 18:05:52 +0000 Subject: [PATCH 07/14] Faster rgb to hex --- mods/ITEMS/mcl_totems/init.lua | 61 +++++++++++----------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 2311e88d7..5f9b254a3 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -5,64 +5,43 @@ minetest.register_on_leaveplayer(function(player) end) -- Totem particle registration -function rgb_to_hex(rgb) - local hexadecimal = "#" - for key, value in pairs(rgb) do - local hex = "" - - while value > 0 do - local index = math.fmod(value, 16) + 1 - value = math.floor(value / 16) - hex = string.sub("0123456789ABCDEF", index, index) .. hex - end - - local len = string.len(hex) - - if len == 0 then - hex = "00" - elseif len == 1 then - hex = "0" .. hex - end - - hexadecimal = hexadecimal .. hex - end - - return hexadecimal +function rgb_to_hex(r, g, b) + return string.format("%02x%02x%02x", r, g, b) end minetest.register_entity("mcl_totems:totem_particle", { physical = true, collide_with_objects = false, - collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + collisionbox = { -0.02, -0.02, -0.02, 0.02, 0.02, 0.02 }, pointable = false, visual = "sprite", - visual_size = {x=0.2, y=0.2}, - spritediv = {x=1, y=1}, - initial_sprite_basepos = {x=0, y=0}, + visual_size = { x = 0.2, y = 0.2 }, + spritediv = { x = 1, y = 1 }, + initial_sprite_basepos = { x = 0, y = 0 }, static_save = false, glow = 14, on_activate = function(self, staticdata) local color if math.random(0, 3) == 0 then - color = rgb_to_hex({ (0.6 + math.random() * 0.2) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + color = rgb_to_hex( 153 + math.random() * 51, 153 + math.random() * 76.5, math.random() * 51) else - color = rgb_to_hex({ (0.1 + math.random() * 0.4) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + color = rgb_to_hex(25.5 + math.random() * 102, 153 + math.random() * 76.5, math.random() * 51) end self.object:set_properties({ - textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..color } + textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:#"..color } }) local t = math.random(1, 2)*math.random() minetest.after(t, function() - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + self.object:set_velocity({ x = math.random(-4, 4) * math.random(), y = math.random(-1, 4) * math.random(), z = math.random(-4, 4) * math.random() }) end) minetest.after(0.3 + t, function() - self.object:set_acceleration({x=0, y=-4, z=0}) - self.object:set_velocity({x=0, y=0, z=0}) + self.object:set_acceleration({ x = 0, y = -4, z = 0 }) + self.object:set_velocity({ x = 0, y = 0, z = 0 }) end) end, on_step = function(self, dtime) - local r = math.random(1,50) + local r = math.random(1, 50) if r == 1 then self.object:remove() end @@ -79,7 +58,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) local ppos = obj:get_pos() local pnname = minetest.get_node(ppos).name -- Some exceptions when _not_ to save the player - for n=1, #mobs_mc.misc.totem_fail_nodes do + for n = 1, #mobs_mc.misc.totem_fail_nodes do if pnname == mobs_mc.misc.totem_fail_nodes[n] then return end @@ -95,14 +74,14 @@ mcl_damage.register_modifier(function(obj, damage, reason) end -- Effects - minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) + minetest.sound_play({ name = "mcl_totems_totem", gain = 1 }, { pos = ppos, max_hear_distance = 16 }, true) --Particles minetest.after(0.1, function() local new_pos = obj:get_pos() if not new_pos then return end - local particlepos = {x = new_pos.x, y = new_pos.y + 1, z = new_pos.z} + local particlepos = { x = new_pos.x, y = new_pos.y + 1, z = new_pos.z } for i = 1, 150 do minetest.add_entity(particlepos, "mcl_totems:totem_particle") end @@ -113,9 +92,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", text = "mcl_totems_totem.png", - position = { x=0.5, y=1 }, - scale = { x=17, y=17 }, - offset = { x=0, y=-178 }, + position = { x = 0.5, y = 1 }, + scale = { x = 17, y = 17 }, + offset = { x = 0, y = -178 }, z_index = 100, }) minetest.after(3, function() @@ -131,4 +110,4 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end end -end, 1000) \ No newline at end of file +end, 1000) From 2b322a451f9ecd71918c9eeb6f40a386d031bfea Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 26 Aug 2021 10:17:15 +0000 Subject: [PATCH 08/14] remove space --- mods/ITEMS/mcl_totems/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 5f9b254a3..2206fcb2a 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -87,7 +87,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end) - -- Big totem overlay + -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", From dafe860e56ac7ce866affe414fe7eef20b5fd3db Mon Sep 17 00:00:00 2001 From: NO11 Date: Sun, 24 Oct 2021 19:31:51 +0000 Subject: [PATCH 09/14] simple totem particles --- mods/ITEMS/mcl_totems/init.lua | 77 +++++++++------------------------- 1 file changed, 20 insertions(+), 57 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 2206fcb2a..79b2c8de0 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -4,49 +4,7 @@ minetest.register_on_leaveplayer(function(player) hud_totem[player] = nil end) --- Totem particle registration - -function rgb_to_hex(r, g, b) - return string.format("%02x%02x%02x", r, g, b) -end - -minetest.register_entity("mcl_totems:totem_particle", { - physical = true, - collide_with_objects = false, - collisionbox = { -0.02, -0.02, -0.02, 0.02, 0.02, 0.02 }, - pointable = false, - visual = "sprite", - visual_size = { x = 0.2, y = 0.2 }, - spritediv = { x = 1, y = 1 }, - initial_sprite_basepos = { x = 0, y = 0 }, - static_save = false, - glow = 14, - on_activate = function(self, staticdata) - local color - if math.random(0, 3) == 0 then - color = rgb_to_hex( 153 + math.random() * 51, 153 + math.random() * 76.5, math.random() * 51) - else - color = rgb_to_hex(25.5 + math.random() * 102, 153 + math.random() * 76.5, math.random() * 51) - end - self.object:set_properties({ - textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:#"..color } - }) - local t = math.random(1, 2)*math.random() - minetest.after(t, function() - self.object:set_velocity({ x = math.random(-4, 4) * math.random(), y = math.random(-1, 4) * math.random(), z = math.random(-4, 4) * math.random() }) - end) - minetest.after(0.3 + t, function() - self.object:set_acceleration({ x = 0, y = -4, z = 0 }) - self.object:set_velocity({ x = 0, y = 0, z = 0 }) - end) - end, - on_step = function(self, dtime) - local r = math.random(1, 50) - if r == 1 then - self.object:remove() - end - end -}) +local particle_colors = {"98BF22", "C49E09", "337D0B", "B0B021", "1E9200"} -- TODO: real MC colors -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) @@ -74,27 +32,32 @@ mcl_damage.register_modifier(function(obj, damage, reason) end -- Effects - minetest.sound_play({ name = "mcl_totems_totem", gain = 1 }, { pos = ppos, max_hear_distance = 16 }, true) - - --Particles + minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true) - minetest.after(0.1, function() - local new_pos = obj:get_pos() - if not new_pos then return end - local particlepos = { x = new_pos.x, y = new_pos.y + 1, z = new_pos.z } - for i = 1, 150 do - minetest.add_entity(particlepos, "mcl_totems:totem_particle") - end - end) + for i = 1, 100 do + minetest.add_particle({ + pos = vector.offset(ppos, 0, math.random(-10, 10) / 10, 0), + velocity = vector.new(math.random(-15, 15) / 10, math.random(0, 15) / 10, math.random(-15, 15) / 10), + acceleration = vector.new(0, -math.random(1, 10) / 10, 0), + expirationtime = math.random(1, 3), + size = math.random(1, 2), + collisiondetection = true, + collision_removal = true, + object_collision = false, + texture = "mcl_particles_totem" .. math.random(1, 4) .. ".png^[colorize:#" .. particle_colors[math.random(#particle_colors)], + glow = 10, + }) + + end -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", text = "mcl_totems_totem.png", - position = { x = 0.5, y = 1 }, - scale = { x = 17, y = 17 }, - offset = { x = 0, y = -178 }, + position = {x = 0.5, y = 1}, + scale = {x = 17, y = 17}, + offset = {x = 0, y = -178}, z_index = 100, }) minetest.after(3, function() From 74890101520d4b04578dbc333aab38ea6cdf6eca Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 25 Oct 2021 17:08:38 +0000 Subject: [PATCH 10/14] Use particlespawners instead of single particles --- mods/ITEMS/mcl_totems/init.lua | 37 +++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 79b2c8de0..aa188855f 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -34,20 +34,29 @@ mcl_damage.register_modifier(function(obj, damage, reason) -- Effects minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true) - for i = 1, 100 do - minetest.add_particle({ - pos = vector.offset(ppos, 0, math.random(-10, 10) / 10, 0), - velocity = vector.new(math.random(-15, 15) / 10, math.random(0, 15) / 10, math.random(-15, 15) / 10), - acceleration = vector.new(0, -math.random(1, 10) / 10, 0), - expirationtime = math.random(1, 3), - size = math.random(1, 2), - collisiondetection = true, - collision_removal = true, - object_collision = false, - texture = "mcl_particles_totem" .. math.random(1, 4) .. ".png^[colorize:#" .. particle_colors[math.random(#particle_colors)], - glow = 10, - }) - + for i = 1, 4 do + for c = 1, #particle_colors do + minetest.add_particlespawner({ + amount = math.round(100/(4 * #particle_colors)), + time = 1, + minpos = vector.offset(ppos, 0, -1, 0), + maxpos = vector.offset(ppos, 0, 1, 0), + minvel = vector.new(-1.5, 0, -1.5), + maxvel = vector.new(1.5, 1.5, 1.5), + minacc = vector.new(0, -0.1, 0), + maxacc = vector.new(0, -1, 0), + minexptime = 1, + maxexptime = 3, + minsize = 1, + maxsize = 2, + collisiondetection = true, + collision_removal = true, + object_collision = false, + vertical = false, + texture = "mcl_particles_totem" .. i .. ".png^[colorize:#" .. particle_colors[c], + glow = 10, + }) + end end -- Big totem overlay From eccba76732bff067bf677bee46acfc51e1298234 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 25 Oct 2021 20:25:34 +0000 Subject: [PATCH 11/14] Use math.floor instead of math.round --- mods/ITEMS/mcl_totems/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index aa188855f..b11e68df7 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -37,7 +37,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) for i = 1, 4 do for c = 1, #particle_colors do minetest.add_particlespawner({ - amount = math.round(100/(4 * #particle_colors)), + amount = math.floor(100 / (4 * #particle_colors)), time = 1, minpos = vector.offset(ppos, 0, -1, 0), maxpos = vector.offset(ppos, 0, 1, 0), From 30f7c638f377f7a2387974736ccd6ac171e5b0a6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 22:55:48 +0200 Subject: [PATCH 12/14] mcl_enchanting: Add spanish translations and update template Credit to: todoporlalibertad Reviewed by j45 --- .../locale/mcl_enchanting.es.tr | 123 +++++++++++ mods/ITEMS/mcl_enchanting/locale/template.txt | 205 ++++++++++-------- 2 files changed, 240 insertions(+), 88 deletions(-) create mode 100644 mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr new file mode 100644 index 000000000..a977e8fe6 --- /dev/null +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr @@ -0,0 +1,123 @@ +# textdomain: mcl_enchanting + + +### enchantments.lua ### + +Arrows passes through multiple objects.=Las flechas atraviesan multiples enemigos. +Arrows set target on fire.=Las flechas prenderan los enemigos. +Bane of Arthropods=Perdición de los Artrópodos +Channeling=Conductividad + +Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.=Canaliza los rayos de una tormenta hacia el enemigo. + +Curse of Vanishing=Maldición de Desaparición +Decreases crossbow charging time.=Disminuye el tiempo de carga de las ballestas. +Decreases time until rod catches something.=Disminuye el tiempo que tardan en picar los cebos en la pesca. +Depth Strider=Agilidad acuática +Efficiency=Eficiencia +Extends underwater breathing time.=Aumenta el tiempo de mantener la respiración. +Fire Aspect=Aspecto Ígneo +Flame=Fuego +Fortune=Fortuna +Frost Walker=Paso Helado +Impaling=Empalamiento +Increases arrow damage.=Incrementa el daño de las flechas. +Increases arrow knockback.=Incrementa el empuje de las flechas. +Increases certain block drops.=Incrementa la cantidad de objetos que sueltan los bloques. + +Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).=Incrementa el daño y ralentiza a los artrópodos. (arañas, lepismas, endermitas, etc) + +Increases damage to undead mobs.=Incrementa el daño contra no-muertos. +Increases damage.=Incrementa el daño. +Increases item durability.=Incrementa la durabilidad de una herramienta. +Increases knockback.=Incrementa el empuje. +Increases mining speed.=Incrementa la velocidad de picado. +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. +Infinity=Infinidad +Item destroyed on death.=El objeto se destruye tras tu muerte. +Knockback=Empuje +Looting=Botín +Loyalty=Lealtad +Luck of the Sea=Suerte Marina +Lure=Atracción +Mending=Reparación +Mined blocks drop themselves.=Los bloques se minarán enteros. +Multishot=Multidisparo +Piercing=Perforación +Power=Poder +Punch=Retroceso +Quick Charge=Carga Rápida +Repair the item while gaining XP orbs.=Repara los objetos portados al recibir orbes de experiencia. +Respiration=Respiración +Riptide=Propulsión acuática +Sets target on fire.=Incencia al enemigo. +Sharpness=Filo +Shoot 3 arrows at the cost of one.=Dispara 3 flechas al precio de una. +Shooting consumes no regular arrows.=No se consumiran las flechas lanzadas. +Silk Touch=Toque de Seda +Smite=Golpeo +Soul Speed=Velocidad de Almas +Sweeping Edge=Filo Arrasador +Trident deals additional damage to ocean mobs.=Incrementa el daño del tridente sobre criaturas acuáticas. + +Trident launches player with itself when thrown. Works only in water or rain.=El tridente impulsa al portador dentro del agua o bajo la lluvia. + +Trident returns after being thrown. Higher levels reduce return time.=El tridente regresa al portador tras lanzarlo. + +Turns water beneath the player into frosted ice and prevents the damage from magma blocks.=Congela el agua bajo tus pies y evita el daño de los bloques de magma. + +Unbreaking=Irrompibilidad + +### engine.lua ### + +@1 Enchantment Levels=Nivel de encantamiento: @1 +@1 Lapis Lazuli=@1 Lapis Lázuli +Inventory=Inventario +Level requirement: @1=Nivel requerido: @1 + +### init.lua ### + +'@1' is not a valid number='@1' no es un número válido +'@1' is not a valid number.='@1' no es un número válido + []= [] +@1 can't be combined with @2.=@1 no se puede combinar con @2 + +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.=Despues elige tu encantamiento, los niveles de experiencia y el lapis lázuli seran consumidos y el encantamiento aplicado al objeto. + +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.=Coloca el objeto en su ranura yse mostraran los encantamientos a elegir. + +Enchant=Encantamiento +Enchant an item=Encantar objeto +Enchanted Book=Libro Encantado +Enchanting Table=Mesa de Encantamientos + +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.=La mesa de Encantamientos dara a tus herramientas, armas o armadura algunas habilidades magicas. Pero a coste de algo de experiencia y lapis lázuli. + +Enchanting succeded.=Encantado correctamente. +Forcefully enchant an item=Encantar objeto a la fuerza. + +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.=Coloca una herramienta, arma, armadura o libro sobre la ranura izquierda, coloca de 1 a 3 Lapis lázulis en la ranura derecha. + +Player '@1' cannot be found.=Jugador @1 no encontrado. +Rightclick the Enchanting Table to open the enchanting menu.=Clic derecho sobre la mesa de encantamientos para abrir la interfaz. +Spend experience, and lapis to enchant various items.=Experiencia y Lapis para encantar varios objetos. + +The number you have entered (@1) is too big, it must be at most @2.=@1 es muy grande, debe ser menor que @2 + +The number you have entered (@1) is too small, it must be at least @2.=@1 es muy pequeño, debe ser mayor a @2 + +The selected enchantment can't be added to the target item.=El encantamiento seleccionado no puede añadirse a ese objeto. +The target doesn't hold an item.=El jugador no sujeta un objeto. +The target item is not enchantable.=El objeto del jugador no se puede encantar. +There is no such enchantment '@1'.=@1 no es un encantamiento. + +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.=Las opciones seran aleatorias dependiendo del nivel de experiencia, los niveles de encantamiento pueden ser aumentados. + +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.=Para aumentar los niveles de encantamientos, coloca librerias alrededor y cerca de la mesa de encantamientos. + +Usage: /enchant []=Usa: /enchant [] +Usage: /forceenchant []=Usa /forceenchant [] diff --git a/mods/ITEMS/mcl_enchanting/locale/template.txt b/mods/ITEMS/mcl_enchanting/locale/template.txt index 08fa82097..1f540d6d3 100644 --- a/mods/ITEMS/mcl_enchanting/locale/template.txt +++ b/mods/ITEMS/mcl_enchanting/locale/template.txt @@ -1,100 +1,129 @@ # textdomain: mcl_enchanting -Aqua Affinity= -Increases underwater mining speed.= -Bane of Arthropods= -Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).= -Blast Protection= -Reduces explosion damage and knockback.= -Channeling= -Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.= -Curse of Binding= -Item cannot be removed from armor slots except due to death, breaking or in Creative Mode.= -Curse of Vanishing= -Item destroyed on death.= -Depth Strider= -Increases underwater movement speed.= -Efficiency= -Increases mining speed.= -Feather Falling= -Reduces fall damage.= -Fire Aspect= -Sets target on fire.= -Fire Protection= -Reduces fire damage.= -Flame= -Arrows set target on fire.= -Fortune= -Increases certain block drops.= -Frost Walker= -Turns water beneath the player into frosted ice and prevents the damage from magma blocks.= -Impaling= -Trident deals additional damage to ocean mobs.= -Infinity= -Shooting consumes no regular arrows.= -Knockback= -Increases knockback.= -Looting= -Increases mob loot.= -Loyalty= -Trident returns after being thrown. Higher levels reduce return time.= -Luck of the Sea= -Increases rate of good loot (enchanting books, etc.)= -Lure= -Decreases time until rod catches something.= -Mending= -Repair the item while gaining XP orbs.= -Multishot= -Shoot 3 arrows at the cost of one.= -Piercing= + + +### enchantments.lua ### + Arrows passes through multiple objects.= -Power= -Increases arrow damage.= -Projectile Protection= -Reduces projectile damage.= -Protection= -Reduces most types of damage by 4% for each level.= -Punch= -Increases arrow knockback.= -Quick Charge= +Arrows set target on fire.= +Bane of Arthropods= +Channeling= + +Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.= + +Curse of Vanishing= Decreases crossbow charging time.= -Respiration= +Decreases time until rod catches something.= +Depth Strider= +Efficiency= Extends underwater breathing time.= -Riptide= -Trident launches player with itself when thrown. Works only in water or rain.= -Sharpness= -Increases damage.= -Silk Touch= -Mined blocks drop themselves.= -Smite= +Fire Aspect= +Flame= +Fortune= +Frost Walker= +Impaling= +Increases arrow damage.= +Increases arrow knockback.= +Increases certain block drops.= + +Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).= + Increases damage to undead mobs.= -Soul Speed= -Increases walking speed on soul sand.= -Sweeping Edge= -Increases sweeping attack damage.= -Thorns= -Reflects some of the damage taken when hit, at the cost of reducing durability with each proc.= -Unbreaking= +Increases damage.= Increases item durability.= -Inventory= -@1 Lapis Lazuli= +Increases knockback.= +Increases mining speed.= +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.= +Infinity= +Item destroyed on death.= +Knockback= +Looting= +Loyalty= +Luck of the Sea= +Lure= +Mending= +Mined blocks drop themselves.= +Multishot= +Piercing= +Power= +Punch= +Quick Charge= +Repair the item while gaining XP orbs.= +Respiration= +Riptide= +Sets target on fire.= +Sharpness= +Shoot 3 arrows at the cost of one.= +Shooting consumes no regular arrows.= +Silk Touch= +Smite= +Soul Speed= +Sweeping Edge= +Trident deals additional damage to ocean mobs.= + +Trident launches player with itself when thrown. Works only in water or rain.= + +Trident returns after being thrown. Higher levels reduce return time.= + +Turns water beneath the player into frosted ice and prevents the damage from magma blocks.= + +Unbreaking= + +### engine.lua ### + @1 Enchantment Levels= +@1 Lapis Lazuli= +Inventory= Level requirement: @1= -Enchant an item= - []= -Usage: /enchant []= -Player '@1' cannot be found.= -There is no such enchantment '@1'.= -The target doesn't hold an item.= -The selected enchantment can't be added to the target item.= + +### init.lua ### + '@1' is not a valid number= -The number you have entered (@1) is too big, it must be at most @2.= -The number you have entered (@1) is too small, it must be at least @2.= -@1 can't be combined with @2.= -Enchanting succeded.= -Forcefully enchant an item= -Usage: /forceenchant []= -The target item is not enchantable.= '@1' is not a valid number.= + []= +@1 can't be combined with @2.= + +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.= + +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.= + +Enchant= +Enchant an item= Enchanted Book= Enchanting Table= -Enchant= + +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.= + +Enchanting succeded.= +Forcefully enchant an item= + +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.= + +Player '@1' cannot be found.= +Rightclick the Enchanting Table to open the enchanting menu.= +Spend experience, and lapis to enchant various items.= + +The number you have entered (@1) is too big, it must be at most @2.= + +The number you have entered (@1) is too small, it must be at least @2.= + +The selected enchantment can't be added to the target item.= +The target doesn't hold an item.= +The target item is not enchantable.= +There is no such enchantment '@1'.= + +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.= + +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.= + +Usage: /enchant []= +Usage: /forceenchant []= + + +##### not used anymore ##### + +# textdomain: mcl_enchanting +Aqua Affinity= From 0369465630508956cb75d1c2c055e71a67b74b73 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 22:59:21 +0200 Subject: [PATCH 13/14] Add todoporlalibertad to translation credits --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index 296e7c23b..de3dcae61 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -110,6 +110,7 @@ * wuniversales * kay27 * pitchum +* todoporlalibertad ## Special thanks * celeron55 for creating Minetest From 19689dd857c047fb857489ed4385b4c5440400c6 Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 26 Oct 2021 16:50:10 +0000 Subject: [PATCH 14/14] Use enchanted golden apple for thing banner --- mods/ITEMS/mcl_banners/patterncraft.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index 79778a665..767235b1e 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -119,8 +119,7 @@ local patterns = { name = N("@1 Thing Charge"), type = "shapeless", - -- TODO: Replace with enchanted golden apple - { e, "mcl_core:apple_gold", d }, + { e, "mcl_core:apple_gold_enchanted", d }, }, ["rhombus"] = { name = N("@1 Lozenge"),