tidied & optimized code

This commit is contained in:
tenplus1 2015-04-10 15:38:53 +01:00
parent efd4ab247c
commit 7d5b162ae9
9 changed files with 440 additions and 320 deletions

View File

@ -10,6 +10,7 @@ Added Staff of Light (thanks Xanthin), crafted from illumishrooms and can turn s
Changed how Crystal Spikes reproduce
Crystal Ingots now require 2x mese crystal and 2x crystal spikes to craft
Removed obsidian brick & stairs now they are in default game, also removed pine wood stairs for same reason
Tidied code and optimized a few routines
1.14

View File

@ -1,7 +1,7 @@
-- Override default Dirt (to stop caves cutting away dirt)
-- override default dirt (to stop caves cutting away dirt)
minetest.override_item("default:dirt", {is_ground_content = false})
-- Green Dirt
-- green dirt
minetest.register_node("ethereal:green_dirt", {
description = "Green Dirt",
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
@ -11,7 +11,7 @@ minetest.register_node("ethereal:green_dirt", {
sounds = default.node_sound_dirt_defaults()
})
-- Dry Dirt
-- dry dirt
minetest.register_node("ethereal:dry_dirt", {
description = "Dried Dirt",
tiles = {"ethereal_dry_dirt.png"},
@ -55,49 +55,50 @@ minetest.register_alias("ethereal:fiery_dirt_top", "ethereal:fiery_dirt")
minetest.register_alias("ethereal:gray_dirt_top", "ethereal:gray_dirt")
minetest.register_alias("ethereal:green_dirt_top", "ethereal:green_dirt")
-- Check surrounding grass and change dirt to Same colour (by Sokomine)
-- check surrounding grass and change dirt to same colour (by Sokomine)
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
interval = 5,
chance = 5,
chance = 2,
action = function(pos, node)
local count_grasses = {}
local curr_max = 0
local curr_type = "ethereal:green_dirt_top"; -- Fallback Colour
local positions = minetest.find_nodes_in_area( {x=(pos.x-2), y=(pos.y-2), z=(pos.z-2)},
{x=(pos.x+2), y=(pos.y+2), z=(pos.z+2)},
"group:ethereal_grass" )
local curr_type = "ethereal:green_dirt_top" -- fallback Colour
local positions = minetest.find_nodes_in_area(
{x=(pos.x-2), y=(pos.y-2), z=(pos.z-2)},
{x=(pos.x+2), y=(pos.y+2), z=(pos.z+2)},
"group:ethereal_grass")
-- count new grass nodes
for _,p in ipairs(positions) do
-- count the new grass node
local n = minetest.get_node( p )
if( n and n.name ) then
if( not( count_grasses[ n.name ] )) then
count_grasses[ n.name ] = 1
local n = minetest.get_node(p)
if n and n.name then
if not count_grasses[n.name] then
count_grasses[n.name] = 1
else
count_grasses[ n.name ] = count_grasses[ n.name ] + 1
count_grasses[n.name] = count_grasses[n.name] + 1
end
-- we found a grass type of which there"s more than the current max
if( count_grasses[ n.name ] > curr_max ) then
curr_max = count_grasses[ n.name ]
-- we found a grass type with more than current max
if count_grasses[n.name] > curr_max then
curr_max = count_grasses[n.name]
curr_type = n.name
end
end
end
minetest.set_node(pos, {name = curr_type })
minetest.set_node(pos, {name = curr_type})
end
})
-- If Grass devoid of light, change to Dirt
-- if grass devoid of light, change to dirt
minetest.register_abm({
nodenames = {"group:ethereal_grass"},
interval = 5,
interval = 2,
chance = 20,
action = function(pos, node)
local name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end

View File

@ -12,9 +12,6 @@ minetest.register_node("ethereal:vine", {
is_ground_content = false,
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
groups = {choppy=3, oddly_breakable_by_hand=1},
legacy_wallmounted = true,
@ -44,9 +41,6 @@ minetest.register_node("ethereal:stone_ladder", {
is_ground_content = false,
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
groups = {cracky=3, oddly_breakable_by_hand=1},
legacy_wallmounted = true,
@ -310,10 +304,10 @@ minetest.register_craft({
minetest.register_on_generated(function(minp, maxp, seed)
local coal_nodes = minetest.find_nodes_in_area(minp, maxp, "default:stone_with_coal")
local bpos
for key, pos in pairs(coal_nodes) do
local bpos = { x=pos.x, y=pos.y + 1, z=pos.z }
bpos = { x=pos.x, y=pos.y + 1, z=pos.z }
if minetest.get_node(bpos).name == "air" then
if bpos.y > -3000 and bpos.y < -2000 then

View File

@ -1,6 +1,6 @@
--[[
Minetest Ethereal Mod 1.15 (9th April 2015)
Minetest Ethereal Mod 1.15 (10th April 2015)
Created by ChinChow
@ -35,6 +35,7 @@ ethereal.lake = 1 -- Small sandy lake areas with gravel below, also used for
ethereal.plains = 1 -- Dry dirt with scorched trees
ethereal.fiery = 1 -- Red grass with lava craters
ethereal.sandclay = 1 -- Sand areas with clay underneath
ethereal.icewater = 1 -- Ice surrounding cold coastal areas
dofile(minetest.get_modpath("ethereal").."/plantlife.lua")
dofile(minetest.get_modpath("ethereal").."/mushroom.lua")

View File

@ -1,342 +1,456 @@
-- Clear default mapgen biomes and decorations
-- clear default mapgen biomes and decorations
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
--minetest.clear_registered_ores()
local e = "ethereal:"
-- Biomes (for 0.4.12 with new changes from Paramat)
if ethereal.icewater == 1 then
minetest.register_biome({
name = "icewater",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 1,
node_water_top = "default:ice",
depth_water_top = 2,
y_min = -31000,
y_max = 1,
heat_point = 0,
humidity_point = 0,
})
end
if ethereal.bamboo == 1 then
minetest.register_biome({
name = e.."bamboo",
node_top = "ethereal:bamboo_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 71,
heat_point = 45.0, humidity_point = 75.0,
name = "bamboo",
node_top = "ethereal:bamboo_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 71,
heat_point = 45,
humidity_point = 75,
})
end
if ethereal.mesa == 1 then
minetest.register_biome({
name = e.."mesa",
node_top = "bakedclay:red", depth_top = 1,
node_filler = "bakedclay:orange", depth_filler = 5,
y_min = 2, y_max = 71,
heat_point = 25.0, humidity_point = 28.0,
name = "mesa",
node_top = "bakedclay:red",
depth_top = 1,
node_filler = "bakedclay:orange",
depth_filler = 5,
y_min = 2,
y_max = 71,
heat_point = 25,
humidity_point = 28,
})
end
if ethereal.alpine == 1 then
minetest.register_biome({
name = e.."alpine",
node_top = "default:dirt_with_snow", depth_top = 1,
node_filler = "default:dirt", depth_filler = 2,
y_min = 40, y_max = 90,
heat_point = 10.0, humidity_point = 40.0,
name = "alpine",
node_top = "default:dirt_with_snow",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
y_min = 40,
y_max = 90,
heat_point = 10,
humidity_point = 40,
})
end
if ethereal.healing == 1 then
minetest.register_biome({
name = e.."healing",
node_top = "default:dirt_with_snow", depth_top = 1,
node_filler = "default:dirt", depth_filler = 2,
y_min = 75, y_max = 140,
heat_point = 10.0, humidity_point = 40.0,
name = "healing",
node_top = "default:dirt_with_snow",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
y_min = 75,
y_max = 140,
heat_point = 10,
humidity_point = 40,
})
end
if ethereal.snowy == 1 then
minetest.register_biome({
name = e.."snowy",
node_top = "ethereal:cold_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 2,
y_min = 5, y_max = 40,
heat_point = 10.0, humidity_point = 40.0,
name = "snowy",
node_top = "ethereal:cold_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
y_min = 5,
y_max = 40,
heat_point = 10,
humidity_point = 40,
})
end
if ethereal.frost == 1 then
minetest.register_biome({
name = e.."frost",
node_top = "ethereal:crystal_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 71,
heat_point = 10.0, humidity_point = 40.0,
name = "frost",
node_top = "ethereal:crystal_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 71,
heat_point = 10,
humidity_point = 40,
})
end
if ethereal.grassy == 1 then
minetest.register_biome({
name = e.."grassy",
node_top = "ethereal:green_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 91,
heat_point = 13.0, humidity_point = 40.0,
name = "grassy",
node_top = "ethereal:green_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 91,
heat_point = 13,
humidity_point = 40,
})
end
if ethereal.caves == 1 then
minetest.register_biome({
name = e.."caves",
node_top = "default:desert_stone", depth_top = 3,
node_filler = "air", depth_filler = 8,
y_min = 4, y_max = 41,
heat_point = 15.0, humidity_point = 25.0,
name = "caves",
node_top = "default:desert_stone",
depth_top = 3,
node_filler = "air",
depth_filler = 8,
y_min = 4,
y_max = 41,
heat_point = 15,
humidity_point = 25,
})
end
if ethereal.grayness == 1 then
minetest.register_biome({
name = e.."grayness",
node_top = "ethereal:gray_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 41,
heat_point = 15.0, humidity_point = 30.0,
name = "grayness",
node_top = "ethereal:gray_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 41,
heat_point = 15,
humidity_point = 30,
})
end
if ethereal.grassytwo == 1 then
minetest.register_biome({
name = e.."grassytwo",
node_top = "ethereal:green_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 91,
heat_point = 15.0, humidity_point = 40.0,
name = "grassytwo",
node_top = "ethereal:green_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 91,
heat_point = 15,
humidity_point = 40,
})
end
if ethereal.prairie == 1 then
minetest.register_biome({
name = e.."prairie",
node_top = "ethereal:prairie_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 3, y_max = 26,
heat_point = 20.0, humidity_point = 40.0,
name = "prairie",
node_top = "ethereal:prairie_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 3,
y_max = 26,
heat_point = 20,
humidity_point = 40,
})
end
if ethereal.jumble == 1 then
minetest.register_biome({
name = e.."jumble",
node_top = "ethereal:green_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 71,
heat_point = 25.0, humidity_point = 50.0,
name = "jumble",
node_top = "ethereal:green_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 71,
heat_point = 25,
humidity_point = 50,
})
end
if ethereal.junglee == 1 then
minetest.register_biome({
name = e.."junglee",
node_top = "ethereal:jungle_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 71,
heat_point = 30.0, humidity_point = 60.0,
name = "junglee",
node_top = "ethereal:jungle_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 71,
heat_point = 30,
humidity_point = 60,
})
end
if ethereal.desert ==1 then
minetest.register_biome({
name = e.."desert",
node_top = "default:desert_sand", depth_top = 5,
node_filler = "default:desert_stone", depth_filler = 70,
y_min = 3, y_max = 23,
heat_point = 35.0, humidity_point = 20.0,
name = "desert",
node_top = "default:desert_sand",
depth_top = 5,
node_filler = "default:desert_stone",
depth_filler = 70,
y_min = 3,
y_max = 23,
heat_point = 35,
humidity_point = 20,
})
end
if ethereal.grove == 1 then
minetest.register_biome({
name = e.."grove",
node_top = "ethereal:grove_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 3, y_max = 23,
heat_point = 40.0, humidity_point = 60.0,
name = "grove",
node_top = "ethereal:grove_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler= 5,
y_min = 3,
y_max = 23,
heat_point = 40,
humidity_point = 60,
})
end
if ethereal.mushroom == 1 then
minetest.register_biome({
name = e.."mushroom",
node_top = "ethereal:mushroom_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 1, y_max = 50,
heat_point = 45.0, humidity_point = 65.0,
name = "mushroom",
node_top = "ethereal:mushroom_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 1,
y_max = 50,
heat_point = 45,
humidity_point = 65,
})
end
if ethereal.desertstone == 1 then
minetest.register_biome({
name = e.."desertstone",
node_top = "default:sandstone", depth_top = 7,
node_filler = "default:desert_stone", depth_filler = 70,
y_min = 3, y_max = 23,
heat_point = 50.0, humidity_point = 20.0,
name = "desertstone",
node_top = "default:sandstone",
depth_top = 7,
node_filler = "default:desert_stone",
depth_filler = 70,
y_min = 3,
y_max = 23,
heat_point = 50,
humidity_point = 20,
})
end
if ethereal.quicksand == 1 then
minetest.register_biome({
name = e.."quicksand",
node_top = "ethereal:quicksand2", depth_top = 3,
node_filler = "default:gravel", depth_filler = 1,
y_min = 1, y_max = 1,
heat_point = 50, humidity_point = 38,
name = "quicksand",
node_top = "ethereal:quicksand2",
depth_top = 3,
node_filler = "default:gravel",
depth_filler = 1,
y_min = 1,
y_max = 1,
heat_point = 50,
humidity_point = 38,
})
end
if ethereal.lake == 1 then
minetest.register_biome({
name = e.."lake",
node_top = "default:sand", depth_top = 2,
node_filler = "default:gravel", depth_filler = 1,
node_water = "default:water_source", node_dust_water= "default:water_source",
y_min = -31000, y_max = 3,
heat_point = 50, humidity_point = 40,
name = "lake",
node_top = "default:sand",
depth_top = 2,
node_filler = "default:gravel",
depth_filler = 1,
node_water = "default:water_source",
node_dust_water = "default:water_source",
y_min = -31000,
y_max = 3,
heat_point = 50,
humidity_point = 40,
})
end
if ethereal.plains == 1 then
minetest.register_biome({
name = e.."plains",
node_top = "ethereal:dry_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 3, y_max = 61,
heat_point = 55.0, humidity_point = 25.0,
name = "plains",
node_top = "ethereal:dry_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 3,
y_max = 61,
heat_point = 55,
humidity_point = 25,
})
end
if ethereal.fiery == 1 then
minetest.register_biome({
name = e.."fiery",
node_top = "ethereal:fiery_dirt", depth_top = 1,
node_filler = "default:dirt", depth_filler = 5,
y_min = 5, y_max = 65,
heat_point = 80.0, humidity_point = 10.0,
name = "fiery",
node_top = "ethereal:fiery_dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 5,
y_min = 5,
y_max = 65,
heat_point = 80,
humidity_point = 10,
})
end
if ethereal.sandclay == 1 then
minetest.register_biome({
name = e.."sandclay",
node_top = "default:sand", depth_top = 3,
node_filler = "default:clay", depth_filler = 2,
y_min = 1, y_max = 11,
heat_point = 65.0, humidity_point = 2.0,
name = "sandclay",
node_top = "default:sand",
depth_top = 3,
node_filler = "default:clay",
depth_filler = 2,
y_min = 1,
y_max = 11,
heat_point = 65,
humidity_point = 2,
})
end
-- Schematics Decoration
--= schematic decorations
local path = minetest.get_modpath("ethereal").."/schematics/"
minetest.register_decoration({ -- Redwood Tree
-- redwood tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"bakedclay:red","bakedclay:orange"},
sidelen = 80, -- was 16
fill_ratio = 0.01, -- was 0.025
biomes = {e.."mesa"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"mesa"},
schematic = path.."redwood.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Banana Tree
-- banana tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:grove_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.015,
biomes = {e.."grove"},
biomes = {"grove"},
schematic = path.."bananatree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Healing Tree
-- healing tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "default:dirt_with_snow",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.04,
biomes = {e.."healing"},
biomes = {"healing"},
schematic = path.."yellowtree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Frost Tree
-- crystal frost tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:crystal_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.010,
biomes = {e.."frost"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"frost"},
schematic = path.."frosttrees.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Giant Mushroom
-- giant mushroom
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:mushroom_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.070,
biomes = {e.."mushroom"},
sidelen = 80,
fill_ratio = 0.07,
biomes = {"mushroom"},
schematic = path.."mushroomone.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Small Lava Crater
-- small lava crater
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:fiery_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.012,
biomes = {e.."fiery"},
biomes = {"fiery"},
schematic = path.."volcanom.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Large Lava Crater
-- large lava crater
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:fiery_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.010,
biomes = {e.."fiery"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"fiery"},
schematic = path.."volcanol.mts",
flags = "place_center_x, place_center_z",
-- replacements = {{"default:stone", "default:desert_stone"}},
})
minetest.register_decoration({ -- Jungle Tree
-- jungle tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:jungle_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.3, -- was 0.250
biomes = {e.."junglee"},
sidelen = 80,
fill_ratio = 0.3,
biomes = {"junglee"},
schematic = path.."jungletree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Willow Tree
-- willow tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:gray_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.025,
biomes = {e.."grayness"},
biomes = {"grayness"},
schematic = path.."willow.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Pine Tree
-- pine tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"ethereal:cold_dirt", "default:dirt_with_snow"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.025,
biomes = {e.."snowy", e.."alpine"},
biomes = {"snowy", "alpine"},
schematic = path.."pinetree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Apple Tree
-- apple tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:green_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.030,
biomes = {e.."grassy", e.."jumble"},
sidelen = 80,
fill_ratio = 0.03,
biomes = {"grassy", "jumble"},
schematic = path.."tree.mts",
flags = "place_center_x, place_center_z",
})
@ -344,230 +458,247 @@ minetest.register_decoration({ -- Apple Tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"ethereal:green_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.005,
biomes = {e.."grassytwo"},
biomes = {"grassytwo"},
schematic = path.."tree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Orange Tree
-- orange tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"ethereal:prairie_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.005,
biomes = {e.."prairie"},
biomes = {"prairie"},
schematic = path.."orangetree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Acacia Tree
-- acacia tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:desert_sand"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.004,
biomes = {e.."desert"},
biomes = {"desert"},
schematic = path.."acaciatree.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({ -- Big Old Tree
-- big old tree
minetest.register_decoration({
deco_type = "schematic",
place_on = "ethereal:green_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.010,
biomes = {e.."grassytwo"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"grassytwo"},
schematic = path.."bigtree.mts",
flags = "place_center_x, place_center_z",
})
-- Simple Decoration
minetest.register_decoration({ -- Scorched Tree
--= simple decorations
-- scorched tree
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:dry_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.006,
biomes = {e.."plains"},
biomes = {"plains"},
decoration = "ethereal:scorched_tree",
height_max = 6,
})
minetest.register_decoration({ -- Bamboo Stalks
-- bamboo stalks
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:bamboo_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.055,
biomes = {e.."bamboo"},
biomes = {"bamboo"},
decoration = "ethereal:bamboo",
height_max = 5,
})
minetest.register_decoration({ -- Bamboo Sprouts & Grass
-- bamboo sprouts & grass
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:bamboo_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.25,
biomes = {e.."bamboo"},
biomes = {"bamboo"},
decoration = {"ethereal:bamboo_sprout", "default:grass_2", "default:grass_3"},
})
minetest.register_decoration({ -- Dry Shrub
-- dry shrub
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:dry_dirt", "default:sand", "default:desert_sand", "sandstone", "bakedclay:red"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.015,
biomes = {e.."plains", e.."lake", e.."desert", e.."desertstone", e.."mesa"},
biomes = {"plains", "lake", "desert", "desertstone", "mesa"},
decoration = "default:dry_shrub",
})
minetest.register_decoration({ -- Flowers & Strawberry
-- flowers & strawberry
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:green_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.030,
sidelen = 80,
fill_ratio = 0.03,
biomes = {"grassy", "grassy", "grassytwo"},
decoration = {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "ethereal:strawberry_7"},
})
minetest.register_decoration({ -- Prairie Flowers & Strawberry
-- prairie flowers & strawberry
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:prairie_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.050,
biomes = {e.."prairie"},
sidelen = 80,
fill_ratio = 0.05,
biomes = {"prairie"},
decoration = {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "ethereal:strawberry_7"},
})
minetest.register_decoration({ -- Crystal Spike & Crystal Grass
-- crystal spike & crystal grass
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:crystal_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.02,
biomes = {e.."frost"},
biomes = {"frost"},
decoration = {"ethereal:crystal_spike", "ethereal:crystalgrass"},
})
minetest.register_decoration({ -- Red Shrub
-- red shrub
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:fiery_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.20,
biomes = {e.."fiery"},
biomes = {"fiery"},
decoration = "ethereal:dry_shrub",
})
minetest.register_decoration({ -- Snowy Grass
-- snowy grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:gray_dirt", "ethereal:cold_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.05,
biomes = {e.."grayness", e.."snowy"},
biomes = {"grayness", "snowy"},
decoration = "ethereal:snowygrass",
})
minetest.register_decoration({ -- Cactus
-- cactus
minetest.register_decoration({
deco_type = "simple",
place_on = "default:sandstone",
sidelen = 80, -- was 16
fill_ratio = 0.010,
biomes = {e.."desertstone"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"desertstone"},
decoration = "default:cactus",
height_max = 3,
})
minetest.register_decoration({ -- Cactus
minetest.register_decoration({
deco_type = "simple",
place_on = "default:desert_sand",
sidelen = 80, -- was 16
fill_ratio = 0.010,
biomes = {e.."desert"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"desert"},
decoration = "default:cactus",
height_max = 4,
})
minetest.register_decoration({ -- Wild Mushroom
-- wild mushroom
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:mushroom_dirt",
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.015,
biomes = {e.."mushroom"},
biomes = {"mushroom"},
decoration = "ethereal:mushroom_plant",
})
minetest.register_decoration({ -- Jungle Grass
-- jungle grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:jungle_dirt", "ethereal:green_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.18,
biomes = {e.."junglee", e.."jumble"},
biomes = {"junglee", "jumble"},
decoration = "default:junglegrass",
})
minetest.register_decoration({ -- Grass
-- grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:green_dirt_top", "ethereal:jungle_dirt", "ethereal:prairie_dirt", "ethereal:grove_dirt"},
sidelen = 80, -- was 16
fill_ratio = 0.40, -- was 0.50
biomes = {e.."grassy", e.."grassytwo", e.."jumble", e.."junglee", e.."prairie", e.."grove"},
sidelen = 80,
fill_ratio = 0.4,
biomes = {"grassy", "grassytwo", "jumble", "junglee", "prairie", "grove"},
decoration = "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5",
})
minetest.register_decoration({ -- Ferns
-- ferns
minetest.register_decoration({
deco_type = "simple",
place_on = "ethereal:grove_dirt",
sidelen = 80, -- was 16
fill_ratio = 0.20,
biomes = {e.."grove"},
sidelen = 80,
fill_ratio = 0.2,
biomes = {"grove"},
decoration = "ethereal:fern",
})
minetest.register_decoration({ -- Snow
-- snow
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:cold_dirt", "default:dirt_with_snow"},
sidelen = 80, -- was 16
fill_ratio = 0.80,
biomes = {e.."snowy", e.."alpine"},
sidelen = 80,
fill_ratio = 0.8,
biomes = {"snowy", "alpine"},
decoration = "default:snow",
})
minetest.register_decoration({ -- Wild Onion
-- wild onion
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:green_dirt", "ethereal:prairie_dirt"},
sidelen = 80, -- was 16
fill_ratio = 0.25, -- was 0.35
biomes = {e.."grassy", e.."grassytwo", e.."jumble", e.."prairie"},
sidelen = 80,
fill_ratio = 0.25,
biomes = {"grassy", "grassytwo", "jumble", "prairie"},
decoration = "ethereal:onion_4",
})
minetest.register_decoration({ -- Papyrus
-- papyrus
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:green_dirt", "ethereal:jungle_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.1,
biomes = {e.."grassy", e.."junglee"},
biomes = {"grassy", "junglee"},
decoration = "default:papyrus",
height_max = 4,
spawn_by = "default:water_source",
num_spawn_by = 1,
})
-- Palm Tree on Sand next to Water
-- palm tree on sand next to water
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y > 1 and minp.y < 1 then
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
-- Assume X and Z lengths are equal
local divlen = 8
local divs = (maxp.x-minp.x)/divlen+1;
local divs = (maxp.x-minp.x)/divlen+1
local pr, x, z
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Find random positions for palm tree
local pr = PseudoRandom(seed+1)
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
for divz=0,divs-1 do
-- find random positions for palm tree
pr = PseudoRandom(seed+1)
x = pr:next(minp.x + math.floor((divx+0)*divlen), minp.x + math.floor((divx+1)*divlen))
z = pr:next(minp.z + math.floor((divz+0)*divlen), minp.z + math.floor((divz+1)*divlen))
if minetest.get_node({x=x,y=1,z=z}).name == "default:sand" and
minetest.find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
minetest.place_schematic({x=x-4,y=2,z=z-4}, path.."palmtree.mts", 0, '', 0)
@ -577,35 +708,39 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end)
-- Farming Redo Plants
--= Farming Redo plants
if farming.mod and farming.mod == "redo" then
print ("[MOD] Ethereal - Detected and using Farming Redo mod")
minetest.register_decoration({ -- Potato
-- potato
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:jungle_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.035,
biomes = {e.."junglee"},
biomes = {"junglee"},
decoration = "farming:potato_3",
})
minetest.register_decoration({ -- Carrot, Cucumber, Potato, Tomato, Corn, Coffee, Raspberry, Rhubarb
-- carrot, cucumber, potato, tomato, corn, coffee, raspberry, rhubarb
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:green_dirt", "ethereal:prairie_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.05,
biomes = {e.."grassy", e.."grassytwo", e.."prairie", e.."jumble"},
biomes = {"grassy", "grassytwo", "prairie", "jumble"},
decoration = {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4"},
})
minetest.register_decoration({ -- Melon, Pumpkin
-- melon and pumpkin
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:green_dirt", "ethereal:jungle_dirt"},
sidelen = 80, -- was 16
sidelen = 80,
fill_ratio = 0.015,
biomes = {e.."grassy", e.."grassytwo", e.."junglee", e.."jumble"},
biomes = {"grassy", "grassytwo", "junglee", "jumble"},
decoration = {"farming:melon_8", "farming:pumpkin_8"},
spawn_by = "default:water_source",
num_spawn_by = 1,

View File

@ -1,8 +1,7 @@
-- Override default Papyrus to make it walkable
-- override default papyrus to make it walkable
minetest.override_item("default:papyrus", {walkable=true, sunlight_propagates=true})
-- Have Papyrus grow up to 4 high and Bamboo grow up to 5 in height (shared abm)
-- have papyrus grow up to 4 high and bamboo grow up to 5 in height (shared abm)
minetest.register_abm({
nodenames = {"default:papyrus", "ethereal:bamboo"},
neighbors = {"group:soil"},
@ -10,32 +9,32 @@ minetest.register_abm({
chance = 20,
action = function(pos, node)
local type = minetest.get_node(pos).name
local high = 4
pos.y = pos.y-1
local name = minetest.get_node(pos).name
pos.y = pos.y - 1
local nod = minetest.get_node_or_nil(pos)
if minetest.get_item_group(name, "soil") < 1 or minetest.find_node_near(pos, 3, {"group:water"}) == nil then
if not nod
or minetest.get_item_group(nod.name, "soil") < 1
or minetest.find_node_near(pos, 3, {"group:water"}) == nil then
return
end
if type == "ethereal:bamboo" then
if node.name == "ethereal:bamboo" then
high = 5
end
pos.y = pos.y+1
pos.y = pos.y + 1
local height = 0
while minetest.get_node(pos).name == type and height < high do
height = height+1
pos.y = pos.y+1
while minetest.get_node(pos).name == node.name and height < high do
height = height + 1
pos.y = pos.y + 1
end
if height < high then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name=type})
end
nod = minetest.get_node_or_nil(pos)
if nod and nod.name == "air" and height < high then
minetest.set_node(pos, {name=node.name})
end
end,

View File

@ -4,7 +4,6 @@
--= Desert Biome
-- Cactus
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:desert_sand", "default:sandstone"},
@ -15,7 +14,6 @@ minetest.register_decoration({
})
-- Desert Plants
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:desert_sand", "default:sandstone", "default:sand"},
@ -28,7 +26,6 @@ minetest.register_decoration({
--= Prairie Biome
-- Grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:prairie_dirt", "ethereal:green_dirt"},
@ -39,7 +36,6 @@ minetest.register_decoration({
})
-- Flowers
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:prairie_grass", "ethereal:green_dirt", "ethereal:grove_dirt", "ethereal:bamboo_dirt"},
@ -58,8 +54,7 @@ minetest.register_decoration({
decoration = {"bakedclay:flower_delphinium", "bakedclay:flower_celosia", "bakedclay:flower_daisy", "bakedclay:flower_bluerose"},
})
--= Shrubs
-- Shrubs
minetest.register_decoration({
deco_type = "simple",
place_on = {"ethereal:prairie_grass", "ethereal:green_dirt", "ethereal:grove_dirt", "ethereal:jungle_grass", "ethereal:gray_dirt"},

View File

@ -49,8 +49,8 @@ end
-- Grow saplings
minetest.register_abm({
nodenames = {"group:ethereal_sapling"},
interval = 20,
chance = 25,
interval = 10,
chance = 50,
action = function(pos, node)
local under = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name

View File

@ -120,7 +120,7 @@ minetest.register_ore({
height_min = -100,
})
-- Randomly generate Coral or Seaweed and have Seaweed grow up to 10 high
-- randomly generate coral or seaweed and have seaweed grow up to 10 high
minetest.register_abm({
nodenames = {"ethereal:sandy"},
neighbors = {"group:water"},
@ -130,31 +130,25 @@ minetest.register_abm({
action = function(pos, node)
local sel = math.random(1,5)
if sel == 1 or minetest.get_node(pos).name == "ethereal:seaweed" then
if sel == 1 or node.name == "ethereal:seaweed" then
local height = 0
while minetest.get_node(pos).name == "ethereal:seaweed"
or minetest.get_node(pos).name == "ethereal:sandy"
while (minetest.get_node(pos).name == "ethereal:seaweed"
or minetest.get_node(pos).name == "ethereal:sandy")
and height < 14 do
height = height + 1
pos.y = pos.y + 1
end
if height < 14 and pos.y < 0 then
if minetest.get_node(pos).name == "default:water_source" then
minetest.set_node(pos, {name="ethereal:seaweed"})
-- print ("GOING UP")
end
if height < 14 and pos.y < 0
and minetest.get_node(pos).name == "default:water_source" then
minetest.set_node(pos, {name="ethereal:seaweed"})
end
else
pos.y = pos.y + 1
if minetest.get_node(pos).name == "default:water_source" then
minetest.set_node(pos, {name="ethereal:coral"..sel})
-- print ("CORAL ", sel)
end
end