Add curtains and update stuff

Curtains are bugged (placed like in creative mode, infinitely) so moved to indev branch. But at least everything else works... somehow...
This commit is contained in:
Mikita Wiśniewski 2022-04-23 12:38:19 +07:00
parent c843781572
commit 37f12fa4ee
6 changed files with 156 additions and 1 deletions

103
api.lua
View File

@ -309,8 +309,109 @@ function mcl_decor.register_dyed_planks(name, desc, hexcolor, dye, colorgroup)
minetest.register_craft({
type = "shapeless",
output = "mcl_decor:"..name,
recipe = {"group:wood", "mcl_dye:" .. dye}
recipe = {"group:wood", "mcl_dye:"..dye}
})
-- maybe descriptions of slabs/stairs after that workaround will be VERY CRAPPY (especially with translations via locales), but at least it works
mcl_stairs.register_stair_and_slab_simple(name, "mcl_decor:"..name, desc..S(" Stair"), desc..S(" Slab"), S("Double")..desc..S(" Slab"), "woodlike")
end
function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgroup)
minetest.register_node("mcl_decor:curtain_"..color, {
description = desc,
tiles = {
wooltile.."^mcl_decor_curtain_alpha.png^[makealpha:255,126,126^mcl_decor_curtain_overlay.png", -- front
wooltile.."^mcl_decor_curtain_alpha.png^[makealpha:255,126,126^mcl_decor_curtain_overlay.png^[transformFY", -- back
wooltile.."^mcl_decor_curtain_overlay.png^[transformR270", -- side
wooltile.."^mcl_decor_curtain_overlay.png^[transformR90", -- side
wooltile.."^mcl_decor_curtain_overlay.png^[transformFY", -- top
wooltile.."^mcl_decor_curtain_alpha.png^[makealpha:255,126,126^mcl_decor_curtain_overlay.png", -- bottom
},
stack_max = 64,
inventory_image = wooltile.."^mcl_decor_curtain_alpha.png^[makealpha:255,126,126^mcl_decor_curtain_overlay.png",
wield_image = wooltile.."^mcl_decor_curtain_alpha.png^[makealpha:255,126,126^mcl_decor_curtain_overlay.png",
walkable = false,
sunlight_propagates = true,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
groups = {handy=1, flammable=-1, curtain=1, attached_node=1, dig_by_piston=1, deco_block=1, material_wool=1, [colorgroup]=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
node_box = {
type = "wallmounted",
},
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
-- taken from mcl_signs (partially)
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above
local under = pointed_thing.under
-- use pointed node's on_rightclick function first, if present
local node_under = minetest.get_node(under)
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack
end
end
local dir = vector.subtract(under, above)
local wdir = minetest.dir_to_wallmounted(dir)
if wdir == 0 then
return itemstack
elseif wdir == 1 then
return itemstack
else
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
if not success then
return itemstack
end
end
end,
on_rightclick = function(pos, node, _, itemstack)
minetest.set_node(pos, {name="mcl_decor:curtain_"..color.."_closed", param2=node.param2})
return itemstack
end
})
minetest.register_node("mcl_decor:curtain_"..color.."_closed", {
description = desc..S(" (closed)"),
tiles = {
wooltile.."^mcl_decor_curtain_overlay.png", -- front
wooltile.."^mcl_decor_curtain_overlay.png^[transformFY", -- back
wooltile.."^mcl_decor_curtain_overlay.png^[transformR270", -- side
wooltile.."^mcl_decor_curtain_overlay.png^[transformR90", -- side
wooltile.."^mcl_decor_curtain_overlay.png^[transformFY", -- top
wooltile.."^mcl_decor_curtain_overlay.png", -- bottom
},
walkable = false,
sunlight_propagates = true,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
groups = {handy=1, flammable=-1, attached_node=1, dig_by_piston=1, not_in_creative_inventory=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
node_box = {
type = "wallmounted",
},
drop = "mcl_decor:curtain_"..color,
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
on_rightclick = function(pos, node, clicker, itemstack)
minetest.set_node(pos, {name="mcl_decor:curtain_"..color, param2=node.param2})
return itemstack
end
})
minetest.register_craft({
output = "mcl_decor:curtain_"..color,
recipe = {
{"mcl_core:iron_ingot", "mcl_core:stick", "mcl_core:iron_ingot"},
{wool, wool, wool},
{wool, "", wool}
}
})
minetest.register_craft({
type = "shapeless",
output = "mcl_decor:curtain_"..color,
recipe = {"group:curtain", "mcl_dye:"..dye},
})
end

View File

@ -63,6 +63,23 @@ Brown Armchair=Коричневое кресло
Pink Armchair=Розовое кресло
Lime Armchair=Зелёное лаймовое кресло
Light Blue Armchair=Светло-голубое кресло
White Armchair=Белые шторы
Grey Armchair=Серые шторы
Light Grey Armchair=Светло-серые шторы
Black Armchair=Чёрные шторы
Red Armchair=Красные шторы
Yellow Armchair=Жёлтые шторы
Green Armchair=Зелёные шторы
Cyan Armchair=Голубые шторы
Blue Armchair=Синее шторы
Magenta Armchair=Фиолетовые шторы
Orange Armchair=Оранжевые шторы
Purple Armchair=Пурпурные шторы
Brown Armchair=Коричневые шторы
Pink Armchair=Розовые шторы
Lime Armchair=Зелёные лаймовые шторы
Light Blue Armchair=Светло-голубые шторы
Stair= Ступенька
Slab= Плита
Double=Двойная
(closed)= (закрыты)

View File

@ -63,6 +63,23 @@ Brown Armchair=
Pink Armchair=
Lime Armchair=
Light Blue Armchair=
White Curtains=
Grey Curtains=
Light Grey Curtains=
Black Curtains=
Red Curtains=
Yellow Curtains=
Green Curtains=
Cyan Curtains=
Blue Curtains=
Magenta Curtains=
Orange Curtains=
Purple Curtains=
Brown Curtains=
Pink Curtains=
Lime Curtains=
Light Blue Curtains=
Stair=
Slab=
Double=
(closed)=

View File

@ -163,6 +163,26 @@ mcl_decor.register_armchair("mcl_decor:light_blue_armchair", S("Light Blue Armch
--- Curtains ---
mcl_decor.register_curtains("white", S("White Curtains"), "mcl_wool:white", "wool_white.png", "white", "unicolor_white")
mcl_decor.register_curtains("grey", S("Grey Curtains"), "mcl_wool:grey", "wool_dark_grey.png", "dark_grey", "unicolor_darkgrey")
mcl_decor.register_curtains("silver", S("Light Grey Curtains"), "mcl_wool:silver", "wool_grey.png", "grey", "unicolor_grey")
mcl_decor.register_curtains("black", S("Black Curtains"), "mcl_wool:black", "wool_black.png", "black", "unicolor_black")
mcl_decor.register_curtains("red", S("Red Curtains"), "mcl_wool:red", "wool_red.png", "red", "unicolor_red")
mcl_decor.register_curtains("yellow", S("Yellow Curtains"), "mcl_wool:yellow", "wool_yellow.png", "yellow", "unicolor_yellow")
mcl_decor.register_curtains("green", S("Green Curtains"), "mcl_wool:green", "wool_dark_green.png", "dark_green", "unicolor_dark_green")
mcl_decor.register_curtains("cyan", S("Cyan Curtains"), "mcl_wool:cyan", "wool_cyan.png", "cyan", "unicolor_cyan")
mcl_decor.register_curtains("blue", S("Blue Curtains"), "mcl_wool:blue", "wool_blue.png", "blue", "unicolor_blue")
mcl_decor.register_curtains("magenta", S("Magenta Curtains"), "mcl_wool:magenta", "wool_magenta.png", "magenta", "unicolor_red_violet")
mcl_decor.register_curtains("orange", S("Orange Curtains"), "mcl_wool:orange", "wool_orange.png", "orange", "unicolor_orange")
mcl_decor.register_curtains("purple", S("Purple Curtains"), "mcl_wool:purple", "wool_violet.png", "violet", "unicolor_violet")
mcl_decor.register_curtains("brown", S("Brown Curtains"), "mcl_wool:brown", "wool_brown.png", "brown", "unicolor_dark_orange")
mcl_decor.register_curtains("pink", S("Pink Curtains"), "mcl_wool:pink", "wool_pink.png", "pink", "unicolor_light_red")
mcl_decor.register_curtains("lime", S("Lime Curtains"), "mcl_wool:lime", "mcl_wool_lime.png", "green", "unicolor_green")
mcl_decor.register_curtains("light_blue", S("Light Blue Curtains"), "mcl_wool:light_blue", "mcl_wool_light_blue.png", "lightblue", "unicolor_light_blue")
--- Dyed Planks ---
mcl_decor.register_dyed_planks("white_planks", S("White Planks"), "#EDEDED", "white", "unicolor_white")
mcl_decor.register_dyed_planks("grey_planks", S("Grey Planks"), "#5F5F5F", "dark_grey", "unicolor_darkgrey")

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B