use real function calls instead of the old string method where possible

(basically leaving only the old legacy mapgen calls still using the string method)
This commit is contained in:
Vanessa Ezekowitz 2014-08-15 10:09:01 -04:00
parent 7f4fc1d553
commit da732bb18e
14 changed files with 36 additions and 31 deletions

View File

@ -207,7 +207,7 @@ plantslib:register_generate_plant({
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
},
"abstract_bushes.grow_bush"
abstract_bushes.grow_bush
)
abstract_bushes.grow_youngtree2 = function(pos)
@ -252,7 +252,7 @@ plantslib:register_generate_plant({
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
},
"abstract_bushes.grow_youngtree2"
abstract_bushes.grow_youngtree2
)
--http://dev.minetest.net/Node_Drawtypes

View File

@ -102,7 +102,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_juncus"
abstract_dryplants.grow_juncus
)
-- at dunes/beach
plantslib:register_generate_plant({
@ -123,5 +123,5 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_juncus"
abstract_dryplants.grow_juncus
)

View File

@ -22,5 +22,5 @@ plantslib:register_generate_plant({
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_grass_variation"
abstract_dryplants.grow_grass_variation
)

View File

@ -30,5 +30,5 @@ plantslib:register_generate_plant({
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_grass"
abstract_dryplants.grow_grass
)

View File

@ -363,7 +363,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_reedmace"
abstract_dryplants.grow_reedmace
)
-- in water
plantslib:register_generate_plant({
@ -386,7 +386,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_reedmace_water"
abstract_dryplants.grow_reedmace_water
)
-- for oases & tropical beaches & tropical swamps
plantslib:register_generate_plant({
@ -406,5 +406,5 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_dryplants.grow_reedmace"
abstract_dryplants.grow_reedmace
)

View File

@ -151,7 +151,7 @@ plantslib:register_generate_plant({ -- near trees (woodlands)
temp_max = -0.5, -- 55 °C (too hot?)
temp_min = 0.75, -- -12 °C
},
"abstract_ferns.grow_fern"
abstract_ferns.grow_fern
)
end
@ -177,7 +177,7 @@ plantslib:register_generate_plant({ -- near stone (mountains)
temp_max = -0.5, -- 55 °C (too hot?)
temp_min = 0.75, -- -12 °C
},
"abstract_ferns.grow_fern"
abstract_ferns.grow_fern
)
end
@ -214,7 +214,7 @@ plantslib:register_generate_plant({ -- near ores (potential mining sites)
temp_max = -0.5, -- 55 °C (too hot?)
temp_min = 0.75, -- -12 °C
},
"abstract_ferns.grow_fern"
abstract_ferns.grow_fern
)
end
@ -244,6 +244,6 @@ plantslib:register_generate_plant({
temp_max = -0.5, -- 55 °C (too hot?)
temp_min = 0.75, -- -12 °C
},
"abstract_ferns.grow_fern"
abstract_ferns.grow_fern
)
end

View File

@ -334,7 +334,7 @@ plantslib:register_generate_plant({
--temp_max = -1,-- -1.2,-- -0.5, -- ~ 55C
--temp_min = -0.35,-- -0.07, -- ~ 25C
},
"abstract_ferns.grow_giant_tree_fern"
abstract_ferns.grow_giant_tree_fern
)
end
@ -361,6 +361,6 @@ plantslib:register_generate_plant({
temp_max = -1.0,
temp_min = 1.0,
},
"abstract_ferns.grow_giant_tree_fern"
abstract_ferns.grow_giant_tree_fern
)
end

View File

@ -151,7 +151,7 @@ plantslib:register_generate_plant({
temp_max = -0.5, -- 55 °C
temp_min = 0.53, -- 0 °C, dies back in winter
},
"abstract_ferns.grow_horsetail"
abstract_ferns.grow_horsetail
)
end
@ -173,6 +173,6 @@ plantslib:register_generate_plant({
temp_max = -0.5, -- 55 °C
temp_min = 0.53, -- 0 °C, dies back in winter
},
"abstract_ferns.grow_horsetail"
abstract_ferns.grow_horsetail
)
end

View File

@ -213,7 +213,7 @@ plantslib:register_generate_plant({
temp_max = -0.5,
temp_min = 0.13,
},
"abstract_ferns.grow_tree_fern"
abstract_ferns.grow_tree_fern
)
end
@ -240,6 +240,6 @@ plantslib:register_generate_plant({
temp_max = -1.0,
temp_min = 1.0,
},
"abstract_ferns.grow_tree_fern"
abstract_ferns.grow_tree_fern
)
end

View File

@ -326,7 +326,7 @@ plantslib:register_generate_plant({
temp_max = -0.22,
temp_min = 0.22,
},
"flowers_plus.grow_waterlily"
flowers_plus.grow_waterlily
)
flowers_plus.grow_seaweed = function(pos)
@ -346,7 +346,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"flowers_plus.grow_seaweed"
flowers_plus.grow_seaweed
)
-- seaweed at beaches
@ -365,7 +365,7 @@ plantslib:register_generate_plant({
temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere
temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere
},
"flowers_plus.grow_seaweed"
flowers_plus.grow_seaweed
)
plantslib:register_generate_plant({
surface = {"default:sand"},
@ -381,7 +381,7 @@ plantslib:register_generate_plant({
temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere
temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere
},
"flowers_plus.grow_seaweed"
flowers_plus.grow_seaweed
)
-- spawn ABM registrations

View File

@ -102,9 +102,9 @@ plantslib:register_generate_plant({
avoid_radius = 4,
plantlife_limit = -0.3,
},
"abstract_molehills.place_molehill"
abstract_molehills.place_molehill
)
-----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------

View File

@ -122,6 +122,11 @@ function plantslib:register_generate_plant(biomedef, node_or_function_or_model)
return
end
if type(node_or_function_or_model) == "string"
and not string.find(node_or_function_or_model, ":") then
print("[Plants Lib] Warning: registered function call using deprecated string method: "..dump(node_or_function_or_model))
end
if biomedef.check_air == false then
print("[Plants Lib] Called legacy mapgen code for "..dump(node_or_function_or_model))
minetest.register_on_generated(plantslib:generate_block_legacy(minp, maxp, biomedef, node_or_function_or_model))
@ -249,7 +254,7 @@ function plantslib:generate_block(minp, maxp, blockseed)
spawned = true
elseif objtype == "function" then
node_or_function_or_model(pos)
spawned = trueload
spawned = true
elseif objtype == "string" and pcall(loadstring(("return %s(...)"):
format(node_or_function_or_model)),pos) then
spawned = true

View File

@ -174,7 +174,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_trunks.place_twig"
abstract_trunks.place_twig
)
end
@ -191,7 +191,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_trunks.place_twig"
abstract_trunks.place_twig
)
end
@ -355,7 +355,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_trunks.place_trunk"
abstract_trunks.place_trunk
)
-----------------------------------------------------------------------------------------------
@ -391,7 +391,7 @@ plantslib:register_generate_plant({
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_trunks.grow_moss_on_ground"
abstract_trunks.grow_moss_on_ground
)
end

View File

@ -150,5 +150,5 @@ plantslib:register_generate_plant({
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
},
"abstract_youngtrees.grow_youngtree"
abstract_youngtrees.grow_youngtree
)