From 39f5cba27eef35877c91291f518974f34130fcb6 Mon Sep 17 00:00:00 2001
From: Vanessa Ezekowitz <vanessaezekowitz@gmail.com>
Date: Tue, 31 Jan 2017 19:39:31 -0500
Subject: Huge update - lots of mods:

areas, biome_lib, blox, bobblocks, boost_cart, homedecor, mobs,
coloredwood, ilights, inbox, item_tweaks, moreblocks, moreores,
pipeworks, plasticbox, signs_lib, stainedglass, roads, unifieddyes,
vines, worldedit, xban2, maybe some others I didn't think about ;-)
---
 plasticbox/depends.txt                        |   5 +-
 plasticbox/init.lua                           | 390 ++++----------------------
 plasticbox/textures/plasticbox_ud_palette.png | Bin 0 -> 443 bytes
 plasticbox/ud_palette.txt                     |   9 +
 4 files changed, 67 insertions(+), 337 deletions(-)
 create mode 100644 plasticbox/textures/plasticbox_ud_palette.png
 create mode 100644 plasticbox/ud_palette.txt

(limited to 'plasticbox')

diff --git a/plasticbox/depends.txt b/plasticbox/depends.txt
index 42f64ae..7910ab9 100644
--- a/plasticbox/depends.txt
+++ b/plasticbox/depends.txt
@@ -1,4 +1,3 @@
 homedecor
