add meta to furnace (mts problem)

master
Rochambeau 2018-07-07 19:41:14 +02:00
parent ff713053ca
commit 95dc5b38ea
3 changed files with 17 additions and 1 deletions

View File

@ -38,6 +38,8 @@ function settlements.build_schematic(pos, building, replace_wall, name)
-- fill chest
if name == "hut" then
minetest.after(2,settlements.fill_chest,pos)
elseif name == "blacksmith" then
minetest.after(2,settlements.initialize_furnace,pos)
end
end)
end

View File

@ -47,7 +47,7 @@ minetest.register_craftitem("settlements:tool", {
on_use = function(itemstack, placer, pointed_thing)
local center_surface = pointed_thing.under
if center_surface then
local building_all_info = {name = "church", mts = schem_path.."church.mts", hsize = 13, max_num = 0.9, rplc = "n"}
local building_all_info = {name = "blacksmith", mts = schem_path.."blacksmith.mts", hsize = 13, max_num = 0.9, rplc = "n"}
settlements.build_schematic(center_surface, building_all_info["mts"],building_all_info["rplc"], building_all_info["name"])
-- settlements.convert_mts_to_lua()

View File

@ -125,6 +125,20 @@ function settlements.fill_chest(pos)
end
end
--
-- initialize furnace
--
function settlements.initialize_furnace(pos)
-- find chests within radius
local furnacepos = minetest.find_node_near(pos, 7, {"default:furnace"})
-- initialize furnacepos (mts furnacepos don't have meta)
if furnacepos then
local meta = minetest.get_meta(furnacepos)
if meta:get_string("infotext") ~= "furnace" then
minetest.registered_nodes["default:furnace"].on_construct(furnacepos)
end
end
end
--
-- randomize table
--
function shuffle(tbl)