mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-22 07:10:21 +02:00
initial progress
This commit is contained in:
@ -46,9 +46,9 @@ function homedecor.register(name, original_def)
|
||||
if expand then
|
||||
-- dissallow rotating only half the expanded node by default
|
||||
-- unless we know better
|
||||
def.on_rotate = def.on_rotate
|
||||
or (minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple)
|
||||
or screwdriver.disallow) or nil
|
||||
def.on_rotate = def.on_rotate or
|
||||
(minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple) or
|
||||
minetest.get_modpath("screwdriver") and screwdriver.disallow) or nil
|
||||
|
||||
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
|
||||
if expand.top then
|
||||
@ -96,6 +96,31 @@ function homedecor.register(name, original_def)
|
||||
end
|
||||
end
|
||||
|
||||
local crafts = def.crafts and table.copy(def.crafts) or {}
|
||||
def.crafts = nil
|
||||
|
||||
-- register the actual minetest node
|
||||
minetest.register_node(":homedecor:" .. name, def)
|
||||
|
||||
for _, cdef in pairs(crafts) do
|
||||
if cdef.recipe then
|
||||
for k, row in pairs(cdef.recipe) do
|
||||
if type(row) == "string" and homedecor.materials[row] then
|
||||
cdef.recipe[k] = homedecor.materials[row]
|
||||
elseif type(row) == "table" then
|
||||
for i, item in pairs(row) do
|
||||
if homedecor.materials[item] then
|
||||
cdef.recipe[k][i] = homedecor.materials[item]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if cdef.type ~= "toolrepair" and not cdef.output then
|
||||
cdef.output = ":homedecor:" .. name
|
||||
end
|
||||
|
||||
minetest.register_craft(cdef)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user