1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-21 14:50:23 +02:00

allow chaining of on_construct instead of overwriting in registration function

This commit is contained in:
Tim
2015-08-19 17:30:37 +02:00
parent 2d433f9652
commit 8a91865d82
2 changed files with 7 additions and 8 deletions

View File

@ -24,10 +24,12 @@ function homedecor.register(name, def)
local infotext = def.infotext
--def.infotext = nil -- currently used to set locked refrigerator infotexts
if infotext and not def.on_construct then
if infotext then
local on_construct = def.on_construct
def.on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", infotext)
if on_construct then on_construct(pos) end
end
end