From 7f685a2928d88b92559e103184796e7e08bf571b Mon Sep 17 00:00:00 2001 From: kaadmy Date: Tue, 1 Sep 2015 15:13:34 -0700 Subject: [PATCH] added automatic village generation(via biome decorations) --- mods/default/mapgen.lua | 2 +- mods/village/mapgen.lua | 43 ++++++++++++++------- mods/village/schematics/village_filler.mts | Bin 184 -> 194 bytes mods/village/schematics/village_road.mts | Bin 200 -> 183 bytes 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index e16984f..c7999b6 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -238,7 +238,7 @@ minetest.register_biome( node_underwater = "default:dirt", node_shore_top = "default:sand", node_shore_filler = "default:sandstone", height_shore = 0, - y_min = 0, y_max = 500, + y_min = 0, y_max = 200, heat_point = 35, humidity_point = 40, }) diff --git a/mods/village/mapgen.lua b/mods/village/mapgen.lua index 1af09b3..3a93e32 100644 --- a/mods/village/mapgen.lua +++ b/mods/village/mapgen.lua @@ -5,7 +5,7 @@ minetest.register_node( tiles = {"default_brick.png^default_book.png"}, is_ground_content = false, groups = {dig_immediate = 2}, - sounds = default.node_sound_wood_defaults({}) + sounds = default.node_sound_wood_defaults() }) minetest.register_node( @@ -15,34 +15,47 @@ minetest.register_node( tiles = {"default_grass.png^default_book.png"}, is_ground_content = false, groups = {dig_immediate = 2}, - sounds = default.node_sound_wood_defaults({}) + sounds = default.node_sound_wood_defaults() }) minetest.register_node( - "village:desert_village", + "village:grassland_village_mg", { - description = "Spawns a village at this block when placed", - tiles = {"default_sand.png^default_book.png"}, + description = "Mapgen village spawner(Has chance of not spawning village)", + tiles = {"default_grass.png^default_book.png"}, is_ground_content = false, groups = {dig_immediate = 2}, - sounds = default.node_sound_wood_defaults({}) + sounds = default.node_sound_wood_defaults() }) -minetest.register_alias("village", "village:grassland_village") - minetest.register_abm( { - nodenames = {"village:grassland_village"}, + nodenames = {"village:grassland_village", "village:grassland_village_mg"}, interval = 1, chance = 1, action = function(pos, node) - print("Spawning a Grassland village at "..dump(pos)) minetest.remove_node(pos) - village.spawn_village(pos, PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)) + local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z) + if node.name == "village:grassland_village_mg" then + if pr:next(1, 100) == 1 then + print("Spawning a (Mapgen)Grassland village at "..dump(pos)) + village.spawn_village(pos, pr) + end + else + print("Spawning a Grassland village at "..dump(pos)) + village.spawn_village(pos, pr) + end end }) -minetest.register_on_generated( - function(minp, maxp, seed) - - end) \ No newline at end of file +minetest.register_decoration( + { + deco_type = "simple", + place_on = "default:dirt_with_grass", + sidelen = 16, + fill_ratio = 0.005, + biomes = {"Grassland", "Forest"}, + decoration = {"village:grassland_village_mg"}, + y_min = 1, + y_max = 1000, + }) \ No newline at end of file diff --git a/mods/village/schematics/village_filler.mts b/mods/village/schematics/village_filler.mts index 710adf2481244b5e8c4d62b0cc29e7874cbaeb36..a8615466481cc5db6e5cbde8361e3462d5f4de20 100644 GIT binary patch delta 119 zcmV--0Eqv%0m1) z&ipR*Ytq_FmSAi0wqShCs2*K$UtiDYsw*OWJ=d$QcurSj&=nbUMFw4wL08n#6?Jq) Z9bIv<0{{T74%+r3Uj}gf@&-nRH{2eH0OX4jivR!s delta 77 zcmdnac!H7NHze4XfrWvGfsuiyo`HQLzaB47N@`kSX-@V#%`SPM;5`E~Ll}d{VgMsl7O4OL