Change mod.conf and readme's depends.

Optipng images, after adding in bamboo top image.
Try out a plantlike style top node for bamboo stalks.
Make Bamboo drop 1-2 bamboo.
Fix Bamboo top drops.
This commit is contained in:
Michieal 2022-12-24 00:57:44 -05:00
parent 42f8fbf9b8
commit c55332bf42
9 changed files with 84 additions and 114 deletions

View File

@ -1,9 +1,9 @@
mcl_bamboo mcl_bamboo
========= =========
This mod adds simple bamboo nodes to your Mineclone 2 world. This mod adds minecraft-like bamboo nodes to your Mineclone 2 world.
Code redo for Mineclone 2: Michieal. Original bamboo code by: Krock. Code: Michieal. Original (basic) bamboo code by: Krock.
License for code: GPL3; images / textures: CC-BY-SA. License for code: GPL3; images / textures: CC-BY-SA.
Images Created by Michieal, except for: Images Created by Michieal, except for:
@ -11,9 +11,11 @@ Inventory / wield image: created by RandomLegoBrick#8692 and is CC0.
Dependencies: mcl_core, mcl_sounds, mcl_tools Dependencies: mcl_core, mcl_sounds, mcl_tools
Optional Dependencies = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesecons_pressureplates, mcl_fences, mesecons_button Optional Dependencies = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesecons_pressureplates, mcl_fences, mesecons_button, mcl_boats
Special thanks to Nicu for help with the nodebox stalk design. Special thanks to Nicu for help with the nodebox stalk design.
Original code's forum topic: Krock'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.

View File

@ -16,14 +16,13 @@ local adj_nodes = {
} }
local SIDE_SCAFFOLDING = false 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"]
bamboo_mosaic.tiles = {"mcl_bamboo_bamboo_plank.png"} 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.groups = {handy = 1, axey = 1, flammable = 3, fire_encouragement = 5, fire_flammability = 20}
bamboo_mosaic.description = S("Bamboo Mosaic Plank") bamboo_mosaic.description = S("Bamboo Mosaic Plank")
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" -- 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
@ -99,6 +98,8 @@ local function bambootoo_register_craftings()
recipe = bamboo .. "_mosaic", recipe = bamboo .. "_mosaic",
burntime = 7.5, burntime = 7.5,
}) })
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_mosaic", recipe = "mcl_stairs:slab_bamboo_mosaic",
@ -109,9 +110,9 @@ local function bambootoo_register_craftings()
recipe = "mcl_stairs:stair_bamboo_mosaic", recipe = "mcl_stairs:stair_bamboo_mosaic",
burntime = 15, burntime = 15,
}) })
end
end
end end
bambootoo_create_nodes() bambootoo_create_nodes()
bambootoo_register_craftings() bambootoo_register_craftings()

View File

