Skip to content

Commit

Permalink
add meta to furnace (mts problem)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeb187 committed Jul 7, 2018
1 parent ff71305 commit 95dc5b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions buildings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 14 additions & 0 deletions utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 95dc5b3

Please sign in to comment.