added blacksmith
parent
863d79debb
commit
8f73f23699
|
@ -1,11 +1,12 @@
|
||||||
-- list of schematics
|
-- list of schematics
|
||||||
local schematic_table = {
|
local schematic_table = {
|
||||||
hut = {name = "hut", mts = schem_path.."hut.mts", hsize = 10, max_num = 0.9, rplc = "y"},
|
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 = 10, max_num = 0.2, rplc = "n"},
|
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 = 7, 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 = 10, max_num = 0.2, 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 = 10, max_num = 0, 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 = 14, max_num = 0.1, 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 ={}
|
local count_buildings ={}
|
||||||
-- iterate over whole table to get all keys
|
-- 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 ) ]
|
local rotation = possible_rotations[ math.random( #possible_rotations ) ]
|
||||||
settlements.foundation(pos, width, depth, height, rotation)
|
settlements.foundation(pos, width, depth, height, rotation)
|
||||||
-- place schematic
|
-- place schematic
|
||||||
minetest.after(2, function()
|
minetest.after(3, function()
|
||||||
minetest.place_schematic(pos, schematic, rotation, nil, true)
|
minetest.place_schematic(pos, schematic, rotation, nil, true)
|
||||||
-- fill chest
|
-- fill chest
|
||||||
if name == "hut" then
|
if name == "hut" then
|
||||||
|
@ -135,6 +136,8 @@ function settlements.pick_next_building(pos_surface)
|
||||||
building_all_info = schematic_table["lamp"]
|
building_all_info = schematic_table["lamp"]
|
||||||
elseif random_number > 55 and count_buildings["church"] < schematic_table["church"]["max_num"]*number_of_buildings then
|
elseif random_number > 55 and count_buildings["church"] < schematic_table["church"]["max_num"]*number_of_buildings then
|
||||||
building_all_info = schematic_table["church"]
|
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
|
else
|
||||||
building_all_info = schematic_table["hut"]
|
building_all_info = schematic_table["hut"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
default
|
default
|
||||||
farming?
|
farming?
|
||||||
|
mobs_npc?
|
||||||
|
|
6
init.lua
6
init.lua
|
@ -11,7 +11,11 @@ dofile(settlements.modpath.."/foundation.lua")
|
||||||
dofile(settlements.modpath.."/buildings.lua")
|
dofile(settlements.modpath.."/buildings.lua")
|
||||||
-- load settlements on server
|
-- load settlements on server
|
||||||
settlements_in_world = settlements.load()
|
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
|
-- on map generation, try to build a settlement
|
||||||
--
|
--
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -92,9 +92,10 @@ function settlements.fill_chest(pos)
|
||||||
end
|
end
|
||||||
-- fill chest
|
-- fill chest
|
||||||
local inv = minetest.get_inventory( {type="node", pos=chestpos} )
|
local inv = minetest.get_inventory( {type="node", pos=chestpos} )
|
||||||
|
-- always
|
||||||
|
inv:add_item("main", "default:apple "..math.random(1,3))
|
||||||
-- low value items
|
-- low value items
|
||||||
if math.random(0,1) < 1 then
|
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", "farming:bread "..math.random(0,3))
|
||||||
inv:add_item("main", "default:steel_ingot "..math.random(0,3))
|
inv:add_item("main", "default:steel_ingot "..math.random(0,3))
|
||||||
-- additional fillings when farmin mod enabled
|
-- additional fillings when farmin mod enabled
|
||||||
|
|
Loading…
Reference in New Issue