Compare commits

...

10 Commits

Author SHA1 Message Date
sfan5
a093b785a5 Replace deprecated functions so it stops crashing 2020-05-15 16:25:18 +02:00
sfan5
03674033c6 Use pine nodes and dry grass from minetest_game if possible 2018-01-09 14:41:23 +01:00
sfan5
43bf44ce63 Structure nodes.lua a little 2018-01-09 14:41:23 +01:00
sfan5
a347081ffd Fix incorrect write_map_usage()
closes #11
2017-12-10 14:02:32 +01:00
sfan5
36925bfbae Redesign fountain & library schematics
* Fountain is now smaller
* Shape of library was made less awkward
2016-10-28 23:58:04 +02:00
sfan5
13265a808f Slight changes to inn & pub schematics 2016-10-28 23:41:30 +02:00
sfan5
9c70e1059a Fix doors in forge & tower schematic 2016-10-28 23:40:52 +02:00
sfan5
731db32517 Update house schematics
* Fix doors
* Proper beds
2016-10-28 23:19:36 +02:00
sfan5
8da8ad5495 Allow loading newer (versioned) WorldEdit schematics 2016-10-28 23:19:14 +02:00
Ekdohibs
09a4382429 Add license 2016-03-13 00:28:30 +01:00
17 changed files with 108 additions and 76 deletions

View File

@ -7,3 +7,7 @@ Biomes: Ocean, Dry grasslands, Wet grasslands, Forest, Jungle, Savanna, Desert,
Tundra, Taiga, Beach.
To use, enable the mod before playing a world for the first time (do not use it in an already used world).
License:
LGPL >= 2.1 for the code
CC-BY-SA for the textures

View File

