The mod depends on moreores now. Added plastic_sheet, metal_wire, bulb and lampshade

master
Andrey2470T 2022-07-27 01:56:26 +03:00
parent dc88d47807
commit d3a2d37a17
46 changed files with 190 additions and 9 deletions

View File

@ -93,6 +93,30 @@ minetest.register_craftitem(":multidecor:steel_scissors",
inventory_image = "multidecor_steel_scissors.png"
})
minetest.register_craftitem(":multidecor:bulb",
{
description = "Bulb",
inventory_image = "multidecor_bulb.png"
})
minetest.register_craftitem(":multidecor:lampshade",
{
description = "Lampshade",
inventory_image = "multidecor_lampshade.png"
})
minetest.register_craftitem(":multidecor:plastic_sheet",
{
description = "Plastic Sheet",
inventory_image = "multidecor_plastic_sheet.png"
})
minetest.register_craftitem(":multidecor:metal_wire",
{
description = "Metal Wire",
inventory_image = "multidecor_metal_wire.png"
})
minetest.register_craft(
{
type = "shapeless",
@ -123,6 +147,19 @@ minetest.register_craft(
recipe = {"multidecor:plank", "default:steel_ingot"}
})
minetest.register_craft(
{
type = "shapeless",
output = "multidecor:lampshade 3",
recipe = {"wool:white", "multidecor:metal_wire"}
})
minetest.register_craft({
type = "cooking",
output = "multidecor:plastic_sheet",
recipe = "default:leaves",
cooktime = 10
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
local contains_saw = false

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -5,6 +5,7 @@ local modpath = minetest.get_modpath("decor_api")
dofile(modpath .. "/connecting.lua")
dofile(modpath .. "/register.lua")
dofile(modpath .. "/bed.lua")
dofile(modpath .. "/lighting.lua")
dofile(modpath .. "/sitting.lua")
dofile(modpath .. "/seat.lua")
dofile(modpath .. "/shelves.lua")

52
decor_api/lighting.lua Normal file
View File

@ -0,0 +1,52 @@
local default_on_rightclick = function(pos)
local node = minetest.get_node(pos)
local add_props = minetest.registered_nodes[node.name].add_properties
if not add_props or not add_props.swap_light then
return
end
minetest.set_node(pos, {name="multidecor:" .. add_props.swap_light.name})
end
function register.register_light(name, base_def, add_def, craft_def)
local def = table.copy(base_def)
def.type = "light"
def.paramtype2 = "facedir"
if add_def then
if add_def.recipe then
craft_def = add_def
else
def.add_properties = add_def
end
end
if def.callbacks then
def.callbacks.on_rightclick = def.callbacks.on_rightclick or default_on_rightclick
else
def.callbacks = {on_rightclick = default_on_rightclick}
end
register.register_furniture_unit(name, def, craft_def)
local def2 = table.copy(def)
local swap_light_name = def2.add_properties.swap_light.name
def2.light_source = def2.add_properties.swap_light.light_level or 8
def2.drop = "multidecor:" .. name
if def2.groups then
def2.groups.not_in_creative_inventory = 1
else
def2.groups = {not_in_creative_inventory = 1}
end
def2.add_properties.swap_light = {name=name}
register.register_furniture_unit(swap_light_name, def2)
minetest.debug(name .. ": " .. dump(minetest.registered_nodes["multidecor:" .. name]))
minetest.debug(swap_light_name .. ": " .. dump(minetest.registered_nodes["multidecor:" .. swap_light_name]))
end

View File

@ -1,4 +1,4 @@
name = decor_api
description = Set of API functions for various furniture stuff
depends = default
depends = default, moreores
author = Andrey01

View File

@ -9,7 +9,8 @@ register.supported_types = {
"seat",
"table",
"shelf",
"bed"
"bed",
"light"
}
-- Default furniture styles
@ -111,6 +112,8 @@ function register.register_furniture_unit(name, def, craft_def)
f_def.paramtype2 = def.paramtype2 or "facedir"
f_def.use_texture_alpha = "clip"
f_def.drop = def.drop
f_def.light_source = def.light_source
f_def.use_texture_alpha = def.use_texture_alpha
if f_def.drawtype == "mesh" then
f_def.mesh = def.mesh

View File

@ -29,6 +29,13 @@ register.register_bed("jungle_bed", {
inv_image = "multidecor_double_jungle_bed_inv.png",
mesh = "multidecor_double_jungle_bed.obj"
}
},
{
recipe = {
{"multidecor:jungleboard", "wool:white", "multidecor:jungleboard"},
{"multidecor:jungleboard", "wool:white", "multidecor:jungleboard"},
{"multidecor:jungleplank", "multidecor:jungleplank", "multidecor:jungleplank"}
}
})
register.register_bed("wooden_bed_with_legs", {
@ -63,4 +70,11 @@ register.register_bed("wooden_bed_with_legs", {
inv_image = "multidecor_double_wooden_bed_inv.png",
mesh = "multidecor_double_wooden_bed_with_legs.b3d"
}
},
{
recipe = {
{"multidecor:board", "wool:white", "multidecor:plank"},
{"multidecor:board", "wool:white", "multidecor:plank"},
{"multidecor:board", "multidecor:plank", ""}
}
})

View File

@ -65,7 +65,7 @@ register.register_seat("soft_modern_jungle_chair", {
material = "wood",
description = "Soft Modern Jungle Chair",
mesh = "multidecor_soft_modern_jungle_chair.b3d",
tiles = {"multidecor_modern_jungle_chair.png"},
tiles = {"multidecor_jungle_wood.png", "multidecor_wool_material.png"},
bounding_boxes = {
{-0.35, -0.5, -0.35, 0.35, 0.25, 0.25},
{-0.35, -0.5, 0.25, 0.35, 1.2, 0.35}
@ -96,7 +96,7 @@ register.register_seat("soft_round_modern_metallic_chair", {
material = "metal",
description = "Soft Round Modern Metallic Chair",
mesh = "multidecor_round_soft_metallic_chair.b3d",
tiles = {"multidecor_round_soft_metallic_chair.png"},
tiles = {"multidecor_wool_material.png", "multidecor_metal_material.png"},
bounding_boxes = {
{-0.5, -0.5, -0.5, 0.5, 0.25, 0.25},
{-0.5, -0.5, 0.25, 0.5, 0.95, 0.5}
@ -127,7 +127,7 @@ register.register_seat("round_modern_metallic_stool", {
material = "metal",
description = "Round Modern Jungle Stool",
mesh = "multidecor_modern_round_metallic_stool.b3d",
tiles = {"multidecor_modern_round_metallic_stool.png"},
tiles = {"multidecor_wool_material.png", "multidecor_metal_material.png"},
bounding_boxes = {
{-0.4, -0.5, -0.4, 0.4, 0.35, 0.4}
}

View File

@ -2,5 +2,6 @@ local modpath = minetest.get_modpath("modern")
dofile(modpath .. "/beds.lua")
dofile(modpath .. "/chairs.lua")
dofile(modpath .. "/lamps.lua")
dofile(modpath .. "/shelves.lua")
dofile(modpath .. "/tables.lua")

73
modern/lamps.lua Normal file
View File

@ -0,0 +1,73 @@
local silvered_lamp_recipe
if minetest.get_modpath("moreores") then
silvered_lamp_recipe = {
recipe = {
{"moreores:silver_ingot", "multidecor:bulb", "moreores:silver_ingot"},
{"moreores:silver_ingot", "multidecor:lampshade", "moreores:silver_ingot"},
{"", "", ""}
}
}
end
register.register_light("silvered_desk_lamp_off", {
style = "modern",
material = "metal",
description = "Silvered Desk Lamp",
use_texture_alpha = "blend",
mesh = "multidecor_silvered_desk_lamp.b3d",
tiles = {"multidecor_silver_material.png", "multidecor_silvered_lampshade.png"},
bounding_boxes = {{-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}},
},
{
swap_light = {
name = "silvered_desk_lamp_on",
light_level = 10
}
}, silvered_lamp_recipe)
register.register_light("copper_wall_sconce_off", {
style = "modern",
material = "glass",
description = "Copper Wall Sconce",
paramtype2 = "wallmounted",
mesh = "multidecor_copper_wall_sconce.b3d",
tiles = {"multidecor_copper_material.png", "multidecor_bulb_surf.png"},
bounding_boxes = {{-0.2, 0, 0.3, 0.2, 0.4, 0.5}},
},
{
swap_light = {
name = "copper_wall_sconce_on"
}
},
{
recipe = {
{"default:copper_ingot", "multidecor:bulb", ""},
{"default:copper_ingot", "", ""},
{"", "", ""}
}
})
register.register_light("plastic_desk_lamp_off", {
style = "modern",
material = "plastic",
description = "Plastic Desk Lamp",
use_texture_alpha = "blend",
mesh = "multidecor_plastic_desk_lamp.b3d",
tiles = {"multidecor_plastic_material.png", "multidecor_plastic_desk_lampshade.png"},
bounding_boxes = {{-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}},
},
{
swap_light = {
name = "plastic_desk_lamp_on",
light_level = 10
}
},
{
recipe = {
{"multidecor:plastic_sheet", "multidecor:lampshade", "multidecor:plastic_sheet"},
{"multidecor:plastic_sheet", "multidecor:bulb", "multidecor:plastic_sheet"},
{"", "multidecor:plastic_sheet", ""}
}
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -38,8 +38,8 @@ register.register_table("round_modern_metallic_table", {
style = "modern",
material = "metal",
description = "Round Modern Metallic Table",
mesh = "multidecor_round_metallic_table.obj",
tiles = {"multidecor_round_metallic_table.png"},
mesh = "multidecor_round_metallic_table.b3d",
tiles = {"multidecor_metal_material.png", "multidecor_aspen_wood.png"},
bounding_boxes = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
}
@ -143,8 +143,8 @@ register.register_table("modern_wooden_table_with_metallic_legs", {
style = "modern",
material = "metal",
description = "Modern Wooden Table With Metallic Legs",
mesh = "multidecor_wooden_table_with_metallic_legs.obj",
tiles = {"multidecor_wooden_table_with_metallic_legs.png"},
mesh = "multidecor_wooden_table_with_metallic_legs.b3d",
tiles = {"multidecor_aspen_wood.png", "multidecor_metal_material.png"},
bounding_boxes = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB