forked from VoxeLibre/VoxeLibre
Cocoas now use attached_node_facedir
This fixes some annoying bugs when removing jungle trees nearby
This commit is contained in:
parent
33386b19ca
commit
d4d03526db
|
@ -68,12 +68,7 @@ end
|
||||||
-- Cocoa definition
|
-- Cocoa definition
|
||||||
-- 1st stage
|
-- 1st stage
|
||||||
|
|
||||||
--[[ TODO (code quality): Turn the cocoa nodes into attached nodes and make use of wallmounted. This is much better
|
--[[ TODO: Use a mesh for cocoas for perfect texture compability. ]]
|
||||||
than the current ugly hacky check after digging a jungle tree (in mcl_core).
|
|
||||||
Problem: If we want to use wallmounted, we MUST use a mesh, since wallmounted does not support
|
|
||||||
nodeboxes with multiple boxes. :-(
|
|
||||||
Using meshes will also clean up the texture mess.
|
|
||||||
]]
|
|
||||||
local crop_def = {
|
local crop_def = {
|
||||||
description = "Premature Cocoa",
|
description = "Premature Cocoa",
|
||||||
_doc_items_create_entry = true,
|
_doc_items_create_entry = true,
|
||||||
|
@ -110,7 +105,7 @@ local crop_def = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
handy=1,axey=1, cocoa=1, not_in_creative_inventory=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1
|
handy=1,axey=1, cocoa=1, not_in_creative_inventory=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, attached_node_facedir=1,
|
||||||
},
|
},
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
_mcl_blast_resistance = 15,
|
_mcl_blast_resistance = 15,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves
|
-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves
|
||||||
|
|
||||||
local register_tree_trunk = function(subname, description, longdesc, tiles, after_dig_node)
|
local register_tree_trunk = function(subname, description, longdesc, tiles)
|
||||||
minetest.register_node("mcl_core:"..subname, {
|
minetest.register_node("mcl_core:"..subname, {
|
||||||
description = description,
|
description = description,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
|
@ -13,8 +13,6 @@ local register_tree_trunk = function(subname, description, longdesc, tiles, afte
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
_mcl_blast_resistance = 10,
|
_mcl_blast_resistance = 10,
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
|
|
||||||
after_dig_node = after_dig_node,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -118,29 +116,6 @@ end
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
-- This is a bad bad workaround which is only done because cocoas are not wallmounted (but should)
|
|
||||||
-- As long cocoas only EVER stick to jungle trees, and nothing else, this is probably a lesser sin.
|
|
||||||
local jungle_tree_after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
-- Drop attached cocoas
|
|
||||||
local posses = {
|
|
||||||
{ x = pos.x + 1, y = pos.y, z = pos.z },
|
|
||||||
{ x = pos.x - 1, y = pos.y, z = pos.z },
|
|
||||||
{ x = pos.x, y = pos.y, z = pos.z + 1 },
|
|
||||||
{ x = pos.x, y = pos.y, z = pos.z - 1 },
|
|
||||||
}
|
|
||||||
for p=1, #posses do
|
|
||||||
local node = minetest.get_node(posses[p])
|
|
||||||
local g = minetest.get_item_group(node.name, "cocoa")
|
|
||||||
if g and g >= 1 then
|
|
||||||
minetest.remove_node(posses[p])
|
|
||||||
local drops = minetest.get_node_drops(node.name, "")
|
|
||||||
for d=1, #drops do
|
|
||||||
minetest.add_item(posses[p], drops[d])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
register_tree_trunk("tree", "Oak Wood", "The trunk of an oak tree.", {"default_tree_top.png", "default_tree_top.png", "default_tree.png"})
|
register_tree_trunk("tree", "Oak Wood", "The trunk of an oak tree.", {"default_tree_top.png", "default_tree_top.png", "default_tree.png"})
|
||||||
register_tree_trunk("darktree", "Dark Oak Wood", "The trunk of a dark oak tree.", {"mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png"})
|
register_tree_trunk("darktree", "Dark Oak Wood", "The trunk of a dark oak tree.", {"mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png"})
|
||||||
register_tree_trunk("acaciatree", "Acacia Wood", "The trunk of an acacia.", {"default_acacia_tree_top.png", "default_acacia_tree_top.png", "default_acacia_tree.png"})
|
register_tree_trunk("acaciatree", "Acacia Wood", "The trunk of an acacia.", {"default_acacia_tree_top.png", "default_acacia_tree_top.png", "default_acacia_tree.png"})
|
||||||
|
@ -148,8 +123,7 @@ register_tree_trunk("darktree", "Dark Oak Wood", "The trunk of a dark oak tree."
|
||||||
register_tree_trunk("sprucetree", "Spruce Wood", "The trunk of a spruce tree.", {"mcl_core_log_spruce_top.png", "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png"})
|
register_tree_trunk("sprucetree", "Spruce Wood", "The trunk of a spruce tree.", {"mcl_core_log_spruce_top.png", "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png"})
|
||||||
register_tree_trunk("birchtree", "Birch Wood", "The trunk of a birch tree.", {"mcl_core_log_birch_top.png", "mcl_core_log_birch_top.png", "mcl_core_log_birch.png"})
|
register_tree_trunk("birchtree", "Birch Wood", "The trunk of a birch tree.", {"mcl_core_log_birch_top.png", "mcl_core_log_birch_top.png", "mcl_core_log_birch.png"})
|
||||||
|
|
||||||
register_tree_trunk("jungletree", "Jungle Wood", "The trunk of a jungle tree.", {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, jungle_tree_after_dig_node)
|
register_tree_trunk("jungletree", "Jungle Wood", "The trunk of a jungle tree.", {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"})
|
||||||
|
|
||||||
|
|
||||||
register_wooden_planks("wood", "Oak Wood Planks", {"default_wood.png"})
|
register_wooden_planks("wood", "Oak Wood Planks", {"default_wood.png"})
|
||||||
register_wooden_planks("darkwood", "Dark Oak Wood Planks", {"mcl_core_planks_big_oak.png"})
|
register_wooden_planks("darkwood", "Dark Oak Wood Planks", {"mcl_core_planks_big_oak.png"})
|
||||||
|
|
Loading…
Reference in New Issue