1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 16:10: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", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1}, groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct, 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", { minetest.register_node("homedecor:bathroom_tiles_medium", {
@ -31,12 +28,9 @@ minetest.register_node("homedecor:bathroom_tiles_medium", {
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1}, groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct, 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", { minetest.register_node("homedecor:bathroom_tiles_light", {
@ -50,12 +44,9 @@ minetest.register_node("homedecor:bathroom_tiles_light", {
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
groups = {cracky=3, ud_param2_colorable = 1}, groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = unifieddyes.on_construct, on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node
}) })
local tr_cbox = { local tr_cbox = {

View File

@ -52,13 +52,11 @@ homedecor.register("bed_regular", {
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(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 if not placer:get_player_control().sneak then
return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing) return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing)
end end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
homedecor.unextend_bed(pos) homedecor.unextend_bed(pos)
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -91,9 +89,7 @@ homedecor.register("bed_extended", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
expand = { forward = "air" }, expand = { forward = "air" },
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
homedecor.unextend_bed(pos) homedecor.unextend_bed(pos)
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -124,10 +120,8 @@ homedecor.register("bed_kingsize", {
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
local inv = digger:get_inventory() local inv = digger:get_inventory()
if digger:get_player_control().sneak and inv:room_for_item("main", "homedecor:bed_regular 2") then 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") 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) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
homedecor.beds_on_rightclick(pos, node, clicker) homedecor.beds_on_rightclick(pos, node, clicker)
return itemstack return itemstack
end end,
}) })
for _, w in pairs({ N_("mahogany"), N_("oak") }) do 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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "homedecor:shutter_oak", 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 = { local mats = {
{ "brass", "homedecor:pole_brass" }, { "brass", "homedecor:pole_brass" },
{ "wrought_iron", "homedecor:pole_wrought_iron" }, { "wrought_iron", "homedecor:pole_wrought_iron" },
@ -1195,7 +1228,6 @@ minetest.register_craft( {
minetest.register_craft({ minetest.register_craft({
output = "homedecor:glowlight_half 6", output = "homedecor:glowlight_half 6",
recipe = { recipe = {
{ "dye:white", "dye:white", "dye:white" },
{ "default:glass", "homedecor:power_crystal", "default:glass", }, { "default:glass", "homedecor:power_crystal", "default:glass", },
} }
}) })
@ -1203,11 +1235,38 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = "homedecor:glowlight_half 6", output = "homedecor:glowlight_half 6",
recipe = { recipe = {
{ "dye:white", "dye:white", "dye:white" },
{"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", }, {"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({ minetest.register_craft({
output = "homedecor:glowlight_quarter 6", output = "homedecor:glowlight_quarter 6",
recipe = { 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({ minetest.register_craft({
output = "homedecor:glowlight_small_cube 8", output = "homedecor:glowlight_small_cube 8",
recipe = { recipe = {
@ -1239,20 +1309,14 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({ unifieddyes.register_color_craft({
output = "homedecor:glowlight_half", output = "homedecor:glowlight_small_cube",
recipe = { palette = "wallmounted",
{"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", type = "shapeless",
neutral_node = "homedecor:glowlight_small_cube",
recipe = { recipe = {
"homedecor:glowlight_quarter", "NEUTRAL_NODE",
"homedecor:glowlight_quarter" "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( { minetest.register_craft( {
output = "homedecor:bathroom_tiles_medium 4", output = "homedecor:bathroom_tiles_medium 4",
recipe = { 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( { minetest.register_craft( {
output = "homedecor:bathroom_tiles_dark 4", output = "homedecor:bathroom_tiles_dark 4",
recipe = { 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 -- misc electrical
minetest.register_craft( { 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( { minetest.register_craft( {
output = "homedecor:bed_kingsize", output = "homedecor:bed_kingsize",
recipe = { 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( { minetest.register_craft( {
output = "homedecor:bottle_green", output = "homedecor:bottle_green",
recipe = { 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({ minetest.register_craft({
output = "homedecor:hanging_lantern 2", output = "homedecor:hanging_lantern 2",
recipe = { recipe = {

View File

@ -83,9 +83,7 @@ homedecor.register("kitchen_chair_padded", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew, on_rotate = unifieddyes.fix_after_screwdriver_nsew,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
pos.y = pos.y+0 -- where do I put my ass ? pos.y = pos.y+0 -- where do I put my ass ?
@ -110,9 +108,7 @@ homedecor.register("armchair", {
node_box = ac_cbox, node_box = ac_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew, 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({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "homedecor:kitchen_chair_padded", 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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "homedecor:kitchen_chair_wood", 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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "homedecor:table_lamp_off", recipe = "homedecor:table_lamp_off",
@ -148,13 +181,15 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({ unifieddyes.register_color_craft({
output = "homedecor:standing_lamp_off", output = "homedecor:table_lamp_off",
palette = "extended",
type = "shapeless",
neutral_node = "homedecor:table_lamp_off",
recipe = { recipe = {
{ "homedecor:table_lamp_off"}, "NEUTRAL_NODE",
{ "group:stick"}, "MAIN_DYE"
{ "group:stick"}, }
},
}) })
minetest.register_craft({ 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 rightnode = minetest.get_node(rightpos)
local inv = placer:get_inventory() local inv = placer:get_inventory()
local lastdye = unifieddyes.last_used_dye[placer_name]
if leftnode.name == "homedecor:bed_regular" then if leftnode.name == "homedecor:bed_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize") 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(pos, {name = "air"})
minetest.set_node(leftpos, { name = newname, param2 = param2}) minetest.swap_node(leftpos, { name = newname, param2 = param2})
meta:set_string("dye", lastdye)
inv:add_item("main", lastdye)
elseif rightnode.name == "homedecor:bed_regular" then elseif rightnode.name == "homedecor:bed_regular" then
local newname = string.gsub(thisnode.name, "_regular", "_kingsize") 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(rightpos, {name = "air"})
minetest.set_node(pos, { name = newname, param2 = param2}) minetest.swap_node(pos, { name = newname, param2 = param2})
meta:set_string("dye", lastdye)
inv:add_item("main", lastdye)
end end
local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} 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 if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then
local newname = string.gsub(thisnode.name, "_regular", "_extended") local newname = string.gsub(thisnode.name, "_regular", "_extended")
local newparam2 = param2 % 8 local newparam2 = param2 % 8
if inv:contains_item("main", lastdye) then minetest.swap_node(toppos, { name = thisnode.name, param2 = param2})
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(pos, { name = newname, param2 = param2}) minetest.swap_node(pos, { name = newname, param2 = param2})
itemstack:take_item() itemstack:take_item()
end end

View File

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

View File

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

View File

@ -112,10 +112,8 @@ minetest.register_node("homedecor:curtain_closed", {
paramtype2 = "colorwallmounted", paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png", palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" }, selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) 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}) 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", paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png", palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" }, selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) 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}) 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", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
light_source = 14, 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}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
on_construct = unifieddyes.on_construct, 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) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "lavalamp:lavalamp_off" node.name = "lavalamp:lavalamp_off"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
@ -59,7 +56,6 @@ minetest.register_node("lavalamp:lavalamp_off", {
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
selection_box = { selection_box = {
@ -70,13 +66,16 @@ minetest.register_node("lavalamp:lavalamp_off", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
drop = "lavalamp:lavalamp", drop = "lavalamp:lavalamp",
on_construct = unifieddyes.on_construct, 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) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "lavalamp:lavalamp" node.name = "lavalamp:lavalamp"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
return itemstack return itemstack
end, end,
drop = {
items = {
{items = {"lavalamp:lavalamp"}, inherit_color = true },
}
}
}) })
minetest.register_craft({ 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 -- convert to param2 coloring
local colors = { local colors = {

View File

@ -25,9 +25,7 @@ minetest.register_node("lrfurn:armchair", {
node_box = armchair_cbox, node_box = armchair_cbox,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end, end,
after_dig_node = unifieddyes.after_dig_node,
on_rotate = unifieddyes.fix_after_screwdriver_nsew, on_rotate = unifieddyes.fix_after_screwdriver_nsew,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then 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 -- convert old static nodes to param2 color
lrfurn.old_static_armchairs = {} lrfurn.old_static_armchairs = {}

View File

@ -60,10 +60,11 @@ end
function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing) function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local colorbits = node.param2 - (node.param2 % 8)
local yaw = placer:get_look_yaw() local yaw = placer:get_look_yaw()
local dir = minetest.yaw_to_dir(yaw-1.5) local dir = minetest.yaw_to_dir(yaw-1.5)
local fdir = minetest.dir_to_wallmounted(dir) 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 end
dofile(minetest.get_modpath("lrfurn").."/longsofas.lua") dofile(minetest.get_modpath("lrfurn").."/longsofas.lua")

View File

@ -26,7 +26,6 @@ minetest.register_node("lrfurn:longsofa", {
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
lrfurn.fix_sofa_rotation_nsew(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() local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end if minetest.is_protected(pos, placer:get_player_name()) then return true end
@ -42,7 +41,6 @@ minetest.register_node("lrfurn:longsofa", {
end end
return itemstack return itemstack
end, end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then if not clicker:is_player() then
return itemstack 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 -- convert old static nodes to param2 colorization
lrfurn.old_static_longsofas = {} lrfurn.old_static_longsofas = {}

View File

@ -26,7 +26,6 @@ minetest.register_node("lrfurn:sofa", {
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
lrfurn.fix_sofa_rotation_nsew(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() local playername = placer:get_player_name()
if minetest.is_protected(pos, placer:get_player_name()) then return true end if minetest.is_protected(pos, placer:get_player_name()) then return true end
@ -42,7 +41,6 @@ minetest.register_node("lrfurn:sofa", {
end end
return itemstack return itemstack
end, end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not clicker:is_player() then if not clicker:is_player() then
return itemstack 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 -- convert old static nodes to param2 color
lrfurn.old_static_sofas = {} lrfurn.old_static_sofas = {}