-technic?
-bucket?
-pipeworks?
+moreblocks
+unifieddyes
diff --git a/plasticbox/init.lua b/plasticbox/init.lua
index 256f972..8bd6a69 100644
--- a/plasticbox/init.lua
+++ b/plasticbox/init.lua
@@ -1,142 +1,22 @@
-plasticbox = {}
-plasticbox.colorlist = {
-        {"black", "Black Plastic"},
-        {"blue", "Blue Plastic"},
-        {"brown", "Brown Plastic"},
-        {"cyan", "Cyan Plastic"},
-        {"green", "Green Plastic"},
-        {"grey", "Grey Plastic"},
-        {"magenta", "Magenta Plastic"},
-        {"orange", "Orange Plastic"},
-        {"pink", "Pink Plastic"},
-        {"red", "Red Plastic"},
-        {"violet", "Violet Plastic"},
-        {"white",  "White Plastic"},
-        {"yellow", "Yellow Plastic"},
-}
-
-
-
---Register Nodes, assign textures, blah, blah...
 minetest.register_node("plasticbox:plasticbox", {
-	description = "Plain Plastic Box",
-	tiles = {"plasticbox.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_black", {
-	description = "Black Plastic Box",
-	tiles = {"plasticbox_black.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_blue", {
-	description = "Blue Plastic Box",
-	tiles = {"plasticbox_blue.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_brown", {
-	description = "Brown Plastic Box",
-	tiles = {"plasticbox_brown.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_cyan", {
-	description = "Cyan Plastic Box",
-	tiles = {"plasticbox_cyan.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_darkgreen", {
-	description = "Dark Green Plastic Box",
-	tiles = {"plasticbox_darkgreen.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_darkgrey", {
-	description = "Dark Gray Plastic Box",
-	tiles = {"plasticbox_darkgrey.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_green", {
-	description = "Green Plastic Box",
-	tiles = {"plasticbox_green.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_grey", {
-	description = "Gray Plastic Box",
-	tiles = {"plasticbox_grey.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_magenta", {
-	description = "Magenta Plastic Box",
-	tiles = {"plasticbox_magenta.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_orange", {
-	description = "Orange Plastic Box",
-	tiles = {"plasticbox_orange.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_pink", {
-	description = "Pink Plastic Box",
-	tiles = {"plasticbox_pink.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_red", {
-	description = "Red Plastic Box",
-	tiles = {"plasticbox_red.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_violet", {
-	description = "Violet Plastic Box",
-	tiles = {"plasticbox_violet.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
-	sounds = default.node_sound_stone_defaults(),
-})
-minetest.register_node("plasticbox:plasticbox_white", {
-	description = "White Plastic Box",
+	description = "Plastic Box",
 	tiles = {"plasticbox_white.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
+	is_ground_content = false,
+	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1},
 	sounds = default.node_sound_stone_defaults(),
+	paramtype2 = "color",
+	palette = "unifieddyes_palette.png",
+	after_dig_node = unifieddyes.after_dig_node,
+	on_rightclick = unifieddyes.on_rightclick,
 })
-minetest.register_node("plasticbox:plasticbox_yellow", {
-	description = "Yellow Plastic Box",
-	tiles = {"plasticbox_yellow.png"},
-	is_ground_content = true,
-	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, level=1},
+
+stairsplus:register_all("plasticbox", "plasticbox", "plasticbox:plasticbox", {
+	description = "Plastic",
+	tiles = {"plasticbox_white.png"},
+	groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1},
 	sounds = default.node_sound_stone_defaults(),
 })
-minetest.register_craftitem("plasticbox:plastic_powder", {
-	image = "plastic_powder.png",
-    	description="Plastic Powder",
-})
-
 
---Register craft for plain box
 minetest.register_craft( {
         output = "plasticbox:plasticbox 4",
         recipe = {
@@ -146,206 +26,48 @@ minetest.register_craft( {
         },
 })
 
-
-minetest.register_craft( {
-        output = "homedecor:plastic_sheeting 7",
-        recipe = {
-                { "plasticbox:plasticbox", "plasticbox:plasticbox" },
-                { "plasticbox:plasticbox", "plasticbox:plasticbox" },
-        },
-})
-
-minetest.register_craft({
-     type = "cooking",
-     output = "homedecor:plastic_sheeting",
-     recipe = "plasticbox:plastic_powder",
-})
-
---Register crafts for colored boxes
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_black',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_black'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_blue',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_blue'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_brown',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_brown'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_cyan',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_cyan'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_green',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_green'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_grey',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_grey'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_magenta',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_magenta'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_orange',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_orange'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_pink',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_pink'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_red',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_red'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_violet',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_violet'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_white',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_white'},
-})
-minetest.register_craft({
-     type = "shapeless",
-     output = 'plasticbox:plasticbox_yellow',
-     recipe = {'plasticbox:plasticbox', 'group:basecolor_yellow'},
-})
-
---ugly below here.
-
-if minetest.get_modpath("moreblocks") then
-                        register_stair(
-                                "plasticbox",
-                                "plasticbox",
-                                "plasticbox:plasticbox",
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                { "plasticbox.png",
-                                },
-                                "Plastic",
-                                "plasticbox",
-                                0
-                        )
-                        register_slab(
-                                "plasticbox",
-                                "plasticbox",
-                                "plasticbox:plasticbox",
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                { "plasticbox.png",
-                                },
-                                "Plastic",
-                                "plasticbox",
-                                0
-                        )
-
-                        register_panel(
-                                "plasticbox",
-                                "plasticbox",
-                                "plasticbox:plasticbox",
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                { "plasticbox.png",
-                                },
-                                "Plastic",
-                                "plasticbox",
-                                0
-                        )
-
-                        register_micro(
-                                "plasticbox",
-                                "plasticbox",
-                                "plasticbox:plasticbox",
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                { "plasticbox.png",
-                                },
-                                "Plastic",
-                                "plasticbox",
-                                0
-                        )
-		table.insert(circular_saw.known_stairs, "plasticbox:plasticbox")
-
-end
-
-
-
-for i in ipairs(plasticbox.colorlist) do
-        local colorname = plasticbox.colorlist[i][1]
-        local desc = plasticbox.colorlist[i][2]
-
-		if minetest.get_modpath("moreblocks") then
-                        register_stair(
-                                "plasticbox",
-                                "plasticbox_"..colorname,
-                                "plasticbox:plasticbox_"..colorname,
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                {        "plasticbox_"..colorname..".png",
-                                },
-                                desc,
-                                "plasticbox_"..colorname,
-                                0
-                        )
-                        register_slab(
-                                "plasticbox",
-                                "plasticbox_"..colorname,
-                                "plasticbox:plasticbox_"..colorname,
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                {        "plasticbox_"..colorname..".png",
-                                },
-                                desc,
-                                "plasticbox_"..colorname,
-                                0
-                        )
-
-                        register_panel(
-                                "plasticbox",
-                                "plasticbox_"..colorname,
-                                "plasticbox:plasticbox_"..colorname,
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                {        "plasticbox_"..colorname..".png",
-                                },
-                                desc,
-                                "plasticbox_"..colorname,
-                                0
-                        )
-
-                        register_micro(
-                                "plasticbox",
-                                "plasticbox_"..colorname,
-                                "plasticbox:plasticbox_"..colorname,
-                                { snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,not_in_creative_inventory=1 },
-                                {        "plasticbox_"..colorname..".png",
-                                },
-                                desc,
-                                "plasticbox_"..colorname,
-                                0
-                        )
-		table.insert(circular_saw.known_stairs, "plasticbox:plasticbox_"..colorname)
-
-	end
-end
-
---Crafting recipes involving other mods
-if minetest.get_modpath("bucket") then
-minetest.register_craft( {
-        output = "bucket:bucket_empty",
-        recipe = {
-                { "homedecor:plastic_sheeting", "", "homedecor:plastic_sheeting" },
-                { "", "homedecor:plastic_sheeting", "" },
-        },
+minetest.register_lbm({
+	name = "plasticbox:convert_colors",
+	label = "Convert plastic boxes to use param2 color",
+	nodenames = {
+			"plasticbox:plasticbox_black",
+			"plasticbox:plasticbox_blue",
+			"plasticbox:plasticbox_brown",
+			"plasticbox:plasticbox_cyan",
+			"plasticbox:plasticbox_green",
+			"plasticbox:plasticbox_grey",
+			"plasticbox:plasticbox_magenta",
+			"plasticbox:plasticbox_orange",
+			"plasticbox:plasticbox_pink",
+			"plasticbox:plasticbox_red",
+			"plasticbox:plasticbox_violet",
+			"plasticbox:plasticbox_white",
+			"plasticbox:plasticbox_yellow",
+			"plasticbox:plasticbox_darkgreen",
+			"plasticbox:plasticbox_darkgrey",
+		},
+	action = function(pos,node)
+		local conv = {
+			["black"] = 5,
+			["blue"] = 73,
+			["brown"] = 22,
+			["cyan"] = 57,
+			["green"] = 41,
+			["grey"] = 3,
+			["magenta"] = 89,
+			["orange"] = 17,
+			["pink"] = 11,
+			["red"] = 9,
+			["violet"] = 81,
+			["white"] = 1,
+			["yellow"] = 25,
+			["darkgreen"] = 46,
+			["darkgrey"] = 4,
+		}
+		local name = node.name
+		local oldcolor = string.sub(name,string.len("plasticbox:plasticbox_-"),-1)
+		node.name = "plasticbox:plasticbox"
+		if conv[oldcolor] then node.param2 = conv[oldcolor] end
+		minetest.set_node(pos,node)
+	end,
 })
-end
diff --git a/plasticbox/textures/plasticbox_ud_palette.png b/plasticbox/textures/plasticbox_ud_palette.png
new file mode 100644
index 0000000..1d7c485
Binary files /dev/null and b/plasticbox/textures/plasticbox_ud_palette.png differ
diff --git a/plasticbox/ud_palette.txt b/plasticbox/ud_palette.txt
new file mode 100644
index 0000000..5e88718
--- /dev/null
+++ b/plasticbox/ud_palette.txt
@@ -0,0 +1,9 @@
+Hues: red orange yellow lime green aqua cyan skyblue blue violet magenta redviolet
+Shades: full full50 light med med50 dark dark50
+(both 1-indexed)
+
+For grayscale, use hue 0, shades available: white gray75 gray50 gray25 black
+
+param2 = color*8 + shade
+
+Invalid colors resolve to white.
-- 
cgit v1.2.3