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:
Michieal 2022-12-25 07:30:31 -05:00
parent c55332bf42
commit 6f05992c8b
3 changed files with 145 additions and 124 deletions

View File

@ -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.

View File

@ -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,15 +35,16 @@ local function bambootoo_create_nodes()
end end
end end
if SIDE_SCAFFOLDING then
--currently, disabled.
minetest.register_node("mcl_bamboo:scaffolding_horizontal", { minetest.register_node("mcl_bamboo:scaffolding_horizontal", {
description = S("Scaffolding (horizontal)"), description = S("Scaffolding (horizontal)"),
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."), doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
doc_items_hidden = false, doc_items_hidden = false,
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"},
drop = "mcl_bamboo:scaffolding",
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",
@ -74,10 +73,22 @@ local function bambootoo_create_nodes()
minetest.set_node(vector.offset(pos, 0, 1, 0), {name = "mcl_bamboo:scaffolding"}) minetest.set_node(vector.offset(pos, 0, 1, 0), {name = "mcl_bamboo:scaffolding"})
end end
end end
end,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end 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 end

View File

@ -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,7 +343,6 @@ 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(
@ -377,7 +384,6 @@ local function create_nodes()
minetest.override_item(bamboo_plank_slab, {groups = node_groups}) minetest.override_item(bamboo_plank_slab, {groups = node_groups})
end end
end end
end
if minetest.get_modpath("mesecons_pressureplates") then if minetest.get_modpath("mesecons_pressureplates") then
@ -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,6 +721,8 @@ local function register_craftings()
burntime = 20 burntime = 20
}) })
if minetest.get_modpath("mcl_stairs") then
if mcl_stairs ~= nil then
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "mcl_stairs:slab_bamboo_plank", recipe = "mcl_stairs:slab_bamboo_plank",
@ -746,6 +754,8 @@ local function register_craftings()
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",