2022-12-21 21:55:50 +01:00
|
|
|
|
-- [bamboo] mod by SmallJoker, Made for MineClone 2 by Michieal (as mcl_bamboo).
|
2022-12-25 13:30:31 +01:00
|
|
|
|
-- Parts of mcl_scaffolding were used. Mcl_scaffolding originally created by Cora; Fixed and heavily reworked
|
|
|
|
|
-- for mcl_bamboo by Michieal.
|
2022-12-14 05:32:54 +01:00
|
|
|
|
-- Creation date: 12-01-2022 (Dec 1st, 2022)
|
2023-01-12 03:50:34 +01:00
|
|
|
|
-- License for Media: CC-BY-SA 4.0 (except where noted); Code: GPLv3
|
2023-01-09 05:08:12 +01:00
|
|
|
|
-- Copyright (C) 2022 - 2023, Michieal. See License.txt
|
2022-12-14 05:32:54 +01:00
|
|
|
|
|
|
|
|
|
-- LOCALS
|
|
|
|
|
local modname = minetest.get_current_modname()
|
2023-01-06 23:40:35 +01:00
|
|
|
|
-- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it...
|
|
|
|
|
-- "BAMBOO" goes here.
|
|
|
|
|
local BAMBOO = "mcl_bamboo:bamboo"
|
2022-12-22 04:22:51 +01:00
|
|
|
|
|
2022-12-28 21:29:06 +01:00
|
|
|
|
mcl_bamboo = {}
|
|
|
|
|
|
2022-12-29 19:16:48 +01:00
|
|
|
|
-- BAMBOO GLOBALS
|
|
|
|
|
dofile(minetest.get_modpath(modname) .. "/globals.lua")
|
|
|
|
|
-- BAMBOO Base Nodes
|
|
|
|
|
dofile(minetest.get_modpath(modname) .. "/bamboo_base.lua")
|
|
|
|
|
-- BAMBOO ITEMS
|
|
|
|
|
dofile(minetest.get_modpath(modname) .. "/bamboo_items.lua")
|
|
|
|
|
-- BAMBOO RECIPES
|
|
|
|
|
dofile(minetest.get_modpath(modname) .. "/recipes.lua")
|
|
|
|
|
|
|
|
|
|
-- ------------------------------------------------------------
|
2022-12-15 05:02:08 +01:00
|
|
|
|
|
2022-12-14 05:32:54 +01:00
|
|
|
|
--ABMs
|
|
|
|
|
minetest.register_abm({
|
2023-02-06 00:47:45 +01:00
|
|
|
|
label = "Bamboo Grow",
|
2023-01-06 23:40:35 +01:00
|
|
|
|
nodenames = mcl_bamboo.bamboo_index,
|
2023-01-16 21:01:38 +01:00
|
|
|
|
interval = 10,
|
|
|
|
|
chance = 20,
|
2023-01-05 04:43:05 +01:00
|
|
|
|
action = function(pos, _)
|
|
|
|
|
mcl_bamboo.grow_bamboo(pos, false)
|
2022-12-29 00:10:12 +01:00
|
|
|
|
end,
|
2022-12-28 20:34:14 +01:00
|
|
|
|
})
|
2023-02-06 00:47:45 +01:00
|
|
|
|
|
2023-02-09 03:09:16 +01:00
|
|
|
|
if minetest.get_modpath("mesecons_mvps") then
|
|
|
|
|
if mesecons_mvps then
|
|
|
|
|
for x = 1, #mcl_bamboo.bamboo_index do
|
|
|
|
|
mesecon.register_mvps_dropper(mcl_bamboo.bamboo_index[x], mcl_bamboo.break_orphaned)
|
2023-02-06 00:47:45 +01:00
|
|
|
|
end
|
2023-02-09 03:09:16 +01:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
minetest.register_abm({
|
|
|
|
|
label = "Break Orphaned Bamboo",
|
|
|
|
|
nodenames = mcl_bamboo.bamboo_index,
|
|
|
|
|
interval = 1.5,
|
|
|
|
|
chance = 1,
|
|
|
|
|
action = function(pos, _)
|
|
|
|
|
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
|
|
|
|
local node_name = node_below.name
|
2023-02-06 00:47:45 +01:00
|
|
|
|
|
2023-02-09 03:09:16 +01:00
|
|
|
|
-- short circuit checks.
|
|
|
|
|
if mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then
|
|
|
|
|
return
|
|
|
|
|
end
|
2023-02-06 00:47:45 +01:00
|
|
|
|
|
2023-02-09 03:09:16 +01:00
|
|
|
|
-- dig the node.
|
|
|
|
|
minetest.remove_node(pos) -- if that fails, remove the node
|
|
|
|
|
local istack = ItemStack("mcl_bamboo:bamboo")
|
|
|
|
|
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(mcl_sounds.node_sound_wood_defaults().dug, sound_params, true)
|
|
|
|
|
minetest.add_item(pos, istack)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
2022-12-28 20:34:14 +01:00
|
|
|
|
|
2022-12-14 05:32:54 +01:00
|
|
|
|
-- Base Aliases.
|
2023-01-06 23:40:35 +01:00
|
|
|
|
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"
|
2022-12-14 05:32:54 +01:00
|
|
|
|
minetest.register_alias("bamboo_block", "mcl_bamboo:bamboo_block")
|
|
|
|
|
minetest.register_alias("bamboo_strippedblock", "mcl_bamboo:bamboo_block_stripped")
|
2023-01-06 23:40:35 +01:00
|
|
|
|
minetest.register_alias("bamboo", BAMBOO)
|
2022-12-14 05:32:54 +01:00
|
|
|
|
minetest.register_alias("bamboo_plank", "mcl_bamboo:bamboo_plank")
|
2022-12-15 05:02:08 +01:00
|
|
|
|
minetest.register_alias("bamboo_mosaic", "mcl_bamboo:bamboo_mosaic")
|
2022-12-14 05:32:54 +01:00
|
|
|
|
|
|
|
|
|
minetest.register_alias("mcl_stairs:stair_bamboo", "mcl_stairs:stair_bamboo_block")
|
2023-01-06 23:40:35 +01:00
|
|
|
|
minetest.register_alias("bamboo_stairs", "mcl_stairs:stair_bamboo_block")
|
|
|
|
|
minetest.register_alias("bamboo:bamboo", BAMBOO)
|
|
|
|
|
minetest.register_alias("scaffold", SCAFFOLDING_NAME)
|
|
|
|
|
minetest.register_alias("mcl_scaffolding:scaffolding", SCAFFOLDING_NAME)
|
|
|
|
|
minetest.register_alias("mcl_scaffolding:scaffolding_horizontal", SCAFFOLDING_NAME)
|
|
|
|
|
|
|
|
|
|
minetest.register_alias("bamboo_fence", "mcl_fences:bamboo_fence")
|
|
|
|
|
minetest.register_alias("bamboo_fence_gate", "mcl_fences:bamboo_fence_gate")
|
2022-12-14 05:32:54 +01:00
|
|
|
|
|
|
|
|
|
--[[
|
2023-01-06 23:40:35 +01:00
|
|
|
|
todo -- make scaffolds do side scaffold blocks, so that they jut out. (Shelved.)
|
2022-12-14 05:32:54 +01:00
|
|
|
|
todo -- Also, make those blocks collapse (break) when a nearby connected scaffold breaks.
|
2022-12-24 06:57:44 +01:00
|
|
|
|
|
|
|
|
|
waiting on specific things:
|
|
|
|
|
todo -- Raft -- need model
|
|
|
|
|
todo -- Raft with Chest. same.
|
2023-01-06 23:43:41 +01:00
|
|
|
|
todo -- handle bonemeal... (shelved until after redoing the bonemeal api).
|
2022-12-24 06:57:44 +01:00
|
|
|
|
|
2022-12-29 07:38:10 +01:00
|
|
|
|
-----------------------------------------------------------
|
|
|
|
|
todo -- Add in Extras. -- Moved to Official Mod Pack.
|
|
|
|
|
|
2022-12-24 06:57:44 +01:00
|
|
|
|
Notes:
|
|
|
|
|
When bone meal is used on it, it grows by 1–2 blocks. Bamboo can grow up to 12–16 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.
|
|
|
|
|
|
2022-12-19 03:04:43 +01:00
|
|
|
|
--]]
|