@ -15,6 +15,8 @@ local node_sound = mcl_sounds.node_sound_wood_defaults()
local SIDE_SCAFFOLDING = false local SIDE_SCAFFOLDING = false
local MAKE_STAIRS = true local MAKE_STAIRS = true
local DEBUG = false local DEBUG = false
local DOUBLE_DROP_CHANCE = 8
--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 = {
@ -62,17 +64,40 @@ local function create_nodes()
paramtype = "light", paramtype = "light",
groups = {handy = 1, axey = 1, choppy = 1, flammable = 3}, groups = {handy = 1, axey = 1, choppy = 1, flammable = 3},
sounds = node_sound, sounds = node_sound,
drops = "mcl_bamboo:bamboo",
drop = {
max_items = 1,
-- Maximum number of item lists to drop.
-- The entries in 'items' are processed in order. For each:
-- Item filtering is applied, chance of drop is applied, if both are
-- successful the entire item list is dropped.
-- Entry processing continues until the number of dropped item lists
-- equals 'max_items'.
-- Therefore, entries should progress from low to high drop chance.
items = {
-- Examples:
{
-- 1 in 100 chance of dropping.
-- Default rarity is '1'.
rarity = DOUBLE_DROP_CHANCE,
items = {bamboo .. " 2"},
},
{
-- 1 in 2 chance of dropping.
-- Default rarity is '1'.
rarity = 1,
items = {bamboo},
},
},
},
inventory_image = "mcl_bamboo_bamboo_shoot.png", inventory_image = "mcl_bamboo_bamboo_shoot.png",
wield_image = "mcl_bamboo_bamboo_shoot.png", wield_image = "mcl_bamboo_bamboo_shoot.png",
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 2, _mcl_hardness = 1.5,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
-- {0.1875, -0.5, -0.125, 0.4125, 0.5, 0.0625},
-- {-0.125, -0.5, 0.125, -0.3125, 0.5, 0.3125},
-- {-0.25, -0.5, -0.3125, 0, 0.5, -0.125},
{-0.175, -0.5, -0.195, 0.05, 0.5, 0.030}, {-0.175, -0.5, -0.195, 0.05, 0.5, 0.030},
} }
}, },
@ -152,81 +177,36 @@ local function create_nodes()
} }
minetest.remove_node(new_pos) minetest.remove_node(new_pos)
minetest.sound_play(node_sound.dug, sound_params, true) minetest.sound_play(node_sound.dug, sound_params, true)
local istack = ItemStack("mcl_bamboo:bamboo") local istack = ItemStack(bamboo)
if math.random(1, DOUBLE_DROP_CHANCE) == 1 then
minetest.add_item(new_pos, istack)
end
minetest.add_item(new_pos, istack) minetest.add_item(new_pos, istack)
elseif node_above and node_above.name == "mcl_bamboo:bamboo_endcap" then elseif node_above and node_above.name == "mcl_bamboo:bamboo_endcap" then
minetest.remove_node(new_pos) minetest.remove_node(new_pos)
minetest.sound_play(node_sound.dug, sound_params, true) minetest.sound_play(node_sound.dug, sound_params, true)
local istack = ItemStack("mcl_bamboo:bamboo") local istack = ItemStack(bamboo)
minetest.add_item(new_pos, istack) minetest.add_item(new_pos, istack)
if math.random(1, DOUBLE_DROP_CHANCE) == 1 then
minetest.add_item(new_pos, istack)
end
end end
end, end,
} }
minetest.register_node(bamboo, bamboo_def) minetest.register_node(bamboo, bamboo_def)
local bamboo_top = table.copy(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.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
bamboo_top.drops = bamboo bamboo_top.tiles = {"mcl_bamboo_endcap.png"}
bamboo_top.drawtype = "plantlike"
bamboo_top.paramtype2 = "meshoptions"
bamboo_top.param2 = 34
bamboo_top.nodebox = nil
bamboo_top.on_place = function(itemstack, placer, pointed_thing) bamboo_top.on_place = function(itemstack, _, _)
if pointed_thing.type ~= "node" then -- Should never occur... but, if it does, then nix it.
itemstack:set_name(bamboo)
return itemstack return itemstack
end end
local node = minetest.get_node(pointed_thing.under)
local pos = pointed_thing.under
if DEBUG then
minetest.log("mcl_bamboo::Node placement data:")
minetest.log(dump(pointed_thing))
minetest.log(dump(node))
end
if DEBUG then
minetest.log("mcl_bamboo::Checking for protected placement of bamboo.")
end
local pname = placer:get_player_name()
if pname then
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
--not for player use.
if minetest.is_creative_enabled(pname) == false then
itemstack:set_count(0)
return itemstack
end
end
if DEBUG then
minetest.log("mcl_bamboo::placement of bamboo is not protected.")
end
if node.name ~= "mcl_bamboo:bamboo" then
return itemstack
end
if DEBUG then
minetest.log("mcl_bamboo::placing bamboo directly.")
end
return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
end
--[[
bamboo_top.on_destruct = function(pos)
-- Node destructor; called before removing node.
local node = minetest.get_node(pos)
if node and node.name == "mcl_bamboo:bamboo_endcap" then
local sound_params = {
pos = pos,
gain = 1.0, -- default
max_hear_distance = 10, -- default, uses a Euclidean metric
}
minetest.remove_node(pos)
minetest.sound_play(node_sound.dug, sound_params, true)
local istack = ItemStack("mcl_bamboo:bamboo")
minetest.add_item(pos, istack)
end
end
]]
minetest.register_node("mcl_bamboo:bamboo_endcap", bamboo_top) minetest.register_node("mcl_bamboo:bamboo_endcap", bamboo_top)
@ -329,25 +309,6 @@ local function create_nodes()
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
} }
--[[ Registers a door
-- name: The name of the door
-- def: a table with the folowing fields:
-- description
-- inventory_image
-- groups
-- tiles_bottom: the tiles of the bottom part of the door {front, side}
-- tiles_top: the tiles of the bottom part of the door {front, side}
-- If the following fields are not defined the default values are used
-- node_box_bottom
-- node_box_top
-- selection_box_bottom
-- selection_box_top
-- only_placer_can_open: if true only the player who placed the door can
-- open it
-- only_redstone_can_open: if true, the door can only be opened by redstone,
-- not by rightclicking it
--]]
mcl_doors:register_door(name, def) mcl_doors:register_door(name, def)
name = "mcl_bamboo:bamboo_trapdoor" name = "mcl_bamboo:bamboo_trapdoor"
@ -871,14 +832,20 @@ todo -- Also, make those blocks collapse (break) when a nearby connected scaffol
todo -- add in alternative bamboo styles to simulate random placement. (see commented out node box definitions. todo -- add in alternative bamboo styles to simulate random placement. (see commented out node box definitions.
todo -- Add Flourish to the endcap node for bamboo. todo -- Add Flourish to the endcap node for bamboo.
todo -- mash all of that together so that it drops as one item, and chooses what version to be, in on_place. todo -- mash all of that together so that it drops as one item, and chooses what version to be, in on_place.
todo -- Raft
todo -- Raft with Chest.
todo -- Add in Extras. todo -- Add in Extras.
todo -- [X] Added a new "Mosaic" plank variant that is unique to Bamboo called Bamboo Mosaic
It can be crafted with 1x2 Bamboo (plank) Slabs in a vertical strip
You can craft Stair and Slab variants of Bamboo Mosaic
Bamboo Mosaic blocks cannot be used as a crafting ingredient where other wooden blocks are used, but they can be
used as fuel. [Done]
todo -- fix scaffolding placing, instead of using on_rightclick first. todo -- fix scaffolding placing, instead of using on_rightclick first.
todo -- make graphic for top node of bamboo.
waiting on specific things:
todo -- Raft -- need model
todo -- Raft with Chest. same.
todo -- handle bonemeal...
Notes:
When bone meal is used on it, it grows by 12 blocks. Bamboo can grow up to 1216 blocks tall.
The top of a bamboo plant requires a light level of 9 or above to grow.
Design Decision - to not make bamboo saplings, and not make them go through a ton of transformations.
--]] --]]

View File

@ -1,4 +1,4 @@
name = mcl_bamboo name = mcl_bamboo
depends = mcl_core, mcl_sounds, mcl_tools depends = mcl_core, mcl_sounds, mcl_tools
optional_depends = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesecons_pressureplates, mcl_fences, mesecons_button, mcl_lanterns optional_depends = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesecons_pressureplates, mcl_fences, mesecons_button, mcl_boats
author = Michieal author = Michieal

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 206 B