diff --git a/depends.txt b/depends.txt index 647b35d..0db75c2 100644 --- a/depends.txt +++ b/depends.txt @@ -1,4 +1,5 @@ default +christmas_craft? flowers? moreblocks? skins? diff --git a/src/aliases.lua b/src/aliases.lua index 3cee7b1..a690f29 100644 --- a/src/aliases.lua +++ b/src/aliases.lua @@ -102,3 +102,8 @@ minetest.register_alias(":default:micro_ice_4", "moreblocks:micro_ice_4") minetest.register_alias(":default:micro_ice_12", "moreblocks:micro_ice_12") minetest.register_alias(":default:micro_ice_14", "moreblocks:micro_ice_14") minetest.register_alias(":default:micro_ice_15", "moreblocks:micro_ice_15") + +-- If christmas_craft then override his star with this mod one. +if minetest.get_modpath("christmas_craft") then + minetest.register_alias_force("christmas_craft:christmas_star", "snow:star") +end diff --git a/src/mapgen.lua b/src/mapgen.lua index 97235ae..398746a 100644 --- a/src/mapgen.lua +++ b/src/mapgen.lua @@ -11,7 +11,7 @@ saplings grow into trees. --]] -- Part 1: To disable the mapgen, add the *starting* comment under this line. ---[[ + local perlin_scale, nosmooth_rarity if not snow.disable_mapgen then print("[snow] Mapgen enabled!") @@ -65,17 +65,17 @@ if not snow.disable_mapgen then minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!") end local path = minetest.get_modpath("snow") - if mgname == "v7" then - --Load mapgen_v7 compatibility. - dofile(path.."/src/mapgen_v7.lua") - else + if mgname == "v6" then --Load mapgen_v6 compatibility. dofile(path.."/src/mapgen_v6.lua") + else + --Load mapgen_v7 compatibility. + dofile(path.."/src/mapgen_v7.lua") end end -- To complete the commenting-out add the *closing* comment under this line. -]] + local pine_tree = { axiom="TABff", diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index 9c7e95d..5101d15 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -142,10 +142,10 @@ local function define_contents() end local smooth = snow.smooth_biomes -local smooth_rarity_max = mg.smooth_rarity_max -local smooth_rarity_min = mg.smooth_rarity_min -local smooth_rarity_dif = mg.smooth_rarity_dif -local nosmooth_rarity = mg.nosmooth_rarity +local smooth_rarity_max = mg.smooth_rarity_max or 0 +local smooth_rarity_min = mg.smooth_rarity_min or 0 +local smooth_rarity_dif = mg.smooth_rarity_dif or 0 +local nosmooth_rarity = mg.nosmooth_rarity or 0 snow.register_on_configuring(function(name, v) if name == "debug" then @@ -199,12 +199,12 @@ minetest.register_on_generated(function(minp, maxp, seed) define_contents() end - local vm, emin, emax = minetest.get_mapgen_object"voxelmanip" + local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} local data = vm:get_data() local param2s = vm:get_param2_data() - local heightmap = minetest.get_mapgen_object"heightmap" + local heightmap = minetest.get_mapgen_object("heightmap") local snow_tab,num = {},1 local pines_tab,pnum = {},1 @@ -255,7 +255,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if not in_biome then if alpine and test - and test > smooth_rarity_min then + and test > smooth_rarity_min then -- remove trees near alpine local ground_y if data[area:index(x, maxp.y, z)] == c.air then diff --git a/src/mapgen_v7.lua b/src/mapgen_v7.lua index ebb3eed..ee98552 100644 --- a/src/mapgen_v7.lua +++ b/src/mapgen_v7.lua @@ -1,58 +1,61 @@ -minetest.register_biome({ +--[[minetest.register_biome({ name = "snow_biome_default", - + node_dust = "default:snow", node_top = "default:dirt_with_snow", depth_top = 1, node_filler = "default:dirt", - depth_filler = 2, - - height_min = snow.min_height, - height_max = snow.min_height+60, + depth_filler = 1, + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, heat_point = 10.0, humidity_point = 40.0, }) - +]]-- minetest.register_biome({ name = "snow_biome_forest", - + node_dust = "default:snow", node_top = "default:dirt_with_snow", depth_top = 1, node_filler = "default:dirt", depth_filler = 2, - - height_min = snow.min_height, - height_max = snow.min_height+60, - heat_point = 10.0, - humidity_point = 55.0, -}) - -minetest.register_biome({ - name = "snow_biome_lush", - - node_top = "default:dirt_with_snow", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 2, - - height_min = snow.min_height, - height_max = snow.min_height+60, - heat_point = 10.0, + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 2, + y_max = 31000, + heat_point = 20.0, humidity_point = 70.0, }) minetest.register_biome({ + name = "snow_biome_lush", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 2, + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 2, + y_max = 31000, + heat_point = 10.0, + humidity_point = 70.0, +}) + +--[[minetest.register_biome({ name = "snow_biome_alpine", node_top = "default:stone", depth_top = 1, node_filler = "default:stone", - height_min = snow.min_height+60, - height_max = 31000, + y_min = snow.min_height+60, + y_max = 31000, heat_point = 10.0, humidity_point = 40.0, }) - +]]-- minetest.register_biome({ name = "snow_biome_sand", @@ -61,8 +64,8 @@ minetest.register_biome({ node_filler = "default:stone", depth_filler = 0, - height_min = -31000, - height_max = 2, + y_min = -2, + y_max = 31000, heat_point = 10.0, humidity_point = 40.0, }) @@ -71,10 +74,19 @@ minetest.register_biome({ --Pine tree. minetest.register_decoration({ deco_type = "schematic", - place_on = "default:dirt_with_snow", + place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, sidelen = 16, - fill_ratio = 0.005, - biomes = {"snow_biome_default"}, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 4087, + octaves = 3, + persist = 0.7, + }, + y_max = 31000, + y_min = 4, + biomes = {"snowy_grassland", "coniferous_forest", "taiga"}, schematic = minetest.get_modpath("snow").."/schematics/pine.mts", flags = "place_center_x, place_center_z", }) @@ -83,7 +95,16 @@ minetest.register_decoration({ deco_type = "schematic", place_on = "default:dirt_with_snow", sidelen = 16, - fill_ratio = 0.05, + noise_params = { + offset = 0.036, + scale = 0.022, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + y_max = 31000, + y_min = 4, biomes = {"snow_biome_forest"}, schematic = minetest.get_modpath("snow").."/schematics/pine.mts", flags = "place_center_x, place_center_z", @@ -93,7 +114,9 @@ minetest.register_decoration({ deco_type = "schematic", place_on = "default:dirt_with_snow", sidelen = 16, - fill_ratio = 0.1, + fill_ratio = 0.05, + y_max = 31000, + y_min = 4, biomes = {"snow_biome_lush"}, schematic = minetest.get_modpath("snow").."/schematics/pine.mts", flags = "place_center_x, place_center_z", @@ -104,35 +127,95 @@ minetest.register_decoration({ deco_type = "simple", place_on = "default:dirt_with_snow", sidelen = 16, - fill_ratio = 0.005, - biomes = {"snow_biome_default"}, + fill_ratio = 0.001, + y_max = 31000, + y_min = 1, + biomes = {"snowy_grassland"}, decoration = "default:dry_shrub", }) +minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_snow", + sidelen = 16, + fill_ratio = 0.01, + y_max = 31000, + y_min = 1, + biomes = {"snow_biome_forest", "snow_biome_lush"}, + decoration = "default:dry_shrub", +}) + +--Snow shrubs. +minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_snow", + sidelen = 16, + fill_ratio = 0.005, + y_max = 31000, + y_min = 1, + biomes = {"snowy_grassland"}, + decoration = "snow:shrub_covered", +}) + minetest.register_decoration({ deco_type = "simple", place_on = "default:dirt_with_snow", sidelen = 16, fill_ratio = 0.05, + y_max = 31000, + y_min = 1, biomes = {"snow_biome_forest", "snow_biome_lush"}, - decoration = "default:dry_shrub", + decoration = "snow:shrub_covered", }) +-- Snow Flowers +local function register_flower(seed, name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.015, + scale = 0.025, + spread = {x = 200, y = 200, z = 200}, + seed = seed, + octaves = 3, + persist = 0.6 + }, + biomes = {"snow_biome_lush", "snow_biome_forest", "taiga", "snowy_grassland", "tundra"}, + y_min = 1, + y_max = 31000, + decoration = "snow:flower_"..name, + }) +end + +register_flower(436, "rose") +register_flower(19822, "tulip") +register_flower(1220999, "dandelion_yellow") +register_flower(36662, "geranium") +register_flower(1133, "viola") +register_flower(73133, "dandelion_white") + --Snow. minetest.register_decoration({ deco_type = "simple", place_on = "default:dirt_with_snow", sidelen = 16, fill_ratio = 10, - biomes = {"snow_biome_default", "snow_biome_forest", "snow_biome_lush"}, + y_max = 31000, + y_min = 1, + biomes = {"snow_biome_forest", "snow_biome_lush"}, decoration = "default:snow", }) -minetest.register_decoration({ +--[[minetest.register_decoration({ deco_type = "simple", place_on = "default:stone", sidelen = 16, fill_ratio = 10, + y_max = 31000, + y_min = 1, biomes = {"snow_biome_alpine"}, decoration = "default:snow", }) +]] diff --git a/src/nodes.lua b/src/nodes.lua index bd43845..e5a9d49 100644 --- a/src/nodes.lua +++ b/src/nodes.lua @@ -1,7 +1,7 @@ -- NODES -- Pine Needles -local nodedef = { +--[[local nodedef = { description = "Pine Needles", drawtype = "allfaces_optional", visual_scale = 1.3, @@ -25,7 +25,22 @@ local nodedef = { }, sounds = default.node_sound_leaves_defaults(), } - +]]-- +local nodedef = table.copy(minetest.registered_nodes["default:pine_needles"]) +nodedef.tiles = {"snow_needles.png"} +nodedef.drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'snow:sapling_pine'}, + rarity = 20, + }, + { + items = {'snow:needles'}, + } + } +} --[[ If christmas_content is enabled, then this next part will override the pine needles' drop code (in the code section above) and adds Xmas tree saplings to the items that are dropped. @@ -64,8 +79,6 @@ snow.register_on_configuring(function(name, v) end end) - - -- Christmas egg if minetest.global_exists("skins") then skins.add("character_snow_man") @@ -94,7 +107,7 @@ minetest.register_node("snow:needles_decorated", nodedef) -- Saplings nodedef = { - description = "Pine Sapling", + description = "Snow Pine Sapling", drawtype = "plantlike", visual_scale = 1.0, tiles = {"snow_sapling_pine.png"}, diff --git a/src/util.lua b/src/util.lua index d5a89e0..c71c39b 100644 --- a/src/util.lua +++ b/src/util.lua @@ -3,7 +3,7 @@ snow = { snowball_gravity = tonumber(minetest.settings:get("snow_snowball_gravity")) or 0.91, snowball_velocity = tonumber(minetest.settings:get("snow_snowball_velocity")) or 19, sleds = minetest.settings:get_bool("snow_sleds", true), - enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", true), + enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", false), lighter_snowfall = minetest.settings:get_bool("snow_lighter_snowfall", false), debug = minetest.settings:get_bool("snow_debug", false), smooth_biomes = minetest.settings:get_bool("snow_smooth_biomes", true), @@ -12,7 +12,7 @@ snow = { min_height = tonumber(minetest.settings:get("snow_min_height")) or 3, mapgen_rarity = tonumber(minetest.settings:get("snow_mapgen_rarity")) or 18, mapgen_size = tonumber(minetest.settings:get("snow_mapgen_size")) or 210, - disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", true), + disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", false), }