From da732bb18eb3cc9f5efbf55bb0e523ef69f0f4fc Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 15 Aug 2014 10:09:01 -0400 Subject: [PATCH] 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) --- bushes/init.lua | 4 ++-- dryplants/juncus.lua | 4 ++-- dryplants/meadowvariation.lua | 2 +- dryplants/moregrass.lua | 2 +- dryplants/reedmace.lua | 6 +++--- ferns/fern.lua | 8 ++++---- ferns/gianttreefern.lua | 4 ++-- ferns/horsetail.lua | 4 ++-- ferns/treefern.lua | 4 ++-- flowers_plus/init.lua | 8 ++++---- molehills/init.lua | 4 ++-- plants_lib/init.lua | 7 ++++++- trunks/generating.lua | 8 ++++---- youngtrees/init.lua | 2 +- 14 files changed, 36 insertions(+), 31 deletions(-) diff --git a/bushes/init.lua b/bushes/init.lua index a2a3213..1ca6023 100644 --- a/bushes/init.lua +++ b/bushes/init.lua @@ -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 diff --git a/dryplants/juncus.lua b/dryplants/juncus.lua index 093d35f..9dedcbd 100644 --- a/dryplants/juncus.lua +++ b/dryplants/juncus.lua @@ -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 ) diff --git a/dryplants/meadowvariation.lua b/dryplants/meadowvariation.lua index da46294..025733c 100644 --- a/dryplants/meadowvariation.lua +++ b/dryplants/meadowvariation.lua @@ -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 ) diff --git a/dryplants/moregrass.lua b/dryplants/moregrass.lua index 3587806..75218e0 100644 --- a/dryplants/moregrass.lua +++ b/dryplants/moregrass.lua @@ -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 ) diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 88d9f76..3a01385 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -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 ) diff --git a/ferns/fern.lua b/ferns/fern.lua index 29e0edc..fa4d99b 100644 --- a/ferns/fern.lua +++ b/ferns/fern.lua @@ -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 diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua index 89caeff..6897bcd 100644 --- a/ferns/gianttreefern.lua +++ b/ferns/gianttreefern.lua @@ -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 diff --git a/ferns/horsetail.lua b/ferns/horsetail.lua index 803bc1f..06608f8 100644 --- a/ferns/horsetail.lua +++ b/ferns/horsetail.lua @@ -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 diff --git a/ferns/treefern.lua b/ferns/treefern.lua index f90d052..bcd11fe 100644 --- a/ferns/treefern.lua +++ b/ferns/treefern.lua @@ -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 diff --git a/flowers_plus/init.lua b/flowers_plus/init.lua index d61daf3..a47e607 100644 --- a/flowers_plus/init.lua +++ b/flowers_plus/init.lua @@ -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 diff --git a/molehills/init.lua b/molehills/init.lua index c80e7cc..d901839 100644 --- a/molehills/init.lua +++ b/molehills/init.lua @@ -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...") ------------------------------------------------------------------------------------------------ \ No newline at end of file +----------------------------------------------------------------------------------------------- diff --git a/plants_lib/init.lua b/plants_lib/init.lua index 4f71ddc..3db9951 100644 --- a/plants_lib/init.lua +++ b/plants_lib/init.lua @@ -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 diff --git a/trunks/generating.lua b/trunks/generating.lua index 3078d31..e46a804 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -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 diff --git a/youngtrees/init.lua b/youngtrees/init.lua index d443571..8e9eff0 100644 --- a/youngtrees/init.lua +++ b/youngtrees/init.lua @@ -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 )