From da4aa9bc35abd3e4ee28d8678fdad7a2613c6423 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 18 Jul 2022 01:51:21 +0200 Subject: [PATCH] improve crying obsidian visuals --- mods/ITEMS/mcl_core/functions.lua | 67 +++++++++---------------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index c56ae51c3..c9caf9423 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1702,41 +1702,14 @@ end -- Obsidian crying -local crobby_psdef = { - amount = 1, - time = 0.9, --everything longer than 1 is a coord exploit - minvel = vector.new(0,-2,0), - maxvel = vector.new(0,-0.5,0), - minacc = vector.new(0,-10,0), - maxacc = vector.new(0,-8,0), - minexptime = 1, - maxexptime = 6, - minsize = 1.5, - maxsize = 2, - collisiondetection = true, - collision_removal = true, - object_collision = true, - vertical = true, - texture = "mcl_core_crying_obsidian_tear.png", -} -local crobby_psdef2 = { - amount = 1, - time = 0.9, --everything longer than 1 is a coord exploit - minvel = vector.new(0,-0.01,0), - maxvel = vector.new(0,-0.005,0), - minacc = vector.new(0,-0.1,0), - maxacc = vector.new(0,-0.01,0), - minexptime = 2, - maxexptime = 3, - minsize = 0.3, - maxsize = 0.6, - collisiondetection = true, - collision_removal = true, - object_collision = true, - vertical = true, - texture = "mcl_core_crying_obsidian_tear.png", +local crobby_particle = { + velocity = vector.new(0,0,0), + size = math.random(1.3,2.5), + texture = "mcl_core_crying_obsidian_tear.png", + collision_removal = false, } + minetest.register_abm({ label = "Obsidian cries", nodenames = {"mcl_core:crying_obsidian"}, @@ -1744,22 +1717,18 @@ minetest.register_abm({ chance = 10, action = function(pos, node) minetest.after(math.random(0.1,1.5),function() - crobby_psdef.minpos = vector.offset(pos,-0.6,-0.51,-0.6) - crobby_psdef.maxpos = vector.offset(pos,0.6,0.51,0.6) - minetest.add_particlespawner(crobby_psdef) - crobby_psdef2.minpos = vector.offset(pos,-0.51,-0.51,-0.51) - crobby_psdef2.maxpos = vector.offset(pos,-0.5,0.51,-0.5) - minetest.add_particlespawner(crobby_psdef2) - crobby_psdef2.minpos = vector.offset(pos,0.51,-0.51,-0.51) - crobby_psdef2.maxpos = vector.offset(pos,0.5,0.51,-0.5) - minetest.add_particlespawner(crobby_psdef2) - crobby_psdef2.minpos = vector.offset(pos,0.51,-0.51,0.51) - crobby_psdef2.maxpos = vector.offset(pos,0.5,0.51,0.5) - minetest.add_particlespawner(crobby_psdef2) - crobby_psdef2.minpos = vector.offset(pos,-0.51,-0.51,0.51) - crobby_psdef2.maxpos = vector.offset(pos,-0.5,0.51,0.5) - minetest.add_particlespawner(crobby_psdef2) - + 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)) + minetest.add_particle(pt) + minetest.after(pt.expirationtime,function() + pt.acceleration = vector.new(0,-9,0) + pt.collisiondetection = true + pt.expirationtime = math.random(1.2,4.5) + minetest.add_particle(pt) + end) end) end })