mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-07-17 07:10:29 +02:00
Remove biome_lib dep from dryplants (#63)
This commit is contained in:
@ -1,21 +1,12 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Grasses - Juncus 0.0.5
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- by Mossmanikin
|
||||
-- textures & ideas partly by Neuromancer
|
||||
|
||||
-- Contains code from: biome_lib
|
||||
-- Looked at code from: default
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- support for i18n
|
||||
local S = minetest.get_translator("dryplants")
|
||||
|
||||
abstract_dryplants.grow_juncus = function(pos)
|
||||
local function grow_juncus(pos)
|
||||
local juncus_type = math.random(2,3)
|
||||
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
||||
or minetest.get_node(right_here).name == "default:junglegrass" then
|
||||
|
||||
local nodename = minetest.get_node(right_here).name
|
||||
if nodename == "air" or nodename == "default:junglegrass" then
|
||||
if juncus_type == 2 then
|
||||
minetest.swap_node(right_here, {name="dryplants:juncus_02"})
|
||||
else
|
||||
@ -70,6 +61,7 @@ minetest.register_node("dryplants:juncus", {
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("dryplants:juncus_02", {
|
||||
description = S("Juncus"),
|
||||
drawtype = "plantlike",
|
||||
@ -96,44 +88,69 @@ minetest.register_node("dryplants:juncus_02", {
|
||||
-- GENERATE SMALL JUNCUS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- near water or swamp
|
||||
biome_lib.register_on_generate({
|
||||
surface = {
|
||||
minetest.register_decoration({
|
||||
name = "dryplants:juncus_water",
|
||||
decoration = {"air"},
|
||||
fill_ratio = 0.16,
|
||||
y_min = 1,
|
||||
y_max = 40,
|
||||
place_on = {
|
||||
"default:dirt_with_grass",
|
||||
--"default:desert_sand",
|
||||
--"default:sand",
|
||||
"stoneage:grass_with_silex",
|
||||
"sumpf:peat",
|
||||
"sumpf:sumpf"
|
||||
},
|
||||
max_count = 70,
|
||||
rarity = 101 - 75,
|
||||
min_elevation = 1, -- above sea level
|
||||
near_nodes = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"},
|
||||
near_nodes_size = 2,
|
||||
near_nodes_vertical = 1,
|
||||
near_nodes_count = 1,
|
||||
plantlife_limit = -0.9,
|
||||
},
|
||||
abstract_dryplants.grow_juncus
|
||||
)
|
||||
-- at dunes/beach
|
||||
biome_lib.register_on_generate({
|
||||
surface = {
|
||||
--"default:dirt_with_grass",
|
||||
--"default:desert_sand",
|
||||
"default:sand",
|
||||
--"stoneage:grass_with_silex",
|
||||
--"sumpf:peat",
|
||||
--"sumpf:sumpf"
|
||||
deco_type = "simple",
|
||||
flags = "all_floors",
|
||||
spawn_by = {
|
||||
"default:water_source",
|
||||
"sumpf:dirtywater_source",
|
||||
"sumpf:sumpf"
|
||||
},
|
||||
max_count = 70,
|
||||
rarity = 101 - 75,
|
||||
min_elevation = 1, -- above sea level
|
||||
near_nodes = {"default:dirt_with_grass"},
|
||||
near_nodes_size = 2,
|
||||
near_nodes_vertical = 1,
|
||||
near_nodes_count = 1,
|
||||
plantlife_limit = -0.9,
|
||||
},
|
||||
abstract_dryplants.grow_juncus
|
||||
)
|
||||
check_offset = -1,
|
||||
num_spawn_by = 1
|
||||
})
|
||||
|
||||
-- at dunes/beach
|
||||
minetest.register_decoration({
|
||||
name = "dryplants:juncus_beach",
|
||||
decoration = {"air"},
|
||||
fill_ratio = 0.08,
|
||||
y_min = 1,
|
||||
y_max = 40,
|
||||
place_on = {
|
||||
"default:sand",
|
||||
},
|
||||
deco_type = "simple",
|
||||
flags = "all_floors",
|
||||
spawn_by = {"default:dirt_with_grass"},
|
||||
check_offset = -1,
|
||||
num_spawn_by = 1
|
||||
})
|
||||
|
||||
local did, did2
|
||||
minetest.register_on_mods_loaded(function()
|
||||
did = minetest.get_decoration_id("dryplants:juncus_water")
|
||||
did2 = minetest.get_decoration_id("dryplants:juncus_beach")
|
||||
minetest.set_gen_notify("decoration", {did, did2})
|
||||
end)
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
local g = minetest.get_mapgen_object("gennotify")
|
||||
local locations = {}
|
||||
|
||||
local deco_locations_1 = g["decoration#" .. did] or {}
|
||||
local deco_locations_2 = g["decoration#" .. did2] or {}
|
||||
|
||||
for _, pos in pairs(deco_locations_1) do
|
||||
locations[#locations+1] = pos
|
||||
end
|
||||
for _, pos in pairs(deco_locations_2) do
|
||||
locations[#locations+1] = pos
|
||||
end
|
||||
|
||||
if #locations == 0 then return end
|
||||
for _, pos in ipairs(locations) do
|
||||
grow_juncus(pos)
|
||||
end
|
||||
end)
|
Reference in New Issue
Block a user