1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2025-07-13 13:30:19 +02:00

7 Commits

Author SHA1 Message Date
70df655a42 allow pebbles to spawn on a few more surface types 2021-04-06 04:09:34 -04:00
4876fc1265 let biome_lib place pebbles instead of using custom mapgen code 2021-04-06 04:08:41 -04:00
81b2b0898b don't use a function to pick random dry grasses
just use `biome_lib`'s random-choice table feature
(it was only there to let the mod replace junglegrass, but that's pointless
when junglegrass doesn't tend to spawn in the same areas)
2021-04-06 03:32:04 -04:00
a750bac532 Merge branch 'master' into 'master'
Made woodsoils soils tillable.

See merge request VanessaE/plantlife_modpack!6
2021-02-07 23:29:08 +00:00
b4b24dedba Made woodsoils soils tillable. 2021-02-07 21:17:29 +01:00
622016713e respect protection when placing twigs 2020-12-02 10:05:01 -05:00
9963e588d6 add minimum minetest version key for contentdb 2020-06-03 13:00:31 -04:00
7 changed files with 87 additions and 71 deletions

View File

@ -7,6 +7,8 @@ local mname = "cavestuff"
-- support for i18n -- support for i18n
local S = minetest.get_translator("cavestuff") local S = minetest.get_translator("cavestuff")
cavestuff = {}
dofile(minetest.get_modpath("cavestuff").."/nodes.lua") dofile(minetest.get_modpath("cavestuff").."/nodes.lua")
dofile(minetest.get_modpath("cavestuff").."/mapgen.lua") dofile(minetest.get_modpath("cavestuff").."/mapgen.lua")

View File

@ -1,52 +1,39 @@
--Map Generation Stuff --Map Generation Stuff
minetest.register_on_generated(function(minp, maxp, seed) biome_lib:register_generate_plant(
if maxp.y >= 2 and minp.y <= 0 then {
-- Generate pebbles surface = {
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100) "default:dirt_with_grass",
-- Assume X and Z lengths are equal "default:gravel",
local divlen = 16 "default:stone",
local divs = (maxp.x-minp.x)/divlen+1; "default:permafrost_with_stones"
for divx=0,divs-1 do },
for divz=0,divs-1 do max_count = 50,
local x0 = minp.x + math.floor((divx+0)*divlen) rarity = 0,
local z0 = minp.z + math.floor((divz+0)*divlen) plantlife_limit = -1,
local x1 = minp.x + math.floor((divx+1)*divlen) check_air = true,
local z1 = minp.z + math.floor((divz+1)*divlen) random_facedir = {0, 3}
-- Determine pebble amount from perlin noise },
local pebble_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 2 * 2) {
-- Find random positions for pebbles based on this random "cavestuff:pebble_1",
local pr = PseudoRandom(seed+1) "cavestuff:pebble_2"
for i=0,pebble_amount do }
local x = pr:next(x0, x1) )
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
if ground_y then biome_lib:register_generate_plant(
local p = {x=x,y=ground_y+1,z=z} {
local nn = minetest.get_node(p).name surface = {
-- Check if the node can be replaced "default:desert_sand",
if minetest.registered_nodes[nn] and "default:desert_stone"
minetest.registered_nodes[nn].buildable_to then },
nn = minetest.get_node({x=x,y=ground_y,z=z}).name max_count = 50,
-- If desert sand, add dry shrub rarity = 0,
if nn == "default:dirt_with_grass" then plantlife_limit = -1,
minetest.swap_node(p,{name="cavestuff:pebble_"..pr:next(1,2), param2=math.random(0,3)}) check_air = true,
elseif nn == "default:desert_sand" then random_facedir = {0, 3}
minetest.swap_node(p,{name="cavestuff:desert_pebble_"..pr:next(1,2), param2=math.random(0,3)}) },
end {
end "cavestuff:desert_pebble_1",
end "cavestuff:desert_pebble_2"
}
end )
end
end
end
end)

View File

@ -1,2 +1,2 @@
name = cavestuff name = cavestuff
depends = default depends = default,biome_lib

View File

@ -7,26 +7,24 @@
-- Looked at code from: default -- Looked at code from: default
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
abstract_dryplants.grow_grass = function(pos) biome_lib:register_generate_plant(
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} {
local grass_size = math.random(1,5) surface = {
if minetest.get_node(right_here).name == "air" -- instead of check_air = true, "default:dirt_with_grass",
or minetest.get_node(right_here).name == "default:junglegrass" then "stoneage:grass_with_silex",
minetest.swap_node(right_here, {name="default:grass_"..grass_size}) "sumpf:peat",
end "sumpf:sumpf"
end },
max_count = TALL_GRASS_PER_MAPBLOCK,
biome_lib:register_generate_plant({ rarity = 101 - TALL_GRASS_RARITY,
surface = { min_elevation = 1, -- above sea level
"default:dirt_with_grass", plantlife_limit = -0.9,
"stoneage:grass_with_silex", check_air = true,
"sumpf:peat",
"sumpf:sumpf"
}, },
max_count = TALL_GRASS_PER_MAPBLOCK, { "default:grass_1",
rarity = 101 - TALL_GRASS_RARITY, "default:grass_2",
min_elevation = 1, -- above sea level "default:grass_3",
plantlife_limit = -0.9, "default:grass_4",
}, "default:grass_5"
abstract_dryplants.grow_grass }
) )

1
modpack.conf Normal file
View File

@ -0,0 +1 @@
min_minetest_version = 5.2.0

View File

@ -42,6 +42,14 @@ for i in pairs(NoDe) do
liquids_pointable = true, liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing local pt = pointed_thing
if not placer then return end
local playername = placer:get_player_name()
if minetest.is_protected(pt.above, playername) then
minetest.record_protection_violation(pt.above, playername)
return
end
local direction = minetest.dir_to_facedir(placer:get_look_dir()) local direction = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.get_node(pt.above).name=="air" then if minetest.get_node(pt.above).name=="air" then
minetest.swap_node(pt.above, {name="trunks:twig_"..math.random(1,4), param2=direction}) minetest.swap_node(pt.above, {name="trunks:twig_"..math.random(1,4), param2=direction})

View File

@ -19,6 +19,11 @@ minetest.register_node("woodsoils:dirt_with_leaves_1", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
soil = {
base = "woodsoils:dirt_with_leaves_1",
dry = "farming:soil",
wet = "farming:soil_wet"
}
}) })
minetest.register_node("woodsoils:dirt_with_leaves_2", { minetest.register_node("woodsoils:dirt_with_leaves_2", {
@ -37,6 +42,11 @@ minetest.register_node("woodsoils:dirt_with_leaves_2", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
soil = {
base = "woodsoils:dirt_with_leaves_2",
dry = "farming:soil",
wet = "farming:soil_wet"
}
}) })
minetest.register_node("woodsoils:grass_with_leaves_1", { minetest.register_node("woodsoils:grass_with_leaves_1", {
@ -55,6 +65,11 @@ minetest.register_node("woodsoils:grass_with_leaves_1", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
soil = {
base = "woodsoils:grass_with_leaves_1",
dry = "farming:soil",
wet = "farming:soil_wet"
}
}) })
minetest.register_node("woodsoils:grass_with_leaves_2", { minetest.register_node("woodsoils:grass_with_leaves_2", {
@ -73,6 +88,11 @@ minetest.register_node("woodsoils:grass_with_leaves_2", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
soil = {
base = "woodsoils:grass_with_leaves_2",
dry = "farming:soil",
wet = "farming:soil_wet"
}
}) })
-- For compatibility with older stuff -- For compatibility with older stuff