1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 08:00:18 +01:00

switch to colored itemstacks

with full crafting recipes
(requires Unified Dyes commit 2a816534 or later)

known issues:

standing lamp bypasses vertical stack check
bed expansion changes the color of the first-placed bed
to match the second when creating a king bed.
This commit is contained in:
Vanessa Dannenberg 2018-08-22 05:08:48 -04:00
parent 9e69a6db73
commit a8729575ab
14 changed files with 272 additions and 97 deletions

View File

@ -12,12 +12,9 @@ minetest.register_node("homedecor:bathroom_tiles_dark", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:bathroom_tiles_medium", {
@ -31,12 +28,9 @@ minetest.register_node("homedecor:bathroom_tiles_medium", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:bathroom_tiles_light", {
@ -50,12 +44,9 @@ minetest.register_node("homedecor:bathroom_tiles_light", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node
})
local tr_cbox = {

View File

@ -52,13 +52,11 @@ homedecor.register("bed_regular", {
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
if not placer:get_player_control().sneak then
return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing)
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
homedecor.unextend_bed(pos)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -91,9 +89,7 @@ homedecor.register("bed_extended", {
sounds = default.node_sound_wood_defaults(),
expand = { forward = "air" },
on_rotate = screwdriver.disallow,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
homedecor.unextend_bed(pos)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -124,10 +120,8 @@ homedecor.register("bed_kingsize", {
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
local inv = digger:get_inventory()
if digger:get_player_control().sneak and inv:room_for_item("main", "homedecor:bed_regular 2") then
inv:remove_item("main", "homedecor:bed_kingsize 1")
@ -137,7 +131,7 @@ homedecor.register("bed_kingsize", {
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
homedecor.beds_on_rightclick(pos, node, clicker)
return itemstack
end
end,
})
for _, w in pairs({ N_("mahogany"), N_("oak") }) do

View File

@ -546,6 +546,17 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:shutter_colored",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:shutter",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
type = "fuel",
recipe = "homedecor:shutter_oak",
@ -867,6 +878,28 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:curtain_closed",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:curtain_closed",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
unifieddyes.register_color_craft({
output = "homedecor:curtain_open",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:curtain_open",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
local mats = {
{ "brass", "homedecor:pole_brass" },
{ "wrought_iron", "homedecor:pole_wrought_iron" },
@ -1195,7 +1228,6 @@ minetest.register_craft( {
minetest.register_craft({
output = "homedecor:glowlight_half 6",
recipe = {
{ "dye:white", "dye:white", "dye:white" },
{ "default:glass", "homedecor:power_crystal", "default:glass", },
}
})
@ -1203,11 +1235,38 @@ minetest.register_craft({
minetest.register_craft({
output = "homedecor:glowlight_half 6",
recipe = {
{ "dye:white", "dye:white", "dye:white" },
{"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", },
}
})
minetest.register_craft({
output = "homedecor:glowlight_half",
recipe = {
{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"},
{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}
}
})
minetest.register_craft({
output = "homedecor:glowlight_half",
type = "shapeless",
recipe = {
"homedecor:glowlight_quarter",
"homedecor:glowlight_quarter"
}
})
unifieddyes.register_color_craft({
output = "homedecor:glowlight_half",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:glowlight_half",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
output = "homedecor:glowlight_quarter 6",
recipe = {
@ -1215,6 +1274,17 @@ minetest.register_craft({
}
})
unifieddyes.register_color_craft({
output = "homedecor:glowlight_quarter",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:glowlight_quarter",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
output = "homedecor:glowlight_small_cube 8",
recipe = {
@ -1239,20 +1309,14 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "homedecor:glowlight_half",
recipe = {
{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"},
{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}
}
})
minetest.register_craft({
output = "homedecor:glowlight_half",
type = "shapeless",
recipe = {
"homedecor:glowlight_quarter",
"homedecor:glowlight_quarter"
unifieddyes.register_color_craft({
output = "homedecor:glowlight_small_cube",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:glowlight_small_cube",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
@ -2227,6 +2291,17 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:bathroom_tiles_light",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:bathroom_tiles_light",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft( {
output = "homedecor:bathroom_tiles_medium 4",
recipe = {
@ -2235,6 +2310,17 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:bathroom_tiles_medium",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:bathroom_tiles_medium",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft( {
output = "homedecor:bathroom_tiles_dark 4",
recipe = {
@ -2243,6 +2329,17 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:bathroom_tiles_dark",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:bathroom_tiles_dark",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- misc electrical
minetest.register_craft( {
@ -2476,6 +2573,17 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:bed_regular",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:bed_regular",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft( {
output = "homedecor:bed_kingsize",
recipe = {
@ -2483,6 +2591,29 @@ minetest.register_craft( {
},
})
unifieddyes.register_color_craft({
output = "homedecor:bed_kingsize",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:bed_kingsize",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
unifieddyes.register_color_craft({
output = "homedecor:bed_kingsize",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:bed_regular",
recipe = {
"NEUTRAL_NODE",
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft( {
output = "homedecor:bottle_green",
recipe = {
@ -2843,6 +2974,17 @@ minetest.register_craft({
},
})
unifieddyes.register_color_craft({
output = "homedecor:desk_lamp",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:desk_lamp",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
output = "homedecor:hanging_lantern 2",
recipe = {

View File

@ -83,9 +83,7 @@ homedecor.register("kitchen_chair_padded", {
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
pos.y = pos.y+0 -- where do I put my ass ?
@ -110,9 +108,7 @@ homedecor.register("armchair", {
node_box = ac_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
})

View File

@ -70,6 +70,17 @@ minetest.register_craft({
},
})
unifieddyes.register_color_craft({
output = "homedecor:armchair",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:armchair",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
type = "shapeless",
output = "homedecor:kitchen_chair_padded",
@ -79,6 +90,17 @@ minetest.register_craft({
},
})
unifieddyes.register_color_craft({
output = "homedecor:kitchen_chair_padded",
palette = "wallmounted",
type = "shapeless",
neutral_node = "homedecor:kitchen_chair_padded",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
type = "fuel",
recipe = "homedecor:kitchen_chair_wood",
@ -106,6 +128,17 @@ minetest.register_craft({
},
})
unifieddyes.register_color_craft({
output = "homedecor:standing_lamp_off",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:standing_lamp_off",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({
type = "fuel",
recipe = "homedecor:table_lamp_off",
@ -148,13 +181,15 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "homedecor:standing_lamp_off",
unifieddyes.register_color_craft({
output = "homedecor:table_lamp_off",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:table_lamp_off",
recipe = {
{ "homedecor:table_lamp_off"},
{ "group:stick"},
{ "group:stick"},
},
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
minetest.register_craft({

View File

@ -211,22 +211,21 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
local rightnode = minetest.get_node(rightpos)
local inv = placer:get_inventory()
local lastdye = unifieddyes.last_used_dye[placer_name]
if leftnode.name == "homedecor:bed_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
local meta = minetest.get_meta(leftpos)
local meta = minetest.get_meta(pos)
local leftmeta = minetest.get_meta(leftpos)
minetest.set_node(pos, {name = "air"})
minetest.set_node(leftpos, { name = newname, param2 = param2})
meta:set_string("dye", lastdye)
inv:add_item("main", lastdye)
minetest.swap_node(leftpos, { name = newname, param2 = param2})
elseif rightnode.name == "homedecor:bed_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
local meta = minetest.get_meta(rightpos)
local meta = minetest.get_meta(pos)
local rightmeta = minetest.get_meta(rightpos)
minetest.set_node(rightpos, {name = "air"})
minetest.set_node(pos, { name = newname, param2 = param2})
meta:set_string("dye", lastdye)
inv:add_item("main", lastdye)
minetest.swap_node(pos, { name = newname, param2 = param2})
end
local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z}
@ -235,14 +234,7 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then
local newname = string.gsub(thisnode.name, "_regular", "_extended")
local newparam2 = param2 % 8
if inv:contains_item("main", lastdye) then
minetest.set_node(toppos, { name = thisnode.name, param2 = param2})
if lastdye then inv:remove_item("main", lastdye.." 1") end
else
minetest.set_node(toppos, { name = thisnode.name, param2 = newparam2})
minetest.chat_send_player(placer_name, "Ran out of "..lastdye..", using neutral color.")
unifieddyes.last_used_dye[placer_name] = nil
end
minetest.swap_node(toppos, { name = thisnode.name, param2 = param2})
minetest.swap_node(pos, { name = newname, param2 = param2})
itemstack:take_item()
end

View File

@ -46,9 +46,7 @@ minetest.register_node("homedecor:glowlight_half", {
sounds = default.node_sound_glass_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:glowlight_quarter", {
@ -86,9 +84,7 @@ minetest.register_node("homedecor:glowlight_quarter", {
sounds = default.node_sound_glass_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:glowlight_small_cube", {
@ -126,9 +122,7 @@ minetest.register_node("homedecor:glowlight_small_cube", {
sounds = default.node_sound_glass_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node
})
homedecor.register("plasma_lamp", {
@ -449,7 +443,6 @@ local function reg_lamp(suffix, nxt, light, brightness)
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
walkable = false,
light_source = light,
selection_box = tlamp_cbox,
@ -457,14 +450,17 @@ local function reg_lamp(suffix, nxt, light, brightness)
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
drop = "homedecor:table_lamp_off",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "homedecor:table_lamp_"..repl[suffix]
minetest.set_node(pos, node)
end,
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node
drop = {
items = {
{items = {"homedecor:table_lamp_off"}, inherit_color = true },
}
}
})
homedecor.register("standing_lamp_"..suffix, {
@ -480,7 +476,6 @@ local function reg_lamp(suffix, nxt, light, brightness)
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
walkable = false,
light_source = light,
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1,
@ -494,9 +489,12 @@ local function reg_lamp(suffix, nxt, light, brightness)
minetest.set_node(pos, node)
end,
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node,
expand = { top="air" },
--expand = { top="air" },
drop = {
items = {
{items = {"homedecor:standing_lamp_off"}, inherit_color = true },
}
}
})
-- for old maps that had the original 3dforniture mod
@ -535,9 +533,7 @@ homedecor.register("desk_lamp", {
groups = {snappy=3, ud_param2_colorable = 1},
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew
})

View File

@ -41,9 +41,7 @@ homedecor.register("shutter", {
node_box = shutter_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node
})
homedecor.register("shutter_colored", {
@ -60,10 +58,7 @@ homedecor.register("shutter_colored", {
node_box = shutter_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node,
drop = "homedecor:shutter"
})
minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet")

View File

@ -112,10 +112,8 @@ minetest.register_node("homedecor:curtain_closed", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
@ -141,10 +139,8 @@ minetest.register_node("homedecor:curtain_open", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})

View File

@ -28,7 +28,6 @@ minetest.register_node("lavalamp:lavalamp", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
walkable = false,
light_source = 14,
@ -39,8 +38,6 @@ minetest.register_node("lavalamp:lavalamp", {
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
sounds = default.node_sound_glass_defaults(),
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "lavalamp:lavalamp_off"
minetest.swap_node(pos, node)
@ -59,7 +56,6 @@ minetest.register_node("lavalamp:lavalamp_off", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
walkable = false,
selection_box = {
@ -70,13 +66,16 @@ minetest.register_node("lavalamp:lavalamp_off", {
sounds = default.node_sound_glass_defaults(),
drop = "lavalamp:lavalamp",
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "lavalamp:lavalamp"
minetest.swap_node(pos, node)
return itemstack
end,
drop = {
items = {
{items = {"lavalamp:lavalamp"}, inherit_color = true },
}
}
})
minetest.register_craft({
@ -88,6 +87,17 @@ minetest.register_craft({
}
})
unifieddyes.register_color_craft({
output = "lavalamp:lavalamp",
palette = "extended",
type = "shapeless",
neutral_node = "lavalamp:lavalamp",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- convert to param2 coloring
local colors = {

View File

@ -25,9 +25,7 @@ minetest.register_node("lrfurn:armchair", {
node_box = armchair_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then
@ -58,6 +56,17 @@ minetest.register_craft({
}
})
unifieddyes.register_color_craft({
output = "lrfurn:armchair",
palette = "wallmounted",
type = "shapeless",
neutral_node = "lrfurn:armchair",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- convert old static nodes to param2 color
lrfurn.old_static_armchairs = {}

View File

@ -60,10 +60,11 @@ end
function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local colorbits = node.param2 - (node.param2 % 8)
local yaw = placer:get_look_yaw()
local dir = minetest.yaw_to_dir(yaw-1.5)
local fdir = minetest.dir_to_wallmounted(dir)
minetest.swap_node(pos, { name = node.name, param2 = fdir })
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
end
dofile(minetest.get_modpath("lrfurn").."/longsofas.lua")

View File

@ -26,7 +26,6 @@ minetest.register_node("lrfurn:longsofa", {
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end
@ -42,7 +41,6 @@ minetest.register_node("lrfurn:longsofa", {
end
return itemstack
end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then
return itemstack
@ -72,6 +70,17 @@ minetest.register_craft({
}
})
unifieddyes.register_color_craft({
output = "lrfurn:longsofa",
palette = "wallmounted",
type = "shapeless",
neutral_node = "lrfurn:longsofa",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- convert old static nodes to param2 colorization
lrfurn.old_static_longsofas = {}

View File

@ -26,7 +26,6 @@ minetest.register_node("lrfurn:sofa", {
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end
@ -42,7 +41,6 @@ minetest.register_node("lrfurn:sofa", {
end
return itemstack
end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then
return itemstack
@ -72,6 +70,17 @@ minetest.register_craft({
}
})
unifieddyes.register_color_craft({
output = "lrfurn:sofa",
palette = "wallmounted",
type = "shapeless",
neutral_node = "lrfurn:sofa",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- convert old static nodes to param2 color
lrfurn.old_static_sofas = {}