plasticbox/init.lua

100 lines
2.8 KiB
Lua
Raw Permalink Normal View History

2013-12-16 21:15:39 -08:00
minetest.register_node("plasticbox:plasticbox", {
2017-01-23 19:06:45 -08:00
description = "Plastic Box",
2013-12-16 21:15:39 -08:00
tiles = {"plasticbox_white.png"},
2017-01-23 19:06:45 -08:00
is_ground_content = false,
2017-02-04 23:36:38 -08:00
groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1},
2017-01-23 19:06:45 -08:00
sounds = default.node_sound_stone_defaults(),
paramtype2 = "color",
2017-02-24 20:56:10 -08:00
palette = "unifieddyes_palette_extended.png",
2017-03-13 22:55:50 -07:00
on_construct = unifieddyes.on_construct,
on_dig = unifieddyes.on_dig,
2017-01-23 19:06:45 -08:00
})
2017-07-09 00:54:33 -07:00
if minetest.global_exists("stairsplus") then
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(),
})
end
2013-12-16 21:15:39 -08:00
minetest.register_craft( {
output = "plasticbox:plasticbox 4",
recipe = {
2018-11-01 15:57:30 -07:00
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "basic_materials:plastic_sheet", "", "basic_materials:plastic_sheet" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
2013-12-16 21:15:39 -08:00
},
})
unifieddyes.register_color_craft({
output = "plasticbox:plasticbox 4",
palette = "extended",
2018-11-01 15:57:30 -07:00
neutral_node = "basic_materials:plastic_sheet",
recipe = {
{ "NEUTRAL_NODE", "NEUTRAL_NODE", "NEUTRAL_NODE" },
{ "NEUTRAL_NODE", "MAIN_DYE", "NEUTRAL_NODE" },
{ "NEUTRAL_NODE", "NEUTRAL_NODE", "NEUTRAL_NODE" },
}
})
unifieddyes.register_color_craft({
output = "plasticbox:plasticbox",
palette = "extended",
type = "shapeless",
neutral_node = "plasticbox:plasticbox",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
2017-01-23 19:06:45 -08:00
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,
2013-12-16 21:15:39 -08:00
})
2017-02-24 20:56:10 -08:00