forked from VoxeLibre/VoxeLibre
Added in Bamboo_Plank variable.
Dinked with the random number generator some. Moved Bamboo Mosaic from base to items. condensed some of the code duplication (WIP). started to add in checks to prevent bamboo from being placed against itself horizontally. Fixed a couple of naming issues.
This commit is contained in:
parent
388632cd46
commit
5ef7d9f7a0
|
@ -139,37 +139,33 @@ local bamboo_def = {
|
|||
if DEBUG then
|
||||
minetest.log("mcl_bamboo::placing bamboo directly.")
|
||||
end
|
||||
|
||||
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
|
||||
local wdir = minetest.dir_to_wallmounted(dir)
|
||||
local fdir = minetest.dir_to_facedir(dir)
|
||||
if wdir ~= 1 then
|
||||
return
|
||||
end
|
||||
local place_item = ItemStack(itemstack) -- make a copy so that we don't indirectly mess with the original.
|
||||
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
if nodename == bamboo then
|
||||
-- return the missing item, so that we can lower the code
|
||||
-- complexity and duplication.
|
||||
itemstack:set_count(itemstack:get_count() + 1)
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
elseif nodename == bamboo_one then
|
||||
place_item:set_name(bamboo_one)
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo placeitem definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
return itemstack, pointed_thing.under
|
||||
elseif nodename == bamboo_two then
|
||||
place_item:set_name(bamboo_two)
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo placeitem definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
return itemstack, pointed_thing.under
|
||||
elseif nodename == bamboo_three then
|
||||
place_item:set_name(bamboo_three)
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo placeitem definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
return itemstack, pointed_thing.under
|
||||
else
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
local placed_type = pr:next(0, 3) -- randomly choose which one to place.
|
||||
if DEBUG then
|
||||
minetest.log("MCL_BAMBOO::Place_Bamboo_Shoot--Type: " .. placed_type)
|
||||
|
@ -182,21 +178,21 @@ local bamboo_def = {
|
|||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
return itemstack, pointed_thing.under
|
||||
elseif placed_type == 1 then
|
||||
place_item=ItemStack(bamboo .. "_1")
|
||||
place_item=ItemStack(bamboo_one)
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo place_item definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
return itemstack, pointed_thing.under
|
||||
elseif placed_type == 2 then
|
||||
place_item=ItemStack(bamboo .. "_2")
|
||||
place_item=ItemStack(bamboo_two)
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo place_item definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
minetest.item_place(place_item, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
||||
return itemstack, pointed_thing.under
|
||||
elseif placed_type == 3 then
|
||||
place_item=ItemStack(bamboo .. "_3")
|
||||
place_item=ItemStack(bamboo_three)
|
||||
if DEBUG then
|
||||
minetest.log("Bamboo place_item definition (current):\n" .. dump(place_item:to_table()))
|
||||
end
|
||||
|
@ -240,7 +236,7 @@ minetest.register_node(bamboo, bamboo_def)
|
|||
|
||||
local bamboo_top = table.copy(bamboo_def)
|
||||
bamboo_top.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
|
||||
bamboo_top.tiles = {"mcl_bamboo_endcap.png"}
|
||||
bamboo_top.tiles = {"mcl_bamboo_flower_pot.png"}
|
||||
bamboo_top.drawtype = "plantlike"
|
||||
bamboo_top.paramtype2 = "meshoptions"
|
||||
bamboo_top.param2 = 34
|
||||
|
@ -374,12 +370,3 @@ bamboo_three_def.selection_box = {
|
|||
}
|
||||
}
|
||||
minetest.register_node(bamboo_three, bamboo_three_def)
|
||||
|
||||
-- Bamboo Mosaic
|
||||
local bamboo_mosaic = minetest.registered_nodes[bamboo .. "_plank"]
|
||||
bamboo_mosaic.tiles = {"mcl_bamboo_bamboo_plank.png"}
|
||||
bamboo_mosaic.groups = {handy = 1, axey = 1, flammable = 3, fire_encouragement = 5, fire_flammability = 20}
|
||||
bamboo_mosaic.description = S("Bamboo Mosaic Plank")
|
||||
bamboo_mosaic._doc_items_longdesc = S("Bamboo Mosaic Plank")
|
||||
minetest.register_node("mcl_bamboo:bamboo_mosaic", bamboo_mosaic)
|
||||
|
||||
|
|
|
@ -22,6 +22,17 @@ local DEBUG = false
|
|||
|
||||
local node_sound = mcl_sounds.node_sound_wood_defaults()
|
||||
|
||||
|
||||
-- Bamboo Mosaic
|
||||
local bamboo_mosaic = table.copy(minetest.registered_nodes[bamboo .. "_plank"])
|
||||
bamboo_mosaic.tiles = {"mcl_bamboo_bamboo_plank.png"}
|
||||
bamboo_mosaic.groups = {handy = 1, axey = 1, flammable = 3, fire_encouragement = 5, fire_flammability = 20}
|
||||
bamboo_mosaic.description = S("Bamboo Mosaic Plank")
|
||||
bamboo_mosaic._doc_items_longdesc = S("Bamboo Mosaic Plank")
|
||||
minetest.register_node("mcl_bamboo:bamboo_mosaic", bamboo_mosaic)
|
||||
|
||||
|
||||
|
||||
-- specific bamboo nodes (Items)... Pt. 1
|
||||
if minetest.get_modpath("mcl_flowerpots") then
|
||||
if DEBUG then
|
||||
|
|
|
@ -12,6 +12,7 @@ local DEBUG = false
|
|||
local strlen = string.len
|
||||
local substr = string.sub
|
||||
local rand = math.random
|
||||
math.randomseed((os.time() + 31) * 31415) -- try to make a valid seed
|
||||
|
||||
--Bamboo can be planted on moss blocks, grass blocks, dirt, coarse dirt, rooted dirt, gravel, mycelium, podzol, sand, red sand, or mud
|
||||
mcl_bamboo.bamboo_dirt_nodes = {
|
||||
|
@ -113,18 +114,18 @@ function mcl_bamboo.grow_bamboo(pos, _)
|
|||
end
|
||||
|
||||
-- Add Groups function, courtesy of Warr1024.
|
||||
function mcl_bamboo.addgroups(name, ...)
|
||||
function mcl_bamboo.add_groups(name, ...)
|
||||
local def = minetest.registered_items[name] or error(name .. " not found")
|
||||
local groups = {}
|
||||
for k, v in pairs(def.groups) do
|
||||
groups[k] = v
|
||||
end
|
||||
local function addall(x, ...)
|
||||
local function add_all(x, ...)
|
||||
if not x then
|
||||
return
|
||||
end
|
||||
groups[x] = 1
|
||||
return addall(...)
|
||||
return add_all(...)
|
||||
end
|
||||
addall(...)
|
||||
return minetest.override_item(name, {groups = groups})
|
||||
|
|
|
@ -5,111 +5,111 @@
|
|||
--- These are all of the fuel recipes and all of the crafting recipes, consolidated into one place.
|
||||
|
||||
local bamboo = "mcl_bamboo:bamboo"
|
||||
|
||||
-- Craftings
|
||||
-- Basic Bamboo craftings
|
||||
minetest.register_craft({
|
||||
local bamboo_plank = bamboo .. "_plank"
|
||||
-- Craftings
|
||||
-- Basic Bamboo craftings
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:stick",
|
||||
recipe = {
|
||||
{bamboo},
|
||||
{bamboo},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_block",
|
||||
recipe = {
|
||||
{bamboo, bamboo, bamboo},
|
||||
{bamboo, bamboo, bamboo},
|
||||
{bamboo, bamboo, bamboo},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_plank 2",
|
||||
minetest.register_craft({
|
||||
output = bamboo_plank .. " 2",
|
||||
recipe = {
|
||||
{bamboo .. "_block"},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_plank 2",
|
||||
minetest.register_craft({
|
||||
output = bamboo_plank .. " 2",
|
||||
recipe = {
|
||||
{bamboo .. "_block_stripped"},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_mosaic",
|
||||
recipe = {
|
||||
{"mcl_stair:slab_bamboo_plank"},
|
||||
{"mcl_stair:slab_bamboo_plank"},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Bamboo specific items
|
||||
-- Bamboo specific items
|
||||
|
||||
if minetest.get_modpath("mcl_doors") then
|
||||
if minetest.get_modpath("mcl_doors") then
|
||||
if mcl_doors then
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_door 3",
|
||||
recipe = {
|
||||
{bamboo .. "_plank", bamboo .. "_plank"},
|
||||
{bamboo .. "_plank", bamboo .. "_plank"},
|
||||
{bamboo .. "_plank", bamboo .. "_plank"}
|
||||
{bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_trapdoor 2",
|
||||
recipe = {
|
||||
{bamboo .. "_plank", bamboo .. "_plank", bamboo .. "_plank"},
|
||||
{bamboo .. "_plank", bamboo .. "_plank", bamboo .. "_plank"},
|
||||
{bamboo_plank, bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank, bamboo_plank},
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:scaffolding 6",
|
||||
recipe = {{bamboo, "mcl_mobitems:string", bamboo},
|
||||
{bamboo, "", bamboo},
|
||||
{bamboo, "", bamboo}}
|
||||
})
|
||||
})
|
||||
|
||||
-- Fuels
|
||||
-- Basic Bamboo nodes
|
||||
minetest.register_craft({
|
||||
-- Fuels
|
||||
-- Basic Bamboo nodes
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo,
|
||||
burntime = 2.5, -- supposed to be 1/2 that of a stick, per minecraft wiki as of JE 1.19.3
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_block",
|
||||
burntime = 15,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_block_stripped",
|
||||
burntime = 15,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_plank",
|
||||
recipe = bamboo_plank,
|
||||
burntime = 7.5,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_mosaic",
|
||||
burntime = 7.5,
|
||||
})
|
||||
})
|
||||
|
||||
-- Bamboo Items
|
||||
if minetest.get_modpath("mcl_doors") then
|
||||
-- Bamboo Items
|
||||
if minetest.get_modpath("mcl_doors") then
|
||||
if mcl_doors then
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
|
@ -123,9 +123,9 @@ local bamboo = "mcl_bamboo:bamboo"
|
|||
burntime = 15,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_modpath("mcl_stairs") then
|
||||
if minetest.get_modpath("mcl_stairs") then
|
||||
if mcl_stairs ~= nil then
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
|
@ -168,16 +168,16 @@ local bamboo = "mcl_bamboo:bamboo"
|
|||
burntime = 15,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mesecons_button:button_bamboo_off",
|
||||
burntime = 5,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_bamboo:scaffolding",
|
||||
burntime = 20
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue