Merge pull request 'Bamboo Piston Fix.' (#3424) from Bamboo_Piston_fix into master

Reviewed-on: MineClone2/MineClone2#3424
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
ancientmarinerdev 2023-02-10 03:49:40 +00:00
commit 6b8226dae3
7 changed files with 109 additions and 38 deletions

View File

@ -477,6 +477,19 @@ mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_black")
mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_brown") mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_brown")
mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_light_blue") mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_light_blue")
mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_pink") mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_pink")
-- Bamboo
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_endcap")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_1")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_2")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_3")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_door")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_trapdoor")
mesecon.register_mvps_unsticky("mcl_signs:wall_sign_bamboo")
mesecon.register_mvps_unsticky("mcl_bamboo:scaffolding")
-- Beds -- Beds
mesecon.register_mvps_unsticky("mcl_beds:bed_black_top") mesecon.register_mvps_unsticky("mcl_beds:bed_black_top")
mesecon.register_mvps_unsticky("mcl_beds:bed_black_bottom") mesecon.register_mvps_unsticky("mcl_beds:bed_black_bottom")

View File

@ -29,7 +29,7 @@ local bamboo_def = {
tiles = {"mcl_bamboo_bamboo_bottom.png", "mcl_bamboo_bamboo_bottom.png", "mcl_bamboo_bamboo.png"}, tiles = {"mcl_bamboo_bamboo_bottom.png", "mcl_bamboo_bamboo_bottom.png", "mcl_bamboo_bamboo.png"},
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
groups = {handy = 1, axey = 1, choppy = 1, flammable = 3}, groups = {handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3},
sounds = node_sound, sounds = node_sound,
drop = { drop = {
@ -293,7 +293,6 @@ local bamboo_block_def = {
return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under))) return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
end, end,
} }
minetest.register_node("mcl_bamboo:bamboo_block", bamboo_block_def) minetest.register_node("mcl_bamboo:bamboo_block", bamboo_block_def)

View File

