diff --git a/mods/plantlife_modpack/plants_lib/API.txt b/mods/biome_lib/API.txt old mode 100755 new mode 100644 similarity index 97% rename from mods/plantlife_modpack/plants_lib/API.txt rename to mods/biome_lib/API.txt index 8f6455ca..73e310f8 --- a/mods/plantlife_modpack/plants_lib/API.txt +++ b/mods/biome_lib/API.txt @@ -7,7 +7,7 @@ Last revision: 2015-02-16 Functions ========= -There are three main functions defined by the main "plants_lib" mod: +There are three main functions defined by the main "biome_lib" mod: spawn_on_surfaces() register_generate_plant() @@ -19,8 +19,8 @@ at any time. They are briefly described below these main functions, but see init.lua for details. Most functions in plants lib are declared locally to avoid namespace -collisions with other mods. They are accessible via the "plantslib" method, -e.g. plantslib:spawn_on_surfaces() and so forth. +collisions with other mods. They are accessible via the "biome_lib" method, +e.g. biome_lib:spawn_on_surfaces() and so forth. ===== spawn_on_surfaces(biome) @@ -219,7 +219,7 @@ checking is disabled. Same holds true for the nneighbors bit above that. ===== -plantslib:register_generate_plant(biome, nodes_or_function_or_treedef) +biome_lib:register_generate_plant(biome, nodes_or_function_or_treedef) To register an object to be spawned at mapgen time rather than via an ABM, call this function with two parameters: a table with your object's biome @@ -335,7 +335,7 @@ will be called in the form: ===== -plantslib:grow_plants(options) +biome_lib:grow_plants(options) The third function, grow_plants() is used to turn the spawned nodes above into something else over time. This function has no return value, and accepts @@ -448,22 +448,22 @@ just checks if DEBUG is true and outputs the phrase "[Plantlife] " followed by the supplied string, via the print() function, if so. ===== -plantslib:generate_tree(pos, treemodel) -plantslib:grow_tree(pos, treemodel) +biome_lib:generate_tree(pos, treemodel) +biome_lib:grow_tree(pos, treemodel) In the case of the growing code and the mapgen-based tree generator code, generating a tree is done via the above two calls, which in turn immediately call the usual spawn_tree() functions. This rerouting exists as a way for -other mods to hook into plants_lib's tree-growing functions in general, +other mods to hook into biome_lib's tree-growing functions in general, perhaps to execute something extra whenever a tree is spawned. -plantslib:generate_tree(pos, treemodel) is called any time a tree is spawned +biome_lib:generate_tree(pos, treemodel) is called any time a tree is spawned at map generation time. 'pos' is the position of the block on which the tree is to be placed. 'treemodel' is the standard L-Systems tree definition table expected by the spawn_tree() function. Refer to the 'trunk' field in that table to derive the name of the tree being spawned. -plantslib:grow_tree(pos, treemodel) does the same sort of thing whenever a +biome_lib:grow_tree(pos, treemodel) does the same sort of thing whenever a tree is spawned within the abm-based growing code, for example when growing a sapling into a tree. @@ -493,7 +493,7 @@ Perlin noise used. The first one is for a "fertile ground" layer, which I tend to refer to as the generic "stuff can potentially grow here" layer. Its values are hard-coded: - plantslib.plantlife_seed_diff = 329 + biome_lib.plantlife_seed_diff = 329 perlin_octaves = 3 perlin_persistence = 0.6 perlin_scale = 100 diff --git a/mods/biome_lib/README.md b/mods/biome_lib/README.md new file mode 100644 index 00000000..ce539d14 --- /dev/null +++ b/mods/biome_lib/README.md @@ -0,0 +1,30 @@ +# Biome Lib + +This library's purpose is to allow other mods to add growing things to the map in a straightforward, simple manner. It contains all the core functions needed by mods and modpacks such as More Trees, Tiny Trees, Plantlife, and others. + +Spawning of plants is optionally sensitive to the amount of available light, elevation, nearness to other nodes, plant-to-plant density, water depth, and a whole host of controls. + +All objects spawned or generated using this mod use Perlin noise to stay within simple biomes, rather than just letting everything just spread around the map randomly. + +This library also features a basic temperature map, which should blend in nicely with SPlizard's Snow Biomes mod (the same Perlin settings are used, with the assumption that the edge of a snow biome is 0° Centigrade). + +Both mapgen-based spawning and ABM-based spawning is supported. Growing code is strictly ABM-based. L-system trees can be spawned at mapgen time via the engine's spawn_tree() function and are quite fast. + +It is primarily intended for mapgen v6, but it should work fine when used with mapgen v7. + +**Dependencies**: default from minetest_game + +**Recommends**: [Plantlife Modpack](https://github.com/VanessaE/plantlife_modpack), +[More Trees](https://github.com/VanessaE/moretrees) + +**License**: WTFPL + +**API**: This mod supplies a small number of very powerful functions. They are, briefly: + +* biome_lib:register_generate_plant() +* biome_lib:spawn_on_surfaces() +* biome_lib:grow_plants() +* biome_lib:find_valid_wall() +* biome_lib:is_node_loaded() + +For a complete description of these functions as well as several of the internal variables within the mod, [read the API.txt document](https://raw.githubusercontent.com/VanessaE/biome_lib/master/API.txt) included in this package. diff --git a/mods/plantlife_modpack/plants_lib/depends.txt b/mods/biome_lib/depends.txt old mode 100755 new mode 100644 similarity index 60% rename from mods/plantlife_modpack/plants_lib/depends.txt rename to mods/biome_lib/depends.txt index b14319d1..c48fe0d0 --- a/mods/plantlife_modpack/plants_lib/depends.txt +++ b/mods/biome_lib/depends.txt @@ -1,3 +1,3 @@ default intllib? -watershed? + diff --git a/mods/plantlife_modpack/plants_lib/init.lua b/mods/biome_lib/init.lua old mode 100755 new mode 100644 similarity index 72% rename from mods/plantlife_modpack/plants_lib/init.lua rename to mods/biome_lib/init.lua index 7b626154..66008e32 --- a/mods/plantlife_modpack/plants_lib/init.lua +++ b/mods/biome_lib/init.lua @@ -8,26 +8,28 @@ -- Various settings - most of these probably won't need to be changed -plantslib = {} +biome_lib = {} -plantslib.blocklist_aircheck = {} -plantslib.blocklist_no_aircheck = {} +plantslib = setmetatable({}, { __index=function(t,k) print("Use of deprecated function:", k) return biomes_lib[k] end }) -plantslib.surface_nodes_aircheck = {} -plantslib.surface_nodes_no_aircheck = {} +biome_lib.blocklist_aircheck = {} +biome_lib.blocklist_no_aircheck = {} -plantslib.surfaceslist_aircheck = {} -plantslib.surfaceslist_no_aircheck = {} +biome_lib.surface_nodes_aircheck = {} +biome_lib.surface_nodes_no_aircheck = {} -plantslib.actioncount_aircheck = {} -plantslib.actioncount_no_aircheck = {} +biome_lib.surfaceslist_aircheck = {} +biome_lib.surfaceslist_no_aircheck = {} -plantslib.actionslist_aircheck = {} -plantslib.actionslist_no_aircheck = {} +biome_lib.actioncount_aircheck = {} +biome_lib.actioncount_no_aircheck = {} -plantslib.modpath = minetest.get_modpath("plants_lib") +biome_lib.actionslist_aircheck = {} +biome_lib.actionslist_no_aircheck = {} -plantslib.total_no_aircheck_calls = 0 +biome_lib.modpath = minetest.get_modpath("biome_lib") + +biome_lib.total_no_aircheck_calls = 0 -- Boilerplate to support localized strings if intllib mod is installed. local S @@ -36,18 +38,18 @@ if minetest.get_modpath("intllib") then else S = function(s) return s end end -plantslib.intllib = S +biome_lib.intllib = S local DEBUG = false --... except if you want to spam the console with debugging info :-) -function plantslib:dbg(msg) +function biome_lib:dbg(msg) if DEBUG then - minetest.log("action", "[Plantlife] "..msg) + print("[Plantlife] "..msg) minetest.log("verbose", "[Plantlife] "..msg) end end -plantslib.plantlife_seed_diff = 329 -- needs to be global so other mods can see it +biome_lib.plantlife_seed_diff = 329 -- needs to be global so other mods can see it local perlin_octaves = 3 local perlin_persistence = 0.6 @@ -56,12 +58,12 @@ local perlin_scale = 100 local temperature_seeddiff = 112 local temperature_octaves = 3 local temperature_persistence = 0.5 -local temperature_scale = 256 +local temperature_scale = 150 -local humidity_seeddiff = 72384 -local humidity_octaves = 4 -local humidity_persistence = 0.66 -local humidity_scale = 256 +local humidity_seeddiff = 9130 +local humidity_octaves = 3 +local humidity_persistence = 0.5 +local humidity_scale = 250 local time_scale = 1 local time_speed = tonumber(minetest.setting_get("time_speed")) @@ -72,12 +74,12 @@ end --PerlinNoise(seed, octaves, persistence, scale) -plantslib.perlin_temperature = PerlinNoise(temperature_seeddiff, temperature_octaves, temperature_persistence, temperature_scale) -plantslib.perlin_humidity = PerlinNoise(humidity_seeddiff, humidity_octaves, humidity_persistence, humidity_scale) +biome_lib.perlin_temperature = PerlinNoise(temperature_seeddiff, temperature_octaves, temperature_persistence, temperature_scale) +biome_lib.perlin_humidity = PerlinNoise(humidity_seeddiff, humidity_octaves, humidity_persistence, humidity_scale) -- Local functions -function plantslib:is_node_loaded(node_pos) +function biome_lib:is_node_loaded(node_pos) local n = minetest.get_node_or_nil(node_pos) if (not n) or (n.name == "ignore") then return false @@ -85,7 +87,7 @@ function plantslib:is_node_loaded(node_pos) return true end -function plantslib:set_defaults(biome) +function biome_lib:set_defaults(biome) biome.seed_diff = biome.seed_diff or 0 biome.min_elevation = biome.min_elevation or -31000 biome.max_elevation = biome.max_elevation or 31000 @@ -123,77 +125,77 @@ end -- register the list of surfaces to spawn stuff on, filtering out all duplicates. -- separate the items by air-checking or non-air-checking map eval methods -function plantslib:register_generate_plant(biomedef, nodes_or_function_or_model) +function biome_lib:register_generate_plant(biomedef, nodes_or_function_or_model) - -- if calling code passes an undefined node for a surface or + -- if calling code passes an undefined node for a surface or -- as a node to be spawned, don't register an action for it. if type(nodes_or_function_or_model) == "string" and string.find(nodes_or_function_or_model, ":") and not minetest.registered_nodes[nodes_or_function_or_model] then - plantslib:dbg("Warning: Ignored registration for undefined spawn node: "..dump(nodes_or_function_or_model)) + biome_lib:dbg("Warning: Ignored registration for undefined spawn node: "..dump(nodes_or_function_or_model)) return end if type(nodes_or_function_or_model) == "string" and not string.find(nodes_or_function_or_model, ":") then - plantslib:dbg("Warning: Registered function call using deprecated string method: "..dump(nodes_or_function_or_model)) + biome_lib:dbg("Warning: Registered function call using deprecated string method: "..dump(nodes_or_function_or_model)) end - if biomedef.check_air == false then - plantslib:dbg("Register no-air-check mapgen hook: "..dump(nodes_or_function_or_model)) - plantslib.actionslist_no_aircheck[#plantslib.actionslist_no_aircheck + 1] = { biomedef, nodes_or_function_or_model } + if biomedef.check_air == false then + biome_lib:dbg("Register no-air-check mapgen hook: "..dump(nodes_or_function_or_model)) + biome_lib.actionslist_no_aircheck[#biome_lib.actionslist_no_aircheck + 1] = { biomedef, nodes_or_function_or_model } local s = biomedef.surface if type(s) == "string" then if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then - if not search_table(plantslib.surfaceslist_no_aircheck, s) then - plantslib.surfaceslist_no_aircheck[#plantslib.surfaceslist_no_aircheck + 1] = s + if not search_table(biome_lib.surfaceslist_no_aircheck, s) then + biome_lib.surfaceslist_no_aircheck[#biome_lib.surfaceslist_no_aircheck + 1] = s end else - plantslib:dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s)) + biome_lib:dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s)) end else for i = 1, #biomedef.surface do local s = biomedef.surface[i] if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then - if not search_table(plantslib.surfaceslist_no_aircheck, s) then - plantslib.surfaceslist_no_aircheck[#plantslib.surfaceslist_no_aircheck + 1] = s + if not search_table(biome_lib.surfaceslist_no_aircheck, s) then + biome_lib.surfaceslist_no_aircheck[#biome_lib.surfaceslist_no_aircheck + 1] = s end else - plantslib:dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s)) + biome_lib:dbg("Warning: Ignored no-air-check registration for undefined surface node: "..dump(s)) end end end else - plantslib:dbg("Register with-air-checking mapgen hook: "..dump(nodes_or_function_or_model)) - plantslib.actionslist_aircheck[#plantslib.actionslist_aircheck + 1] = { biomedef, nodes_or_function_or_model } + biome_lib:dbg("Register with-air-checking mapgen hook: "..dump(nodes_or_function_or_model)) + biome_lib.actionslist_aircheck[#biome_lib.actionslist_aircheck + 1] = { biomedef, nodes_or_function_or_model } local s = biomedef.surface if type(s) == "string" then if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then - if not search_table(plantslib.surfaceslist_aircheck, s) then - plantslib.surfaceslist_aircheck[#plantslib.surfaceslist_aircheck + 1] = s + if not search_table(biome_lib.surfaceslist_aircheck, s) then + biome_lib.surfaceslist_aircheck[#biome_lib.surfaceslist_aircheck + 1] = s end else - plantslib:dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s)) + biome_lib:dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s)) end else for i = 1, #biomedef.surface do local s = biomedef.surface[i] if s and (string.find(s, "^group:") or minetest.registered_nodes[s]) then - if not search_table(plantslib.surfaceslist_aircheck, s) then - plantslib.surfaceslist_aircheck[#plantslib.surfaceslist_aircheck + 1] = s + if not search_table(biome_lib.surfaceslist_aircheck, s) then + biome_lib.surfaceslist_aircheck[#biome_lib.surfaceslist_aircheck + 1] = s end else - plantslib:dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s)) + biome_lib:dbg("Warning: Ignored with-air-checking registration for undefined surface node: "..dump(s)) end end end end end -function plantslib:populate_surfaces(biome, nodes_or_function_or_model, snodes, checkair) +function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes, checkair) - plantslib:set_defaults(biome) + biome_lib:set_defaults(biome) -- filter stage 1 - find nodes from the supplied surfaces that are within the current biome. @@ -204,8 +206,8 @@ function plantslib:populate_surfaces(biome, nodes_or_function_or_model, snodes, local pos = snodes[i] local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = -plantslib.perlin_temperature:get2d({x=pos.x, y=pos.z}) - local noise3 = plantslib.perlin_humidity:get2d({x=pos.x+150, y=pos.z+50}) + local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) + local noise3 = biome_lib.perlin_humidity:get2d({x=pos.x+150, y=pos.z+50}) local biome_surfaces_string = dump(biome.surface) local surface_ok = false @@ -216,7 +218,7 @@ function plantslib:populate_surfaces(biome, nodes_or_function_or_model, snodes, else if string.find(biome_surfaces_string, "group:") then for j = 1, #biome.surface do - if string.find(biome.surface[j], "^group:") + if string.find(biome.surface[j], "^group:") and minetest.get_item_group(dest_node.name, biome.surface[j]) then surface_ok = true break @@ -287,7 +289,7 @@ function plantslib:populate_surfaces(biome, nodes_or_function_or_model, snodes, if objtype == "table" then if nodes_or_function_or_model.axiom then - plantslib:generate_tree(pos, nodes_or_function_or_model) + biome_lib:generate_tree(pos, nodes_or_function_or_model) spawned = true else local fdir = nil @@ -312,7 +314,7 @@ function plantslib:populate_surfaces(biome, nodes_or_function_or_model, snodes, format(nodes_or_function_or_model)),pos) then spawned = true else - plantslib:dbg("Warning: Ignored invalid definition for object "..dump(nodes_or_function_or_model).." that was pointed at {"..dump(pos).."}") + biome_lib:dbg("Warning: Ignored invalid definition for object "..dump(nodes_or_function_or_model).." that was pointed at {"..dump(pos).."}") end else tries = tries + 1 @@ -325,51 +327,51 @@ end -- Primary mapgen spawner, for mods that can work with air checking enabled on -- a surface during the initial map read stage. -function plantslib:generate_block_with_air_checking() - if #plantslib.blocklist_aircheck > 0 then +function biome_lib:generate_block_with_air_checking() + if #biome_lib.blocklist_aircheck > 0 then - local minp = plantslib.blocklist_aircheck[1][1] - local maxp = plantslib.blocklist_aircheck[1][2] + local minp = biome_lib.blocklist_aircheck[1][1] + local maxp = biome_lib.blocklist_aircheck[1][2] -- use the block hash as a unique key into the surface nodes -- tables, so that we can write the tables thread-safely. local blockhash = minetest.hash_node_position(minp) - if not plantslib.surface_nodes_aircheck.blockhash then + if not biome_lib.surface_nodes_aircheck.blockhash then if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call - plantslib.surface_nodes_aircheck.blockhash = - minetest.find_nodes_in_area_under_air(minp, maxp, plantslib.surfaceslist_aircheck) + biome_lib.surface_nodes_aircheck.blockhash = + minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck) else - local search_area = minetest.find_nodes_in_area(minp, maxp, plantslib.surfaceslist_aircheck) + local search_area = minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_aircheck) -- search the generated block for air-bounded surfaces the slow way. - plantslib.surface_nodes_aircheck.blockhash = {} + biome_lib.surface_nodes_aircheck.blockhash = {} for i = 1, #search_area do local pos = search_area[i] local p_top = { x=pos.x, y=pos.y+1, z=pos.z } if minetest.get_node(p_top).name == "air" then - plantslib.surface_nodes_aircheck.blockhash[#plantslib.surface_nodes_aircheck.blockhash + 1] = pos + biome_lib.surface_nodes_aircheck.blockhash[#biome_lib.surface_nodes_aircheck.blockhash + 1] = pos end end end - plantslib.actioncount_aircheck.blockhash = 1 + biome_lib.actioncount_aircheck.blockhash = 1 else - if plantslib.actioncount_aircheck.blockhash <= #plantslib.actionslist_aircheck then + if biome_lib.actioncount_aircheck.blockhash <= #biome_lib.actionslist_aircheck then -- [1] is biome, [2] is node/function/model - plantslib:populate_surfaces( - plantslib.actionslist_aircheck[plantslib.actioncount_aircheck.blockhash][1], - plantslib.actionslist_aircheck[plantslib.actioncount_aircheck.blockhash][2], - plantslib.surface_nodes_aircheck.blockhash, true) - plantslib.actioncount_aircheck.blockhash = plantslib.actioncount_aircheck.blockhash + 1 + biome_lib:populate_surfaces( + biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][1], + biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][2], + biome_lib.surface_nodes_aircheck.blockhash, true) + biome_lib.actioncount_aircheck.blockhash = biome_lib.actioncount_aircheck.blockhash + 1 else - if plantslib.surface_nodes_aircheck.blockhash then - table.remove(plantslib.blocklist_aircheck, 1) - plantslib.surface_nodes_aircheck.blockhash = nil + if biome_lib.surface_nodes_aircheck.blockhash then + table.remove(biome_lib.blocklist_aircheck, 1) + biome_lib.surface_nodes_aircheck.blockhash = nil end end end @@ -379,33 +381,33 @@ end -- Secondary mapgen spawner, for mods that require disabling of -- checking for air during the initial map read stage. -function plantslib:generate_block_no_aircheck() - if #plantslib.blocklist_no_aircheck > 0 then +function biome_lib:generate_block_no_aircheck() + if #biome_lib.blocklist_no_aircheck > 0 then - local minp = plantslib.blocklist_no_aircheck[1][1] - local maxp = plantslib.blocklist_no_aircheck[1][2] + local minp = biome_lib.blocklist_no_aircheck[1][1] + local maxp = biome_lib.blocklist_no_aircheck[1][2] local blockhash = minetest.hash_node_position(minp) - if not plantslib.surface_nodes_no_aircheck.blockhash then + if not biome_lib.surface_nodes_no_aircheck.blockhash then -- directly read the block to be searched into the chunk cache - plantslib.surface_nodes_no_aircheck.blockhash = - minetest.find_nodes_in_area(minp, maxp, plantslib.surfaceslist_no_aircheck) - plantslib.actioncount_no_aircheck.blockhash = 1 + biome_lib.surface_nodes_no_aircheck.blockhash = + minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck) + biome_lib.actioncount_no_aircheck.blockhash = 1 else - if plantslib.actioncount_no_aircheck.blockhash <= #plantslib.actionslist_no_aircheck then - plantslib:populate_surfaces( - plantslib.actionslist_no_aircheck[plantslib.actioncount_no_aircheck.blockhash][1], - plantslib.actionslist_no_aircheck[plantslib.actioncount_no_aircheck.blockhash][2], - plantslib.surface_nodes_no_aircheck.blockhash, false) - plantslib.actioncount_no_aircheck.blockhash = plantslib.actioncount_no_aircheck.blockhash + 1 + if biome_lib.actioncount_no_aircheck.blockhash <= #biome_lib.actionslist_no_aircheck then + biome_lib:populate_surfaces( + biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][1], + biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][2], + biome_lib.surface_nodes_no_aircheck.blockhash, false) + biome_lib.actioncount_no_aircheck.blockhash = biome_lib.actioncount_no_aircheck.blockhash + 1 else - if plantslib.surface_nodes_no_aircheck.blockhash then - table.remove(plantslib.blocklist_no_aircheck, 1) - plantslib.surface_nodes_no_aircheck.blockhash = nil + if biome_lib.surface_nodes_no_aircheck.blockhash then + table.remove(biome_lib.blocklist_no_aircheck, 1) + biome_lib.surface_nodes_no_aircheck.blockhash = nil end end end @@ -415,29 +417,29 @@ end -- "Record" the chunks being generated by the core mapgen minetest.register_on_generated(function(minp, maxp, blockseed) - plantslib.blocklist_aircheck[#plantslib.blocklist_aircheck + 1] = { minp, maxp } + biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp } end) minetest.register_on_generated(function(minp, maxp, blockseed) - plantslib.blocklist_no_aircheck[#plantslib.blocklist_no_aircheck + 1] = { minp, maxp } + biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp } end) -- "Play" them back, populating them with new stuff in the process minetest.register_globalstep(function(dtime) if dtime < 0.2 and -- don't attempt to populate if lag is already too high - (#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) then - plantslib.globalstep_start_time = minetest.get_us_time() - plantslib.globalstep_runtime = 0 - while (#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) - and plantslib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS. - if #plantslib.blocklist_aircheck > 0 then - plantslib:generate_block_with_air_checking() + (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) then + biome_lib.globalstep_start_time = minetest.get_us_time() + biome_lib.globalstep_runtime = 0 + while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) + and biome_lib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS. + if #biome_lib.blocklist_aircheck > 0 then + biome_lib:generate_block_with_air_checking() end - if #plantslib.blocklist_no_aircheck > 0 then - plantslib:generate_block_no_aircheck() + if #biome_lib.blocklist_no_aircheck > 0 then + biome_lib:generate_block_no_aircheck() end - plantslib.globalstep_runtime = minetest.get_us_time() - plantslib.globalstep_start_time + biome_lib.globalstep_runtime = minetest.get_us_time() - biome_lib.globalstep_start_time end end end) @@ -446,26 +448,26 @@ end) -- to prevent unpopulated map areas minetest.register_on_shutdown(function() - minetest.log("[plants_lib] Stand by, playing out the rest of the aircheck mapblock log") - minetest.log("(there are "..#plantslib.blocklist_aircheck.." entries)...") + print("[biome_lib] Stand by, playing out the rest of the aircheck mapblock log") + print("(there are "..#biome_lib.blocklist_aircheck.." entries)...") while true do - plantslib:generate_block_with_air_checking(0.1) - if #plantslib.blocklist_aircheck == 0 then return end + biome_lib:generate_block_with_air_checking(0.1) + if #biome_lib.blocklist_aircheck == 0 then return end end end) minetest.register_on_shutdown(function() - minetest.log("[plants_lib] Stand by, playing out the rest of the no-aircheck mapblock log") - minetest.log("(there are "..#plantslib.blocklist_aircheck.." entries)...") + print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log") + print("(there are "..#biome_lib.blocklist_aircheck.." entries)...") while true do - plantslib:generate_block_no_aircheck(0.1) - if #plantslib.blocklist_no_aircheck == 0 then return end + biome_lib:generate_block_no_aircheck(0.1) + if #biome_lib.blocklist_no_aircheck == 0 then return end end end) -- The spawning ABM -function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) +function biome_lib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) local biome = {} @@ -486,7 +488,7 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) biome.interval = 1 end - plantslib:set_defaults(biome) + biome_lib:set_defaults(biome) biome.spawn_plants_count = #(biome.spawn_plants) minetest.register_abm({ @@ -495,18 +497,18 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) chance = biome.spawn_chance, neighbors = biome.neighbors, action = function(pos, node, active_object_count, active_object_count_wider) - local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } + local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } local n_top = minetest.get_node(p_top) local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, perlin_octaves, perlin_persistence, perlin_scale) local noise1 = perlin_fertile_area:get2d({x=p_top.x, y=p_top.z}) - local noise2 = plantslib.perlin_temperature:get2d({x=p_top.x, y=p_top.z}) - local noise3 = plantslib.perlin_humidity:get2d({x=p_top.x+150, y=p_top.z+50}) - if noise1 > biome.plantlife_limit + local noise2 = biome_lib.perlin_temperature:get2d({x=p_top.x, y=p_top.z}) + local noise3 = biome_lib.perlin_humidity:get2d({x=p_top.x+150, y=p_top.z+50}) + if noise1 > biome.plantlife_limit and noise2 <= biome.temp_min and noise2 >= biome.temp_max and noise3 <= biome.humidity_min and noise3 >= biome.humidity_max - and plantslib:is_node_loaded(p_top) then + and biome_lib:is_node_loaded(p_top) then local n_light = minetest.get_node_light(p_top, nil) if not (biome.avoid_nodes and biome.avoid_radius and minetest.find_node_near(p_top, biome.avoid_radius + math.random(-1.5,2), biome.avoid_nodes)) and n_light >= biome.light_min @@ -517,7 +519,7 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) and pos.y >= biome.min_elevation and pos.y <= biome.max_elevation then - local walldir = plantslib:find_adjacent_wall(p_top, biome.verticals_list, biome.choose_random_wall) + local walldir = biome_lib:find_adjacent_wall(p_top, biome.verticals_list, biome.choose_random_wall) if biome.alt_wallnode and walldir then if n_top.name == "air" then minetest.set_node(p_top, { name = biome.alt_wallnode, param2 = walldir }) @@ -543,8 +545,8 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) minetest.set_node(pos, { name = plant_to_spawn, param2 = fdir }) elseif biome.spawn_on_side then - local onside = plantslib:find_open_side(pos) - if onside then + local onside = biome_lib:find_open_side(pos) + if onside then minetest.set_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir }) end elseif biome.spawn_on_bottom then @@ -562,7 +564,7 @@ end -- The growing ABM -function plantslib:grow_plants(opts) +function biome_lib:grow_plants(opts) local options = opts @@ -589,17 +591,17 @@ function plantslib:grow_plants(opts) local root_node = minetest.get_node({x=pos.x, y=pos.y-options.height_limit, z=pos.z}) local walldir = nil if options.need_wall and options.verticals_list then - walldir = plantslib:find_adjacent_wall(p_top, options.verticals_list, options.choose_random_wall) + walldir = biome_lib:find_adjacent_wall(p_top, options.verticals_list, options.choose_random_wall) end - if n_top.name == "air" and (not options.need_wall or (options.need_wall and walldir)) - then + if (n_top.name == "air" or n_top.name == "default:snow") + and (not options.need_wall or (options.need_wall and walldir)) then -- corner case for changing short junglegrass -- to dry shrub in desert if n_bot.name == options.dry_early_node and options.grow_plant == "junglegrass:short" then minetest.set_node(pos, { name = "default:dry_shrub" }) elseif options.grow_vertically and walldir then - if plantslib:search_downward(pos, options.height_limit, options.ground_nodes) then + if biome_lib:search_downward(pos, options.height_limit, options.ground_nodes) then minetest.set_node(p_top, { name = options.grow_plant, param2 = walldir}) end @@ -607,7 +609,7 @@ function plantslib:grow_plants(opts) minetest.remove_node(pos) else - plantslib:replace_object(pos, options.grow_result, options.grow_function, options.facedir, options.seed_diff) + biome_lib:replace_object(pos, options.grow_result, options.grow_function, options.facedir, options.seed_diff) end end end @@ -617,22 +619,22 @@ end -- Function to decide how to replace a plant - either grow it, replace it with -- a tree, run a function, or die with an error. -function plantslib:replace_object(pos, replacement, grow_function, walldir, seeddiff) +function biome_lib:replace_object(pos, replacement, grow_function, walldir, seeddiff) local growtype = type(grow_function) if growtype == "table" then minetest.remove_node(pos) - plantslib:grow_tree(pos, grow_function) + biome_lib:grow_tree(pos, grow_function) return elseif growtype == "function" then local perlin_fertile_area = minetest.get_perlin(seeddiff, perlin_octaves, perlin_persistence, perlin_scale) local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = plantslib.perlin_temperature:get2d({x=pos.x, y=pos.z}) + local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) grow_function(pos,noise1,noise2,walldir) return elseif growtype == "string" then local perlin_fertile_area = minetest.get_perlin(seeddiff, perlin_octaves, perlin_persistence, perlin_scale) local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = plantslib.perlin_temperature:get2d({x=pos.x, y=pos.z}) + local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) assert(loadstring(grow_function.."(...)"))(pos,noise1,noise2,walldir) return elseif growtype == "nil" then @@ -646,11 +648,11 @@ end -- function to decide if a node has a wall that's in verticals_list{} -- returns wall direction of valid node, or nil if invalid. -function plantslib:find_adjacent_wall(pos, verticals, randomflag) +function biome_lib:find_adjacent_wall(pos, verticals, randomflag) local verts = dump(verticals) if randomflag then local walltab = {} - + if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 3 end if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 2 end if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end @@ -671,7 +673,7 @@ end -- node that matches the ground table. Returns the new position, or nil if -- height limit is exceeded before finding it. -function plantslib:search_downward(pos, heightlimit, ground) +function biome_lib:search_downward(pos, heightlimit, ground) for i = 0, heightlimit do if string.find(dump(ground), minetest.get_node({x=pos.x, y=pos.y-i, z = pos.z}).name) then return {x=pos.x, y=pos.y-i, z = pos.z} @@ -680,7 +682,7 @@ function plantslib:search_downward(pos, heightlimit, ground) return false end -function plantslib:find_open_side(pos) +function biome_lib:find_open_side(pos) if minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name == "air" then return {newpos = { x=pos.x-1, y=pos.y, z=pos.z }, facedir = 2} end @@ -699,37 +701,37 @@ end -- spawn_tree() on generate is routed through here so that other mods can hook -- into it. -function plantslib:generate_tree(pos, nodes_or_function_or_model) +function biome_lib:generate_tree(pos, nodes_or_function_or_model) minetest.spawn_tree(pos, nodes_or_function_or_model) end -- and this one's for the call used in the growing code -function plantslib:grow_tree(pos, nodes_or_function_or_model) +function biome_lib:grow_tree(pos, nodes_or_function_or_model) minetest.spawn_tree(pos, nodes_or_function_or_model) end -- Check for infinite stacks if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then - plantslib.expect_infinite_stacks = false + biome_lib.expect_infinite_stacks = false else - plantslib.expect_infinite_stacks = true + biome_lib.expect_infinite_stacks = true end -- read a field from a node's definition -function plantslib:get_nodedef_field(nodename, fieldname) +function biome_lib:get_nodedef_field(nodename, fieldname) if not minetest.registered_nodes[nodename] then return nil end return minetest.registered_nodes[nodename][fieldname] end -minetest.log("action", "[Plants Lib] Loaded") +print("[Biome Lib] Loaded") minetest.after(0, function() - minetest.log("action", "[Plants Lib] Registered a total of "..(#plantslib.surfaceslist_aircheck)+(#plantslib.surfaceslist_no_aircheck).." surface types to be evaluated, spread") - minetest.log("action", "[Plants Lib] across "..#plantslib.actionslist_aircheck.." actions with air-checking and "..#plantslib.actionslist_no_aircheck.." actions without.") + print("[Biome Lib] Registered a total of "..(#biome_lib.surfaceslist_aircheck)+(#biome_lib.surfaceslist_no_aircheck).." surface types to be evaluated, spread") + print("[Biome Lib] across "..#biome_lib.actionslist_aircheck.." actions with air-checking and "..#biome_lib.actionslist_no_aircheck.." actions without.") end) diff --git a/mods/plantlife_modpack/plants_lib/locale/de.txt b/mods/biome_lib/locale/de.txt old mode 100755 new mode 100644 similarity index 100% rename from mods/plantlife_modpack/plants_lib/locale/de.txt rename to mods/biome_lib/locale/de.txt diff --git a/mods/plantlife_modpack/plants_lib/locale/fr.txt b/mods/biome_lib/locale/fr.txt old mode 100755 new mode 100644 similarity index 100% rename from mods/plantlife_modpack/plants_lib/locale/fr.txt rename to mods/biome_lib/locale/fr.txt diff --git a/mods/plantlife_modpack/plants_lib/locale/template.txt b/mods/biome_lib/locale/template.txt old mode 100755 new mode 100644 similarity index 100% rename from mods/plantlife_modpack/plants_lib/locale/template.txt rename to mods/biome_lib/locale/template.txt diff --git a/mods/plantlife_modpack/plants_lib/locale/tr.txt b/mods/biome_lib/locale/tr.txt old mode 100755 new mode 100644 similarity index 100% rename from mods/plantlife_modpack/plants_lib/locale/tr.txt rename to mods/biome_lib/locale/tr.txt diff --git a/mods/moretrees/README.md b/mods/moretrees/README.md index 8e5758bc..905cefa4 100755 --- a/mods/moretrees/README.md +++ b/mods/moretrees/README.md @@ -8,4 +8,4 @@ jungle trees mod, and big contributions by RealBadAngel. Brought together into one mod and made L-systems compatible by Vanessa Ezekowitz. -Dependencies: plants_lib and default +Dependencies: biome_lib and default diff --git a/mods/moretrees/biome_defs.lua b/mods/moretrees/biome_defs.lua index 8c50de79..6f3bf0d2 100755 --- a/mods/moretrees/biome_defs.lua +++ b/mods/moretrees/biome_defs.lua @@ -91,7 +91,7 @@ moretrees.willow_biome = { } moretrees.acacia_biome = { - surface = { "default:dirt_with_grass", "default:desert_sand" }, + surface = { "default:dirt_with_grass", "default:dirt_with_dry_grass", "default:desert_sand" }, avoid_nodes = moretrees.avoidnodes, avoid_radius = 15, seed_diff = 1, diff --git a/mods/moretrees/crafts.lua b/mods/moretrees/crafts.lua index f608e345..6b0c232f 100755 --- a/mods/moretrees/crafts.lua +++ b/mods/moretrees/crafts.lua @@ -3,6 +3,7 @@ local S = moretrees.intllib for i in ipairs(moretrees.treelist) do local treename = moretrees.treelist[i][1] + -- MODIFICATION MADE FOR MFF //MFF(Mg|08/12/15) if minetest.registered_items["moretrees:" .. treename .. "_trunk_sideways"] then minetest.register_craft({ output = "moretrees:"..treename.."_trunk 2", diff --git a/mods/moretrees/default_settings.txt b/mods/moretrees/default_settings.txt index c1825a4b..cd9017ad 100755 --- a/mods/moretrees/default_settings.txt +++ b/mods/moretrees/default_settings.txt @@ -18,13 +18,15 @@ moretrees.enable_beech = true -- set this to true to make moretrees spawn saplings at mapgen time instead -- of fully-grown trees, which will grow into full trees very quickly. With --- older versions of plants_lib, doing this will reduce mapgen lag. +-- older versions of biome_lib, doing this will reduce mapgen lag. moretrees.spawn_saplings = true --- Set this to true to allow usage of the stairsplus mod in moreblocks +-- Set this to true to allow defining stairs/slabs/etc. If Moreblocks is +-- installed, this will use that mod's Stairs Plus component. Otherwise, it +-- will use the default stairs mod in minetest_game, if present -moretrees.enable_stairsplus = true +moretrees.enable_stairs = true -- Set this to true if you want the plantlike drawtype for leaves, which -- improves some peoples' framerates without resorting to making leaf nodes opaque. diff --git a/mods/moretrees/depends.txt b/mods/moretrees/depends.txt index 1cd5974d..c666762d 100755 --- a/mods/moretrees/depends.txt +++ b/mods/moretrees/depends.txt @@ -1,5 +1,6 @@ default -plants_lib +biome_lib +stairs? moreblocks? intllib? diff --git a/mods/moretrees/init.lua b/mods/moretrees/init.lua index 6fe8ee9b..bc2ec386 100755 --- a/mods/moretrees/init.lua +++ b/mods/moretrees/init.lua @@ -52,6 +52,17 @@ else end moretrees.intllib = S +-- clone node + +function moretrees.clone_node(name) + local node2 = {} + local node = minetest.registered_nodes[name] + for k,v in pairs(node) do + node2[k]=v + end + return node2 +end + -- infinite stacks checking if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then @@ -118,57 +129,57 @@ end if moretrees.enable_beech then - plantslib:register_generate_plant(moretrees.beech_biome, moretrees.spawn_beech_object) + biome_lib:register_generate_plant(moretrees.beech_biome, moretrees.spawn_beech_object) end if moretrees.enable_apple_tree then - plantslib:register_generate_plant(moretrees.apple_tree_biome, moretrees.spawn_apple_tree_object) + biome_lib:register_generate_plant(moretrees.apple_tree_biome, moretrees.spawn_apple_tree_object) end if moretrees.enable_oak then - plantslib:register_generate_plant(moretrees.oak_biome, moretrees.spawn_oak_object) + biome_lib:register_generate_plant(moretrees.oak_biome, moretrees.spawn_oak_object) end if moretrees.enable_sequoia then - plantslib:register_generate_plant(moretrees.sequoia_biome, moretrees.spawn_sequoia_object) + biome_lib:register_generate_plant(moretrees.sequoia_biome, moretrees.spawn_sequoia_object) end if moretrees.enable_palm then - plantslib:register_generate_plant(moretrees.palm_biome, moretrees.spawn_palm_object) + biome_lib:register_generate_plant(moretrees.palm_biome, moretrees.spawn_palm_object) end if moretrees.enable_pine then - plantslib:register_generate_plant(moretrees.pine_biome, moretrees.spawn_pine_object) + biome_lib:register_generate_plant(moretrees.pine_biome, moretrees.spawn_pine_object) end if moretrees.enable_rubber_tree then - plantslib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.spawn_rubber_tree_object) + biome_lib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.spawn_rubber_tree_object) end if moretrees.enable_willow then - plantslib:register_generate_plant(moretrees.willow_biome, moretrees.spawn_willow_object) + biome_lib:register_generate_plant(moretrees.willow_biome, moretrees.spawn_willow_object) end if moretrees.enable_acacia then - plantslib:register_generate_plant(moretrees.acacia_biome, moretrees.spawn_acacia_object) + biome_lib:register_generate_plant(moretrees.acacia_biome, moretrees.spawn_acacia_object) end if moretrees.enable_birch then - plantslib:register_generate_plant(moretrees.birch_biome, moretrees.spawn_birch_object) + biome_lib:register_generate_plant(moretrees.birch_biome, moretrees.spawn_birch_object) end if moretrees.enable_spruce then - plantslib:register_generate_plant(moretrees.spruce_biome, moretrees.spawn_spruce_object) + biome_lib:register_generate_plant(moretrees.spruce_biome, moretrees.spawn_spruce_object) end if moretrees.enable_jungle_tree then - plantslib:register_generate_plant(moretrees.jungletree_biome, moretrees.spawn_jungletree_object) + biome_lib:register_generate_plant(moretrees.jungletree_biome, moretrees.spawn_jungletree_object) end if moretrees.enable_fir then - plantslib:register_generate_plant(moretrees.fir_biome, moretrees.spawn_fir_object) + biome_lib:register_generate_plant(moretrees.fir_biome, moretrees.spawn_fir_object) if minetest.get_modpath("snow") then - plantslib:register_generate_plant(moretrees.fir_biome_snow, moretrees.spawn_fir_snow_object) + biome_lib:register_generate_plant(moretrees.fir_biome_snow, moretrees.spawn_fir_snow_object) end end diff --git a/mods/moretrees/node_defs.lua b/mods/moretrees/node_defs.lua index 098b522e..ab0ecfd8 100755 --- a/mods/moretrees/node_defs.lua +++ b/mods/moretrees/node_defs.lua @@ -76,7 +76,9 @@ for i in ipairs(moretrees.treelist) do local selbox = moretrees.treelist[i][5] local vscale = moretrees.treelist[i][6] - if treename ~= "jungletree" then -- the default game provides jungle tree trunk/planks nodes. + if treename ~= "jungletree" -- the default game provides jungle tree, acacia, and pine trunk/planks nodes. +-- and treename ~= "acacia" UNCOMMENT WHEN ACACIA IS MERGED FROM MT_GAME + and treename ~= "pine" then minetest.register_node("moretrees:"..treename.."_trunk", { description = S(treedesc.." Trunk"), @@ -173,37 +175,63 @@ for i in ipairs(moretrees.treelist) do }, }) - if minetest.get_modpath("moreblocks") and moretrees.enable_stairsplus then + if moretrees.enable_stairs then + if minetest.get_modpath("moreblocks") then --- stairsplus:register_all(modname, subname, recipeitem, {fields}) + -- stairsplus:register_all(modname, subname, recipeitem, {fields}) - stairsplus:register_all( - "moretrees", - treename.."_trunk", - "moretrees:"..treename.."_trunk", - { - groups = { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2, not_in_creative_inventory=1 }, - tiles = { - "moretrees_"..treename.."_trunk_top.png", + stairsplus:register_all( + "moretrees", + treename.."_trunk", + "moretrees:"..treename.."_trunk", + { + groups = { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2, not_in_creative_inventory=1 }, + tiles = { + "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk.png" + }, + description = S(treedesc.." Trunk"), + drop = treename.."_trunk", + } + ) + + stairsplus:register_all( + "moretrees", + treename.."_planks", + "moretrees:"..treename.."_planks", + { + groups = { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1 }, + tiles = { "moretrees_"..treename.."_wood.png" }, + description = S(treedesc.." Planks"), + drop = treename.."_planks", + } + ) + elseif minetest.get_modpath("stairs") then + stairs.register_stair_and_slab( + "moretrees_"..treename.."_trunk", + "moretrees:"..treename.."_trunk", + { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2 }, + { "moretrees_"..treename.."_trunk_top.png", "moretrees_"..treename.."_trunk_top.png", "moretrees_"..treename.."_trunk.png" }, - description = S(treedesc.." Trunk"), - drop = treename.."_trunk", - } - ) + S(treedesc.." Trunk Stair"), + S(treedesc.." Trunk Slab"), + default.node_sound_wood_defaults() + ) - stairsplus:register_all( - "moretrees", - treename.."_planks", - "moretrees:"..treename.."_planks", - { - groups = { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1 }, - tiles = { "moretrees_"..treename.."_wood.png" }, - description = S(treedesc.." Planks"), - drop = treename.."_planks", - } - ) + stairs.register_stair_and_slab( + "moretrees_"..treename.."_planks", + "moretrees:"..treename.."_planks", + { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3 }, + { "moretrees_"..treename.."_wood.png" }, + S(treedesc.." Planks Stair"), + S(treedesc.." Planks Slab"), + default.node_sound_wood_defaults() + ) + + end end end @@ -346,9 +374,9 @@ minetest.register_node("moretrees:fir_leaves_bright", { }) if moretrees.enable_redefine_apple then - minetest.override_item("default:apple", - {groups = { fleshy=3, dig_immediate=3, flammable=2, leafdecay=3, leafdecay_drop=1, attached_node = 1} - }) + local appledef = moretrees.clone_node("default:apple") + appledef.groups.attached_node = 1 + minetest.register_node(":default:apple", appledef) end table.insert(moretrees.avoidnodes, "default:jungletree") @@ -425,5 +453,10 @@ minetest.register_alias("conifers:leaves", "moretrees:fir_leaves") minetest.register_alias("conifers:leaves_special", "moretrees:fir_leaves_bright") minetest.register_alias("conifers:sapling", "moretrees:fir_sapling") +minetest.register_alias("moretrees:pine_trunk", "default:pinetree") +minetest.register_alias("moretrees:pine_planks", "default:pinewood") +minetest.register_alias("moretrees:pine_sapling", "default:pine_sapling") +minetest.register_alias("moretrees:pine_leaves", "default:pine_needles") + -- Overriding moretrees' palm leaves: minetest.override_item("moretrees:palm_leaves",{walkable = false}) diff --git a/mods/moretrees/saplings.lua b/mods/moretrees/saplings.lua index 7d8a9b97..b34db92a 100755 --- a/mods/moretrees/saplings.lua +++ b/mods/moretrees/saplings.lua @@ -7,8 +7,8 @@ for i in ipairs(moretrees.treelist) do if treename ~= "birch" and treename ~= "spruce" and treename ~= "fir" and treename ~= "jungletree" then - plantslib:dbg(dump(moretrees[tree_biome].surface)) - plantslib:grow_plants({ + biome_lib:dbg(dump(moretrees[tree_biome].surface)) + biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, grow_plant = "moretrees:"..treename.."_sapling", @@ -16,7 +16,7 @@ for i in ipairs(moretrees.treelist) do grow_function = moretrees[tree_model], }) - plantslib:grow_plants({ + biome_lib:grow_plants({ grow_delay = 2, grow_chance = 30, grow_plant = "moretrees:"..treename.."_sapling_ongen", @@ -27,7 +27,7 @@ for i in ipairs(moretrees.treelist) do end end -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, grow_plant = "moretrees:birch_sapling", @@ -35,7 +35,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_birch" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = 2, grow_chance = 30, grow_plant = "moretrees:birch_sapling_ongen", @@ -43,7 +43,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_birch" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, grow_plant = "moretrees:spruce_sapling", @@ -51,7 +51,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_spruce" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = 2, grow_chance = 30, grow_plant = "moretrees:spruce_sapling_ongen", @@ -59,7 +59,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_spruce" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, grow_plant = "moretrees:fir_sapling", @@ -67,7 +67,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_fir" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = 2, grow_chance = 30, grow_plant = "moretrees:fir_sapling_ongen", @@ -75,7 +75,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_fir" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, grow_plant = "moretrees:jungletree_sapling", @@ -83,7 +83,7 @@ plantslib:grow_plants({ grow_function = "moretrees:grow_jungletree" }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = 2, grow_chance = 30, grow_plant = "moretrees:jungletree_sapling_ongen", diff --git a/mods/moretrees/textures/moretrees_pine_leaves.png b/mods/moretrees/textures/moretrees_pine_leaves.png deleted file mode 100755 index e6de4829..00000000 Binary files a/mods/moretrees/textures/moretrees_pine_leaves.png and /dev/null differ diff --git a/mods/moretrees/textures/moretrees_pine_sapling.png b/mods/moretrees/textures/moretrees_pine_sapling.png deleted file mode 100755 index 624e1aeb..00000000 Binary files a/mods/moretrees/textures/moretrees_pine_sapling.png and /dev/null differ diff --git a/mods/moretrees/textures/moretrees_pine_trunk.png b/mods/moretrees/textures/moretrees_pine_trunk.png deleted file mode 100755 index ea685e3a..00000000 Binary files a/mods/moretrees/textures/moretrees_pine_trunk.png and /dev/null differ diff --git a/mods/moretrees/textures/moretrees_pine_trunk_top.png b/mods/moretrees/textures/moretrees_pine_trunk_top.png deleted file mode 100755 index 01aed1d7..00000000 Binary files a/mods/moretrees/textures/moretrees_pine_trunk_top.png and /dev/null differ diff --git a/mods/moretrees/textures/moretrees_pine_wood.png b/mods/moretrees/textures/moretrees_pine_wood.png deleted file mode 100755 index 30c48cd5..00000000 Binary files a/mods/moretrees/textures/moretrees_pine_wood.png and /dev/null differ diff --git a/mods/plantlife_modpack/README b/mods/plantlife_modpack/README index 8e13f156..8c62e494 100755 --- a/mods/plantlife_modpack/README +++ b/mods/plantlife_modpack/README @@ -22,7 +22,7 @@ that is necessary for them to spawn on, so they won't grow if placed on e.g. cobble or homedecor flower pot, etc. This doesn't affect wall-climbing poison ivy, since it uses a different growth pattern. -All plants use multiple controls provided by plants_lib, to keep where they +All plants use multiple controls provided by biome_lib, to keep where they grow under control - no more random spread of plants! In addition, the density of the plants in any region they appear in has been fixed and brought under control. diff --git a/mods/plantlife_modpack/along_shore/depends.txt b/mods/plantlife_modpack/along_shore/depends.txt index e27a0d06..a63765af 100755 --- a/mods/plantlife_modpack/along_shore/depends.txt +++ b/mods/plantlife_modpack/along_shore/depends.txt @@ -1,3 +1,3 @@ default -plants_lib +biome_lib flowers_plus? \ No newline at end of file diff --git a/mods/plantlife_modpack/bushes/depends.txt b/mods/plantlife_modpack/bushes/depends.txt index bde0bdf5..4e351798 100755 --- a/mods/plantlife_modpack/bushes/depends.txt +++ b/mods/plantlife_modpack/bushes/depends.txt @@ -1,2 +1,2 @@ default -plants_lib \ No newline at end of file +biome_lib \ No newline at end of file diff --git a/mods/plantlife_modpack/bushes/init.lua b/mods/plantlife_modpack/bushes/init.lua index 51c34ed4..c20c804c 100755 --- a/mods/plantlife_modpack/bushes/init.lua +++ b/mods/plantlife_modpack/bushes/init.lua @@ -194,7 +194,7 @@ abstract_bushes.grow_bush_node = function(pos,dir, leaf_type) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "stoneage:grass_with_silex", @@ -240,7 +240,7 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "stoneage:grass_with_silex", diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1.png b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1.png new file mode 100644 index 00000000..28fe91fe Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1L.png b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1L.png new file mode 100644 index 00000000..1d8a8e2c Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1L.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1R.png b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1R.png new file mode 100644 index 00000000..514b888b Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BlockBranch1R.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1.png new file mode 100644 index 00000000..5bb2b46f Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm.png new file mode 100644 index 00000000..5574f38f Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm2.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm2.png new file mode 100644 index 00000000..6ffd2f36 Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm2.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm3.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm3.png new file mode 100644 index 00000000..5bb9bf5b Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm3.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm4.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm4.png new file mode 100644 index 00000000..b204feff Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranches1sm4.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesCenter.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesCenter.png new file mode 100644 index 00000000..0c9b5af1 Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesCenter.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide1.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide1.png new file mode 100644 index 00000000..ca95dd3c Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide1.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide2.png b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide2.png new file mode 100644 index 00000000..d62499e8 Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/BushBranchesSide2.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/blank.png b/mods/plantlife_modpack/bushes/textures/old & unused/blank.png new file mode 100644 index 00000000..ed495a82 Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/blank.png differ diff --git a/mods/plantlife_modpack/bushes/textures/old & unused/moretrees_pine_leaves3.png b/mods/plantlife_modpack/bushes/textures/old & unused/moretrees_pine_leaves3.png new file mode 100644 index 00000000..57d077d0 Binary files /dev/null and b/mods/plantlife_modpack/bushes/textures/old & unused/moretrees_pine_leaves3.png differ diff --git a/mods/plantlife_modpack/bushes_classic/cooking.lua b/mods/plantlife_modpack/bushes_classic/cooking.lua index 8ea273bf..e667b288 100755 --- a/mods/plantlife_modpack/bushes_classic/cooking.lua +++ b/mods/plantlife_modpack/bushes_classic/cooking.lua @@ -1,4 +1,4 @@ -local S = plantslib.intllib +local S = biome_lib.intllib -- Basket diff --git a/mods/plantlife_modpack/bushes_classic/depends.txt b/mods/plantlife_modpack/bushes_classic/depends.txt index 632373e9..16347c63 100755 --- a/mods/plantlife_modpack/bushes_classic/depends.txt +++ b/mods/plantlife_modpack/bushes_classic/depends.txt @@ -1,3 +1,3 @@ -plants_lib +biome_lib farming? farming_plus? diff --git a/mods/plantlife_modpack/bushes_classic/init.lua b/mods/plantlife_modpack/bushes_classic/init.lua index 43c848ea..8979ae69 100755 --- a/mods/plantlife_modpack/bushes_classic/init.lua +++ b/mods/plantlife_modpack/bushes_classic/init.lua @@ -3,7 +3,7 @@ -- -- License: WTFPL -local S = plantslib.intllib +local S = biome_lib.intllib bushes_classic = {} @@ -30,7 +30,7 @@ bushes_classic.spawn_list = {} dofile(minetest.get_modpath('bushes_classic') .. '/cooking.lua') dofile(minetest.get_modpath('bushes_classic') .. '/nodes.lua') -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = 3600, spawn_plants = bushes_classic.spawn_list, avoid_radius = 10, diff --git a/mods/plantlife_modpack/bushes_classic/nodes.lua b/mods/plantlife_modpack/bushes_classic/nodes.lua index f9beda41..af724523 100755 --- a/mods/plantlife_modpack/bushes_classic/nodes.lua +++ b/mods/plantlife_modpack/bushes_classic/nodes.lua @@ -1,4 +1,4 @@ -local S = plantslib.intllib +local S = biome_lib.intllib plantlife_bushes = {} @@ -118,7 +118,7 @@ plantlife_bushes.after_place_node = function(pos, placer, itemstack) meta:set_string("bush_type", name_parts[1]) end --- regrow berries (uses a base abm instead of plants_lib because of the use of metadata). +-- regrow berries (uses a base abm instead of biome_lib because of the use of metadata). minetest.register_abm({ nodenames = {"bushes:fruitless_bush"}, diff --git a/mods/plantlife_modpack/dryplants/depends.txt b/mods/plantlife_modpack/dryplants/depends.txt index 5be68335..059033e3 100755 --- a/mods/plantlife_modpack/dryplants/depends.txt +++ b/mods/plantlife_modpack/dryplants/depends.txt @@ -1,3 +1,3 @@ default -plants_lib +biome_lib farming? diff --git a/mods/plantlife_modpack/dryplants/init.lua b/mods/plantlife_modpack/dryplants/init.lua index 5dd637c0..6433b42d 100755 --- a/mods/plantlife_modpack/dryplants/init.lua +++ b/mods/plantlife_modpack/dryplants/init.lua @@ -9,7 +9,7 @@ local mname = "dryplants" -- License (everything): WTFPL -- Contains code from: default, farming -- Looked at code from: darkage, sickle, stairs --- Dependencies: default, farming, plants_lib +-- Dependencies: default, farming, biome_lib -- Supports: ----------------------------------------------------------------------------------------------- abstract_dryplants = {} diff --git a/mods/plantlife_modpack/dryplants/juncus.lua b/mods/plantlife_modpack/dryplants/juncus.lua index e36b1291..6f380194 100755 --- a/mods/plantlife_modpack/dryplants/juncus.lua +++ b/mods/plantlife_modpack/dryplants/juncus.lua @@ -5,7 +5,7 @@ -- textures & ideas partly by Neuromancer -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default ----------------------------------------------------------------------------------------------- @@ -84,7 +84,7 @@ minetest.register_node("dryplants:juncus_02", { -- GENERATE SMALL JUNCUS ----------------------------------------------------------------------------------------------- -- near water or swamp -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", --"default:desert_sand", @@ -105,7 +105,7 @@ plantslib:register_generate_plant({ abstract_dryplants.grow_juncus ) -- at dunes/beach -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { --"default:dirt_with_grass", --"default:desert_sand", diff --git a/mods/plantlife_modpack/dryplants/meadowvariation.lua b/mods/plantlife_modpack/dryplants/meadowvariation.lua index 9ef0a4f9..f94590ae 100755 --- a/mods/plantlife_modpack/dryplants/meadowvariation.lua +++ b/mods/plantlife_modpack/dryplants/meadowvariation.lua @@ -4,7 +4,7 @@ -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default ----------------------------------------------------------------------------------------------- @@ -13,7 +13,7 @@ abstract_dryplants.grow_grass_variation = function(pos) minetest.set_node(right_here, {name="dryplants:grass_short"}) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", }, diff --git a/mods/plantlife_modpack/dryplants/moregrass.lua b/mods/plantlife_modpack/dryplants/moregrass.lua index aec09b9e..88761c88 100755 --- a/mods/plantlife_modpack/dryplants/moregrass.lua +++ b/mods/plantlife_modpack/dryplants/moregrass.lua @@ -4,7 +4,7 @@ -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default ----------------------------------------------------------------------------------------------- @@ -17,7 +17,7 @@ abstract_dryplants.grow_grass = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "stoneage:grass_with_silex", diff --git a/mods/plantlife_modpack/dryplants/reedmace.lua b/mods/plantlife_modpack/dryplants/reedmace.lua index c2331733..7a5c4c22 100755 --- a/mods/plantlife_modpack/dryplants/reedmace.lua +++ b/mods/plantlife_modpack/dryplants/reedmace.lua @@ -5,7 +5,7 @@ -- textures & ideas partly by Neuromancer -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default, trees ----------------------------------------------------------------------------------------------- @@ -325,7 +325,7 @@ minetest.register_entity("dryplants:reedmace_water_entity",{ ----------------------------------------------------------------------------------------------- -- SPAWN REEDMACE ----------------------------------------------------------------------------------------------- ---[[plantslib:spawn_on_surfaces({ +--[[biome_lib:spawn_on_surfaces({ spawn_delay = 1200, spawn_plants = {"dryplants:reedmace_sapling"}, spawn_chance = 400, @@ -346,7 +346,7 @@ minetest.register_entity("dryplants:reedmace_water_entity",{ -- GENERATE REEDMACE ----------------------------------------------------------------------------------------------- -- near water or swamp -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "default:desert_sand", @@ -367,7 +367,7 @@ plantslib:register_generate_plant({ abstract_dryplants.grow_reedmace ) -- in water -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt", "default:dirt_with_grass", @@ -390,7 +390,7 @@ plantslib:register_generate_plant({ abstract_dryplants.grow_reedmace_water ) -- for oases & tropical beaches & tropical swamps -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:sand", "sumpf:sumpf" diff --git a/mods/plantlife_modpack/ferns/depends.txt b/mods/plantlife_modpack/ferns/depends.txt index 0077f8a1..9d994c05 100755 --- a/mods/plantlife_modpack/ferns/depends.txt +++ b/mods/plantlife_modpack/ferns/depends.txt @@ -1,2 +1,2 @@ default -plants_lib \ No newline at end of file +biome_lib \ No newline at end of file diff --git a/mods/plantlife_modpack/ferns/fern.lua b/mods/plantlife_modpack/ferns/fern.lua index f4bbe6fa..51cac8f5 100755 --- a/mods/plantlife_modpack/ferns/fern.lua +++ b/mods/plantlife_modpack/ferns/fern.lua @@ -3,9 +3,9 @@ ----------------------------------------------------------------------------------------------- -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default, flowers, painting, trees --- Dependencies: plants_lib +-- Dependencies: biome_lib -- Supports: dryplants, stoneage, sumpf ----------------------------------------------------------------------------------------------- -- some inspiration from here @@ -71,7 +71,7 @@ create_nodes() ----------------------------------------------------------------------------------------------- if abstract_ferns.config.lady_ferns_near_tree == true then - plantslib:register_generate_plant({ -- near trees (woodlands) + biome_lib:register_generate_plant({ -- near trees (woodlands) surface = { "default:dirt_with_grass", "default:mossycobble", @@ -100,7 +100,7 @@ if abstract_ferns.config.lady_ferns_near_tree == true then end if abstract_ferns.config.lady_ferns_near_rock == true then - plantslib:register_generate_plant({ -- near stone (mountains) + biome_lib:register_generate_plant({ -- near stone (mountains) surface = { "default:dirt_with_grass", "default:mossycobble", @@ -127,7 +127,7 @@ if abstract_ferns.config.lady_ferns_near_rock == true then end if abstract_ferns.config.lady_ferns_near_ores == true then -- this one causes a huge fps drop - plantslib:register_generate_plant({ -- near ores (potential mining sites) + biome_lib:register_generate_plant({ -- near ores (potential mining sites) surface = { "default:dirt_with_grass", "default:mossycobble", @@ -165,7 +165,7 @@ if abstract_ferns.config.lady_ferns_near_ores == true then -- this one causes a end if abstract_ferns.config.lady_ferns_in_groups == true then -- this one is meant as a replacement of Ferns_near_Ores - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "default:mossycobble", diff --git a/mods/plantlife_modpack/ferns/gianttreefern.lua b/mods/plantlife_modpack/ferns/gianttreefern.lua index 3fbea3a7..ecbca403 100755 --- a/mods/plantlife_modpack/ferns/gianttreefern.lua +++ b/mods/plantlife_modpack/ferns/gianttreefern.lua @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------------------------- -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: 4seasons, default -- Supports: vines ----------------------------------------------------------------------------------------------- @@ -285,7 +285,7 @@ minetest.register_abm({ -- in jungles if abstract_ferns.config.enable_giant_treeferns_in_jungle == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "default:sand", @@ -310,7 +310,7 @@ end -- for oases & tropical beaches if abstract_ferns.config.enable_giant_treeferns_in_oases == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:sand"--, --"default:desert_sand" diff --git a/mods/plantlife_modpack/ferns/horsetail.lua b/mods/plantlife_modpack/ferns/horsetail.lua index 464472e0..66cb3b65 100755 --- a/mods/plantlife_modpack/ferns/horsetail.lua +++ b/mods/plantlife_modpack/ferns/horsetail.lua @@ -3,9 +3,9 @@ ----------------------------------------------------------------------------------------------- -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default, flowers, trees --- Dependencies: plants_lib +-- Dependencies: biome_lib -- Supports: dryplants, stoneage, sumpf ----------------------------------------------------------------------------------------------- @@ -74,7 +74,7 @@ create_nodes() -- Spawning ----------------------------------------------------------------------------------------------- if abstract_ferns.config.enable_horsetails_spawning == true then - plantslib:spawn_on_surfaces({ + biome_lib:spawn_on_surfaces({ spawn_delay = 1200, spawn_plants = node_names, spawn_chance = 400, @@ -102,7 +102,7 @@ end ----------------------------------------------------------------------------------------------- if abstract_ferns.config.enable_horsetails_on_grass == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "sumpf:sumpf" @@ -134,7 +134,7 @@ if abstract_ferns.config.enable_horsetails_on_grass == true then end if abstract_ferns.config.enable_horsetails_on_stones == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:gravel", -- roots go deep "default:mossycobble", diff --git a/mods/plantlife_modpack/ferns/treefern.lua b/mods/plantlife_modpack/ferns/treefern.lua index e0347c1b..689c5d52 100755 --- a/mods/plantlife_modpack/ferns/treefern.lua +++ b/mods/plantlife_modpack/ferns/treefern.lua @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------------------------- -- by Mossmanikin -- License (everything): WTFPL --- Contains code from: plants_lib +-- Contains code from: biome_lib -- Looked at code from: default , trees ----------------------------------------------------------------------------------------------- @@ -174,7 +174,7 @@ minetest.register_abm({ -- in jungles if abstract_ferns.config.enable_treeferns_in_jungle == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "default:sand", @@ -202,7 +202,7 @@ end -- for oases & tropical beaches if abstract_ferns.config.enable_treeferns_in_oases == true then - plantslib:register_generate_plant({ + biome_lib:register_generate_plant({ surface = { "default:sand"--, --"default:desert_sand" diff --git a/mods/plantlife_modpack/flowers_plus/depends.txt b/mods/plantlife_modpack/flowers_plus/depends.txt index 6a669060..37952da4 100755 --- a/mods/plantlife_modpack/flowers_plus/depends.txt +++ b/mods/plantlife_modpack/flowers_plus/depends.txt @@ -1,2 +1,2 @@ -plants_lib - +biome_lib +farming? diff --git a/mods/plantlife_modpack/flowers_plus/init.lua b/mods/plantlife_modpack/flowers_plus/init.lua index 800ba9f1..c9a42feb 100755 --- a/mods/plantlife_modpack/flowers_plus/init.lua +++ b/mods/plantlife_modpack/flowers_plus/init.lua @@ -1,4 +1,4 @@ -local S = plantslib.intllib +local S = biome_lib.intllib -- This file supplies a few additional plants and some related crafts -- for the plantlife modpack. Last revision: 2013-04-24 @@ -76,16 +76,16 @@ for i in ipairs(lilies_list) do local above_node = minetest.get_node(pt.above) local top_node = minetest.get_node(top_pos) - if plantslib:get_nodedef_field(under_node.name, "buildable_to") then + if biome_lib:get_nodedef_field(under_node.name, "buildable_to") then if under_node.name ~= "default:water_source" then place_pos = pt.under elseif top_node.name ~= "default:water_source" - and plantslib:get_nodedef_field(top_node.name, "buildable_to") then + and biome_lib:get_nodedef_field(top_node.name, "buildable_to") then place_pos = top_pos else return end - elseif plantslib:get_nodedef_field(above_node.name, "buildable_to") then + elseif biome_lib:get_nodedef_field(above_node.name, "buildable_to") then place_pos = pt.above end @@ -119,7 +119,7 @@ for i in ipairs(lilies_list) do minetest.set_node(place_pos, {name = "flowers:waterlily", param2 = fdir}) end - if not plantslib.expect_infinite_stacks then + if not biome_lib.expect_infinite_stacks then itemstack:take_item() end return itemstack @@ -176,16 +176,16 @@ for i in ipairs(algae_list) do local above_node = minetest.get_node(pt.above) local top_node = minetest.get_node(top_pos) - if plantslib:get_nodedef_field(under_node.name, "buildable_to") then + if biome_lib:get_nodedef_field(under_node.name, "buildable_to") then if under_node.name ~= "default:water_source" then place_pos = pt.under elseif top_node.name ~= "default:water_source" - and plantslib:get_nodedef_field(top_node.name, "buildable_to") then + and biome_lib:get_nodedef_field(top_node.name, "buildable_to") then place_pos = top_pos else return end - elseif plantslib:get_nodedef_field(above_node.name, "buildable_to") then + elseif biome_lib:get_nodedef_field(above_node.name, "buildable_to") then place_pos = pt.above end @@ -193,7 +193,6 @@ for i in ipairs(algae_list) do local nodename = "default:cobble" -- :D - if place_pos == nil then return itemstack end -- pour éviter crash avec nénuphare if not keys["sneak"] then --local node = minetest.get_node(pt.under) local seaweed = math.random(1,4) @@ -212,7 +211,7 @@ for i in ipairs(algae_list) do minetest.set_node(place_pos, {name = "flowers:seaweed", param2 = fdir}) end - if not plantslib.expect_infinite_stacks then + if not biome_lib.expect_infinite_stacks then itemstack:take_item() end return itemstack @@ -275,6 +274,11 @@ local box = { fixed = { { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, } +local sunflower_drop = "farming:seed_wheat" +if minetest.registered_items["farming:seed_spelt"] then + sunflower_drop = "farming:seed_spelt" +end + minetest.register_node(":flowers:sunflower", { description = "Sunflower", drawtype = "mesh", @@ -290,15 +294,14 @@ minetest.register_node(":flowers:sunflower", { sounds = default.node_sound_leaves_defaults(), selection_box = box, collision_box = box, -}) - -minetest.override_item("flowers:sunflower", {drop = { - max_items = 1, - items = { - {items = {"farming:seed_wheat"}, rarity = 8}, - {items = {"flowers:sunflower"}}, + drop = { + max_items = 1, + items = { + {items = {sunflower_drop}, rarity = 8}, + {items = {"flowers:sunflower"}}, + } } -}}) +}) local extra_aliases = { "waterlily", @@ -343,7 +346,7 @@ flowers_plus.grow_waterlily = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:water_source"}, max_count = lilies_max_count, rarity = lilies_rarity, @@ -365,7 +368,7 @@ flowers_plus.grow_seaweed = function(pos) minetest.set_node(right_here, {name="along_shore:seaweed_"..math.random(1,4), param2=math.random(1,3)}) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:water_source"}, max_count = seaweed_max_count, rarity = seaweed_rarity, @@ -382,7 +385,7 @@ plantslib:register_generate_plant({ -- seaweed at beaches -- MM: not satisfied with it, but IMHO some beaches should have some algae -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:water_source"}, max_count = seaweed_max_count, rarity = seaweed_rarity, @@ -398,7 +401,7 @@ plantslib:register_generate_plant({ }, flowers_plus.grow_seaweed ) -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:sand"}, max_count = seaweed_max_count*2, rarity = seaweed_rarity/2, @@ -415,7 +418,7 @@ plantslib:register_generate_plant({ flowers_plus.grow_seaweed ) -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:dirt_with_grass"}, avoid_nodes = { "flowers:sunflower" }, max_count = sunflowers_max_count, @@ -430,7 +433,7 @@ plantslib:register_generate_plant({ -- spawn ABM registrations -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY/2, spawn_plants = { "flowers:waterlily", @@ -452,7 +455,7 @@ plantslib:spawn_on_surfaces({ random_facedir = {0,3} }) -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY*2, spawn_plants = {"flowers:seaweed"}, spawn_chance = SPAWN_CHANCE*2, @@ -465,7 +468,7 @@ plantslib:spawn_on_surfaces({ facedir = 1 }) -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY*2, spawn_plants = {"flowers:seaweed"}, spawn_chance = SPAWN_CHANCE*2, @@ -479,7 +482,7 @@ plantslib:spawn_on_surfaces({ facedir = 1 }) -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY*2, spawn_plants = {"flowers:seaweed"}, spawn_chance = SPAWN_CHANCE*2, @@ -493,7 +496,7 @@ plantslib:spawn_on_surfaces({ facedir = 1 }) -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY*2, spawn_plants = {"flowers:sunflower"}, spawn_chance = SPAWN_CHANCE*2, diff --git a/mods/plantlife_modpack/molehills/depends.txt b/mods/plantlife_modpack/molehills/depends.txt index bde0bdf5..4e351798 100755 --- a/mods/plantlife_modpack/molehills/depends.txt +++ b/mods/plantlife_modpack/molehills/depends.txt @@ -1,2 +1,2 @@ default -plants_lib \ No newline at end of file +biome_lib \ No newline at end of file diff --git a/mods/plantlife_modpack/molehills/init.lua b/mods/plantlife_modpack/molehills/init.lua index 9292c6ab..8f116f42 100755 --- a/mods/plantlife_modpack/molehills/init.lua +++ b/mods/plantlife_modpack/molehills/init.lua @@ -92,7 +92,7 @@ abstract_molehills.place_molehill = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:dirt_with_grass"}, max_count = Molehills_Max_Count, rarity = Molehills_Rarity, @@ -105,7 +105,7 @@ plantslib:register_generate_plant({ abstract_molehills.place_molehill ) -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"watershed:drygrass"}, max_count = Molehills_Max_Count, rarity = 97, diff --git a/mods/plantlife_modpack/poisonivy/depends.txt b/mods/plantlife_modpack/poisonivy/depends.txt index 6a669060..249cc743 100755 --- a/mods/plantlife_modpack/poisonivy/depends.txt +++ b/mods/plantlife_modpack/poisonivy/depends.txt @@ -1,2 +1,2 @@ -plants_lib +biome_lib diff --git a/mods/plantlife_modpack/poisonivy/init.lua b/mods/plantlife_modpack/poisonivy/init.lua index 6ab84f10..bef78baf 100755 --- a/mods/plantlife_modpack/poisonivy/init.lua +++ b/mods/plantlife_modpack/poisonivy/init.lua @@ -1,7 +1,7 @@ -- This file supplies poison ivy for the plantlife modpack -- Last revision: 2013-01-24 -local S = plantslib.intllib +local S = biome_lib.intllib local SPAWN_DELAY = 1000 local SPAWN_CHANCE = 200 @@ -69,7 +69,7 @@ minetest.register_node('poisonivy:climbing', { buildable_to = true, }) -plantslib:spawn_on_surfaces({ +biome_lib:spawn_on_surfaces({ spawn_delay = SPAWN_DELAY, spawn_plants = {"poisonivy:seedling"}, avoid_radius = 10, @@ -82,7 +82,7 @@ plantslib:spawn_on_surfaces({ verticals_list = walls_list }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = SPAWN_DELAY, grow_chance = GROW_CHANCE, grow_plant = "poisonivy:seedling", @@ -90,7 +90,7 @@ plantslib:grow_plants({ grow_nodes = {"default:dirt_with_grass"} }) -plantslib:grow_plants({ +biome_lib:grow_plants({ grow_delay = GROW_DELAY, grow_chance = GROW_CHANCE*2, grow_plant = "poisonivy:climbing", diff --git a/mods/plantlife_modpack/trunks/crafting.lua b/mods/plantlife_modpack/trunks/crafting.lua index 72f39ba7..a1823eea 100755 --- a/mods/plantlife_modpack/trunks/crafting.lua +++ b/mods/plantlife_modpack/trunks/crafting.lua @@ -130,4 +130,4 @@ minetest.register_craft({ -- twigs blocks --> twigs_roof_corner_2's {"trunks:twigs", "" ,"trunks:twigs"}, { "" ,"trunks:twigs", "" }, } -}) +}) \ No newline at end of file diff --git a/mods/plantlife_modpack/trunks/depends.txt b/mods/plantlife_modpack/trunks/depends.txt index 9c27f3b4..99cfba19 100755 --- a/mods/plantlife_modpack/trunks/depends.txt +++ b/mods/plantlife_modpack/trunks/depends.txt @@ -1,5 +1,5 @@ default -plants_lib +biome_lib bushes? ferns? moretrees? diff --git a/mods/plantlife_modpack/trunks/generating.lua b/mods/plantlife_modpack/trunks/generating.lua index f6dbab3a..7848a7a7 100755 --- a/mods/plantlife_modpack/trunks/generating.lua +++ b/mods/plantlife_modpack/trunks/generating.lua @@ -162,7 +162,7 @@ abstract_trunks.place_twig = function(pos) end if Twigs_on_ground == true then -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:dirt_with_grass"}, max_count = Twigs_on_ground_Max_Count, rarity = Twigs_on_ground_Rarity, @@ -179,7 +179,7 @@ plantslib:register_generate_plant({ end if Twigs_on_water == true then -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:water_source"}, max_count = Twigs_on_water_Max_Count, rarity = Twigs_on_water_Rarity, @@ -341,7 +341,7 @@ abstract_trunks.place_trunk = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:dirt_with_grass"}, max_count = Trunks_Max_Count, -- 320, rarity = Trunks_Rarity, -- 99, @@ -374,7 +374,7 @@ abstract_trunks.grow_moss_on_ground = function(pos) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"default:dirt_with_grass"}, max_count = Moss_on_ground_Max_Count, rarity = Moss_on_ground_Rarity, @@ -458,7 +458,7 @@ abstract_trunks.grow_moss_on_trunk = function(pos) --end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:tree", "default:jungletree", @@ -535,7 +535,7 @@ abstract_trunks.grow_roots = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = {"group:tree"}, max_count = 1000, rarity = 1, diff --git a/mods/plantlife_modpack/trunks/nodes.lua b/mods/plantlife_modpack/trunks/nodes.lua index 4de48cf4..feb7293a 100755 --- a/mods/plantlife_modpack/trunks/nodes.lua +++ b/mods/plantlife_modpack/trunks/nodes.lua @@ -303,6 +303,7 @@ local TRuNKS = { -- MoD TRuNK {"default", "tree" }, {"default", "jungletree" }, + {"default", "pinetree" }, {"trees", "tree_conifer" }, {"trees", "tree_mangrove" }, @@ -314,7 +315,6 @@ local TRuNKS = { {"moretrees", "fir_trunk" }, {"moretrees", "oak_trunk" }, {"moretrees", "palm_trunk" }, - {"moretrees", "pine_trunk" }, {"moretrees", "rubber_tree_trunk" }, {"moretrees", "rubber_tree_trunk_empty" }, {"moretrees", "sequoia_trunk" }, @@ -359,3 +359,5 @@ for i in pairs(TRuNKS) do end end end + +minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot") diff --git a/mods/plantlife_modpack/vines/README.md b/mods/plantlife_modpack/vines/README.md index 89fdb270..386dcaed 100755 --- a/mods/plantlife_modpack/vines/README.md +++ b/mods/plantlife_modpack/vines/README.md @@ -47,7 +47,7 @@ table. |description| string|The vine's tooltip description| |average_length|int| The average length of vines| -For biome definitions please see the [plants_lib API documentation](https://github.com/VanessaE/plantlife_modpack/blob/master/API.txt) +For biome definitions please see the [biome_lib API documentation](https://github.com/VanessaE/biome_lib/blob/master/API.txt) ## Notice Vines use after_destruct on registered leave nodes to remove vines from which diff --git a/mods/plantlife_modpack/vines/depends.txt b/mods/plantlife_modpack/vines/depends.txt index 4146336c..573e6e18 100755 --- a/mods/plantlife_modpack/vines/depends.txt +++ b/mods/plantlife_modpack/vines/depends.txt @@ -1,3 +1,3 @@ default -plants_lib +biome_lib moretrees? diff --git a/mods/plantlife_modpack/vines/functions.lua b/mods/plantlife_modpack/vines/functions.lua index ae0607bf..87024bdd 100755 --- a/mods/plantlife_modpack/vines/functions.lua +++ b/mods/plantlife_modpack/vines/functions.lua @@ -91,7 +91,7 @@ vines.register_vine = function( name, defs, biome ) end }) - plantslib:spawn_on_surfaces( biome ) + biome_lib:spawn_on_surfaces( biome ) local override_nodes = function( nodes, defs ) local function override( index, registered ) diff --git a/mods/plantlife_modpack/woodsoils/depends.txt b/mods/plantlife_modpack/woodsoils/depends.txt index 462d1833..c95a2bf2 100755 --- a/mods/plantlife_modpack/woodsoils/depends.txt +++ b/mods/plantlife_modpack/woodsoils/depends.txt @@ -1,5 +1,5 @@ default -plants_lib +biome_lib bushes? ferns? moretrees? diff --git a/mods/plantlife_modpack/woodsoils/generating.lua b/mods/plantlife_modpack/woodsoils/generating.lua index aabb0f5c..db1dfa52 100755 --- a/mods/plantlife_modpack/woodsoils/generating.lua +++ b/mods/plantlife_modpack/woodsoils/generating.lua @@ -73,7 +73,7 @@ abstract_woodsoils.place_soil = function(pos) end end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "group:tree", "ferns:fern_03", @@ -94,7 +94,7 @@ plantslib:register_generate_plant({ "abstract_woodsoils.place_soil" ) -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "moretrees:apple_tree_sapling_ongen", "moretrees:beech_sapling_ongen", diff --git a/mods/plantlife_modpack/youngtrees/depends.txt b/mods/plantlife_modpack/youngtrees/depends.txt index bde0bdf5..4e351798 100755 --- a/mods/plantlife_modpack/youngtrees/depends.txt +++ b/mods/plantlife_modpack/youngtrees/depends.txt @@ -1,2 +1,2 @@ default -plants_lib \ No newline at end of file +biome_lib \ No newline at end of file diff --git a/mods/plantlife_modpack/youngtrees/init.lua b/mods/plantlife_modpack/youngtrees/init.lua index 102275a1..2099125c 100755 --- a/mods/plantlife_modpack/youngtrees/init.lua +++ b/mods/plantlife_modpack/youngtrees/init.lua @@ -130,7 +130,7 @@ abstract_youngtrees.grow_youngtree_node = function(pos, height) end -plantslib:register_generate_plant({ +biome_lib:register_generate_plant({ surface = { "default:dirt_with_grass", "stoneage:grass_with_silex", diff --git a/worlds/minetestforfun/news.txt b/worlds/minetestforfun/news.txt index 487f5a6e..f997da4e 100755 --- a/worlds/minetestforfun/news.txt +++ b/worlds/minetestforfun/news.txt @@ -9,6 +9,9 @@ Ca y est, les classes Warrior et Hunter sont là ! (Venez les tester et aider no Venez visiter notre nouveau site "minetestforfun.com" ! ---??/08/2015--- (Remerciements : crabman77/crabman, LeMagnesium/Mg, Obani) +Ajout de "biome_lib" (extraction du mod plant_lib et son API vers un mod isolé) +MAJ de "moretrees" (compatibilité avec la nouvelle lib des biomes) +MAJ de "plantlife_modpack" (division du mod en deux parties) Suppression de "bone" (devenu obsolète, et peu d'utilité ou utilisé pour passer du temps sur son debug) MAJ de "throwing" (Nouvelle arbalète automatique - grâce à son système logique en Mese - pour les Hunters uniquement) MAJ de "MFF_game" (Ajustement de la texture du "Steel Block" et "Steel Ingot" pour être plus sombre et diférente de l'équivalent en "Argent/Silver") diff --git a/worlds/minetestforfun/world.mt b/worlds/minetestforfun/world.mt index bf056181..71f3511c 100755 --- a/worlds/minetestforfun/world.mt +++ b/worlds/minetestforfun/world.mt @@ -30,7 +30,7 @@ load_mod_bushes_classic = true load_mod_flowers_plus = true load_mod_junglegrass = true load_mod_nature_classic = true -load_mod_plants_lib = true +load_mod_biome_lib = true load_mod_poisonivy = true load_mod_vines = true load_mod_moretrees = true