@ -4,7 +4,7 @@ buildings = {
{sizex= 9, sizez= 9, yoff= 0, ysize= 2, scm="cotton_field"},
{sizex= 3, sizez= 3, yoff= 1, ysize= 4, scm="lamp", weight=1/5, no_rotate=true},
{sizex= 4, sizez= 4, yoff=-5, ysize=11, scm="well", no_rotate=true, pervillage=1},
{sizex= 7, sizez= 7, yoff= 0, ysize=11, scm="fountain", weight=1/4, pervillage=3},
{sizex= 7, sizez= 7, yoff= 0, ysize= 6, scm="fountain", weight=1/4, pervillage=3},
{sizex= 5, sizez= 5, yoff= 0, ysize= 6, scm="small_house", orients={3}},
{sizex= 6, sizez=12, yoff= 0, ysize= 7, scm="house_with_garden", orients={1}},
{sizex=16, sizez=17, yoff= 0, ysize=12, scm="church", orients={3}, pervillage=1},

View File

@ -7,44 +7,50 @@ local DMAX = 20
local AREA_SIZE = 80
dofile(minetest.get_modpath(minetest.get_current_modname()).."/nodes.lua")
c_air = minetest.get_content_id("air")
c_ignore = minetest.get_content_id("ignore")
c_water = minetest.get_content_id("default:water_source")
c_grass = minetest.get_content_id("default:dirt_with_grass")
c_dry_grass = minetest.get_content_id("mg:dirt_with_dry_grass")
c_dirt_snow = minetest.get_content_id("default:dirt_with_snow")
c_snow = minetest.get_content_id("default:snow")
c_sapling = minetest.get_content_id("default:sapling")
c_tree = minetest.get_content_id("default:tree")
c_leaves = minetest.get_content_id("default:leaves")
c_junglesapling = minetest.get_content_id("default:junglesapling")
c_jungletree = minetest.get_content_id("default:jungletree")
c_jungleleaves = minetest.get_content_id("default:jungleleaves")
c_savannasapling = minetest.get_content_id("mg:savannasapling")
c_savannatree = minetest.get_content_id("mg:savannatree")
c_savannaleaves = minetest.get_content_id("mg:savannaleaves")
c_pinesapling = minetest.get_content_id("mg:pinesapling")
c_pinetree = minetest.get_content_id("mg:pinetree")
c_pineleaves = minetest.get_content_id("mg:pineleaves")
c_dirt = minetest.get_content_id("default:dirt")
c_stone = minetest.get_content_id("default:stone")
c_water = minetest.get_content_id("default:water_source")
c_ice = minetest.get_content_id("default:ice")
c_sand = minetest.get_content_id("default:sand")
c_sandstone = minetest.get_content_id("default:sandstone")
c_desert_sand = minetest.get_content_id("default:desert_sand")
c_desert_stone = minetest.get_content_id("default:desert_stone")
c_snowblock = minetest.get_content_id("default:snowblock")
c_cactus = minetest.get_content_id("default:cactus")
c_grass_1 = minetest.get_content_id("default:grass_1")
c_grass_2 = minetest.get_content_id("default:grass_2")
c_grass_3 = minetest.get_content_id("default:grass_3")
c_grass_4 = minetest.get_content_id("default:grass_4")
c_grass_5 = minetest.get_content_id("default:grass_5")
local function get_content_id(name)
name = minetest.registered_aliases[name] or name
return minetest.get_content_id(name)
end
c_air = get_content_id("air")
c_ignore = get_content_id("ignore")
c_water = get_content_id("default:water_source")
c_grass = get_content_id("default:dirt_with_grass")
c_dry_grass = get_content_id("mg:dirt_with_dry_grass")
c_dirt_snow = get_content_id("default:dirt_with_snow")
c_snow = get_content_id("default:snow")
c_sapling = get_content_id("default:sapling")
c_tree = get_content_id("default:tree")
c_leaves = get_content_id("default:leaves")
c_junglesapling = get_content_id("default:junglesapling")
c_jungletree = get_content_id("default:jungletree")
c_jungleleaves = get_content_id("default:jungleleaves")
c_savannasapling = get_content_id("mg:savannasapling")
c_savannatree = get_content_id("mg:savannatree")
c_savannaleaves = get_content_id("mg:savannaleaves")
c_pinesapling = get_content_id("mg:pinesapling")
c_pinetree = get_content_id("mg:pinetree")
c_pineleaves = get_content_id("mg:pineleaves")
c_dirt = get_content_id("default:dirt")
c_stone = get_content_id("default:stone")
c_water = get_content_id("default:water_source")
c_ice = get_content_id("default:ice")
c_sand = get_content_id("default:sand")
c_sandstone = get_content_id("default:sandstone")
c_desert_sand = get_content_id("default:desert_sand")
c_desert_stone = get_content_id("default:desert_stone")
c_snowblock = get_content_id("default:snowblock")
c_cactus = get_content_id("default:cactus")
c_grass_1 = get_content_id("default:grass_1")
c_grass_2 = get_content_id("default:grass_2")
c_grass_3 = get_content_id("default:grass_3")
c_grass_4 = get_content_id("default:grass_4")
c_grass_5 = get_content_id("default:grass_5")
c_grasses = {c_grass_1, c_grass_2, c_grass_3, c_grass_4, c_grass_5}
c_jungle_grass = minetest.get_content_id("default:junglegrass")
c_dry_shrub = minetest.get_content_id("default:dry_shrub")
c_papyrus = minetest.get_content_id("default:papyrus")
c_jungle_grass = get_content_id("default:junglegrass")
c_dry_shrub = get_content_id("default:dry_shrub")
c_papyrus = get_content_id("default:papyrus")
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"})
@ -114,7 +120,7 @@ local function smooth(x, z, ...)
end
function inside_village(x, z, village, vnoise)
return get_vn(x, z, vnoise:get2d({x = x, y = z}), village) <= 40
return get_vn(x, z, vnoise:get_2d({x = x, y = z}), village) <= 40
end
local wseed
@ -349,7 +355,7 @@ function get_biome_table(minp, humidity, temperature, range)
local mnp, mxp = {x=minp.x+xi*80,z=minp.z+zi*80}, {x=minp.x+xi*80+80,z=minp.z+zi*80+80}
local pr = PseudoRandom(get_bseed(mnp))
local bxp, bzp = pr:next(mnp.x, mxp.x), pr:next(mnp.z, mxp.z)
local h, t = humidity:get2d({x=bxp, y=bzp}), temperature:get2d({x=bxp, y=bzp})
local h, t = humidity:get_2d({x=bxp, y=bzp}), temperature:get_2d({x=bxp, y=bzp})
l[#l+1] = {x=bxp, z=bzp, h=h, t=t}
end
end
@ -379,15 +385,7 @@ local function get_perlin_map(seed, octaves, persistance, scale, minp, maxp)
{offset=0, scale=1, spread={x=scale, y=scale, z=scale}, seed=seed, octaves=octaves, persist=persistance},
{x=sidelen, y=sidelen, z=sidelen}
)
return pm:get2dMap_flat({x = minp.x, y = minp.z, z = 0})
end
local function copytable(t)
local t2 = {}
for key, val in pairs(t) do
t2[key] = val
end
return t2
return pm:get_2d_map_flat({x = minp.x, y = minp.z, z = 0})
end
local function mg_generate(minp, maxp, emin, emax, vm)
@ -574,10 +572,10 @@ local function mg_generate(minp, maxp, emin, emax, vm)
for _, ore_sheet in ipairs(mg.registered_ore_sheets) do
local sidelen = maxp.x - minp.x + 1
local np = copytable(ore_sheet.noise_params)
local np = table.copy(ore_sheet.noise_params)
np.seed = np.seed + minp.y
local pm = minetest.get_perlin_map(np, {x = sidelen, y = sidelen, z = 1})
local map = pm:get2dMap_flat({x = minp.x, y = minp.z})
local map = pm:get_2d_map_flat({x = minp.x, y = minp.z})
local ni = 0
local trh = ore_sheet.threshhold
local wherein = minetest.get_content_id(ore_sheet.wherein)

View File

@ -1,3 +1,7 @@
-------------------------
-- Savanna tree
-------------------------
minetest.register_node("mg:savannatree", {
description = "Savannawood Tree",
tiles = {"mg_dry_tree_top.png", "mg_dry_tree_top.png", "mg_dry_tree.png"},
@ -71,21 +75,21 @@ minetest.register_abm({
local data = vm:get_data()
add_savannatree(data, a, pos.x, pos.y, pos.z, minp, maxp, PseudoRandom(math.random(1,100000)))
vm:set_data(data)
vm:write_to_map(data)
vm:write_to_map()
vm:update_map()
end
})
minetest.register_node("mg:dirt_with_dry_grass", {
description = "Dry Grass",
tiles = {"mg_dry_grass.png", "default_dirt.png", "default_dirt.png^mg_dry_grass_side.png"},
is_ground_content = true,
groups = {crumbly=3,soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
-------------------------
-- Pine tree
-------------------------
if minetest.registered_nodes["default:pine_tree"] ~= nil then
minetest.register_alias("mg:pinetree", "default:pine_tree")
minetest.register_alias("mg:pineleaves", "default:pine_needles")
minetest.register_alias("mg:pinewood", "default:pine_wood")
minetest.register_alias("mg:pinesapling", "default:pine_sapling")
else
minetest.register_node("mg:pinetree", {
description = "Pine Tree",
@ -160,11 +164,34 @@ minetest.register_abm({
local data = vm:get_data()
add_pinetree(data, a, pos.x, pos.y, pos.z, minp, maxp, PseudoRandom(math.random(1,100000)), c_air)
vm:set_data(data)
vm:write_to_map(data)
vm:write_to_map()
vm:update_map()
end
})
end
-------------------------
-- Other
-------------------------
if minetest.registered_nodes["default:dirt_with_dry_grass"] ~= nil then
minetest.register_alias("mg:dirt_with_dry_grass", "default:dirt_with_dry_grass")
else
minetest.register_node("mg:dirt_with_dry_grass", {
description = "Dry Grass",
tiles = {"mg_dry_grass.png", "default_dirt.png", "default_dirt.png^mg_dry_grass_side.png"},
is_ground_content = true,
groups = {crumbly=3,soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
end
minetest.register_node("mg:ignore", {
description = "MG Ignore",
drawtype = "airlike",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ minetest.register_globalstep(function(dtime)
end
end
--vm:set_data(data)
--vm:write_to_map(data)
--vm:write_to_map()
--for _, pos in ipairs(to_update) do
-- nodeupdate(pos)
--end

View File

@ -33,7 +33,7 @@ function villages_at_point(minp, noise1)
local s = pi:next(1, 400)
local x = pi:next(mp.x, mp.x + 79)
local z = pi:next(mp.z, mp.z + 79)
if s <= VILLAGE_CHANCE and noise1:get2d({x = x, y = z}) >= -0.3 then return {} end
if s <= VILLAGE_CHANCE and noise1:get_2d({x = x, y = z}) >= -0.3 then return {} end
end
end
end
@ -41,7 +41,7 @@ function villages_at_point(minp, noise1)
if pr:next(1, 400) > VILLAGE_CHANCE then return {} end -- No village here
local x = pr:next(minp.x, minp.x + 79)
local z = pr:next(minp.z, minp.z + 79)
if noise1:get2d({x = x, y = z}) < -0.3 then return {} end -- Deep in the ocean
if noise1:get_2d({x = x, y = z}) < -0.3 then return {} end -- Deep in the ocean
local type = pr:next(1, 1) -- TODO: actually make them
local size = pr:next(VILLAGE_MIN_SIZE, VILLAGE_MAX_SIZE) -- TODO: change to type-dependant sizes
local height = pr:next(5, 20)

3
we.lua
View File

@ -14,6 +14,9 @@ function import_scm(scm)
end
local value = f:read("*a")
f:close()
if value:sub(1, 2) == "5:" then
value = value:sub(3)
end
value = value:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1)
local escaped = value:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end)
local startpos, startpos1, endpos = 1, 1