@ -35,7 +35,7 @@ if minetest.get_modpath("mcl_flowerpots") then
if mcl_flowerpots ~= nil then if mcl_flowerpots ~= nil then
-- Flower-potted Bamboo... -- Flower-potted Bamboo...
local flwr_name = BAMBOO local flwr_name = BAMBOO
local flwr_def = {name = "bamboo_plant", local flwr_def = { name = "bamboo_plant",
desc = S("Bamboo"), desc = S("Bamboo"),
image = "mcl_bamboo_bamboo_fpm.png", -- use with "register_potted_cube" image = "mcl_bamboo_bamboo_fpm.png", -- use with "register_potted_cube"
-- "mcl_bamboo_flower_pot.png", -- use with "register_potted_flower" -- "mcl_bamboo_flower_pot.png", -- use with "register_potted_flower"
@ -53,11 +53,11 @@ if minetest.get_modpath("mcl_doors") then
local bot_door_tiles = {} local bot_door_tiles = {}
if BROKEN_DOORS then if BROKEN_DOORS then
top_door_tiles = {"mcl_bamboo_door_top_alt.png", "mcl_bamboo_door_top.png"} top_door_tiles = { "mcl_bamboo_door_top_alt.png", "mcl_bamboo_door_top.png" }
bot_door_tiles = {"mcl_bamboo_door_bottom_alt.png", "mcl_bamboo_door_bottom.png"} bot_door_tiles = { "mcl_bamboo_door_bottom_alt.png", "mcl_bamboo_door_bottom.png" }
else else
top_door_tiles = {"mcl_bamboo_door_top.png", "mcl_bamboo_door_top.png"} top_door_tiles = { "mcl_bamboo_door_top.png", "mcl_bamboo_door_top.png" }
bot_door_tiles = {"mcl_bamboo_door_bottom.png", "mcl_bamboo_door_bottom.png"} bot_door_tiles = { "mcl_bamboo_door_bottom.png", "mcl_bamboo_door_bottom.png" }
end end
local name = "mcl_bamboo:bamboo_door" local name = "mcl_bamboo:bamboo_door"
@ -65,7 +65,7 @@ if minetest.get_modpath("mcl_doors") then
description = S("Bamboo Door."), description = S("Bamboo Door."),
inventory_image = "mcl_bamboo_door_wield.png", inventory_image = "mcl_bamboo_door_wield.png",
wield_image = "mcl_bamboo_door_wield.png", wield_image = "mcl_bamboo_door_wield.png",
groups = {handy = 1, axey = 1, material_wood = 1, flammable = -1}, groups = { handy = 1, axey = 1, material_wood = 1, flammable = -1 },
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
tiles_bottom = bot_door_tiles, tiles_bottom = bot_door_tiles,
@ -86,7 +86,7 @@ if minetest.get_modpath("mcl_doors") then
_doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."), _doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."),
wield_image = "mcl_bamboo_trapdoor_side.png", wield_image = "mcl_bamboo_trapdoor_side.png",
inventory_image = "mcl_bamboo_trapdoor_side.png", inventory_image = "mcl_bamboo_trapdoor_side.png",
groups = {handy = 1, axey = 1, mesecon_effector_on = 1, material_wood = 1, flammable = -1}, groups = { handy = 1, axey = 1, mesecon_effector_on = 1, material_wood = 1, flammable = -1 },
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -137,7 +137,7 @@ if minetest.get_modpath("mcl_stairs") then
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
@ -168,13 +168,13 @@ if minetest.get_modpath("mesecons_pressureplates") then
mesecon.register_pressure_plate( mesecon.register_pressure_plate(
"mcl_bamboo:pressure_plate_bamboo_wood", "mcl_bamboo:pressure_plate_bamboo_wood",
S("Bamboo Pressure Plate"), S("Bamboo Pressure Plate"),
{"mcl_bamboo_bamboo_plank.png"}, { "mcl_bamboo_bamboo_plank.png" },
{"mcl_bamboo_bamboo_plank.png"}, { "mcl_bamboo_bamboo_plank.png" },
"mcl_bamboo_bamboo_plank.png", "mcl_bamboo_bamboo_plank.png",
nil, nil,
{{BAMBOO_PLANK, BAMBOO_PLANK}}, { { BAMBOO_PLANK, BAMBOO_PLANK } },
mcl_sounds.node_sound_wood_defaults(), mcl_sounds.node_sound_wood_defaults(),
{axey = 1, material_wood = 1}, { axey = 1, material_wood = 1 },
nil, nil,
S("A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.")) S("A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."))
@ -204,8 +204,8 @@ if minetest.get_modpath("mcl_fences") then
mcl_bamboo.mcl_log("Fences Section Entrance. Modpath exists.") mcl_bamboo.mcl_log("Fences Section Entrance. Modpath exists.")
local id = "bamboo_fence" local id = "bamboo_fence"
local wood_groups = {handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20} local wood_groups = { handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20 }
local wood_connect = {"group:fence_wood"} local wood_connect = { "group:fence_wood" }
local fence_id = mcl_fences.register_fence(id, S("Bamboo Fence"), "mcl_bamboo_fence_bamboo.png", wood_groups, local fence_id = mcl_fences.register_fence(id, S("Bamboo Fence"), "mcl_bamboo_fence_bamboo.png", wood_groups,
2, 15, wood_connect, node_sound) 2, 15, wood_connect, node_sound)
@ -224,7 +224,7 @@ if minetest.get_modpath("mesecons_button") then
"mcl_bamboo_bamboo_plank.png", "mcl_bamboo_bamboo_plank.png",
BAMBOO_PLANK, BAMBOO_PLANK,
node_sound, node_sound,
{material_wood = 1, handy = 1, pickaxey = 1, flammable = 3, fire_flammability = 20, fire_encouragement = 5, }, { material_wood = 1, handy = 1, pickaxey = 1, flammable = 3, fire_flammability = 20, fire_encouragement = 5, },
1, 1,
false, false,
S("A bamboo button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."), S("A bamboo button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."),
@ -253,24 +253,24 @@ minetest.register_node(SCAFFOLDING_NAME, {
description = S("Scaffolding"), description = S("Scaffolding"),
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" },
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
use_texture_alpha = "clip", use_texture_alpha = "clip",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, { -0.5, 0.375, -0.5, 0.5, 0.5, 0.5 },
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375}, { -0.5, -0.5, -0.5, -0.375, 0.5, -0.375 },
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375}, { 0.375, -0.5, -0.5, 0.5, 0.5, -0.375 },
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5}, { 0.375, -0.5, 0.375, 0.5, 0.5, 0.5 },
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5}, { -0.5, -0.5, 0.375, -0.375, 0.5, 0.5 },
} }
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
}, },
}, },
buildable_to = false, buildable_to = false,
@ -279,7 +279,7 @@ minetest.register_node(SCAFFOLDING_NAME, {
climbable = true, climbable = true,
physical = true, physical = true,
node_placement_prediction = "", node_placement_prediction = "",
groups = {handy = 1, axey = 1, flammable = 3, building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, falling_node = 1, stack_falling = 1}, groups = { handy = 1, axey = 1, flammable = 3, building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, dig_by_piston = 1, falling_node = 1, stack_falling = 1 },
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
_mcl_hardness = 0, _mcl_hardness = 0,
@ -319,7 +319,7 @@ minetest.register_node(SCAFFOLDING_NAME, {
local dir = vector.subtract(pointed.under, pointed.above) local dir = vector.subtract(pointed.under, pointed.above)
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
if wdir == 1 then if wdir == 1 then
minetest.set_node(pointed.above, {name = SCAFFOLDING_NAME, param2 = 0}) minetest.set_node(pointed.above, { name = SCAFFOLDING_NAME, param2 = 0 })
if not minetest.is_creative_enabled(placer:get_player_name()) then if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item(1) itemstack:take_item(1)
end end

View File

@ -67,6 +67,32 @@ end
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap" local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
-- For when I learn more about the pistons...
function mcl_bamboo.break_orphaned(pos)
mcl_bamboo.mcl_log("Break_Orphaned called.")
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))
local node_name = node_below.name
-- 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
-- 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
--]]
function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
local node_above = minetest.get_node(vector.offset(pos, 0, 1, 0)) local node_above = minetest.get_node(vector.offset(pos, 0, 1, 0))
mcl_bamboo.mcl_log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied)) mcl_bamboo.mcl_log("Grow bamboo called; bonemeal: " .. tostring(bonemeal_applied))
@ -161,7 +187,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
-- equals top of the stalk before the cap -- equals top of the stalk before the cap
if node_name == "air" then if node_name == "air" then
mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") mcl_bamboo.mcl_log("Grow bamboo; Placing endcap")
minetest.set_node(vector.offset(chk_pos, 0, 1, 0), {name = BAMBOO_ENDCAP_NAME}) minetest.set_node(vector.offset(chk_pos, 0, 1, 0), { name = BAMBOO_ENDCAP_NAME })
return true -- returning true means use up the bonemeal. return true -- returning true means use up the bonemeal.
else else
return false return false
@ -178,13 +204,13 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
if node_name == "air" then if node_name == "air" then
-- here we can check to see if we can do up to 2 bamboo shoots onto the stalk -- here we can check to see if we can do up to 2 bamboo shoots onto the stalk
mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.")
minetest.set_node(chk_pos, {name = node_below}) minetest.set_node(chk_pos, { name = node_below })
-- handle growing a second node. -- handle growing a second node.
if grow_amount == 2 then if grow_amount == 2 then
chk_pos = vector.offset(chk_pos, 0, 1, 0) chk_pos = vector.offset(chk_pos, 0, 1, 0)
if minetest.get_node(chk_pos).name == "air" then if minetest.get_node(chk_pos).name == "air" then
mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!")
minetest.set_node(chk_pos, {name = node_below}) minetest.set_node(chk_pos, { name = node_below })
end end
end end
return true -- exit out with a success. We've added 1-2 nodes, per the wiki. return true -- exit out with a success. We've added 1-2 nodes, per the wiki.
@ -210,7 +236,7 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
if node_name == "air" and above_node_name == "air" then if node_name == "air" and above_node_name == "air" then
if height - 1 == dist then if height - 1 == dist then
mcl_bamboo.mcl_log("Grow bamboo; Placing endcap") mcl_bamboo.mcl_log("Grow bamboo; Placing endcap")
minetest.set_node(chk_pos, {name = BAMBOO_ENDCAP_NAME}) minetest.set_node(chk_pos, { name = BAMBOO_ENDCAP_NAME })
end end
end end
break break
@ -222,13 +248,13 @@ function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)
if node_name == "air" then if node_name == "air" then
mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist) mcl_bamboo.mcl_log("Grow bamboo; dist: " .. dist)
mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.") mcl_bamboo.mcl_log("Grow bamboo; Placing bamboo.")
minetest.set_node(chk_pos, {name = node_below}) minetest.set_node(chk_pos, { name = node_below })
-- handle growing a second node. (1 in 32 chance.) -- handle growing a second node. (1 in 32 chance.)
if grow_amount == 2 and dist <= height - 2 then if grow_amount == 2 and dist <= height - 2 then
chk_pos = vector.offset(chk_pos, 0, 1, 0) chk_pos = vector.offset(chk_pos, 0, 1, 0)
if minetest.get_node(chk_pos).name == "air" then if minetest.get_node(chk_pos).name == "air" then
mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!") mcl_bamboo.mcl_log("Grow bamboo; OOOH! It's twofer day!")
minetest.set_node(chk_pos, {name = node_below}) minetest.set_node(chk_pos, { name = node_below })
end end
end end
break break
@ -251,7 +277,7 @@ function mcl_bamboo.add_groups(name, ...)
return add_all(...) return add_all(...)
end end
addall(...) addall(...)
return minetest.override_item(name, {groups = groups}) return minetest.override_item(name, { groups = groups })
end end
function mcl_bamboo.mcl_log(m, l) function mcl_bamboo.mcl_log(m, l)

