mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-01 14:17:29 +01:00
Fireworks are now craftable
This commit is contained in:
parent
e69bd1412e
commit
a65684e875
@ -1,17 +1,28 @@
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "vl_fireworks:rocket 3",
|
||||
recipe = {"mcl_core:paper", "mcl_mobitems:gunpowder"},
|
||||
})
|
||||
local function register_firework_crafts()
|
||||
local recipe = {"mcl_core:paper"}
|
||||
for i=1, 3 do
|
||||
table.insert(recipe, "mcl_mobitems:gunpowder")
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "vl_fireworks:rocket 3",
|
||||
recipe = recipe,
|
||||
})
|
||||
end
|
||||
end
|
||||
register_firework_crafts()
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "vl_fireworks:rocket 3",
|
||||
recipe = {"mcl_core:paper", "mcl_mobitems:gunpowder", "mcl_mobitems:gunpowder"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "vl_fireworks:rocket 3",
|
||||
recipe = {"mcl_core:paper", "mcl_mobitems:gunpowder", "mcl_mobitems:gunpowder", "mcl_mobitems:gunpowder"},
|
||||
})
|
||||
local function craft_firework(itemstack, player, old_grid)
|
||||
if itemstack:get_name() ~= "vl_fireworks:rocket" then return end
|
||||
local gp = 0
|
||||
for _, item in pairs(old_grid) do
|
||||
if item:get_name() == "mcl_mobitems:gunpowder" then gp = gp + 1 end
|
||||
end
|
||||
local tbl = vl_fireworks.firework_def._vl_fireworks_std_durs_forces[gp]
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_float("vl_fireworks:duration", tbl[1])
|
||||
meta:set_int("vl_fireworks:force", tbl[2])
|
||||
tt.reload_itemstack_description(itemstack)
|
||||
return itemstack
|
||||
end
|
||||
core.register_craft_predict(craft_firework)
|
||||
core.register_on_craft(craft_firework)
|
||||
|
@ -136,7 +136,7 @@ function vl_fireworks.shoot_firework(itemstack, pos)
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craftitem("vl_fireworks:rocket", { -- TODO use metadata
|
||||
local firework_def = {
|
||||
description = description,
|
||||
inventory_image = "vl_fireworks_rocket.png",
|
||||
stack_max = 64,
|
||||
@ -162,4 +162,7 @@ minetest.register_craftitem("vl_fireworks:rocket", { -- TODO use metadata
|
||||
_vl_fireworks_tt = function(duration)
|
||||
return S("Duration:") .. " " .. duration
|
||||
end,
|
||||
})
|
||||
}
|
||||
vl_fireworks.firework_def = table.copy(firework_def)
|
||||
|
||||
minetest.register_craftitem("vl_fireworks:rocket", firework_def)
|
||||
|
Loading…
Reference in New Issue
Block a user