One firework entity to rule them all

This commit is contained in:
the-real-herowl 2024-12-24 23:05:05 +01:00 committed by the-real-herowl
parent 9ef0738a2e
commit 1a98c9ad2e

View file

@ -105,9 +105,9 @@ local firework_entity = {
end, end,
} }
vl_projectile.register("vl_fireworks:rocket", firework_entity)
local function register_rocket(n, duration, force) local function register_rocket(n, duration, force)
def = table.copy(firework_entity)
vl_projectile.register("vl_fireworks:rocket_" .. n, def) -- TODO one entity
minetest.register_craftitem("vl_fireworks:rocket_" .. n, { -- TODO one item, use metadata minetest.register_craftitem("vl_fireworks:rocket_" .. n, { -- TODO one item, use metadata
description = description, description = description,
_tt_help = tt_help .. " " .. duration, _tt_help = tt_help .. " " .. duration,
@ -127,13 +127,13 @@ local function register_rocket(n, duration, force)
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
-- pos.y = pos.y + 1 -- pos.y = pos.y + 1
vl_projectile.create("vl_fireworks:rocket_" .. n, { vl_projectile.create("vl_fireworks:rocket", {
pos=pos, pos=pos,
velocity=vector.new(0,1,0) velocity=vector.new(0,1,0)
}) })
end, end,
_on_dispense = function(dropitem, pos, droppos, dropnode, dropdir) _on_dispense = function(dropitem, pos, droppos, dropnode, dropdir)
vl_projectile.create("vl_fireworks:rocket_" .. n, { vl_projectile.create("vl_fireworks:rocket", {
pos=pos, pos=pos,
velocity=vector.new(0,1,0) velocity=vector.new(0,1,0)
}) })