add grass, cactus, enable in mapgen
This commit is contained in:
parent
ca50395cee
commit
20d8a29187
56
mods/fl_mapgen/decorations.lua
Normal file
56
mods/fl_mapgen/decorations.lua
Normal file
@ -0,0 +1,56 @@
|
||||
for i = 1, 5 do
|
||||
minetest.register_decoration({
|
||||
name = "fl_plantlife:savannah_grass_" .. i,
|
||||
deco_type = "simple",
|
||||
place_on = {"fl_topsoil:savannah_dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
--higher seems to cause mapgen light bugs
|
||||
fill_ratio = 0.001,
|
||||
biomes = {"savannah"},
|
||||
y_max = 300,
|
||||
y_min = 4,
|
||||
param2 = 1,
|
||||
param2_max = 255,
|
||||
decoration = "fl_plantlife:savannah_grass_" .. i
|
||||
})
|
||||
end
|
||||
|
||||
for i = 1, 5 do
|
||||
minetest.register_decoration({
|
||||
name = "fl_plantlife:grass_" .. i,
|
||||
deco_type = "simple",
|
||||
place_on = {"fl_topsoil:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.08,
|
||||
biomes = {"grassland", "deciduousforest"},
|
||||
y_max = 300,
|
||||
y_min = 4,
|
||||
param2 = 1,
|
||||
param2_max = 255,
|
||||
decoration = "fl_plantlife:grass_" .. i
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "fl_plantlife:cactus",
|
||||
deco_type = "schematic",
|
||||
place_on = {"fl_stone:sand"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.0001,
|
||||
biomes = {"sand"},
|
||||
y_max = 300,
|
||||
y_min = 4,
|
||||
schematic = {
|
||||
--for some reason first one never exists?
|
||||
size = {x=1, y=4, z=1},
|
||||
data = {
|
||||
{name = "fl_plantlife:cactus"},
|
||||
{name = "fl_plantlife:cactus"},
|
||||
{name = "fl_plantlife:cactus"},
|
||||
{name = "fl_plantlife:cactus"},
|
||||
},
|
||||
yslice_prob = {
|
||||
{ypos = 3, prob = 160}
|
||||
}
|
||||
}
|
||||
})
|
@ -1,7 +1,6 @@
|
||||
local modpath = minetest.get_modpath("fl_mapgen")
|
||||
|
||||
dofile(modpath .. "/aliases.lua")
|
||||
dofile(modpath .. "/other.lua")
|
||||
dofile(modpath .. "/abm.lua")
|
||||
|
||||
dofile(modpath .. "/biomes.lua")
|
||||
@ -9,4 +8,8 @@ dofile(modpath .. "/biomes.lua")
|
||||
dofile(modpath .. "/biome_sky.lua")
|
||||
dofile(modpath .. "/ores.lua")
|
||||
dofile(modpath .. "/trees.lua")
|
||||
dofile(modpath .. "/dungeon/init.lua")
|
||||
dofile(modpath .. "/decorations.lua")
|
||||
dofile(modpath .. "/dungeon/init.lua")
|
||||
|
||||
--at the end as this contains register_on_generateds
|
||||
dofile(modpath .. "/other.lua")
|
@ -1 +1 @@
|
||||
depends = fl_liquids, fl_stone, fl_ores, fl_topsoil, fl_storage, fl_stairs, fl_trees
|
||||
depends = fl_liquids, fl_stone, fl_ores, fl_topsoil, fl_storage, fl_stairs, fl_trees, fl_plantlife
|
@ -3,6 +3,7 @@
|
||||
local bedrock_depth = -300
|
||||
local bedrock_height = 1
|
||||
|
||||
--create bedrock layers
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
if minp.y > bedrock_depth + bedrock_height or maxp.y < bedrock_depth then
|
||||
return
|
||||
@ -32,6 +33,7 @@ minetest.register_on_generated(function(minp, maxp)
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
--vary snow layers
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
local vm, mine, maxe = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new({MinEdge=mine, MaxEdge=maxe})
|
||||
@ -54,4 +56,24 @@ minetest.register_on_generated(function(minp, maxp)
|
||||
|
||||
vm:set_param2_data(p2_data)
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
--start cactus timers
|
||||
local cactus_did = minetest.get_decoration_id("fl_plantlife:cactus")
|
||||
minetest.set_gen_notify("decoration", {cactus_did})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
local g = minetest.get_mapgen_object("gennotify")
|
||||
local locations = g["decoration#" .. cactus_did] or {}
|
||||
if #locations == 0 then return end
|
||||
for _, pos in ipairs(locations) do
|
||||
for i=1, 3 do
|
||||
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y+i, z=pos.z})
|
||||
if not node then return end
|
||||
if node.name == "fl_plantlife:cactus" then
|
||||
local timer = minetest.get_node_timer({x=pos.x, y=pos.y+i, z=pos.z})
|
||||
timer:start(math.random(600, 1200))
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
@ -46,7 +46,7 @@ minetest.register_decoration({
|
||||
place_on = "fl_topsoil:dirt_with_grass",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.03,
|
||||
biomes = {"deciduous_forest"},
|
||||
biomes = {"deciduousforest"},
|
||||
y_max = 300,
|
||||
y_min = 4,
|
||||
place_offset_y = 1,
|
||||
@ -62,7 +62,7 @@ minetest.register_decoration({
|
||||
place_on = "fl_topsoil:dirt_with_grass",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.03,
|
||||
biomes = {"deciduous_forest"},
|
||||
biomes = {"deciduousforest"},
|
||||
y_max = 300,
|
||||
y_min = 4,
|
||||
place_offset_y = 1,
|
||||
|
42
mods/fl_plantlife/cactus.lua
Normal file
42
mods/fl_plantlife/cactus.lua
Normal file
@ -0,0 +1,42 @@
|
||||
minetest.register_node("fl_plantlife:cactus", {
|
||||
description = "cactus",
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-7/16, -0.5, -7/16, 7/16, 0.5, 7/16}
|
||||
},
|
||||
tiles = {
|
||||
"[combine:16x16:0,-16=farlands_cactus.png",
|
||||
"[combine:16x16:0,-16=farlands_cactus.png",
|
||||
"[combine:16x16:0,0=farlands_cactus.png",
|
||||
},
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(600, 1200))
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
--minetest.chat_send_all("triggered")
|
||||
local above = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
if not above then return end
|
||||
if not minetest.registered_nodes[above.name] or minetest.registered_nodes[above.name].drawtype == "airlike" then
|
||||
return
|
||||
end
|
||||
local under = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
--minetest.chat_send_all(under.name)
|
||||
if not under then return end
|
||||
if under.name == "fl_stone:sand" then
|
||||
minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "fl_plantlife:cactus"})
|
||||
minetest.get_node_timer(pos):start(math.random(600, 1200))
|
||||
return
|
||||
elseif under.name == "fl_plantlife:cactus" then
|
||||
--minetest.chat_send_all("triggered")
|
||||
local base = minetest.get_node_or_nil({x=pos.x, y=pos.y-2, z=pos.z})
|
||||
if not base then return end
|
||||
if base.name ~= "fl_stone:sand" then return end
|
||||
minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "fl_plantlife:cactus"})
|
||||
minetest.get_node_timer(pos):start(math.random(600, 1200))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(600, 1200))
|
||||
end,
|
||||
groups = {oddly_breakable_by_hand = 3}
|
||||
})
|
@ -1,5 +1,6 @@
|
||||
local modpath = minetest.get_modpath("fl_plantlife")
|
||||
|
||||
dofile(modpath .. "/grass.lua")
|
||||
dofile(modpath .. "/cactus.lua")
|
||||
dofile(modpath .. "/flowers.lua")
|
||||
dofile(modpath .. "/flowerpot.lua")
|
BIN
mods/fl_plantlife/textures/farlands_cactus.png
Normal file
BIN
mods/fl_plantlife/textures/farlands_cactus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Loading…
x
Reference in New Issue
Block a user