mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Mega commit. lol.
Did a LOT of refactoring. Cleaned up some vestigial code. Cleaned up aliases.
This commit is contained in:
parent
ee0b355f51
commit
7ebf9b7ab8
@ -4,17 +4,17 @@
|
||||
--- DateTime: 12/29/22 12:33 PM -- Restructure Date
|
||||
---
|
||||
|
||||
-- CONSTS
|
||||
local DOUBLE_DROP_CHANCE = 8
|
||||
-- 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"
|
||||
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
|
||||
|
||||
-- LOCALS
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local bamboo = "mcl_bamboo:bamboo"
|
||||
local node_sound = mcl_sounds.node_sound_wood_defaults()
|
||||
|
||||
-- CONSTS
|
||||
local DOUBLE_DROP_CHANCE = 8
|
||||
|
||||
local strlen = string.len
|
||||
local substr = string.sub
|
||||
local pr = PseudoRandom((os.time() + 15766) * 12) -- switched from math.random() to PseudoRandom because the random wasn't very random.
|
||||
|
||||
local on_rotate
|
||||
@ -46,13 +46,13 @@ local bamboo_def = {
|
||||
-- 1 in 100 chance of dropping.
|
||||
-- Default rarity is '1'.
|
||||
rarity = DOUBLE_DROP_CHANCE,
|
||||
items = {bamboo .. " 2"},
|
||||
items = {BAMBOO .. " 2"},
|
||||
},
|
||||
{
|
||||
-- 1 in 2 chance of dropping.
|
||||
-- Default rarity is '1'.
|
||||
rarity = 1,
|
||||
items = {bamboo},
|
||||
items = {BAMBOO},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -90,11 +90,10 @@ local bamboo_def = {
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local pos = pointed_thing.under
|
||||
local nodename = node.name
|
||||
mcl_bamboo.mcl_log("node name: " .. nodename)
|
||||
|
||||
mcl_bamboo.mcl_log("Node placement data:")
|
||||
mcl_bamboo.mcl_log(dump(pointed_thing))
|
||||
mcl_bamboo.mcl_log(node.name)
|
||||
mcl_bamboo.mcl_log("node name: " .. nodename)
|
||||
|
||||
mcl_bamboo.mcl_log("Checking for protected placement of bamboo.")
|
||||
if mcl_bamboo.is_protected(pos, placer) then
|
||||
@ -110,7 +109,7 @@ local bamboo_def = {
|
||||
end
|
||||
end
|
||||
|
||||
if mcl_bamboo.is_bamboo(nodename) == false and nodename ~= "mcl_bamboo:bamboo_endcap" then
|
||||
if mcl_bamboo.is_bamboo(nodename) == false and nodename ~= BAMBOO_ENDCAP_NAME then
|
||||
-- not bamboo...
|
||||
if nodename ~= "mcl_flowerpots:flower_pot" then
|
||||
if mcl_bamboo.is_dirt(nodename) == false then
|
||||
@ -131,10 +130,9 @@ local bamboo_def = {
|
||||
|
||||
local place_item = ItemStack(itemstack) -- make a copy so that we don't indirectly mess with the original.
|
||||
|
||||
mcl_bamboo.mcl_log("node name: " .. nodename)
|
||||
|
||||
local bamboo_node = mcl_bamboo.is_bamboo(nodename)
|
||||
mcl_bamboo.mcl_log("bamboo_node: " .. bamboo_node)
|
||||
mcl_bamboo.mcl_log("node name: " .. nodename .. "\nbamboo_node: " .. bamboo_node)
|
||||
-- intentional use of nodename.
|
||||
|
||||
if bamboo_node ~= -1 then
|
||||
place_item = ItemStack(mcl_bamboo.bamboo_index[bamboo_node])
|
||||
@ -152,32 +150,25 @@ local bamboo_def = {
|
||||
-- Node destructor; called before removing node.
|
||||
local new_pos = vector.offset(pos, 0, 1, 0)
|
||||
local node_above = minetest.get_node(new_pos)
|
||||
local bamboo_node = substr(node_above.name, 1, strlen(bamboo))
|
||||
local istack = ItemStack(bamboo)
|
||||
local bamboo_node = string.sub(node_above.name, 1, string.len(BAMBOO))
|
||||
local istack = ItemStack(BAMBOO)
|
||||
local sound_params = {
|
||||
pos = new_pos,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 10, -- default, uses a Euclidean metric
|
||||
}
|
||||
|
||||
if node_above and (bamboo_node == bamboo and node_above.name ~= "mcl_bamboo:bamboo_endcap") then
|
||||
if node_above and (bamboo_node == BAMBOO or node_above.name == BAMBOO_ENDCAP_NAME) then
|
||||
minetest.remove_node(new_pos)
|
||||
minetest.sound_play(node_sound.dug, sound_params, true)
|
||||
if pr:next(1, DOUBLE_DROP_CHANCE) == 1 then
|
||||
minetest.add_item(new_pos, istack)
|
||||
end
|
||||
minetest.add_item(new_pos, istack)
|
||||
elseif node_above and node_above.name == "mcl_bamboo:bamboo_endcap" then
|
||||
minetest.remove_node(new_pos)
|
||||
minetest.sound_play(node_sound.dug, sound_params, true)
|
||||
minetest.add_item(new_pos, istack)
|
||||
if pr:next(1, DOUBLE_DROP_CHANCE) == 1 then
|
||||
minetest.add_item(new_pos, istack)
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
minetest.register_node(bamboo, bamboo_def)
|
||||
minetest.register_node(BAMBOO, 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}
|
||||
@ -193,11 +184,11 @@ bamboo_top.collision_box = nil
|
||||
|
||||
bamboo_top.on_place = function(itemstack, _, _)
|
||||
-- Should never occur... but, if it does, then nix it.
|
||||
itemstack:set_name(bamboo)
|
||||
itemstack:set_name(BAMBOO)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_bamboo:bamboo_endcap", bamboo_top)
|
||||
minetest.register_node(BAMBOO_ENDCAP_NAME, bamboo_top)
|
||||
|
||||
local bamboo_block_def = {
|
||||
description = "Bamboo Block",
|
||||
@ -253,7 +244,7 @@ minetest.register_node("mcl_bamboo:bamboo_plank", {
|
||||
|
||||
-- Bamboo Part 2 Base nodes.
|
||||
-- Bamboo Mosaic
|
||||
local bamboo_mosaic = table.copy(minetest.registered_nodes[bamboo .. "_plank"])
|
||||
local bamboo_mosaic = table.copy(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")
|
||||
|
@ -3,6 +3,21 @@
|
||||
--- Created by michieal.
|
||||
--- DateTime: 12/29/22 12:38 PM -- Restructure Date
|
||||
---
|
||||
|
||||
-- CONSTS
|
||||
-- Due to door fix #2736, doors are displayed backwards. When this is fixed, set this variable to false.
|
||||
local BROKEN_DOORS = true
|
||||
|
||||
-- FUTURE USE VARIABLE. MUST REMAIN FALSE UNTIL IT HAS BEEN FULLY IMPLEMENTED. DO NOT ENABLE.
|
||||
local SIDE_SCAFFOLDING = false
|
||||
local SIDE_SCAFFOLD_NAME = "mcl_bamboo:scaffolding_horizontal"
|
||||
-- ---------------------------------------------------------------------------
|
||||
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"
|
||||
-- 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"
|
||||
local BAMBOO_PLANK = BAMBOO .. "_plank"
|
||||
|
||||
-- LOCALS
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
@ -12,15 +27,6 @@ local adj_nodes = {
|
||||
vector.new(0, 0, -1),
|
||||
vector.new(-1, 0, 0),
|
||||
}
|
||||
|
||||
-- CONSTS
|
||||
-- Due to door fix #2736, doors are displayed backwards. When this is fixed, set this variable to false.
|
||||
local BROKEN_DOORS = true
|
||||
|
||||
-- FUTURE USE VARIABLE. MUST REMAIN FALSE UNTIL IT HAS BEEN FULLY IMPLEMENTED. DO NOT ENABLE.
|
||||
local SIDE_SCAFFOLDING = false
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
local node_sound = mcl_sounds.node_sound_wood_defaults()
|
||||
|
||||
-- specific bamboo nodes (Items)... Pt. 1
|
||||
@ -28,15 +34,15 @@ if minetest.get_modpath("mcl_flowerpots") then
|
||||
mcl_bamboo.mcl_log("FlowerPot Section Entrance. Modpath exists.")
|
||||
if mcl_flowerpots ~= nil then
|
||||
-- Flower-potted Bamboo...
|
||||
local flwr_name = "mcl_bamboo:bamboo"
|
||||
local flwr_name = BAMBOO
|
||||
local flwr_def = {name = "bamboo_plant",
|
||||
desc = S("Bamboo"),
|
||||
image = "mcl_bamboo_bamboo_fpm.png", -- use with "register_potted_cube"
|
||||
-- "mcl_bamboo_flower_pot.png", -- use with "register_potted_flower"
|
||||
}
|
||||
|
||||
mcl_flowerpots.register_potted_cube(flwr_name, flwr_def)
|
||||
-- mcl_flowerpots.register_potted_flower(flwr_name, flwr_def)
|
||||
-- Chose cube over "potted_flower" as "potted flower" looks bad.
|
||||
mcl_flowerpots.register_potted_cube(flwr_name, flwr_def) -- mcl_flowerpots.register_potted_flower(flwr_name, flwr_def)
|
||||
minetest.register_alias("bamboo_flower_pot", "mcl_flowerpots:flower_pot_bamboo_plant")
|
||||
end
|
||||
end
|
||||
@ -111,7 +117,7 @@ if minetest.get_modpath("mcl_stairs") then
|
||||
)
|
||||
mcl_stairs.register_stair_and_slab_simple(
|
||||
"bamboo_plank",
|
||||
"mcl_bamboo:bamboo_plank",
|
||||
BAMBOO_PLANK,
|
||||
S("Bamboo Plank Stair"),
|
||||
S("Bamboo Plank Slab"),
|
||||
S("Double Bamboo Plank Slab")
|
||||
@ -166,7 +172,7 @@ if minetest.get_modpath("mesecons_pressureplates") then
|
||||
{"mcl_bamboo_bamboo_plank.png"},
|
||||
"mcl_bamboo_bamboo_plank.png",
|
||||
nil,
|
||||
{{"mcl_bamboo:bamboo_plank", "mcl_bamboo:bamboo_plank"}},
|
||||
{{BAMBOO_PLANK, BAMBOO_PLANK}},
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
{axey = 1, material_wood = 1},
|
||||
nil,
|
||||
@ -189,7 +195,7 @@ if minetest.get_modpath("mcl_signs") then
|
||||
mcl_signs.register_sign_custom("mcl_bamboo", "_bamboo", "mcl_signs_sign_greyscale.png",
|
||||
"#f6dc91", "default_sign_greyscale.png", "default_sign_greyscale.png",
|
||||
"Bamboo Sign")
|
||||
mcl_signs.register_sign_craft("mcl_bamboo", "mcl_bamboo:bamboo_plank", "_bamboo")
|
||||
mcl_signs.register_sign_craft("mcl_bamboo", BAMBOO_PLANK, "_bamboo")
|
||||
minetest.register_alias("bamboo_sign", "mcl_signs:wall_sign_bamboo")
|
||||
end
|
||||
end
|
||||
@ -198,7 +204,6 @@ if minetest.get_modpath("mcl_fences") then
|
||||
mcl_bamboo.mcl_log("Fences Section Entrance. Modpath exists.")
|
||||
|
||||
local id = "bamboo_fence"
|
||||
local id_gate = "bamboo_fence_gate"
|
||||
local wood_groups = {handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20}
|
||||
local wood_connect = {"group:fence_wood"}
|
||||
|
||||
@ -209,24 +214,6 @@ if minetest.get_modpath("mcl_fences") then
|
||||
|
||||
mcl_bamboo.mcl_log(dump(fence_id))
|
||||
mcl_bamboo.mcl_log(dump(gate_id))
|
||||
|
||||
local craft_wood = "mcl_bamboo:bamboo_plank"
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:" .. id .. " 3",
|
||||
recipe = {
|
||||
{craft_wood, "mcl_core:stick", craft_wood},
|
||||
{craft_wood, "mcl_core:stick", craft_wood},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:" .. id_gate,
|
||||
recipe = {
|
||||
{"mcl_core:stick", craft_wood, "mcl_core:stick"},
|
||||
{"mcl_core:stick", craft_wood, "mcl_core:stick"},
|
||||
}
|
||||
})
|
||||
minetest.register_alias("bamboo_fence", "mcl_fences:" .. id)
|
||||
minetest.register_alias("bamboo_fence_gate", "mcl_fences:" .. id_gate)
|
||||
end
|
||||
|
||||
if minetest.get_modpath("mesecons_button") then
|
||||
@ -235,7 +222,7 @@ if minetest.get_modpath("mesecons_button") then
|
||||
"bamboo",
|
||||
S("Bamboo Button"),
|
||||
"mcl_bamboo_bamboo_plank.png",
|
||||
"mcl_bamboo:bamboo_plank",
|
||||
BAMBOO_PLANK,
|
||||
node_sound,
|
||||
{material_wood = 1, handy = 1, pickaxey = 1, flammable = 3, fire_flammability = 20, fire_encouragement = 5, },
|
||||
1,
|
||||
@ -257,15 +244,12 @@ if minetest.get_modpath("mcl_stairs") then
|
||||
end
|
||||
end
|
||||
|
||||
local scaffold_name = "mcl_bamboo:scaffolding"
|
||||
local side_scaffold_name = "mcl_bamboo:scaffolding_horizontal"
|
||||
|
||||
local disallow_on_rotate
|
||||
if minetest.get_modpath("screwdriver") then
|
||||
disallow_on_rotate = screwdriver.disallow
|
||||
end
|
||||
|
||||
minetest.register_node(scaffold_name, {
|
||||
minetest.register_node(SCAFFOLDING_NAME, {
|
||||
description = S("Scaffolding"),
|
||||
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
||||
doc_items_hidden = false,
|
||||
@ -320,7 +304,7 @@ minetest.register_node(scaffold_name, {
|
||||
-- place on solid nodes
|
||||
-- Need to add in a check here... to prevent placing scaffolds against doors, chests, etc.
|
||||
-- Added in a quick check. need to test it.
|
||||
if node.name ~= scaffold_name then
|
||||
if node.name ~= SCAFFOLDING_NAME then
|
||||
-- this is a temp fix... will NOT work in final scaffolding implementation.
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
@ -335,7 +319,7 @@ minetest.register_node(scaffold_name, {
|
||||
local dir = vector.subtract(pointed.under, pointed.above)
|
||||
local wdir = minetest.dir_to_wallmounted(dir)
|
||||
if wdir == 1 then
|
||||
minetest.set_node(pointed.above, {name = scaffold_name, param2 = 0})
|
||||
minetest.set_node(pointed.above, {name = SCAFFOLDING_NAME, param2 = 0})
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item(1)
|
||||
end
|
||||
@ -357,9 +341,9 @@ minetest.register_node(scaffold_name, {
|
||||
pos = vector.offset(pos, 0, 1, 0) -- cleaned up vector.
|
||||
local cn = minetest.get_node(pos) -- current node.
|
||||
if cn.name == "air" then
|
||||
-- first step to making scaffolding work like Minecraft scaffolding.
|
||||
-- first step to making scaffolding work like scaffolding should.
|
||||
-- Prevent running up, and putting down new scaffolding
|
||||
if cnb.name == scaffold_name and bn == scaffold_name and SIDE_SCAFFOLDING == false then
|
||||
if cnb.name == SCAFFOLDING_NAME and bn == SCAFFOLDING_NAME and SIDE_SCAFFOLDING == false then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -384,7 +368,7 @@ minetest.register_node(scaffold_name, {
|
||||
-- Node destructor; called before removing node.
|
||||
local new_pos = vector.offset(pos, 0, 1, 0)
|
||||
local node_above = minetest.get_node(new_pos)
|
||||
if node_above and node_above.name == scaffold_name then
|
||||
if node_above and node_above.name == SCAFFOLDING_NAME then
|
||||
local sound_params = {
|
||||
pos = new_pos,
|
||||
gain = 1.0, -- default
|
||||
@ -393,7 +377,7 @@ minetest.register_node(scaffold_name, {
|
||||
|
||||
minetest.remove_node(new_pos)
|
||||
minetest.sound_play(node_sound.dug, sound_params, true)
|
||||
local istack = ItemStack(scaffold_name)
|
||||
local istack = ItemStack(SCAFFOLDING_NAME)
|
||||
minetest.add_item(new_pos, istack)
|
||||
end
|
||||
end,
|
||||
@ -403,7 +387,7 @@ minetest.register_node(scaffold_name, {
|
||||
-- YOU HAVE BEEN WARNED.
|
||||
--[[
|
||||
if SIDE_SCAFFOLDING then
|
||||
minetest.register_node(scaffold_name, {
|
||||
minetest.register_node(SCAFFOLDING_NAME, {
|
||||
description = S("Scaffolding"),
|
||||
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
||||
doc_items_hidden = false,
|
||||
@ -461,8 +445,8 @@ minetest.register_node(scaffold_name, {
|
||||
end
|
||||
mcl_bamboo.mcl_log("placement of scaffolding is not protected.")
|
||||
-- place on solid nodes
|
||||
if node.name ~= scaffold_name then
|
||||
minetest.set_node(pointed.above, {name = scaffold_name, param2 = 0})
|
||||
if node.name ~= SCAFFOLDING_NAME then
|
||||
minetest.set_node(pointed.above, {name = SCAFFOLDING_NAME, param2 = 0})
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item(1)
|
||||
end
|
||||
@ -476,7 +460,7 @@ minetest.register_node(scaffold_name, {
|
||||
local bn = down_two
|
||||
if cn.name == "air" then
|
||||
-- first step to making scaffolding work like Minecraft scaffolding.
|
||||
if cnb.name == scaffold_name and bn == scaffold_name and SIDE_SCAFFOLDING == false then
|
||||
if cnb.name == SCAFFOLDING_NAME and bn == SCAFFOLDING_NAME and SIDE_SCAFFOLDING == false then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -508,7 +492,7 @@ minetest.register_node(scaffold_name, {
|
||||
repeat
|
||||
local ctrl = placer:get_player_control()
|
||||
if ctrl and ctrl.sneak then
|
||||
if node.name == scaffold_name or node.name == side_scaffold_name then
|
||||
if node.name == SCAFFOLDING_NAME or node.name == SIDE_SCAFFOLD_NAME then
|
||||
local pp2 = h
|
||||
|
||||
local np2 = pp2 + 1
|
||||
@ -523,7 +507,7 @@ minetest.register_node(scaffold_name, {
|
||||
|
||||
itemstack:take_item(1)
|
||||
if minetest.get_node(new_pos).name == "air" then
|
||||
minetest.set_node(new_pos, {name = side_scaffold_name, param2 = np2})
|
||||
minetest.set_node(new_pos, {name = SIDE_SCAFFOLD_NAME, param2 = np2})
|
||||
if np2 >= 6 then
|
||||
np2 = 6
|
||||
minetest.minetest.dig_node(new_pos)
|
||||
@ -544,7 +528,7 @@ minetest.register_node(scaffold_name, {
|
||||
-- Node destructor; called before removing node.
|
||||
local new_pos = vector.offset(pos, 0, 1, 0)
|
||||
local node_above = minetest.get_node(new_pos)
|
||||
if node_above and node_above.name == scaffold_name then
|
||||
if node_above and node_above.name == SCAFFOLDING_NAME then
|
||||
local sound_params = {
|
||||
pos = new_pos,
|
||||
gain = 1.0, -- default
|
||||
@ -553,13 +537,13 @@ minetest.register_node(scaffold_name, {
|
||||
|
||||
minetest.remove_node(new_pos)
|
||||
minetest.sound_play(node_sound.dug, sound_params, true)
|
||||
local istack = ItemStack(scaffold_name)
|
||||
local istack = ItemStack(SCAFFOLDING_NAME)
|
||||
minetest.add_item(new_pos, istack)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(side_scaffold_name, {
|
||||
minetest.register_node(SIDE_SCAFFOLD_NAME, {
|
||||
description = S("Scaffolding"),
|
||||
doc_items_longdesc = S("Scaffolding block used to climb up or out across areas."),
|
||||
doc_items_hidden = false,
|
||||
@ -588,11 +572,11 @@ minetest.register_node(side_scaffold_name, {
|
||||
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 ~= scaffold_name then
|
||||
if minetest.get_node(vector.offset(pos, 0, 0, 0)).name ~= SCAFFOLDING_NAME then
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_item(pos, scaffold_name)
|
||||
minetest.add_item(pos, SCAFFOLDING_NAME)
|
||||
else
|
||||
minetest.set_node(vector.offset(pos, 0, 1, 0), {name = side_scaffold_name})
|
||||
minetest.set_node(vector.offset(pos, 0, 1, 0), {name = SIDE_SCAFFOLD_NAME})
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -56,6 +56,8 @@ function mcl_bamboo.is_protected(pos, placer)
|
||||
return false
|
||||
end
|
||||
|
||||
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
|
||||
|
||||
function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
|
||||
local node_above = minetest.get_node(vector.offset(pos, 0, 1, 0))
|
||||
mcl_bamboo.mcl_log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied))
|
||||
@ -133,14 +135,14 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
|
||||
chk_pos = vector.offset(pos, 0, py, 0)
|
||||
node_name = minetest.get_node(chk_pos).name
|
||||
dist = vector.distance(soil_pos, chk_pos)
|
||||
if mcl_bamboo.is_bamboo(node_name) == false or node_name == "mcl_bamboo:bamboo_endcap" then
|
||||
if mcl_bamboo.is_bamboo(node_name) == false or node_name == BAMBOO_ENDCAP_NAME then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist)
|
||||
|
||||
if node_name == "mcl_bamboo:bamboo_endcap" then
|
||||
if node_name == BAMBOO_ENDCAP_NAME then
|
||||
-- prevent overgrowth
|
||||
return false
|
||||
end
|
||||
@ -151,7 +153,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
|
||||
-- equals top of the stalk before the cap
|
||||
if node_name == "air" then
|
||||
mcl_bamboo.mcl_log("Grow bamboo; Placing endcap")
|
||||
minetest.set_node(vector.offset(chk_pos, 0, 1, 0), {name = "mcl_bamboo:bamboo_endcap"})
|
||||
minetest.set_node(vector.offset(chk_pos, 0, 1, 0), {name = BAMBOO_ENDCAP_NAME})
|
||||
return true -- returning true means use up the bonemeal.
|
||||
else
|
||||
return false
|
||||
@ -195,7 +197,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
|
||||
if node_name == "air" then
|
||||
if height - 1 == dist then
|
||||
mcl_bamboo.mcl_log("Grow bamboo; Placing endcap")
|
||||
minetest.set_node(chk_pos, {name = "mcl_bamboo:bamboo_endcap"})
|
||||
minetest.set_node(chk_pos, {name = BAMBOO_ENDCAP_NAME})
|
||||
end
|
||||
end
|
||||
break
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
-- LOCALS
|
||||
local modname = minetest.get_current_modname()
|
||||
local bamboo = "mcl_bamboo:bamboo"
|
||||
-- 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"
|
||||
|
||||
mcl_bamboo = {}
|
||||
|
||||
@ -24,7 +26,7 @@ dofile(minetest.get_modpath(modname) .. "/recipes.lua")
|
||||
|
||||
--ABMs
|
||||
minetest.register_abm({
|
||||
nodenames = {bamboo, bamboo .. "_1", bamboo .. "_2", bamboo .. "_3"},
|
||||
nodenames = mcl_bamboo.bamboo_index,
|
||||
interval = 31.5,
|
||||
chance = 40,
|
||||
action = function(pos, _)
|
||||
@ -33,26 +35,31 @@ minetest.register_abm({
|
||||
})
|
||||
|
||||
-- Base Aliases.
|
||||
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"
|
||||
minetest.register_alias("bamboo_block", "mcl_bamboo:bamboo_block")
|
||||
minetest.register_alias("bamboo_strippedblock", "mcl_bamboo:bamboo_block_stripped")
|
||||
minetest.register_alias("bamboo", "mcl_bamboo:bamboo")
|
||||
minetest.register_alias("bamboo", BAMBOO)
|
||||
minetest.register_alias("bamboo_plank", "mcl_bamboo:bamboo_plank")
|
||||
minetest.register_alias("bamboo_mosaic", "mcl_bamboo:bamboo_mosaic")
|
||||
|
||||
minetest.register_alias("mcl_stairs:stair_bamboo", "mcl_stairs:stair_bamboo_block")
|
||||
minetest.register_alias("bamboo:bamboo", "mcl_bamboo:bamboo")
|
||||
minetest.register_alias("scaffold", "mcl_bamboo:scaffolding")
|
||||
minetest.register_alias("mcl_scaffolding:scaffolding", "mcl_bamboo:scaffolding")
|
||||
minetest.register_alias("mcl_scaffolding:scaffolding_horizontal", "mcl_bamboo:scaffolding")
|
||||
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")
|
||||
|
||||
--[[
|
||||
todo -- make scaffolds do side scaffold blocks, so that they jut out.
|
||||
todo -- make scaffolds do side scaffold blocks, so that they jut out. (Shelved.)
|
||||
todo -- Also, make those blocks collapse (break) when a nearby connected scaffold breaks.
|
||||
|
||||
waiting on specific things:
|
||||
todo -- Raft -- need model
|
||||
todo -- Raft with Chest. same.
|
||||
todo -- handle bonemeal...
|
||||
todo -- handle bonemeal... (shelved until after redoing the bonemeal api).
|
||||
|
||||
-----------------------------------------------------------
|
||||
todo -- Add in Extras. -- Moved to Official Mod Pack.
|
||||
|
@ -4,43 +4,45 @@
|
||||
--- DateTime: 12/29/22 12:46 PM -- Restructure Date
|
||||
--- These are all of the fuel recipes and all of the crafting recipes, consolidated into one place.
|
||||
|
||||
local bamboo = "mcl_bamboo:bamboo"
|
||||
local bamboo_plank = bamboo .. "_plank"
|
||||
-- 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"
|
||||
local BAMBOO_PLANK = BAMBOO .. "_plank"
|
||||
-- Craftings
|
||||
-- Basic Bamboo craftings
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:stick",
|
||||
recipe = {
|
||||
{bamboo},
|
||||
{bamboo},
|
||||
{BAMBOO},
|
||||
{BAMBOO},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_block",
|
||||
output = BAMBOO .. "_block",
|
||||
recipe = {
|
||||
{bamboo, bamboo, bamboo},
|
||||
{bamboo, bamboo, bamboo},
|
||||
{bamboo, bamboo, bamboo},
|
||||
{BAMBOO, BAMBOO, BAMBOO},
|
||||
{BAMBOO, BAMBOO, BAMBOO},
|
||||
{BAMBOO, BAMBOO, BAMBOO},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo_plank .. " 2",
|
||||
output = BAMBOO_PLANK .. " 2",
|
||||
recipe = {
|
||||
{bamboo .. "_block"},
|
||||
{BAMBOO .. "_block"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo_plank .. " 2",
|
||||
output = BAMBOO_PLANK .. " 2",
|
||||
recipe = {
|
||||
{bamboo .. "_block_stripped"},
|
||||
{BAMBOO .. "_block_stripped"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = bamboo .. "_mosaic",
|
||||
output = BAMBOO .. "_mosaic",
|
||||
recipe = {
|
||||
{"mcl_stair:slab_bamboo_plank"},
|
||||
{"mcl_stair:slab_bamboo_plank"},
|
||||
@ -49,62 +51,76 @@ minetest.register_craft({
|
||||
|
||||
-- Bamboo specific items
|
||||
|
||||
if minetest.get_modpath("mcl_doors") then
|
||||
if mcl_doors then
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_door 3",
|
||||
recipe = {
|
||||
{bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_trapdoor 2",
|
||||
recipe = {
|
||||
{bamboo_plank, bamboo_plank, bamboo_plank},
|
||||
{bamboo_plank, bamboo_plank, bamboo_plank},
|
||||
}
|
||||
})
|
||||
end
|
||||
if minetest.get_modpath("mcl_doors") and mcl_doors then
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_door 3",
|
||||
recipe = {
|
||||
{BAMBOO_PLANK, BAMBOO_PLANK},
|
||||
{BAMBOO_PLANK, BAMBOO_PLANK},
|
||||
{BAMBOO_PLANK, BAMBOO_PLANK}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_trapdoor 2",
|
||||
recipe = {
|
||||
{BAMBOO_PLANK, BAMBOO_PLANK, BAMBOO_PLANK},
|
||||
{BAMBOO_PLANK, BAMBOO_PLANK, BAMBOO_PLANK},
|
||||
}
|
||||
})
|
||||
end
|
||||
if minetest.get_modpath("mcl_fences") then
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_fence 3",
|
||||
recipe = {
|
||||
{BAMBOO_PLANK, "mcl_core:stick", BAMBOO_PLANK},
|
||||
{BAMBOO_PLANK, "mcl_core:stick", BAMBOO_PLANK},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:bamboo_fence_gate",
|
||||
recipe = {
|
||||
{"mcl_core:stick", BAMBOO_PLANK, "mcl_core:stick"},
|
||||
{"mcl_core:stick", BAMBOO_PLANK, "mcl_core:stick"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_bamboo:scaffolding 6",
|
||||
recipe = {{bamboo, "mcl_mobitems:string", bamboo},
|
||||
{bamboo, "", bamboo},
|
||||
{bamboo, "", bamboo}}
|
||||
recipe = {{BAMBOO, "mcl_mobitems:string", BAMBOO},
|
||||
{BAMBOO, "", BAMBOO},
|
||||
{BAMBOO, "", BAMBOO}}
|
||||
})
|
||||
|
||||
-- Fuels
|
||||
-- Basic Bamboo nodes
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo,
|
||||
recipe = BAMBOO,
|
||||
burntime = 2.5, -- supposed to be 1/2 that of a stick, per minecraft wiki as of JE 1.19.3
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_block",
|
||||
recipe = BAMBOO .. "_block",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_block_stripped",
|
||||
recipe = BAMBOO .. "_block_stripped",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo_plank,
|
||||
recipe = BAMBOO_PLANK,
|
||||
burntime = 7.5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = bamboo .. "_mosaic",
|
||||
recipe = BAMBOO .. "_mosaic",
|
||||
burntime = 7.5,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user