Add labels, fix tornado effect.

This commit is contained in:
Aaron Suen 2019-12-30 10:59:13 -05:00
parent fcb4009ce3
commit 791087d7f1

View File

@ -12,13 +12,17 @@ local bdesc = blackdot:gsub("%^", "\\^"):gsub(":", "\\:")
local frame = "[combine:16x16:0,0=" .. bdesc .. ":15,0=" .. bdesc local frame = "[combine:16x16:0,0=" .. bdesc .. ":15,0=" .. bdesc
.. ":0,15=" .. bdesc .. ":15,15=" .. bdesc .. ":0,15=" .. bdesc .. ":15,15=" .. bdesc
local function regdemo(num, func) local function regdemo(num, desc, func)
return minetest.register_node(modname .. ":demo" .. num, { return minetest.register_node(modname .. ":demo" .. num, {
description = desc,
drawtype = "allfaces", drawtype = "allfaces",
tiles = {{name = frame, backface_culling = false}}, tiles = {{name = frame, backface_culling = false}},
groups = {[modname] = 1}, groups = {[modname] = 1},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
on_construct = function(pos)
return minetest.get_meta(pos):set_string("infotext", desc)
end,
on_punch = function(pos) return minetest.remove_node(pos) end, on_punch = function(pos) return minetest.remove_node(pos) end,
on_demo = func on_demo = func
}) })
@ -34,7 +38,7 @@ minetest.register_abm({
end end
}) })
regdemo(1, function(pos) regdemo(1, "ASMD ShockRifle Effect", function(pos)
local endpos = { local endpos = {
x = pos.x + math_random() * 20 - 10, x = pos.x + math_random() * 20 - 10,
y = pos.y + math_random() * 20 - 10, y = pos.y + math_random() * 20 - 10,
@ -59,9 +63,9 @@ regdemo(1, function(pos)
}) })
end) end)
regdemo(2, function(pos) regdemo(2, "Implosion / Teleport Arrive", function(pos)
minetest.add_particlespawner_advanced({ minetest.add_particlespawner_advanced({
amount = 25, amount = 100,
time = 0, time = 0,
pos = { pos = {
x = {pos.x, -10, 20}, x = {pos.x, -10, 20},
@ -84,21 +88,26 @@ regdemo(2, function(pos)
}) })
end) end)
regdemo(3, function(pos) regdemo(3, "Tornado", function(pos)
minetest.add_particlespawner_advanced({ minetest.add_particlespawner_advanced({
amount = 200, amount = 200,
time = 0, time = 2,
pos = { pos = {
x = {pos.x, -10, 20}, x = {pos.x - 10, 0, 20},
y = {pos.y, -10, 0, 20}, y = {pos.y, 0, 0, 10},
z = {pos.z, -10, 0, 0, 20} z = {pos.z - 10, 0, 0, 0, 20}
}, },
velocity = { velocity = {
x = {0, -5, 0, 0, 10}, x = {-5, 0, 0, 0, 10},
y = {0, -5, 0, 10}, y = {0, 0, 0, 10},
z = {0, 5, -10} z = {5, 0, -10}
}, },
expirationtime = {1}, acceleration = {
x = {2.5, 0, -5},
y = {5},
z = {2.5, 0, 0, 0, -5}
},
expirationtime = {2},
texture = blackdot, texture = blackdot,
size = {1, 0, 0, 0, 0, 4} size = {1, 0, 0, 0, 0, 4}
}) })