Add more nodes
16
LICENSE
@ -1,15 +1,17 @@
|
|||||||
┌──────────────────────────────────────────────────────────────────────┐
|
┌──────────────────────────────────────────────────────────────────────┐
|
||||||
│ Copyright (c) 2015-2017 kilbith <jeanpatrick.guerrero@gmail.com> │
|
│ Copyright (c) 2015-2017 kilbith <jeanpatrick.guerrero@gmail.com> │
|
||||||
│ │
|
│ │
|
||||||
│ Code: BSD │
|
│ Code: BSD │
|
||||||
│ Textures: WTFPL (credits: Gambit, kilbith, Cisoun) │
|
│ Textures: WTFPL (credits: Gambit, kilbith, Cisoun) │
|
||||||
│ Sounds: │
|
│ Textures (radio, speaker, hanging candle, rooster) by │
|
||||||
|
gigomaf <bartiko2@poczta.fm> (CC BY-NC 3.0) │
|
||||||
|
│ Sounds: │
|
||||||
│ - xdecor_boiling_water.ogg - by Audionautics - CC BY-SA │
|
│ - xdecor_boiling_water.ogg - by Audionautics - CC BY-SA │
|
||||||
│ freesound.org/people/Audionautics/sounds/133901/ │
|
│ freesound.org/people/Audionautics/sounds/133901/ │
|
||||||
│ - xdecor_enchanting.ogg - by Timbre - CC BY-SA-NC │
|
│ - xdecor_enchanting.ogg - by Timbre - CC BY-SA-NC │
|
||||||
│ freesound.org/people/Timbre/sounds/221683/ │
|
│ freesound.org/people/Timbre/sounds/221683/ │
|
||||||
│ - xdecor_bouncy.ogg - by Blender Foundation - CC BY 3.0 │
|
│ - xdecor_bouncy.ogg - by Blender Foundation - CC BY 3.0 │
|
||||||
│ opengameart.org/content/funny-comic-cartoon-bounce-sound │
|
│ opengameart.org/content/funny-comic-cartoon-bounce-sound │
|
||||||
└──────────────────────────────────────────────────────────────────────┘
|
└──────────────────────────────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ function xdecor.stairs_valid_def(def)
|
|||||||
not (def.groups.not_cuttable == 1) and
|
not (def.groups.not_cuttable == 1) and
|
||||||
not def.groups.wool and
|
not def.groups.wool and
|
||||||
(def.tiles and type(def.tiles[1]) == "string" and not
|
(def.tiles and type(def.tiles[1]) == "string" and not
|
||||||
def.tiles[1]:find("default_mineral")) and
|
def.tiles[1]:find("default_mineral")) and
|
||||||
not def.mesecons and
|
not def.mesecons and
|
||||||
def.description and
|
def.description and
|
||||||
def.description ~= "" and
|
def.description ~= "" and
|
||||||
|
@ -143,7 +143,7 @@ xdecor.register("candle", {
|
|||||||
animation = {type="vertical_frames", length = 1.5}
|
animation = {type="vertical_frames", length = 1.5}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "xdecor_candle_floor.png",
|
name = "xdecor_candle_hanging.png",
|
||||||
animation = {type="vertical_frames", length = 1.5}
|
animation = {type="vertical_frames", length = 1.5}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -397,6 +397,15 @@ xdecor.register("ivy", {
|
|||||||
sounds = default.node_sound_leaves_defaults()
|
sounds = default.node_sound_leaves_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
xdecor.register("rooster", {
|
||||||
|
description = S("Rooster"),
|
||||||
|
drawtype = "torchlike",
|
||||||
|
inventory_image = "xdecor_rooster.png",
|
||||||
|
walkable = false,
|
||||||
|
groups = {snappy = 3, attached_node = 1},
|
||||||
|
tiles = {"xdecor_rooster.png"},
|
||||||
|
})
|
||||||
|
|
||||||
xdecor.register("lantern", {
|
xdecor.register("lantern", {
|
||||||
description = S("Lantern"),
|
description = S("Lantern"),
|
||||||
light_source = 13,
|
light_source = 13,
|
||||||
@ -418,6 +427,7 @@ xdecor.register("lantern", {
|
|||||||
local xdecor_lightbox = {
|
local xdecor_lightbox = {
|
||||||
iron = S("Iron Light Box"),
|
iron = S("Iron Light Box"),
|
||||||
wooden = S("Wooden Light Box"),
|
wooden = S("Wooden Light Box"),
|
||||||
|
wooden2 = S("Wooden Light Box 2"),
|
||||||
}
|
}
|
||||||
|
|
||||||
for l, desc in pairs(xdecor_lightbox) do
|
for l, desc in pairs(xdecor_lightbox) do
|
||||||
@ -609,3 +619,19 @@ xdecor.register("woodframed_glass", {
|
|||||||
groups = {cracky = 2, oddly_breakable_by_hand = 1},
|
groups = {cracky = 2, oddly_breakable_by_hand = 1},
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
for _, v in ipairs({"radio", "speaker"}) do
|
||||||
|
xdecor.register(v, {
|
||||||
|
description = v:gsub("^%l", string.upper),
|
||||||
|
on_rotate = screwdriver.rotate_simple,
|
||||||
|
tiles = {
|
||||||
|
"xdecor_" .. v .. "_top.png",
|
||||||
|
"xdecor_" .. v .. "_side.png",
|
||||||
|
"xdecor_" .. v .. "_side.png",
|
||||||
|
"xdecor_" .. v .. "_side.png",
|
||||||
|
"xdecor_" .. v .. "_back.png",
|
||||||
|
"xdecor_" .. v .. "_front.png",
|
||||||
|
},
|
||||||
|
groups = {cracky = 2, not_cuttable = 1},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
@ -180,6 +180,30 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:radio",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {"xdecor:speaker", "xdecor:speaker"}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:rooster",
|
||||||
|
recipe = {
|
||||||
|
{"default:gold_ingot", "", "default:gold_ingot"},
|
||||||
|
{"", "default:gold_ingot", ""},
|
||||||
|
{"default:gold_ingot", "", "default:gold_ingot"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:speaker",
|
||||||
|
recipe = {
|
||||||
|
{"default:gold_ingot", "default:copper_ingot", "default:gold_ingot"},
|
||||||
|
{"default:copper_ingot", "", "default:copper_ingot"},
|
||||||
|
{"default:gold_ingot", "default:copper_ingot", "default:gold_ingot"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:stone_tile 2",
|
output = "xdecor:stone_tile 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -267,3 +291,9 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:wooden2_lightbox",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {"xdecor:wooden_lightbox"},
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -1,37 +1,19 @@
|
|||||||
local workbench = {}
|
local workbench = {}
|
||||||
WB = {}
|
local nodes = {}
|
||||||
|
|
||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
local min, ceil = math.min, math.ceil
|
local min, ceil = math.min, math.ceil
|
||||||
local registered_nodes = minetest.registered_nodes
|
|
||||||
local S = minetest.get_translator("xdecor")
|
local S = minetest.get_translator("xdecor")
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
|
|
||||||
-- Nodes allowed to be cut
|
-- Nodes allowed to be cut
|
||||||
-- Only the regular, solid blocks without metas or explosivity can be cut
|
-- Only the regular, solid blocks without metas or explosivity can be cut
|
||||||
local nodes = {}
|
for node, def in pairs(minetest.registered_nodes) do
|
||||||
for node, def in pairs(registered_nodes) do
|
|
||||||
if xdecor.stairs_valid_def(def) then
|
if xdecor.stairs_valid_def(def) then
|
||||||
nodes[#nodes + 1] = node
|
nodes[#nodes + 1] = node
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Optionally, you can register custom cuttable nodes in the workbench
|
|
||||||
WB.custom_nodes_register = {
|
|
||||||
-- "default:leaves",
|
|
||||||
}
|
|
||||||
|
|
||||||
setmetatable(nodes, {
|
|
||||||
__concat = function(t1, t2)
|
|
||||||
for i = 1, #t2 do
|
|
||||||
t1[#t1 + 1] = t2[i]
|
|
||||||
end
|
|
||||||
|
|
||||||
return t1
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
nodes = nodes .. WB.custom_nodes_register
|
|
||||||
|
|
||||||
-- Nodeboxes definitions
|
-- Nodeboxes definitions
|
||||||
workbench.defs = {
|
workbench.defs = {
|
||||||
-- Name YieldX YZ WH L
|
-- Name YieldX YZ WH L
|
||||||
@ -187,7 +169,7 @@ function workbench.allow_put(pos, listname, index, stack, player)
|
|||||||
local stackname = stack:get_name()
|
local stackname = stack:get_name()
|
||||||
if (listname == "tool" and stack:get_wear() > 0 and
|
if (listname == "tool" and stack:get_wear() > 0 and
|
||||||
workbench:repairable(stackname)) or
|
workbench:repairable(stackname)) or
|
||||||
(listname == "input" and registered_nodes[stackname .. "_cube"]) or
|
(listname == "input" and minetest.registered_nodes[stackname .. "_cube"]) or
|
||||||
(listname == "hammer" and stackname == "xdecor:hammer") or
|
(listname == "hammer" and stackname == "xdecor:hammer") or
|
||||||
listname == "storage" then
|
listname == "storage" then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
@ -232,7 +214,7 @@ function workbench.on_take(pos, listname, index, stack, player)
|
|||||||
local stackname = stack:get_name()
|
local stackname = stack:get_name()
|
||||||
|
|
||||||
if listname == "input" then
|
if listname == "input" then
|
||||||
if stackname == inputname and registered_nodes[inputname .. "_cube"] then
|
if stackname == inputname and minetest.registered_nodes[inputname .. "_cube"] then
|
||||||
workbench:get_output(inv, input, stackname)
|
workbench:get_output(inv, input, stackname)
|
||||||
else
|
else
|
||||||
inv:set_list("forms", {})
|
inv:set_list("forms", {})
|
||||||
@ -274,69 +256,67 @@ xdecor.register("workbench", {
|
|||||||
allow_metadata_inventory_move = workbench.allow_move
|
allow_metadata_inventory_move = workbench.allow_move
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
for _, d in ipairs(workbench.defs) do
|
||||||
for _, d in ipairs(workbench.defs) do
|
for i = 1, #nodes do
|
||||||
for i = 1, #nodes do
|
local node = nodes[i]
|
||||||
local node = nodes[i]
|
local mod_name, item_name = node:match("^(.-):(.*)")
|
||||||
local mod_name, item_name = node:match("^(.-):(.*)")
|
local def = minetest.registered_nodes[node]
|
||||||
local def = registered_nodes[node]
|
|
||||||
|
|
||||||
if item_name and d[3] then
|
if item_name and d[3] then
|
||||||
local groups = {}
|
local groups = {}
|
||||||
local tiles
|
local tiles
|
||||||
groups.not_in_creative_inventory = 1
|
groups.not_in_creative_inventory = 1
|
||||||
|
|
||||||
for k, v in pairs(def.groups) do
|
for k, v in pairs(def.groups) do
|
||||||
if k ~= "wood" and k ~= "stone" and k ~= "level" then
|
if k ~= "wood" and k ~= "stone" and k ~= "level" then
|
||||||
groups[k] = v
|
groups[k] = v
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if def.tiles then
|
|
||||||
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
|
|
||||||
tiles = def.tiles
|
|
||||||
else
|
|
||||||
tiles = {def.tiles[1]}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
tiles = {def.tile_images[1]}
|
|
||||||
end
|
|
||||||
|
|
||||||
--TODO: Translation support for Stairs/Slab
|
|
||||||
if not registered_nodes["stairs:slab_" .. item_name] then
|
|
||||||
stairs.register_stair_and_slab(item_name, node,
|
|
||||||
groups, tiles, def.description .. " Stair",
|
|
||||||
def.description .. " Slab", def.sounds)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node(":" .. node .. "_" .. d[1], {
|
|
||||||
--TODO: Translation support
|
|
||||||
description = def.description .. " " .. d[1]:gsub("^%l", string.upper),
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
sounds = def.sounds,
|
|
||||||
tiles = tiles,
|
|
||||||
groups = groups,
|
|
||||||
-- `unpack` has been changed to `table.unpack` in newest Lua versions
|
|
||||||
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),
|
|
||||||
sunlight_propagates = true,
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
|
|
||||||
elseif item_name and mod_name then
|
|
||||||
minetest.register_alias_force(
|
|
||||||
("%s:%s_innerstair"):format(mod_name, item_name),
|
|
||||||
("stairs:stair_inner_%s"):format(item_name)
|
|
||||||
)
|
|
||||||
minetest.register_alias_force(
|
|
||||||
("%s:%s_outerstair"):format(mod_name, item_name),
|
|
||||||
("stairs:stair_outer_%s"):format(item_name)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if def.tiles then
|
||||||
|
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
|
||||||
|
tiles = def.tiles
|
||||||
|
else
|
||||||
|
tiles = {def.tiles[1]}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tiles = {def.tile_images[1]}
|
||||||
|
end
|
||||||
|
|
||||||
|
--TODO: Translation support for Stairs/Slab
|
||||||
|
if not minetest.registered_nodes["stairs:slab_" .. item_name] then
|
||||||
|
stairs.register_stair_and_slab(item_name, node,
|
||||||
|
groups, tiles, def.description .. " Stair",
|
||||||
|
def.description .. " Slab", def.sounds)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node(":" .. node .. "_" .. d[1], {
|
||||||
|
--TODO: Translation support
|
||||||
|
description = def.description .. " " .. d[1]:gsub("^%l", string.upper),
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
sounds = def.sounds,
|
||||||
|
tiles = tiles,
|
||||||
|
groups = groups,
|
||||||
|
-- `unpack` has been changed to `table.unpack` in newest Lua versions
|
||||||
|
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
on_place = minetest.rotate_node
|
||||||
|
})
|
||||||
|
|
||||||
|
elseif item_name and mod_name then
|
||||||
|
minetest.register_alias_force(
|
||||||
|
("%s:%s_innerstair"):format(mod_name, item_name),
|
||||||
|
("stairs:stair_inner_%s"):format(item_name)
|
||||||
|
)
|
||||||
|
minetest.register_alias_force(
|
||||||
|
("%s:%s_outerstair"):format(mod_name, item_name),
|
||||||
|
("stairs:stair_outer_%s"):format(item_name)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
-- Craft items
|
-- Craft items
|
||||||
|
|
||||||
|
BIN
textures/xdecor_candle_hanging.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
textures/xdecor_radio_back.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/xdecor_radio_front.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/xdecor_radio_side.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
textures/xdecor_radio_top.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/xdecor_rooster.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
textures/xdecor_speaker_back.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/xdecor_speaker_front.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/xdecor_speaker_side.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/xdecor_speaker_top.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/xdecor_wooden2_lightbox.png
Normal file
After Width: | Height: | Size: 15 KiB |