Stop polluting global namespace

This commit is contained in:
Craig Robbins 2014-08-20 18:35:08 +10:00 committed by Vanessa Ezekowitz
parent 50cb0a2741
commit f44f81213c
6 changed files with 310 additions and 297 deletions

View File

@ -127,8 +127,11 @@ plantslib:spawn_on_surfaces({
}, },
seed_diff = 329, seed_diff = 329,
})]] })]]
if Ferns_near_Tree == true then
plantslib:register_generate_plant({ -- near trees (woodlands) assert(abstract_ferns.config.Lady_fern == true)
if abstract_ferns.config.Ferns_near_Tree == true then
plantslib:register_generate_plant({ -- near trees (woodlands)
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:mossycobble", "default:mossycobble",
@ -152,11 +155,11 @@ plantslib:register_generate_plant({ -- near trees (woodlands)
temp_min = 0.75, -- -12 °C temp_min = 0.75, -- -12 °C
}, },
abstract_ferns.grow_fern abstract_ferns.grow_fern
) )
end end
if Ferns_near_Rock == true then if abstract_ferns.config.Ferns_near_Rock == true then
plantslib:register_generate_plant({ -- near stone (mountains) plantslib:register_generate_plant({ -- near stone (mountains)
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:mossycobble", "default:mossycobble",
@ -178,11 +181,11 @@ plantslib:register_generate_plant({ -- near stone (mountains)
temp_min = 0.75, -- -12 °C temp_min = 0.75, -- -12 °C
}, },
abstract_ferns.grow_fern abstract_ferns.grow_fern
) )
end end
if Ferns_near_Ores == true then -- this one causes a huge fps drop if abstract_ferns.config.Ferns_near_Ores == true then -- this one causes a huge fps drop
plantslib:register_generate_plant({ -- near ores (potential mining sites) plantslib:register_generate_plant({ -- near ores (potential mining sites)
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:mossycobble", "default:mossycobble",
@ -215,11 +218,11 @@ plantslib:register_generate_plant({ -- near ores (potential mining sites)
temp_min = 0.75, -- -12 °C temp_min = 0.75, -- -12 °C
}, },
abstract_ferns.grow_fern abstract_ferns.grow_fern
) )
end end
if Ferns_in_Groups == true then -- this one is meant as a replacement of Ferns_near_Ores if abstract_ferns.config.Ferns_in_Groups == true then -- this one is meant as a replacement of Ferns_near_Ores
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:mossycobble", "default:mossycobble",
@ -245,5 +248,5 @@ plantslib:register_generate_plant({
temp_min = 0.75, -- -12 °C temp_min = 0.75, -- -12 °C
}, },
abstract_ferns.grow_fern abstract_ferns.grow_fern
) )
end end

View File

@ -276,9 +276,12 @@ minetest.register_abm({
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- GENERATE GIANT TREE FERN -- GENERATE GIANT TREE FERN
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
assert(abstract_ferns.config.Giant_Tree_Fern == true)
-- in jungles -- in jungles
if Giant_Tree_Ferns_in_Jungle == true then if abstract_ferns.config.Giant_Tree_Ferns_in_Jungle == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:sand", "default:sand",
@ -302,12 +305,12 @@ plantslib:register_generate_plant({
--temp_min = -0.35,-- -0.07, -- ~ 25C --temp_min = -0.35,-- -0.07, -- ~ 25C
}, },
abstract_ferns.grow_giant_tree_fern abstract_ferns.grow_giant_tree_fern
) )
end end
-- for oases & tropical beaches -- for oases & tropical beaches
if Giant_Tree_Ferns_for_Oases == true then if abstract_ferns.config.Giant_Tree_Ferns_for_Oases == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:sand"--, "default:sand"--,
--"default:desert_sand" --"default:desert_sand"
@ -329,5 +332,5 @@ plantslib:register_generate_plant({
temp_min = 1.0, temp_min = 1.0,
}, },
abstract_ferns.grow_giant_tree_fern abstract_ferns.grow_giant_tree_fern
) )
end end

View File

@ -94,8 +94,8 @@ minetest.register_node("ferns:horsetail_04", { -- the one in inventory
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- Spawning -- Spawning
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
if Horsetails_Spawning == true then if abstract_ferns.config.Horsetails_Spawning == true then
plantslib:spawn_on_surfaces({ plantslib:spawn_on_surfaces({
spawn_delay = 1200, spawn_delay = 1200,
spawn_plants = { spawn_plants = {
"ferns:horsetail_01", "ferns:horsetail_01",
@ -119,13 +119,16 @@ plantslib:spawn_on_surfaces({
near_nodes_size = 2, near_nodes_size = 2,
near_nodes_vertical = 1, near_nodes_vertical = 1,
near_nodes_count = 1, near_nodes_count = 1,
}) })
end end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- Generating -- Generating
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
if Horsetails_on_Grass == true then
plantslib:register_generate_plant({ assert(abstract_ferns.config.Horsetails == true)
if abstract_ferns.config.Horsetails_on_Grass == true then
plantslib:register_generate_plant({
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"sumpf:sumpf" "sumpf:sumpf"
@ -152,11 +155,11 @@ plantslib:register_generate_plant({
temp_min = 0.53, -- 0 °C, dies back in winter temp_min = 0.53, -- 0 °C, dies back in winter
}, },
abstract_ferns.grow_horsetail abstract_ferns.grow_horsetail
) )
end end
if Horsetails_on_Stony == true then if abstract_ferns.config.Horsetails_on_Stony == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:gravel", -- roots go deep "default:gravel", -- roots go deep
"default:mossycobble", "default:mossycobble",
@ -174,5 +177,5 @@ plantslib:register_generate_plant({
temp_min = 0.53, -- 0 °C, dies back in winter temp_min = 0.53, -- 0 °C, dies back in winter
}, },
abstract_ferns.grow_horsetail abstract_ferns.grow_horsetail
) )
end end

View File

@ -10,19 +10,19 @@ abstract_ferns = {}
dofile(minetest.get_modpath("ferns").."/settings.lua") dofile(minetest.get_modpath("ferns").."/settings.lua")
if Lady_fern == true then if abstract_ferns.config.Lady_fern == true then
dofile(minetest.get_modpath("ferns").."/fern.lua") dofile(minetest.get_modpath("ferns").."/fern.lua")
end end
if Horsetails == true then if abstract_ferns.Horsetails == true then
dofile(minetest.get_modpath("ferns").."/horsetail.lua") dofile(minetest.get_modpath("ferns").."/horsetail.lua")
end end
if Tree_Fern == true then if abstract_ferns.config.Tree_Fern == true then
dofile(minetest.get_modpath("ferns").."/treefern.lua") dofile(minetest.get_modpath("ferns").."/treefern.lua")
end end
if Giant_Tree_Fern == true then if abstract_ferns.config.Giant_Tree_Fern == true then
dofile(minetest.get_modpath("ferns").."/gianttreefern.lua") dofile(minetest.get_modpath("ferns").."/gianttreefern.lua")
end end

View File

@ -13,30 +13,31 @@
-- If something is still unclear, don't hesitate to post your question @ https://forum.minetest.net/viewtopic.php?id=6921 -- If something is still unclear, don't hesitate to post your question @ https://forum.minetest.net/viewtopic.php?id=6921
abstract_ferns.config = {}
-- Which plants should generate/spawn? -- Which plants should generate/spawn?
Lady_fern = true abstract_ferns.config.Lady_fern = true
Horsetails = true abstract_ferns.config.Horsetails = true
Tree_Fern = true abstract_ferns.config.Tree_Fern = true
Giant_Tree_Fern = true abstract_ferns.config.Giant_Tree_Fern = true
-- Where should they generate/spawn? (if they generate/spawn) -- Where should they generate/spawn? (if they generate/spawn)
-- --
-- Lady-Fern -- Lady-Fern
Ferns_near_Tree = true abstract_ferns.config.Ferns_near_Tree = true
Ferns_near_Rock = true abstract_ferns.config.Ferns_near_Rock = true
Ferns_near_Ores = true -- if there's a bunch of ferns there's ores nearby, this one causes a huge fps drop abstract_ferns.config.Ferns_near_Ores = true -- if there's a bunch of ferns there's ores nearby, this one causes a huge fps drop
Ferns_in_Groups = false -- this one is meant as a replacement of Ferns_near_Ores: ferns tend to generate in groups, less fps drop, no hint for nearby ores abstract_ferns.config.Ferns_in_Groups = false -- this one is meant as a replacement of Ferns_near_Ores: ferns tend to generate in groups, less fps drop, no hint for nearby ores
-- --
-- Horsetails -- Horsetails
Horsetails_Spawning = false -- horsetails will grow in already explored areas, over time, near water or gravel abstract_ferns.config.Horsetails_Spawning = false -- horsetails will grow in already explored areas, over time, near water or gravel
Horsetails_on_Grass = true -- on dirt with grass and swamp (sumpf mod) abstract_ferns.config.Horsetails_on_Grass = true -- on dirt with grass and swamp (sumpf mod)
Horsetails_on_Stony = true -- on gravel, mossy cobble and silex (stoneage mod) abstract_ferns.config.Horsetails_on_Stony = true -- on gravel, mossy cobble and silex (stoneage mod)
-- --
-- Tree_Fern -- Tree_Fern
Tree_Ferns_in_Jungle = true abstract_ferns.config.Tree_Ferns_in_Jungle = true
Tree_Ferns_for_Oases = true -- for oases and tropical beaches abstract_ferns.config.Tree_Ferns_for_Oases = true -- for oases and tropical beaches
-- --
-- Giant_Tree_Fern -- Giant_Tree_Fern
Giant_Tree_Ferns_in_Jungle = true abstract_ferns.config.Giant_Tree_Ferns_in_Jungle = true
Giant_Tree_Ferns_for_Oases = true -- for oases and tropical beaches abstract_ferns.config.Giant_Tree_Ferns_for_Oases = true -- for oases and tropical beaches

View File

@ -188,9 +188,12 @@ minetest.register_abm({
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- GENERATE TREE FERN -- GENERATE TREE FERN
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
assert(abstract_ferns.config.Tree_Fern == true)
-- in jungles -- in jungles
if Tree_Ferns_in_Jungle == true then if abstract_ferns.config.Tree_Ferns_in_Jungle == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
"default:sand", "default:sand",
@ -214,12 +217,12 @@ plantslib:register_generate_plant({
temp_min = 0.13, temp_min = 0.13,
}, },
abstract_ferns.grow_tree_fern abstract_ferns.grow_tree_fern
) )
end end
-- for oases & tropical beaches -- for oases & tropical beaches
if Tree_Ferns_for_Oases == true then if abstract_ferns.config.Tree_Ferns_for_Oases == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:sand"--, "default:sand"--,
--"default:desert_sand" --"default:desert_sand"