forked from VoxeLibre/VoxeLibre
Fix Licensing.
Removed Make_Stairs check. Made unified protection check. Began work on the second half of scaffolding. Removed comments that was no longer needed.
This commit is contained in:
parent
c55332bf42
commit
6f05992c8b
|
@ -3,9 +3,9 @@ mcl_bamboo
|
||||||
|
|
||||||
This mod adds minecraft-like bamboo nodes to your Mineclone 2 world.
|
This mod adds minecraft-like bamboo nodes to your Mineclone 2 world.
|
||||||
|
|
||||||
Code: Michieal. Original (basic) bamboo code by: Krock.
|
Code: Michieal. Original (basic) bamboo code by: Small Joker.
|
||||||
|
|
||||||
License for code: GPL3; images / textures: CC-BY-SA.
|
License for code / images / textures: CC-BY-SA.
|
||||||
Images Created by Michieal, except for:
|
Images Created by Michieal, except for:
|
||||||
Inventory / wield image: created by RandomLegoBrick#8692 and is CC0.
|
Inventory / wield image: created by RandomLegoBrick#8692 and is CC0.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Optional Dependencies = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesec
|
||||||
|
|
||||||
Special thanks to Nicu for help with the nodebox stalk design.
|
Special thanks to Nicu for help with the nodebox stalk design.
|
||||||
|
|
||||||
Krock's bamboo forum topic:
|
Small Joker's bamboo forum topic:
|
||||||
Forum topic: https://forum.minetest.net/viewtopic.php?id=8289
|
Forum topic: https://forum.minetest.net/viewtopic.php?id=8289
|
||||||
|
|
||||||
Scaffold inspiration: Cora, because she said that it couldn't be done.
|
Scaffold inspiration: Cora, because she said that it couldn't be done.
|
|
@ -14,7 +14,6 @@ local adj_nodes = {
|
||||||
vector.new(1, 0, 0),
|
vector.new(1, 0, 0),
|
||||||
vector.new(-1, 0, 0),
|
vector.new(-1, 0, 0),
|
||||||
}
|
}
|
||||||
local SIDE_SCAFFOLDING = false
|
|
||||||
|
|
||||||
local function bambootoo_create_nodes()
|
local function bambootoo_create_nodes()
|
||||||
local bamboo_mosaic = minetest.registered_nodes[bamboo .. "_plank"]
|
local bamboo_mosaic = minetest.registered_nodes[bamboo .. "_plank"]
|
||||||
|
@ -24,7 +23,6 @@ local function bambootoo_create_nodes()
|
||||||
bamboo_mosaic._doc_items_longdesc = S("Bamboo Mosaic Plank")
|
bamboo_mosaic._doc_items_longdesc = S("Bamboo Mosaic Plank")
|
||||||
minetest.register_node("mcl_bamboo:bamboo_mosaic", bamboo_mosaic)
|
minetest.register_node("mcl_bamboo:bamboo_mosaic", bamboo_mosaic)
|
||||||
|
|
||||||
-- crafted by "mcl_stair:slab_bamboo_plank", "mcl_stair:slab_bamboo_block", "mcl_stair:slab_bamboo_stripped"
|
|
||||||
if minetest.get_modpath("mcl_stairs") then
|
if minetest.get_modpath("mcl_stairs") then
|
||||||
if mcl_stairs ~= nil then
|
if mcl_stairs ~= nil then
|
||||||
mcl_stairs.register_stair_and_slab_simple(
|
mcl_stairs.register_stair_and_slab_simple(
|
||||||
|
@ -37,47 +35,60 @@ local function bambootoo_create_nodes()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if SIDE_SCAFFOLDING then
|
minetest.register_node("mcl_bamboo:scaffolding_horizontal", {
|
||||||
--currently, disabled.
|
description = S("Scaffolding (horizontal)"),
|
||||||
minetest.register_node("mcl_bamboo:scaffolding_horizontal", {
|
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
||||||
description = S("Scaffolding (horizontal)"),
|
doc_items_hidden = false,
|
||||||
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
tiles = {"mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_bottom.png"},
|
||||||
doc_items_hidden = false,
|
drop = "mcl_bamboo:scaffolding",
|
||||||
tiles = {"mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_bottom.png"},
|
drawtype = "nodebox",
|
||||||
drawtype = "nodebox",
|
paramtype = "light",
|
||||||
paramtype = "light",
|
paramtype2 = "4dir",
|
||||||
use_texture_alpha = "clip",
|
param2 = 0,
|
||||||
node_box = {
|
use_texture_alpha = "clip",
|
||||||
type = "fixed",
|
node_box = {
|
||||||
fixed = {
|
type = "fixed",
|
||||||
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
|
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
||||||
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
|
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
|
||||||
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
|
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
|
||||||
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
|
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
|
||||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 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},
|
||||||
},
|
},
|
||||||
selection_box = {
|
},
|
||||||
type = "fixed",
|
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},
|
||||||
fixed = {
|
_mcl_after_falling = function(pos)
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
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)
|
||||||
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},
|
minetest.add_item(pos, "mcl_bamboo:scaffolding")
|
||||||
_mcl_after_falling = function(pos)
|
else
|
||||||
if minetest.get_node(pos).name == "mcl_bamboo:scaffolding_horizontal" then
|
minetest.set_node(vector.offset(pos, 0, 1, 0), {name = "mcl_bamboo:scaffolding"})
|
||||||
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
|
||||||
end
|
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
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
-- [bamboo] mod by SmallJoker, Made for MineClone 2 by Michieal (as mcl_bamboo).
|
-- [bamboo] mod by SmallJoker, Made for MineClone 2 by Michieal (as mcl_bamboo).
|
||||||
-- Parts of mcl_scaffolding were used. Mcl_scaffolding originally created by Cora; heavily reworked for mcl_bamboo by Michieal.
|
-- Parts of mcl_scaffolding were used. Mcl_scaffolding originally created by Cora; Fixed and heavily reworked
|
||||||
|
-- for mcl_bamboo by Michieal.
|
||||||
-- Creation date: 12-01-2022 (Dec 1st, 2022)
|
-- Creation date: 12-01-2022 (Dec 1st, 2022)
|
||||||
-- License for everything: GPL3
|
-- License for everything: CC-BY-SA 4.0
|
||||||
-- Bamboo max height: 12-16
|
-- Bamboo max height: 12-16
|
||||||
|
|
||||||
-- LOCALS
|
-- LOCALS
|
||||||
|
@ -13,10 +14,21 @@ local node_sound = mcl_sounds.node_sound_wood_defaults()
|
||||||
|
|
||||||
-- CONSTS
|
-- CONSTS
|
||||||
local SIDE_SCAFFOLDING = false
|
local SIDE_SCAFFOLDING = false
|
||||||
local MAKE_STAIRS = true
|
|
||||||
local DEBUG = false
|
local DEBUG = false
|
||||||
local DOUBLE_DROP_CHANCE = 8
|
local DOUBLE_DROP_CHANCE = 8
|
||||||
|
|
||||||
|
mcl_bamboo ={}
|
||||||
|
|
||||||
|
--- pos: node position; placer: ObjectRef that is placing the item
|
||||||
|
--- returns: true if protected, otherwise false.
|
||||||
|
function mcl_bamboo.is_protected(pos, placer)
|
||||||
|
local name = placer:get_player_name()
|
||||||
|
if minetest.is_protected(pos, name) then
|
||||||
|
minetest.record_protection_violation(pos, name)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--Bamboo can be planted on moss blocks, grass blocks, dirt, coarse dirt, rooted dirt, gravel, mycelium, podzol, sand, red sand, or mud
|
--Bamboo can be planted on moss blocks, grass blocks, dirt, coarse dirt, rooted dirt, gravel, mycelium, podzol, sand, red sand, or mud
|
||||||
local bamboo_dirt_nodes = {
|
local bamboo_dirt_nodes = {
|
||||||
|
@ -38,7 +50,7 @@ local BROKEN_DOORS = true
|
||||||
-- LOCAL FUNCTIONS
|
-- LOCAL FUNCTIONS
|
||||||
|
|
||||||
-- Add Groups function, courtesy of Warr1024.
|
-- Add Groups function, courtesy of Warr1024.
|
||||||
function addgroups(name, ...)
|
function mcl_bamboo.addgroups(name, ...)
|
||||||
local def = minetest.registered_items[name] or error(name .. " not found")
|
local def = minetest.registered_items[name] or error(name .. " not found")
|
||||||
local groups = {}
|
local groups = {}
|
||||||
for k, v in pairs(def.groups) do
|
for k, v in pairs(def.groups) do
|
||||||
|
@ -124,9 +136,7 @@ local function create_nodes()
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
minetest.log("mcl_bamboo::Checking for protected placement of bamboo.")
|
minetest.log("mcl_bamboo::Checking for protected placement of bamboo.")
|
||||||
end
|
end
|
||||||
local pname = placer:get_player_name()
|
if mcl_bamboo.is_protected(pos, placer) then
|
||||||
if minetest.is_protected(pos, pname) then
|
|
||||||
minetest.record_protection_violation(pos, pname)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
|
@ -224,9 +234,7 @@ local function create_nodes()
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
local pname = placer:get_player_name()
|
if mcl_bamboo.is_protected(pos, placer) then
|
||||||
if minetest.is_protected(pos, pname) then
|
|
||||||
minetest.record_protection_violation(pos, pname)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -335,47 +343,45 @@ local function create_nodes()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if MAKE_STAIRS then
|
if minetest.get_modpath("mcl_stairs") then
|
||||||
if minetest.get_modpath("mcl_stairs") then
|
if mcl_stairs ~= nil then
|
||||||
if mcl_stairs ~= nil then
|
mcl_stairs.register_stair_and_slab_simple(
|
||||||
mcl_stairs.register_stair_and_slab_simple(
|
"bamboo_block",
|
||||||
"bamboo_block",
|
"mcl_bamboo:bamboo_block",
|
||||||
"mcl_bamboo:bamboo_block",
|
S("Bamboo Stair"),
|
||||||
S("Bamboo Stair"),
|
S("Bamboo Slab"),
|
||||||
S("Bamboo Slab"),
|
S("Double Bamboo Slab")
|
||||||
S("Double Bamboo Slab")
|
)
|
||||||
)
|
mcl_stairs.register_stair_and_slab_simple(
|
||||||
mcl_stairs.register_stair_and_slab_simple(
|
"bamboo_stripped",
|
||||||
"bamboo_stripped",
|
"mcl_bamboo:bamboo_block_stripped",
|
||||||
"mcl_bamboo:bamboo_block_stripped",
|
S("Stripped Bamboo Stair"),
|
||||||
S("Stripped Bamboo Stair"),
|
S("Stripped Bamboo Slab"),
|
||||||
S("Stripped Bamboo Slab"),
|
S("Double Stripped Bamboo Slab")
|
||||||
S("Double Stripped Bamboo Slab")
|
)
|
||||||
)
|
mcl_stairs.register_stair_and_slab_simple(
|
||||||
mcl_stairs.register_stair_and_slab_simple(
|
"bamboo_plank",
|
||||||
"bamboo_plank",
|
"mcl_bamboo:bamboo_plank",
|
||||||
"mcl_bamboo:bamboo_plank",
|
S("Bamboo Plank Stair"),
|
||||||
S("Bamboo Plank Stair"),
|
S("Bamboo Plank Slab"),
|
||||||
S("Bamboo Plank Slab"),
|
S("Double Bamboo Plank Slab")
|
||||||
S("Double Bamboo Plank Slab")
|
)
|
||||||
)
|
|
||||||
|
|
||||||
-- let's add plank slabs to the wood_slab group.
|
-- let's add plank slabs to the wood_slab group.
|
||||||
local bamboo_plank_slab = "mcl_stairs:slab_bamboo_plank"
|
local bamboo_plank_slab = "mcl_stairs:slab_bamboo_plank"
|
||||||
local node_groups = {
|
local node_groups = {
|
||||||
wood_slab = 1,
|
wood_slab = 1,
|
||||||
building_block = 1,
|
building_block = 1,
|
||||||
slab = 1,
|
slab = 1,
|
||||||
axey = 1,
|
axey = 1,
|
||||||
handy = 1,
|
handy = 1,
|
||||||
stair = 1,
|
stair = 1,
|
||||||
flammable = 1,
|
flammable = 1,
|
||||||
fire_encouragement = 5,
|
fire_encouragement = 5,
|
||||||
fire_flammability = 20
|
fire_flammability = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.override_item(bamboo_plank_slab, {groups = node_groups})
|
minetest.override_item(bamboo_plank_slab, {groups = node_groups})
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -502,6 +508,8 @@ local function create_nodes()
|
||||||
tiles = {"mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_bottom.png"},
|
tiles = {"mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_top.png", "mcl_bamboo_scaffolding_bottom.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "4dir",
|
||||||
|
param2 = 0,
|
||||||
use_texture_alpha = "clip",
|
use_texture_alpha = "clip",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -552,9 +560,7 @@ local function create_nodes()
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(ptd.under)
|
local node = minetest.get_node(ptd.under)
|
||||||
local pos = ptd.under
|
local pos = ptd.under
|
||||||
local pname = placer:get_player_name()
|
if mcl_bamboo.is_protected(pos, placer) then
|
||||||
if minetest.is_protected(pos, pname) then
|
|
||||||
minetest.record_protection_violation(pos, pname)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
|
@ -715,37 +721,41 @@ local function register_craftings()
|
||||||
burntime = 20
|
burntime = 20
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
if minetest.get_modpath("mcl_stairs") then
|
||||||
type = "fuel",
|
if mcl_stairs ~= nil then
|
||||||
recipe = "mcl_stairs:slab_bamboo_plank",
|
minetest.register_craft({
|
||||||
burntime = 7.5,
|
type = "fuel",
|
||||||
})
|
recipe = "mcl_stairs:slab_bamboo_plank",
|
||||||
minetest.register_craft({
|
burntime = 7.5,
|
||||||
type = "fuel",
|
})
|
||||||
recipe = "mcl_stairs:slab_bamboo_block",
|
minetest.register_craft({
|
||||||
burntime = 7.5,
|
type = "fuel",
|
||||||
})
|
recipe = "mcl_stairs:slab_bamboo_block",
|
||||||
minetest.register_craft({
|
burntime = 7.5,
|
||||||
type = "fuel",
|
})
|
||||||
recipe = "mcl_stairs:slab_bamboo_stripped",
|
minetest.register_craft({
|
||||||
burntime = 7.5,
|
type = "fuel",
|
||||||
})
|
recipe = "mcl_stairs:slab_bamboo_stripped",
|
||||||
|
burntime = 7.5,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_stairs:stair_bamboo_plank",
|
recipe = "mcl_stairs:stair_bamboo_plank",
|
||||||
burntime = 15,
|
burntime = 15,
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_stairs:stair_bamboo_block",
|
recipe = "mcl_stairs:stair_bamboo_block",
|
||||||
burntime = 15,
|
burntime = 15,
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_stairs:stair_bamboo_stripped",
|
recipe = "mcl_stairs:stair_bamboo_stripped",
|
||||||
burntime = 15,
|
burntime = 15,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
|
|
Loading…
Reference in New Issue