View File

@ -26,6 +26,7 @@ dofile(minetest.get_modpath(modname) .. "/recipes.lua")
--ABMs --ABMs
minetest.register_abm({ minetest.register_abm({
label = "Bamboo Grow",
nodenames = mcl_bamboo.bamboo_index, nodenames = mcl_bamboo.bamboo_index,
interval = 10, interval = 10,
chance = 20, chance = 20,
@ -34,6 +35,38 @@ minetest.register_abm({
end, end,
}) })
--[[ TODO: Figure out how to make this work:
local function dropper_call(node, pushdir, stack, stackid)
mcl_bamboo.mcl_log("mvps_dropper call for bamboo:")
-- mcl_bamboo.break_orphaned()
mcl_bamboo.mcl_log(dump(node))
end
if minetest.get_modpath("mesecons_mvps") then
if mesecon then
mcl_bamboo.mcl_log("registering mvps_dropper for bamboo:")
for x = 1, #mcl_bamboo.bamboo_index do
mesecon.register_mvps_dropper(mcl_bamboo.bamboo_index[x],dropper_call)
mcl_bamboo.mcl_log("registering: " .. mcl_bamboo.bamboo_index[x])
end
end
else
end
--]]
minetest.register_abm({
label = "Break Orphaned Bamboo",
nodenames = mcl_bamboo.bamboo_index,
interval = 1.5,
chance = 1,
action = function(pos, _)
mcl_bamboo.break_orphaned(pos)
end,
})
-- Base Aliases. -- Base Aliases.
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding" local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"
minetest.register_alias("bamboo_block", "mcl_bamboo:bamboo_block") minetest.register_alias("bamboo_block", "mcl_bamboo:bamboo_block")

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 optional_depends = mcl_flowerpots, mclx_stairs, mcl_doors, mcl_signs, mesecons_pressureplates, mcl_fences, mesecons_button, mesecons_mvps
author = Michieal author = Michieal

View File

@ -45,8 +45,8 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = BAMBOO .. "_mosaic", output = BAMBOO .. "_mosaic",
recipe = { recipe = {
{"mcl_stair:slab_bamboo_plank"}, {"mcl_stairs:slab_bamboo_plank"},
{"mcl_stair:slab_bamboo_plank"}, {"mcl_stairs:slab_bamboo_plank"},
} }
}) })