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,7 +127,10 @@ plantslib:spawn_on_surfaces({
}, },
seed_diff = 329, seed_diff = 329,
})]] })]]
if Ferns_near_Tree == true then
assert(abstract_ferns.config.Lady_fern == true)
if abstract_ferns.config.Ferns_near_Tree == true then
plantslib:register_generate_plant({ -- near trees (woodlands) plantslib:register_generate_plant({ -- near trees (woodlands)
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
@ -155,7 +158,7 @@ plantslib:register_generate_plant({ -- near trees (woodlands)
) )
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",
@ -181,7 +184,7 @@ plantslib:register_generate_plant({ -- near stone (mountains)
) )
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",
@ -218,7 +221,7 @@ plantslib:register_generate_plant({ -- near ores (potential mining sites)
) )
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",

View File

@ -276,8 +276,11 @@ 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",
@ -306,7 +309,7 @@ plantslib:register_generate_plant({
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"--,

View File

@ -94,7 +94,7 @@ 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 = {
@ -124,7 +124,10 @@ end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- Generating -- Generating
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
if Horsetails_on_Grass == true then
assert(abstract_ferns.config.Horsetails == true)
if abstract_ferns.config.Horsetails_on_Grass == true then
plantslib:register_generate_plant({ plantslib:register_generate_plant({
surface = { surface = {
"default:dirt_with_grass", "default:dirt_with_grass",
@ -155,7 +158,7 @@ plantslib:register_generate_plant({
) )
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

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,8 +188,11 @@ 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",
@ -218,7 +221,7 @@ plantslib:register_generate_plant({
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"--,