From 8f73f2369905bb462c0d3d4d47942344a2e2aced Mon Sep 17 00:00:00 2001 From: Rochambeau Date: Thu, 5 Jul 2018 20:15:40 +0200 Subject: [PATCH] added blacksmith --- buildings.lua | 17 ++++++++++------- depends.txt | 1 + init.lua | 6 +++++- schematics/blacksmith.mts | Bin 0 -> 356 bytes schematics/lamp.mts | Bin 208 -> 253 bytes utils.lua | 3 ++- 6 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 schematics/blacksmith.mts diff --git a/buildings.lua b/buildings.lua index 29f5c18..578701d 100644 --- a/buildings.lua +++ b/buildings.lua @@ -1,11 +1,12 @@ -- list of schematics local schematic_table = { - hut = {name = "hut", mts = schem_path.."hut.mts", hsize = 10, max_num = 0.9, rplc = "y"}, - garden = {name = "garden", mts = schem_path.."garden.mts", hsize = 10, max_num = 0.2, rplc = "n"}, - lamp = {name = "lamp", mts = schem_path.."lamp.mts", hsize = 7, max_num = 0.2, rplc = "n"}, - tower = {name = "tower", mts = schem_path.."tower.mts", hsize = 10, max_num = 0.2, rplc = "n"}, - well = {name = "well", mts = schem_path.."well.mts", hsize = 10, max_num = 0, rplc = "n"}, - church = {name = "church", mts = schem_path.."church.mts", hsize = 14, max_num = 0.1, rplc = "n"} + hut = {name = "hut", mts = schem_path.."hut.mts", hsize = 11, max_num = 0.9, rplc = "y"}, + garden = {name = "garden", mts = schem_path.."garden.mts", hsize = 11, max_num = 0.2, rplc = "n"}, + lamp = {name = "lamp", mts = schem_path.."lamp.mts", hsize = 8, max_num = 0.1, rplc = "n"}, + tower = {name = "tower", mts = schem_path.."tower.mts", hsize = 11, max_num = 0.15, rplc = "n"}, + well = {name = "well", mts = schem_path.."well.mts", hsize = 11, max_num = 0, rplc = "n"}, + church = {name = "church", mts = schem_path.."church.mts", hsize = 15, max_num = 0.075, rplc = "n"}, + blacksmith = {name = "blacksmith", mts = schem_path.."blacksmith.mts", hsize = 11, max_num = 0.1, rplc = "n"}, } local count_buildings ={} -- iterate over whole table to get all keys @@ -40,7 +41,7 @@ function settlements.build_schematic(pos, building, replace_wall, name) local rotation = possible_rotations[ math.random( #possible_rotations ) ] settlements.foundation(pos, width, depth, height, rotation) -- place schematic - minetest.after(2, function() + minetest.after(3, function() minetest.place_schematic(pos, schematic, rotation, nil, true) -- fill chest if name == "hut" then @@ -135,6 +136,8 @@ function settlements.pick_next_building(pos_surface) building_all_info = schematic_table["lamp"] elseif random_number > 55 and count_buildings["church"] < schematic_table["church"]["max_num"]*number_of_buildings then building_all_info = schematic_table["church"] + elseif random_number > 45 and count_buildings["blacksmith"] < schematic_table["blacksmith"]["max_num"]*number_of_buildings then + building_all_info = schematic_table["blacksmith"] else building_all_info = schematic_table["hut"] end diff --git a/depends.txt b/depends.txt index 88efa0a..33161c5 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ default farming? +mobs_npc? diff --git a/init.lua b/init.lua index 34e3232..fa901e9 100644 --- a/init.lua +++ b/init.lua @@ -11,7 +11,11 @@ dofile(settlements.modpath.."/foundation.lua") dofile(settlements.modpath.."/buildings.lua") -- load settlements on server settlements_in_world = settlements.load() - +if minetest.get_modpath("mobs_npc") ~= nil then + --mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) + mobs:register_spawn("mobs_npc:npc", {"default:junglewood"}, 20, 0, 1, 7, 31000, nil) + mobs:register_spawn("mobs_npc:trader", {"default:junglewood"}, 20, 0, 1, 7, 31000, nil) +end -- -- on map generation, try to build a settlement -- diff --git a/schematics/blacksmith.mts b/schematics/blacksmith.mts new file mode 100644 index 0000000000000000000000000000000000000000..1f0e15e23d043f8073443458484f0c18569de441 GIT binary patch literal 356 zcmeYb3HD`RVPFTrdI(_PVGvJAO-n4zDX~h)EGmgF&n(G^PcKR=E@og(%q(J%C@uj~ z#a3V{zPKbmFEu_XCqFrxfd^S1gAj}dR+3bd2~ts>n3Gd%m7JfHl#|LJ1T!foF)1D@ z#t+j4wlUt2fxn_4F)y{)Dk-rjJ}oD)gh3dlA}6sdF}^szv?w{1fe$8#ZcJKfQC?zl zYQ>zllRWtv6nI>_MFV51 zsk-@QlB{xq;=|KRSwsa?%J*|-vpZF^pH*I>v6kiRJ>NYu`_f*_?J=CHze4XfrWvYft`W59s(FRCyF@n@}#7uC6?xtSfykZl}rq^OkfZyE=kNR zDz+-lNlc1Q&QD6pNv)WZoWQ{B#-^sw=EyNyvXi%oheyZZ%#j0JV#%zhH!>O;Gg}K7 rJ6lY+&Sb5%8I?l85IJ&!PgeE1XFI%b6Gs@0G3v0BOk{ AGXMYp diff --git a/utils.lua b/utils.lua index 1fa2a1d..4c3b30f 100644 --- a/utils.lua +++ b/utils.lua @@ -92,9 +92,10 @@ function settlements.fill_chest(pos) end -- fill chest local inv = minetest.get_inventory( {type="node", pos=chestpos} ) + -- always + inv:add_item("main", "default:apple "..math.random(1,3)) -- low value items if math.random(0,1) < 1 then - inv:add_item("main", "default:apple "..math.random(0,3)) inv:add_item("main", "farming:bread "..math.random(0,3)) inv:add_item("main", "default:steel_ingot "..math.random(0,3)) -- additional fillings when farmin mod enabled