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

make wooden banister colorable via Unified Dyes

This commit is contained in:
Vanessa Dannenberg 2018-09-12 18:49:51 -04:00
parent 41455647a2
commit eb6089a03e
4 changed files with 42 additions and 8 deletions

View File

@ -3273,6 +3273,19 @@ for i in ipairs(homedecor.banister_materials) do
})
end
unifieddyes.register_color_craft({
output = "",
palette = "split",
neutral_node = "homedecor:banister_wood_horizontal",
type = "shapeless",
output_prefix = "homedecor:banister_wood_horizontal_",
output_suffix = "",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE",
}
})
if (minetest.get_modpath("technic") and minetest.get_modpath("dye") and minetest.get_modpath("bees")) then
technic.register_separating_recipe({ input = {"bees:wax 1"}, output = {"homedecor:oil_extract 2","dye:yellow 1"} })
end

View File

@ -257,6 +257,8 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
if not pos then return itemstack end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local meta = itemstack:get_meta()
local pindex = meta:get_int("palette_index")
local abovepos = { x=pos.x, y=pos.y+1, z=pos.z }
local abovenode = minetest.get_node(abovepos)
@ -371,7 +373,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
end
end
minetest.set_node(pos, {name = new_place_name, param2 = fdir})
minetest.set_node(pos, {name = new_place_name, param2 = fdir+pindex})
itemstack:take_item()
return itemstack
end

View File

@ -483,23 +483,19 @@ for _, side in ipairs({"diagonal_left", "diagonal_right", "horizontal"}) do
local name, matdesc, tile1, tile2 = unpack(mat)
local nodename = "banister_"..name.."_"..side
local groups = { snappy = 3, not_in_creative_inventory = 1 }
local cbox = {
type = "fixed",
fixed = { -9/16, -3/16, 5/16, 9/16, 24/16, 8/16 }
}
if side == "horizontal" then
groups = { snappy = 3 }
cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 5/16, 8/16, 8/16, 8/16 }
}
else
minetest.register_alias(string.gsub("homedecor:"..nodename, "diagonal_", ""), "homedecor:"..nodename)
end
homedecor.register(nodename, {
local def = {
description = S("Banister for Stairs (@1, @2)", matdesc, sidedesc),
mesh = "homedecor_banister_"..side..".obj",
tiles = {
@ -507,12 +503,35 @@ for _, side in ipairs({"diagonal_left", "diagonal_right", "horizontal"}) do
tile2,
},
inventory_image = "homedecor_banister_"..name.."_inv.png",
groups = groups,
selection_box = cbox,
collision_box = cbox,
groups = { snappy = 3},
on_place = homedecor.place_banister,
drop = "homedecor:banister_"..name.."_horizontal",
})
}
if side ~= "horizontal" then
def.groups.not_in_creative_inventory = 1
end
if name == "wood" then
def.airbrush_replacement_node = "homedecor:banister_wood_"..side.."_grey"
def.groups.ud_param2_colorable = 1
def.paramtype2 = "colorfacedir"
end
homedecor.register(nodename, def)
if name == "wood" then
local nn = "homedecor:"..nodename
local def2 = table.copy(minetest.registered_items[nn])
def2.tiles = {
homedecor.white_wood,
homedecor.white_wood
}
def2.inventory_image = "homedecor_banister_wood_colored_inv.png"
unifieddyes.generate_split_palette_nodes(nn, def2, "homedecor:banister_"..name.."_horizontal")
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB