Fix crying obsidian particles (#4583)

LUAs `math.random(a,b)` expects a and b to be integers. `size` was only randomized once.

Reviewed-on: VoxeLibre/VoxeLibre#4583
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: kno10 <erich.schubert@gmail.com>
Co-committed-by: kno10 <erich.schubert@gmail.com>
This commit is contained in:
kno10 2024-08-16 22:01:19 +02:00 committed by the-real-herowl
parent df60ec947d
commit 5e6e4967f0
1 changed files with 10 additions and 12 deletions

View File

@ -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)
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)