diff --git a/trunks/crafting.lua b/trunks/crafting.lua index 7aa5c09..3f3d8b9 100644 --- a/trunks/crafting.lua +++ b/trunks/crafting.lua @@ -1,4 +1,132 @@ +----------------------------------------------------------------------------------------------- +-- TWiGS +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- *leaves --> twigs + output = "trunks:twig_1 2", + recipe = {{"group:leafdecay"}} +}) +if minetest.get_modpath("moretrees") ~= nil then +minetest.register_craft({ -- moretrees_leaves --> twigs + output = "trunks:twig_1 2", + recipe = {{"group:moretrees_leaves"}} +}) +minetest.register_craft({ -- except moretrees:palm_leaves + output = "moretrees:palm_leaves", + recipe = {{"moretrees:palm_leaves"}} +}) +end +if minetest.get_modpath("bushes") ~= nil then +minetest.register_craft({ -- BushLeaves --> twigs + output = "trunks:twig_1 2", + recipe = {{"bushes:BushLeaves1"}} +}) minetest.register_craft({ + output = "trunks:twig_1 2", + recipe = {{"bushes:BushLeaves2"}} +}) +minetest.register_craft({ -- bushbranches --> twigs + output = "trunks:twig_1 4", + recipe = {{"bushes:bushbranches1"}} +}) +minetest.register_craft({ + output = "trunks:twig_1 4", + recipe = {{"bushes:bushbranches2"}} +}) +minetest.register_craft({ + output = "trunks:twig_1 4", + recipe = {{"bushes:bushbranches2a"}} +}) +minetest.register_craft({ + output = "trunks:twig_1 4", + recipe = {{"bushes:bushbranches3"}} +}) +end +minetest.register_craft({ -- twigs block --> twigs + output = "trunks:twig_1 8", + recipe = {{"trunks:twigs"}} +}) +minetest.register_craft({ -- twigs_slab --> twigs + output = "trunks:twig_1 4", + recipe = {{"trunks:twigs_slab"}} +}) +minetest.register_craft({ -- twigs_roof --> twigs + output = "trunks:twig_1 4", + recipe = {{"trunks:twigs_roof"}} +}) +minetest.register_craft({ -- twigs_roof_corner --> twigs + output = "trunks:twig_1 3", + recipe = {{"trunks:twigs_roof_corner"}} +}) +minetest.register_craft({ -- twigs_roof_corner_2 --> twigs + output = "trunks:twig_1 3", + recipe = {{"trunks:twigs_roof_corner_2"}} +}) +----------------------------------------------------------------------------------------------- +-- STiCK +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twig --> stick output = "default:stick", recipe = {{"trunks:twig_1"}} +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS BLoCK +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twigs --> twigs block + output = "trunks:twigs", + recipe = { + {"trunks:twig_1","trunks:twig_1","trunks:twig_1"}, + {"trunks:twig_1", "" ,"trunks:twig_1"}, + {"trunks:twig_1","trunks:twig_1","trunks:twig_1"}, + } +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS SLaBS +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twigs blocks --> twigs_slabs + output = "trunks:twigs_slab 6", + recipe = { + {"trunks:twigs","trunks:twigs","trunks:twigs"}, + } +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooFS +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twigs blocks --> twigs_roofs + output = "trunks:twigs_roof 4", + recipe = { + {"trunks:twigs",""}, + {"","trunks:twigs"}, + } +}) +minetest.register_craft({ + output = "trunks:twigs_roof 4", + recipe = { + {"","trunks:twigs"}, + {"trunks:twigs",""}, + } +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooF CoRNeRS +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twigs blocks --> twigs_roof_corners + output = "trunks:twigs_roof_corner 8", + recipe = { + { "" ,"trunks:twigs", "" }, + {"trunks:twigs", "" ,"trunks:twigs"}, + } +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooF CoRNeRS 2 +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- twigs blocks --> twigs_roof_corner_2's + output = "trunks:twigs_roof_corner_2 8", + recipe = { + {"trunks:twigs", "" ,"trunks:twigs"}, + { "" ,"trunks:twigs", "" }, + } }) \ No newline at end of file diff --git a/trunks/init.lua b/trunks/init.lua index 85e4c82..ba380bb 100644 --- a/trunks/init.lua +++ b/trunks/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Trunks" -local version = "0.0.6" +local version = "0.0.7" local mname = "trunks" ----------------------------------------------------------------------------------------------- diff --git a/trunks/nodes.lua b/trunks/nodes.lua index 6dda080..7496a1a 100644 --- a/trunks/nodes.lua +++ b/trunks/nodes.lua @@ -79,3 +79,199 @@ minetest.register_node("trunks:moss_fungus", { groups = {dig_immediate=2,attached_node=1}, sounds = default.node_sound_leaves_defaults(), }) + +----------------------------------------------------------------------------------------------- +-- TWiGS BLoCK +----------------------------------------------------------------------------------------------- +minetest.register_alias("woodstuff:twigs", "trunks:twigs") + +minetest.register_node("trunks:twigs", { + description = "Twigs Block", + paramtype2 = "facedir", + tiles = {"trunks_twigs.png"}, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS SLaB +----------------------------------------------------------------------------------------------- +minetest.register_alias("woodstuff:twigs_slab", "trunks:twigs_slab") + +minetest.register_node("trunks:twigs_slab", { + description = "Twigs Slab", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"trunks_twigs.png"}, + node_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, + }, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooF +----------------------------------------------------------------------------------------------- +minetest.register_alias("woodstuff:twigs_roof", "trunks:twigs_roof") + +minetest.register_node("trunks:twigs_roof", { + description = "Twigs Roof", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"trunks_twigs.png"}, + node_box = { + type = "fixed", +-- { left, bottom, front, right, top, back } + fixed = { + {-1/2, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, -1/2, -1/2, 1/2, 0, 0}, + } + }, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooF CoRNeR +----------------------------------------------------------------------------------------------- +minetest.register_alias("woodstuff:twigs_roof_corner", "trunks:twigs_roof_corner") + +minetest.register_node("trunks:twigs_roof_corner", { + description = "Twigs Roof Corner", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "trunks_twigs_corner.png", + "trunks_twigs_corner.png", + "trunks_twigs.png" + }, + node_box = { + type = "fixed", +-- { left, bottom, front, right, top, back } + fixed = { + {-1/2, 0, 0, 0, 1/2, 1/2}, + {0, -1/2, 0, 1/2, 0, 1/2}, + {-1/2, -1/2, -1/2, 0, 0, 0}, + } + }, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- TWiGS RooF CoRNeR 2 +----------------------------------------------------------------------------------------------- +minetest.register_alias("woodstuff:twigs_roof_corner_2", "trunks:twigs_roof_corner_2") + +minetest.register_node("trunks:twigs_roof_corner_2", { + description = "Twigs Roof Corner 2", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "trunks_twigs_corner.png", + "trunks_twigs_corner.png", + "trunks_twigs.png" + }, + node_box = { + type = "fixed", +-- { left, bottom, front, right, top, back } + fixed = { + {-1/2, -1/2, 0, 0, 0, 1/2}, + {0, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, 0, -1/2, 0, 1/2, 0}, + } + }, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +if Auto_Roof_Corner == true then + + local roof = "trunks:twigs_roof" + local corner = "trunks:twigs_roof_corner" + local corner_2 = "trunks:twigs_roof_corner_2" + + minetest.register_abm({ + nodenames = {roof}, + interval = 1, + chance = 1, + action = function(pos) + + local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) + local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) + local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) + local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) + -- corner 1 + if ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner and node_north.param2 == 3)) + then + minetest.add_node(pos, {name=corner, param2=0}) + end + + if ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner and node_east.param2 == 0)) + then + minetest.add_node(pos, {name=corner, param2=1}) + end + + if ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner and node_south.param2 == 1)) + then + minetest.add_node(pos, {name=corner, param2=2}) + end + + if ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner and node_west.param2 == 2)) + then + minetest.add_node(pos, {name=corner, param2=3}) + end + -- corner 2 + if ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner_2 and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner_2 and node_north.param2 == 3)) + then + minetest.add_node(pos, {name=corner_2, param2=0}) + end + + if ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner_2 and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner_2 and node_east.param2 == 0)) + then + minetest.add_node(pos, {name=corner_2, param2=1}) + end + + if ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner_2 and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner_2 and node_south.param2 == 1)) + then + minetest.add_node(pos, {name=corner_2, param2=2}) + end + + if ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner_2 and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner_2 and node_west.param2 == 2)) + then + minetest.add_node(pos, {name=corner_2, param2=3}) + end + + end, + }) +end \ No newline at end of file diff --git a/trunks/trunks_settings.txt b/trunks/trunks_settings.txt index 92b4bf7..db847e5 100644 --- a/trunks/trunks_settings.txt +++ b/trunks/trunks_settings.txt @@ -45,4 +45,6 @@ Moss_on_trunk = true Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes -Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %) \ No newline at end of file +Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %) + +Auto_Roof_Corner = true -- behavior is similar (not the same!) to the one of minecraft stairs \ No newline at end of file