forked from mtcontrib/homedecor_modpack
make homedecor game agnostic (#28)
* make materials.lua with hades, minetest game, farlands items * make textures file for central handling * make mods game agnostic * take out the trash * handle multiple seats in sofas * add github luacheck workflow and various luacheck fixes * add fluxionary scope creep * fix devtest breaking right to a name policy Co-authored-by: wsor4035 <24964441+wsor4035@users.noreply.github.com> Co-authored-by: SFENCE <sfence.software@gmail.com>
This commit is contained in:
@ -46,9 +46,12 @@ 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
|
||||
screwdriver.disallow
|
||||
)
|
||||
)
|
||||
|
||||
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
|
||||
if expand.top then
|
||||
@ -96,6 +99,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