From 1a3b387c9a675a01c373c8072f1c02ea63f39bf4 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 17 Jun 2014 00:49:45 -0400 Subject: [PATCH] add optional moreblocks/stairsplus support defaults to enabled, to disable add: coloredwood_enable_stairsplus = false to minetest.conf. --- depends.txt | 1 + init.lua | 7 +++-- wood.lua | 73 +++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/depends.txt b/depends.txt index 8f3fcfd..f727feb 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ default unifieddyes +moreblocks? diff --git a/init.lua b/init.lua index efe57dc..028163b 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- Colored Wood mod by Vanessa Ezekowitz ~~ 2013-03-20 +-- Colored Wood mod by Vanessa Ezekowitz -- based on my unifieddyes template. -- -- License: WTFPL @@ -16,8 +16,8 @@ -- Uncolored sticks cannot be dyed separately, but they can still be used -- to build colored wooden fences. These are crafted either by placing six -- plain, uncolored sticks into the crafting grid in the usual manner, plus --- one portion of dye or paint in the upper-left corner of the grid --- (D = dye or paint, S = uncolored stick): +-- one portion of dye in the upper-left corner of the grid +-- (D = dye, S = uncolored stick): -- -- D - - -- S S S @@ -43,7 +43,6 @@ dofile(minetest.get_modpath("coloredwood").."/wood.lua") dofile(minetest.get_modpath("coloredwood").."/fence.lua") dofile(minetest.get_modpath("coloredwood").."/stick.lua") ---dofile(minetest.get_modpath("coloredwood").."/ladder.lua") print("[Colored Wood] Loaded!") diff --git a/wood.lua b/wood.lua index f406388..e07ad29 100644 --- a/wood.lua +++ b/wood.lua @@ -3,6 +3,14 @@ -- -- License: WTFPL +local coloredwood = {} + +coloredwood.enable_stairsplus = true + +if minetest.setting_getbool("coloredwood_enable_stairsplus") == false or not minetest.get_modpath("moreblocks") then + coloredwood.enable_stairsplus = false +end + local colored_block_modname = "coloredwood" local colored_block_description = "Wood Planks" local neutral_block = "default:wood" @@ -106,8 +114,6 @@ for shade = 1, 3 do minetest.register_node(colorname, { description = nodedesc, tiles = { pngname }, --- inventory_image = pngname, --- wield_image = pngname, sunlight_propagates = colored_block_sunlight, paramtype = "light", walkable = colored_block_walkable, @@ -118,8 +124,6 @@ for shade = 1, 3 do minetest.register_node(s50colorname, { description = s50nodedesc, tiles = { s50pngname }, --- inventory_image = s50pngname, --- wield_image = s50pngname, sunlight_propagates = colored_block_sunlight, paramtype = "light", walkable = colored_block_walkable, @@ -127,6 +131,35 @@ for shade = 1, 3 do sounds = colored_block_sound }) + if coloredwood.enable_stairsplus then + +-- stairsplus:register_all(modname, subname, recipeitem, {fields}) + + stairsplus:register_all( + "coloredwood", + "wood_"..shadename..huename, + colorname, + { + groups = colored_block_groups, + tiles = { pngname }, + description = nodedesc, + drop = "wood_"..shadename..huename, + } + ) + + stairsplus:register_all( + "coloredwood", + "wood_"..shadename..huename.."_s50", + s50colorname, + { + groups = colored_block_groups, + tiles = { s50pngname }, + description = s50nodedesc, + drop = "wood_"..shadename..huename.."_s50", + } + ) + end + minetest.register_craft({ type = "fuel", recipe = colorname, @@ -177,8 +210,6 @@ for hue = 1, 12 do minetest.register_node(colorname, { description = nodedesc, tiles = { pngname }, --- inventory_image = pngname, --- wield_image = pngname, sunlight_propagates = colored_block_sunlight, paramtype = "light", walkable = colored_block_walkable, @@ -186,6 +217,20 @@ for hue = 1, 12 do sounds = colored_block_sound }) + if coloredwood.enable_stairsplus then + stairsplus:register_all( + "coloredwood", + "wood_light_"..huename, + colorname, + { + groups = colored_block_groups, + tiles = { pngname }, + description = nodedesc, + drop = "wood_light_"..huename, + } + ) + end + minetest.register_craft({ type = "fuel", recipe = colorname, @@ -225,8 +270,6 @@ for grey = 1,5 do minetest.register_node(greyshadename, { description = nodedesc, tiles = { pngname }, --- inventory_image = pngname, --- wield_image = pngname, sunlight_propagates = colored_block_sunlight, paramtype = "light", walkable = colored_block_walkable, @@ -234,6 +277,20 @@ for grey = 1,5 do sounds = colored_block_sound }) + if coloredwood.enable_stairsplus then + stairsplus:register_all( + "coloredwood", + "wood_"..greyname, + greyshadename, + { + groups = colored_block_groups, + tiles = { pngname }, + description = nodedesc, + drop = "wood_"..greyname, + } + ) + end + minetest.register_craft({ type = "fuel", recipe = greyshadename,