mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-03 00:03:46 +01:00
26c1be3722
Added in secondary bamboo node types. Changed the grow_bamboo function to make use of new alt nodes, and removed unneccessary "force" parameter.
158 lines
4.1 KiB
Lua
158 lines
4.1 KiB
Lua
---
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
--- Created by michieal.
|
|
--- DateTime: 12/14/22 10:11 PM
|
|
---
|
|
|
|
-- LOCALS
|
|
local modname = minetest.get_current_modname()
|
|
local S = minetest.get_translator(modname)
|
|
local bamboo = "mcl_bamboo:bamboo"
|
|
local adj_nodes = {
|
|
vector.new(0, 0, 1),
|
|
vector.new(0, 0, -1),
|
|
vector.new(1, 0, 0),
|
|
vector.new(-1, 0, 0),
|
|
}
|
|
|
|
local function bambootoo_create_nodes()
|
|
-- Bamboo alternative node types.
|
|
local def = minetest.registered_nodes [bamboo]
|
|
def.node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.05, -0.5, 0.285, -0.275, 0.5, 0.06},
|
|
}
|
|
}
|
|
minetest.register_node(bamboo.."_1", def)
|
|
|
|
def.node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{0.25, -0.5, 0.325, 0.025, 0.5, 0.100},
|
|
}
|
|
}
|
|
minetest.register_node(bamboo.."_2", def)
|
|
|
|
|
|
def.node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.125, -0.5, 0.125, -0.3125, 0.5, 0.3125},
|
|
}
|
|
}
|
|
minetest.register_node(bamboo.."_3", def)
|
|
|
|
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)
|
|
|
|
if minetest.get_modpath("mcl_stairs") then
|
|
if mcl_stairs ~= nil then
|
|
mcl_stairs.register_stair_and_slab_simple(
|
|
"bamboo_mosaic",
|
|
"mcl_bamboo:bamboo_mosaic",
|
|
S("Bamboo Mosaic Stair"),
|
|
S("Bamboo Mosaic Slab"),
|
|
S("Double Bamboo Mosaic Slab")
|
|
)
|
|
end
|
|
end
|
|
|
|
|
|
minetest.register_node("mcl_bamboo:scaffolding_horizontal", {
|
|
description = S("Scaffolding (horizontal)"),
|
|
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
|
doc_items_hidden = false,
|
|
tiles = {"mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_bottom.png"},
|
|
drop = "mcl_bamboo:scaffolding",
|
|
drawtype = "nodebox",
|
|
paramtype = "light",
|
|
paramtype2 = "4dir",
|
|
param2 = 0,
|
|
use_texture_alpha = "clip",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
|
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
|
|
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
|
|
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
|
|
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
|
|
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
|
}
|
|
},
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
},
|
|
},
|
|
groups = {handy = 1, axey = 1, flammable = 3, building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, not_in_creative_inventory = 1, falling_node = 1},
|
|
_mcl_after_falling = function(pos)
|
|
if minetest.get_node(pos).name == "mcl_bamboo:scaffolding_horizontal" then
|
|
if minetest.get_node(vector.offset(pos, 0, 0, 0)).name ~= "mcl_bamboo:scaffolding" then
|
|
minetest.remove_node(pos)
|
|
minetest.add_item(pos, "mcl_bamboo:scaffolding")
|
|
else
|
|
minetest.set_node(vector.offset(pos, 0, 1, 0), {name = "mcl_bamboo:scaffolding"})
|
|
end
|
|
end
|
|
end,
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if pointed_thing.type ~= "node" then
|
|
return itemstack
|
|
end
|
|
local node = minetest.get_node(pointed_thing.under)
|
|
local pos = pointed_thing.under
|
|
if mcl_bamboo.is_protected(pos, placer) then
|
|
return
|
|
end
|
|
-- todo: finish this section.
|
|
end
|
|
|
|
|
|
})
|
|
|
|
end
|
|
|
|
local function bambootoo_register_craftings()
|
|
|
|
minetest.register_craft({
|
|
output = bamboo .. "_mosaic",
|
|
recipe = {
|
|
{"mcl_stair:slab_bamboo_plank"},
|
|
{"mcl_stair:slab_bamboo_plank"},
|
|
}
|
|
})
|
|
|
|
-- Fuels...
|
|
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = bamboo .. "_mosaic",
|
|
burntime = 7.5,
|
|
})
|
|
if minetest.get_modpath("mcl_stairs") then
|
|
if mcl_stairs ~= nil then
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "mcl_stairs:slab_bamboo_mosaic",
|
|
burntime = 7.5,
|
|
})
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "mcl_stairs:stair_bamboo_mosaic",
|
|
burntime = 15,
|
|
})
|
|
end
|
|
end
|
|
end
|
|
|
|
bambootoo_create_nodes()
|
|
bambootoo_register_craftings()
|