forked from mtcontrib/homedecor_modpack
register a copy of the def instead of the passed def, this allows us later to spawn supporting nodes from the same original def
This commit is contained in:
parent
9420e9136c
commit
cc79b5fc03
@ -57,7 +57,7 @@ end
|
||||
-- locked = true,
|
||||
-- }
|
||||
--
|
||||
function homedecor.handle_inventory(name, def)
|
||||
function homedecor.handle_inventory(name, def, original_def)
|
||||
local inventory = def.inventory
|
||||
if not inventory then return end
|
||||
def.inventory = nil
|
||||
@ -153,6 +153,5 @@ function homedecor.handle_inventory(name, def)
|
||||
return allow_take and allow_take(pos, listname, index, stack, player)
|
||||
or stack:get_count()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -2,7 +2,9 @@ homedecor = homedecor or {}
|
||||
local S = homedecor.gettext
|
||||
|
||||
--wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings
|
||||
function homedecor.register(name, def)
|
||||
function homedecor.register(name, original_def)
|
||||
local def = table.copy(original_def)
|
||||
|
||||
def.drawtype = def.drawtype
|
||||
or (def.mesh and "mesh")
|
||||
or (def.node_box and "nodebox")
|
||||
@ -19,7 +21,7 @@ function homedecor.register(name, def)
|
||||
def.paramtype2 = def.paramtype2 or "facedir"
|
||||
end
|
||||
|
||||
homedecor.handle_inventory(name, def)
|
||||
homedecor.handle_inventory(name, def, original_def)
|
||||
|
||||
local infotext = def.infotext
|
||||
--def.infotext = nil -- currently used to set locked refrigerator infotexts
|
||||
|
Loading…
Reference in New Issue
Block a user