moreblocks/stairsplus/registrations.lua

109 lines
2.8 KiB
Lua
Raw Normal View History

--[[
2015-01-12 17:46:22 +01:00
More Blocks: registrations
2017-02-19 13:35:16 +01:00
Copyright (c) 2011-2017 Hugo Locurcio and contributors.
Licensed under the zlib license. See LICENSE.md for more information.
--]]
-- default registrations
local default_nodes = { -- Default stairs/slabs/panels/microblocks:
2014-03-09 10:38:18 +01:00
"stone",
"stone_block",
2014-03-09 10:38:18 +01:00
"cobble",
"mossycobble",
"brick",
"sandstone",
"steelblock",
"goldblock",
"copperblock",
"bronzeblock",
"diamondblock",
"tinblock",
2014-03-09 10:38:18 +01:00
"desert_stone",
"desert_stone_block",
2014-10-28 22:12:40 +01:00
"desert_cobble",
2015-06-17 17:18:17 +02:00
"meselamp",
2014-03-09 10:38:18 +01:00
"glass",
"tree",
"wood",
"jungletree",
"junglewood",
"pine_tree",
"pine_wood",
"acacia_tree",
"acacia_wood",
"aspen_tree",
"aspen_wood",
2014-03-09 10:38:18 +01:00
"obsidian",
"obsidian_block",
"obsidianbrick",
2014-03-09 10:38:18 +01:00
"obsidian_glass",
"stonebrick",
"desert_stonebrick",
"sandstonebrick",
"silver_sandstone",
"silver_sandstone_brick",
"silver_sandstone_block",
"desert_sandstone",
"desert_sandstone_brick",
"desert_sandstone_block",
"sandstone_block",
"coral_skeleton",
2014-03-09 10:38:18 +01:00
}
for _, name in pairs(default_nodes) do
local mod = "default"
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
ndef.sunlight_propagates = true
-- Stone and desert_stone drop cobble and desert_cobble respectively.
if type(ndef.drop) == "string" then
ndef.drop = ndef.drop:gsub(".+:", "")
end
-- Use the primary tile for all sides of cut glasslike nodes.
if #ndef.tiles > 1 and ndef.drawtype and ndef.drawtype:find("glass") then
ndef.tiles = {ndef.tiles[1]}
end
mod = "moreblocks"
stairsplus:register_all(mod, name, nodename, ndef)
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
end
-- farming registrations
if minetest.get_modpath("farming") then
local farming_nodes = {"straw"}
for _, name in pairs(farming_nodes) do
local mod = "farming"
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
ndef.sunlight_propagates = true
mod = "moreblocks"
stairsplus:register_all(mod, name, nodename, ndef)
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
end
2014-03-09 10:38:18 +01:00
end
-- wool registrations
if minetest.get_modpath("wool") then
local dyes = {"white", "grey", "black", "red", "yellow", "green", "cyan",
"blue", "magenta", "orange", "violet", "brown", "pink",
"dark_grey", "dark_green"}
for _, name in pairs(dyes) do
local mod = "wool"
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
ndef.sunlight_propagates = true
-- Prevent dye+cut wool recipy from creating a full wool block.
ndef.groups.wool = nil
stairsplus:register_all(mod, name, nodename, ndef)
end
end