diff --git a/CHANGELOG.md b/CHANGELOG.md index d3381a3..474d2a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [Oct 20th - STILL UNDER DEVELOPMENT] Update: The Something Update + +- Make some changes to world generation +- World Tokens now use Lua Voxel Manipulators instead of waiting a set time. This makes the spawn area much larger though... +- Added `emits_heat` group to the following nodes: + - Torch + - Fire + - Lava +- Water freezes in cold biomes if not neighbouring heat emiting nodes +- New lily pad texture + ## [Oct 19th 2024] Bugfix Update - Minor bugfixes diff --git a/mods/CORE/pyutest/util.lua b/mods/CORE/pyutest/util.lua index fdfeba6..5e3d7a2 100644 --- a/mods/CORE/pyutest/util.lua +++ b/mods/CORE/pyutest/util.lua @@ -239,3 +239,27 @@ PyuTest.rotate_and_place = function(itemstack, placer, pointed_thing) end return minetest.item_place(itemstack, placer, pointed_thing, param2) end + +PyuTest.register_interval = function(fn, time) + local first_run = true + + local function interval() + if first_run then + first_run = false + else + fn() + end + + minetest.after(time, fn) + end + + interval() +end + +PyuTest.deal_damage = function(target, damage) + local hp = target:get_hp() + + if hp > 0 then + target:set_hp(hp - damage) + end +end diff --git a/mods/CORE/walkover/README.md b/mods/CORE/walkover/README.md new file mode 100644 index 0000000..eff23be --- /dev/null +++ b/mods/CORE/walkover/README.md @@ -0,0 +1,25 @@ +Walkover +-------- + +Some mod developers have shown an interest in having an `on_walk_over` event. This is useful for pressure-plates and the like. + +See this issue - https://github.com/minetest/minetest/issues/247 + +I have implemented a server-side version in Lua using globalstep which people might find useful. Of course this would better implemented via a client-based "on walk over", but it is sufficient for my needs now. + +Example Usage +------------- + +```lua +minetest.register_node("somemod:someblock", { + description = "Talking Block", + tiles = {"somemod_someblock.png"}, + on_walk_over = function(pos, node, player) + minetest.chat_send_player(player, "Hey! Watch it!") + end +}) +``` + +Credits +------ +Mod created by lordfingle, licensed under Apache License 2.0. diff --git a/mods/CORE/walkover/init.lua b/mods/CORE/walkover/init.lua new file mode 100644 index 0000000..ec4fcbc --- /dev/null +++ b/mods/CORE/walkover/init.lua @@ -0,0 +1,47 @@ +local get_connected_players = minetest.get_connected_players +local get_node = minetest.get_node +local vector = vector +local ceil = math.ceil +local pairs = pairs + +walkover = {} + +local on_walk = {} +local registered_globals = {} + +walkover.registered_globals = registered_globals + +function walkover.register_global(func) + table.insert(registered_globals, func) +end + +minetest.register_on_mods_loaded(function() + for name,def in pairs(minetest.registered_nodes) do + if def.on_walk_over then + on_walk[name] = def.on_walk_over + end + end +end) + +local timer = 0 +minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer >= 0.6 then + for _, player in pairs(get_connected_players()) do + local ppos = player:get_pos() + local npos = vector.add(ppos, vector.new(0, -0.1, 0)) + if npos then + local node = get_node(npos) + if node then + if on_walk[node.name] then + on_walk[node.name](npos, node, player) + end + for i = 1, #registered_globals do + registered_globals[i](npos, node, player) + end + end + end + end + timer = 0 + end +end) diff --git a/mods/ITEMS/pyutest_blocks/liquid.lua b/mods/ITEMS/pyutest_blocks/liquid.lua index 724afa0..18fe7eb 100644 --- a/mods/ITEMS/pyutest_blocks/liquid.lua +++ b/mods/ITEMS/pyutest_blocks/liquid.lua @@ -9,7 +9,8 @@ PyuTest.make_liquid("pyutest_blocks:water", "Water", { PyuTest.make_liquid("pyutest_blocks:lava", "Lava", { lava = 1, - coolable = 1 + coolable = 1, + emits_heat = 1, }, "pyutest-lava.png", 5, { damage_per_second = 4, light_source = 8 diff --git a/mods/ITEMS/pyutest_blocks/special.lua b/mods/ITEMS/pyutest_blocks/special.lua index f5ac742..2e42aac 100644 --- a/mods/ITEMS/pyutest_blocks/special.lua +++ b/mods/ITEMS/pyutest_blocks/special.lua @@ -21,6 +21,7 @@ PyuTest.make_node("pyutest_blocks:torch", "Torch", { dig_immediate = 1, light = 1, attached_node = 1, + emits_heat = 1, oddly_breakable_by_hand = PyuTest.BLOCK_FAST }, { "pyutest-torch.png", @@ -65,7 +66,8 @@ PyuTest.make_node("pyutest_blocks:contagious_acid", "Contagious Acid", { PyuTest.make_node("pyutest_blocks:fire", "Fire", { dig_immediate = 1, - oddly_breakable_by_hand = PyuTest.BLOCK_FAST + oddly_breakable_by_hand = PyuTest.BLOCK_FAST, + emits_heat = 1 }, { "pyutest-fire.png" }, { drawtype = "firelike", walkable = false, @@ -177,10 +179,14 @@ PyuTest.make_node("pyutest_blocks:magma", "Magma", { }, { "pyutest-molten-rock.png" }, { paramtype = "light", light_source = 11, - damage_per_second = 3, overlay_tiles = { {name = "pyutest-ore-overlay.png", color = "darkorange"} - } + }, + on_walk_over = function (pos, node, player) + if player then + PyuTest.deal_damage(player, 3) + end + end }) PyuTest.make_node("pyutest_blocks:bedrock", "Bedrock", { diff --git a/mods/ITEMS/pyutest_electricity/init.lua b/mods/ITEMS/pyutest_electricity/init.lua index f268c5f..3aea003 100644 --- a/mods/ITEMS/pyutest_electricity/init.lua +++ b/mods/ITEMS/pyutest_electricity/init.lua @@ -47,7 +47,8 @@ PyuTest.make_wire = function(id, desc, groups, color, opts, texture, delay) paramtype = "light", sunlight_propagates = true, walkable = false, - inventory_image = texture or "pyutest-wire.png", + inventory_image = "pyutest-powder.png", + wield_image = "pyutest-powder.png", __on_electricity_activated = function(pos, node, sender_pos) for _, v in pairs(PyuTest.get_full_neighbours(pos)) do diff --git a/mods/ITEMS/pyutest_farming/api.lua b/mods/ITEMS/pyutest_farming/api.lua index d29b137..cdce56c 100644 --- a/mods/ITEMS/pyutest_farming/api.lua +++ b/mods/ITEMS/pyutest_farming/api.lua @@ -87,7 +87,7 @@ PyuTest.make_crop = function (name, desc, output, growtime, water_multiplier, te local node = minetest.get_node(pos) if node.name == "pyutest_farming:farmland" then - minetest.place_node(pointed_thing.above, {name = name.."_crop"}, user) + minetest.place_node(pointed_thing.under + vector.new(0, 1, 0), {name = name.."_crop"}, user) itemstack:set_count(itemstack:get_count() - 1) return itemstack end diff --git a/mods/ITEMS/pyutest_farming/init.lua b/mods/ITEMS/pyutest_farming/init.lua index 306e751..eec9b3d 100644 --- a/mods/ITEMS/pyutest_farming/init.lua +++ b/mods/ITEMS/pyutest_farming/init.lua @@ -8,7 +8,7 @@ PyuTest.make_crop("pyutest_farming:wheat", "Wheat", "pyutest_tools:wheat 2", 65, seed_color = "#eed89a" }) -PyuTest.make_crop("pyutest_farming:carrot", "Carrot", "pyutest_tools:carrot 3", 90, nil, { +PyuTest.make_crop("pyutest_farming:carrot", "Carrot", "pyutest_tools:carrot 3", 90, 0.33, { crop_color = "#d19d79", grown_color = "#d19d79", seed_color = "#d19d79" diff --git a/mods/ITEMS/pyutest_flowers/init.lua b/mods/ITEMS/pyutest_flowers/init.lua index 35c0dbe..6f2114d 100644 --- a/mods/ITEMS/pyutest_flowers/init.lua +++ b/mods/ITEMS/pyutest_flowers/init.lua @@ -52,6 +52,10 @@ PyuTest.make_node("pyutest_flowers:lilypad", "Lily Pad", { type = "fixed", fixed = {-0.5, -31/64, -0.5, 0.5, -15/32, 0.5} }, + collision_box = { + type = "fixed", + fixed = {-0.5, -31/64, -0.5, 0.5, -15/32, 0.5} + }, }) PyuTest.make_flower("pyutest_flowers:maybell", "Maybell", "pyutest-maybell.png", "pyutest_flowers:white_dye", true) @@ -60,7 +64,7 @@ PyuTest.make_flower("pyutest_flowers:black_rose", "Black Rose", "pyutest-black-r PyuTest.make_node("pyutest_flowers:vines", "Vines", { snappy = PyuTest.BLOCK_FAST, - flammable = 1 + flammable = 1, }, {"pyutest-vines.png"}, { drawtype = "signlike", paramtype = "light", @@ -68,6 +72,7 @@ PyuTest.make_node("pyutest_flowers:vines", "Vines", { climbable = true, buildable_to = true, sunlight_propagates = true, + waving = 2, paramtype2 = "wallmounted", selection_box = { type = "wallmounted" diff --git a/mods/ITEMS/pyutest_tools/api.lua b/mods/ITEMS/pyutest_tools/api.lua index 338a395..e5174c0 100644 --- a/mods/ITEMS/pyutest_tools/api.lua +++ b/mods/ITEMS/pyutest_tools/api.lua @@ -50,7 +50,6 @@ PyuTest.make_sword = function (nsname, desc, texture, damage, durability, atkspe end PyuTest.make_food = function (nsname, desc, wield_image, health_fill, cook_into, extra_code) - local code = extra_code or function()end PyuTest.make_item(nsname, desc, { food = 1 @@ -59,7 +58,7 @@ PyuTest.make_food = function (nsname, desc, wield_image, health_fill, cook_into, if user == nil then return end minetest.sound_play({name = "eat", gain = 1}, {pos = user:get_pos(), start_time = 1.2}) minetest.do_item_eat(health_fill, "", itemstack, user, pt) - code() + if extra_code then extra_code() end end, __pyutest_cook_into = cook_into }) diff --git a/mods/PLAYER/pyutest_cmds/gameplay.lua b/mods/PLAYER/pyutest_cmds/gameplay.lua index 803d146..8a6c556 100644 --- a/mods/PLAYER/pyutest_cmds/gameplay.lua +++ b/mods/PLAYER/pyutest_cmds/gameplay.lua @@ -10,3 +10,11 @@ minetest.register_chatcommand("biome", { return true, string.format("Current biome name: %s", name) end }) + +minetest.register_chatcommand("day", { + description = "Return the current day", + func = function (name) + local day = minetest.get_day_count() + return true, string.format("Current day is: %d", day) + end +}) diff --git a/mods/PLAYER/pyutest_home/init.lua b/mods/PLAYER/pyutest_home/init.lua index b0afd57..e86b6e7 100644 --- a/mods/PLAYER/pyutest_home/init.lua +++ b/mods/PLAYER/pyutest_home/init.lua @@ -24,7 +24,14 @@ minetest.register_chatcommand("tphome", { description = "Teleports to home ", func = function (name, param) local player = minetest.get_player_by_name(name) - player:set_pos(homes[name][param] or player:get_pos()) + local home = homes[name][param] + + if home ~= nil then + player:set_pos(home) + return true, "Teleported to home: " .. param + else + return false, "No such home exists!" + end end }) diff --git a/mods/WORLD/README b/mods/WORLD/README new file mode 100644 index 0000000..8a1016e --- /dev/null +++ b/mods/WORLD/README @@ -0,0 +1 @@ +also contains environmental mods diff --git a/mods/MAPGEN/modpack.conf b/mods/WORLD/modpack.conf similarity index 100% rename from mods/MAPGEN/modpack.conf rename to mods/WORLD/modpack.conf diff --git a/mods/WORLD/pyutest_environment/init.lua b/mods/WORLD/pyutest_environment/init.lua new file mode 100644 index 0000000..3b7ba7a --- /dev/null +++ b/mods/WORLD/pyutest_environment/init.lua @@ -0,0 +1,29 @@ +minetest.register_abm({ + label = "Water freezing", + nodenames = {"group:water"}, + interval = 3, + chance = 2.5, + catch_up = true, + action = function (pos) + local heat = minetest.get_heat(pos) + local found = minetest.find_node_near(pos, 2, {"group:emits_heat"}) ~= nil + + if heat and heat < 12 and not found then + minetest.set_node(pos, {name = "pyutest_blocks:ice_block"}) + end + end +}) + +minetest.register_abm({ + label = "Ice thawing", + nodenames = {"group:thawable"}, + neighbors = {"group:emits_heat"}, + interval = 3, + chance = 2.5, + catch_up = true, + action = function (pos, node) + local def = minetest.registered_nodes[node.name] + local thaw_into = def.__thaw_into or "pyutest_blocks:water_source" + minetest.set_node(pos, { name = thaw_into }) + end +}) diff --git a/mods/MAPGEN/pyutest_ores/mod.conf b/mods/WORLD/pyutest_environment/mod.conf similarity index 100% rename from mods/MAPGEN/pyutest_ores/mod.conf rename to mods/WORLD/pyutest_environment/mod.conf diff --git a/mods/MAPGEN/pyutest_mapgen/api.lua b/mods/WORLD/pyutest_mapgen/api.lua similarity index 100% rename from mods/MAPGEN/pyutest_mapgen/api.lua rename to mods/WORLD/pyutest_mapgen/api.lua diff --git a/mods/MAPGEN/pyutest_mapgen/mapgen.lua b/mods/WORLD/pyutest_mapgen/biomes.lua similarity index 74% rename from mods/MAPGEN/pyutest_mapgen/mapgen.lua rename to mods/WORLD/pyutest_mapgen/biomes.lua index 9c75ece..95b19ca 100644 --- a/mods/MAPGEN/pyutest_mapgen/mapgen.lua +++ b/mods/WORLD/pyutest_mapgen/biomes.lua @@ -1,40 +1,8 @@ -minetest.register_alias("mapgen_stone", "pyutest_blocks:stone_block") -minetest.register_alias("mapgen_water_source", "pyutest_blocks:water_source") -minetest.register_alias("mapgen_river_water_source", "pyutest_blocks:water_source") -minetest.register_alias("mapgen_lava_source", "pyutest_blocks:lava_source") -minetest.register_alias("mapgen_singlenode", "air") - -local mg_flags = minetest.settings:get_flags("mg_flags") -local mg_name = minetest.get_mapgen_setting("mg_name") -minetest.set_mapgen_setting(string.format("mg%s_cavern_threshold", mg_name), "0.20", true) - -mg_flags.caverns = true -mg_flags.dungeons = false - --- https://git.minetest.land/VoxeLibre/VoxeLibre/src/branch/master/mods/MAPGEN/mcl_mapgen_core/init.lua#L127 -local mg_flags_str = "" -for k,v in pairs(mg_flags) do - if v == false then - k = "no" .. k - end - mg_flags_str = mg_flags_str .. k .. "," -end -if string.len(mg_flags_str) > 0 then - mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str)-1) -end -minetest.set_mapgen_setting("mg_flags", mg_flags_str, true) - --- Biomes - PyuTest.BIOME_TOPS = { - grassland = 30, - forest = 35, - desert = 70, - frozen_plains = 30, - mountains = 300, - mushroom_fields = 30, - ice_spikes = 250, - swamp = 10 + lowland = 10, + normal = 40, + mountains = 1000, + skyland = 31000, } -- Overworld biome types @@ -103,8 +71,8 @@ PyuTest.get_extra_flowering_biomes = function () return biomes end --- wrapper around minetest.register_biome but with defaults and caves -PyuTest.register_overworld_biome = function(name, type, opts) +-- wrapper around minetest.register_biome but with defaults, caves and oceans +PyuTest.register_overworld_biome = function(name, type, opts, only_base) local nopts = PyuTest.util.tablecopy(opts) or {} nopts["name"] = name nopts["depth_top"] = nopts["depth_top"] or 1 @@ -113,13 +81,17 @@ PyuTest.register_overworld_biome = function(name, type, opts) nopts["depth_water_top"] = nopts["depth_water_top"] or nil -- cant think of a sane default.. nopts["node_water"] = nopts["node_water"] or "pyutest_blocks:water_source" - nopts["node_river_water"] = nopts["node_river_water"] or "pyutest_blocks:water_source" + nopts["node_river_water"] = nopts["node_river_water"] or "pyutest_blocks:river_water_source" nopts["node_riverbed"] = nopts["node_riverbed"] or "pyutest_blocks:gravel_block" minetest.register_biome(PyuTest.util.tableconcat(nopts, { _pyutest_biome_type = type, })) + if only_base then + return + end + minetest.register_biome(PyuTest.util.tableconcat({ name = name.."_ocean", node_top = nopts["node_riverbed"], @@ -181,85 +153,40 @@ if PyuTest.is_flat() then node_top = "pyutest_grass:dark_grass_block", node_filler = "pyutest_blocks:dirt_block", - y_max = PyuTest.BIOME_TOPS.grassland, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_BOTTOM, heat_point = 50, humidity_point = 50, - }) + }, true) return end +-- Plains like biomes PyuTest.register_overworld_biome("grassland", PyuTest.BIOME_TYPES.NORMAL, { node_top = "pyutest_grass:grass_block", node_filler = "pyutest_blocks:dirt_block", - y_max = PyuTest.BIOME_TOPS.grassland, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 53, - humidity_point = 57, - - _pyutest_biome_flowering = true -}) - -PyuTest.register_overworld_biome("forest", PyuTest.BIOME_TYPES.NORMAL, { - node_top = "pyutest_grass:dark_grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, + y_max = PyuTest.BIOME_TOPS.normal, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, heat_point = 50, - humidity_point = 65, + humidity_point = 40, + _pyutest_biome_flowering = true }) -PyuTest.register_overworld_biome("stony_mountains", PyuTest.BIOME_TYPES.WARM, { - node_top = "pyutest_blocks:stone_block", - node_filler = "pyutest_blocks:stone_block", - - y_max = PyuTest.BIOME_TOPS.mountains, - y_min = PyuTest.BIOME_TOPS.grassland, - - heat_point = 65, - humidity_point = 8 -}) - PyuTest.register_overworld_biome("desert", PyuTest.BIOME_TYPES.DESERT, { node_top = "pyutest_blocks:sand_block", node_filler = "pyutest_blocks:sandstone_block", node_riverbed = "pyutest_blocks:sand_block", - y_max = PyuTest.BIOME_TOPS.desert, + y_max = PyuTest.BIOME_TOPS.normal, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - heat_point = 84, - humidity_point = 4 -}) - -PyuTest.register_overworld_biome("desert_mountains", PyuTest.BIOME_TYPES.DESERT, { - node_top = "pyutest_blocks:sand_block", - node_filler = "pyutest_blocks:sandstone_block", - - y_max = PyuTest.BIOME_TOPS.mountains, - y_min = PyuTest.BIOME_TOPS.desert, - - heat_point = 83, - humidity_point = 6 -}) - -PyuTest.register_overworld_biome("snowy_mountains", PyuTest.BIOME_TYPES.COLD, { - node_dust = "pyutest_blocks:snow_carpet", - node_top = "pyutest_blocks:snow_block", - node_filler = "pyutest_blocks:snow_block", - - y_max = PyuTest.BIOME_TOPS.mountains, - y_min = PyuTest.BIOME_TOPS.frozen_plains, - - heat_point = 6, - humidity_point = 72 + heat_point = 80, + humidity_point = 5 }) PyuTest.register_overworld_biome("frozen_plains", PyuTest.BIOME_TYPES.COLD, { @@ -267,39 +194,219 @@ PyuTest.register_overworld_biome("frozen_plains", PyuTest.BIOME_TYPES.COLD, { node_top = "pyutest_blocks:snow_block", node_filler = "pyutest_blocks:snow_block", - y_max = PyuTest.BIOME_TOPS.frozen_plains, + y_max = PyuTest.BIOME_TOPS.normal, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, node_water_top = "pyutest_blocks:ice_block", - depth_water_top = 5, + depth_water_top = 1, - heat_point = 9, - humidity_point = 67 + heat_point = 5, + humidity_point = 60 +}) + +PyuTest.register_overworld_biome("savanna", PyuTest.BIOME_TYPES.WARM, { + node_top = "pyutest_grass:savanna_grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 70, + humidity_point = 15 +}) + +-- Forest like biomes +PyuTest.register_overworld_biome("forest", PyuTest.BIOME_TYPES.NORMAL, { + node_top = "pyutest_grass:dark_grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 60, + + _pyutest_biome_flowering = true }) PyuTest.register_overworld_biome("mushroom_fields", PyuTest.BIOME_TYPES.NORMAL, { node_top = "pyutest_blocks:mycelium_block", node_filler = "pyutest_blocks:dirt_block", - y_max = PyuTest.BIOME_TOPS.mushroom_fields, + y_max = PyuTest.BIOME_TOPS.normal, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - heat_point = 53, - humidity_point = 94 + heat_point = 50, + humidity_point = 90 }) -PyuTest.register_overworld_biome("ice_spikes", PyuTest.BIOME_TYPES.COLD, { - node_top = "pyutest_blocks:ice_block", - node_filler = "pyutest_blocks:ice_block", +PyuTest.register_overworld_biome("large_mushroom_forest", PyuTest.BIOME_TYPES.NORMAL, { + node_top = "pyutest_blocks:mycelium_block", + node_filler = "pyutest_blocks:dirt_block", - y_max = PyuTest.BIOME_TOPS.ice_spikes, + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 90 +}) + +PyuTest.register_overworld_biome("snowy_forest", PyuTest.BIOME_TYPES.COLD, { + node_dust = "pyutest_blocks:snow_carpet", + node_top = "pyutest_blocks:snow_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, node_water_top = "pyutest_blocks:ice_block", depth_water_top = 5, - heat_point = 9, - humidity_point = 70 + heat_point = 5, + humidity_point = 60 +}) + +PyuTest.register_overworld_biome("taiga", PyuTest.BIOME_TYPES.CHILLY, { + node_top = "pyutest_grass:dark_grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 15, + humidity_point = 60, + + _pyutest_biome_flowering = true +}) + +PyuTest.register_overworld_biome("cherry_grove", PyuTest.BIOME_TYPES.NORMAL, { + node_top = "pyutest_grass:grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 70, + + _pyutest_biome_flowering = true, + _pyutest_biome_flowering_extra = true +}) + + +PyuTest.register_overworld_biome("birch_forest", PyuTest.BIOME_TYPES.NORMAL, { + node_top = "pyutest_grass:grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 60, + + _pyutest_biome_flowering = true +}) + +PyuTest.register_overworld_biome("old_growth_birch_forest", PyuTest.BIOME_TYPES.NORMAL, { + node_top = "pyutest_grass:grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 60, + + _pyutest_biome_flowering = true, + _pyutest_biome_flowering_extra = true +}) + +PyuTest.register_overworld_biome("aspen_forest", PyuTest.BIOME_TYPES.CHILLY, { + node_top = "pyutest_grass:aspen_grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 30, + humidity_point = 50, + + _pyutest_biome_flowering = true +}) + +PyuTest.register_overworld_biome("redwood_forest", PyuTest.BIOME_TYPES.CHILLY, { + node_top = "pyutest_blocks:podzol_block", + node_filler = "pyutest_blocks:podzol_block", + + y_max = PyuTest.BIOME_TOPS.normal, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 30, + humidity_point = 50, + + _pyutest_biome_flowering = true +}) + +-- Marsh biomes +PyuTest.register_overworld_biome("swamp", PyuTest.BIOME_TYPES.WETLAND, { + node_top = "pyutest_grass:swampy_grass_block", + node_filler = "pyutest_blocks:dirt_block", + + y_max = PyuTest.BIOME_TOPS.lowland, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + heat_point = 50, + humidity_point = 80, +}) + +-- Mountainous biomes + +PyuTest.register_overworld_biome("stony_mountains", PyuTest.BIOME_TYPES.WARM, { + node_top = "pyutest_blocks:stone_block", + node_filler = "pyutest_blocks:stone_block", + + y_max = PyuTest.BIOME_TOPS.mountains, + y_min = PyuTest.BIOME_TOPS.normal, + + heat_point = 40, + humidity_point = 10 +}, true) + +PyuTest.register_overworld_biome("desert_mountains", PyuTest.BIOME_TYPES.DESERT, { + node_top = "pyutest_blocks:sand_block", + node_filler = "pyutest_blocks:sandstone_block", + + y_max = PyuTest.BIOME_TOPS.mountains, + y_min = PyuTest.BIOME_TOPS.normal, + + heat_point = 80, + humidity_point = 5 +}, true) + +PyuTest.register_overworld_biome("snowy_mountains", PyuTest.BIOME_TYPES.COLD, { + node_dust = "pyutest_blocks:snow_carpet", + node_top = "pyutest_blocks:snow_block", + node_filler = "pyutest_blocks:snow_block", + + y_max = PyuTest.BIOME_TOPS.mountains, + y_min = PyuTest.BIOME_TOPS.normal, + + heat_point = 5, + humidity_point = 60 +}, true) + +PyuTest.register_overworld_biome("ice_spikes", PyuTest.BIOME_TYPES.COLD, { + node_top = "pyutest_blocks:ice_block", + node_filler = "pyutest_blocks:ice_block", + + y_max = PyuTest.BIOME_TOPS.mountains, + y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, + + node_water_top = "pyutest_blocks:ice_block", + depth_water_top = 5, + + heat_point = 5, + humidity_point = 60 }) PyuTest.register_overworld_biome("meadow", PyuTest.BIOME_TYPES.NORMAL, { @@ -310,137 +417,9 @@ PyuTest.register_overworld_biome("meadow", PyuTest.BIOME_TYPES.NORMAL, { y_max = PyuTest.BIOME_TOPS.mountains, y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - heat_point = 52, - humidity_point = 83, + heat_point = 50, + humidity_point = 60, _pyutest_biome_flowering = true, _pyutest_biome_flowering_extra = true }) - -PyuTest.register_overworld_biome("snowy_forest", PyuTest.BIOME_TYPES.COLD, { - node_dust = "pyutest_blocks:snow_carpet", - node_top = "pyutest_blocks:snow_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - node_water_top = "pyutest_blocks:ice_block", - depth_water_top = 5, - - heat_point = 8, - humidity_point = 69 -}) - -PyuTest.register_overworld_biome("savanna", PyuTest.BIOME_TYPES.WARM, { - node_top = "pyutest_grass:savanna_grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.grassland, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 72, - humidity_point = 9 -}) - -PyuTest.register_overworld_biome("taiga", PyuTest.BIOME_TYPES.CHILLY, { - node_top = "pyutest_grass:dark_grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 28, - humidity_point = 72, - - _pyutest_biome_flowering = true -}) - -PyuTest.register_overworld_biome("birch_forest", PyuTest.BIOME_TYPES.NORMAL, { - node_top = "pyutest_grass:grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 48, - humidity_point = 85, - - _pyutest_biome_flowering = true -}) - -PyuTest.register_overworld_biome("cherry_grove", PyuTest.BIOME_TYPES.NORMAL, { - node_top = "pyutest_grass:grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 52, - humidity_point = 78, - - _pyutest_biome_flowering = true, - _pyutest_biome_flowering_extra = true -}) - -PyuTest.register_overworld_biome("swamp", PyuTest.BIOME_TYPES.WETLAND, { - node_top = "pyutest_grass:swampy_grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.swamp, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 52, - humidity_point = 88, -}) - -PyuTest.register_overworld_biome("old_growth_birch_forest", PyuTest.BIOME_TYPES.NORMAL, { - node_top = "pyutest_grass:grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 47, - humidity_point = 73, - - _pyutest_biome_flowering = true, - _pyutest_biome_flowering_extra = true -}) - -PyuTest.register_overworld_biome("aspen_forest", PyuTest.BIOME_TYPES.CHILLY, { - node_top = "pyutest_grass:aspen_grass_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 25, - humidity_point = 63, - - _pyutest_biome_flowering = true -}) - -PyuTest.register_overworld_biome("redwood_forest", PyuTest.BIOME_TYPES.CHILLY, { - node_top = "pyutest_blocks:podzol_block", - node_filler = "pyutest_blocks:podzol_block", - - y_max = PyuTest.BIOME_TOPS.forest, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 21, - humidity_point = 65, - - _pyutest_biome_flowering = true -}) - -PyuTest.register_overworld_biome("large_mushroom_forest", PyuTest.BIOME_TYPES.NORMAL, { - node_top = "pyutest_blocks:mycelium_block", - node_filler = "pyutest_blocks:dirt_block", - - y_max = PyuTest.BIOME_TOPS.mushroom_fields, - y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM, - - heat_point = 53, - humidity_point = 98 -}) diff --git a/mods/MAPGEN/pyutest_mapgen/init.lua b/mods/WORLD/pyutest_mapgen/init.lua similarity index 87% rename from mods/MAPGEN/pyutest_mapgen/init.lua rename to mods/WORLD/pyutest_mapgen/init.lua index 12528c0..d188f74 100644 --- a/mods/MAPGEN/pyutest_mapgen/init.lua +++ b/mods/WORLD/pyutest_mapgen/init.lua @@ -2,6 +2,7 @@ local modpath = minetest.get_modpath("pyutest_mapgen") dofile(modpath.."/api.lua") dofile(modpath.."/mapgen.lua") +dofile(modpath.."/biomes.lua") if not PyuTest.is_flat() then dofile(modpath.."/structures.lua") diff --git a/mods/WORLD/pyutest_mapgen/mapgen.lua b/mods/WORLD/pyutest_mapgen/mapgen.lua new file mode 100644 index 0000000..22ea85e --- /dev/null +++ b/mods/WORLD/pyutest_mapgen/mapgen.lua @@ -0,0 +1,25 @@ +minetest.register_alias("mapgen_stone", "pyutest_blocks:stone_block") +minetest.register_alias("mapgen_water_source", "pyutest_blocks:water_source") +minetest.register_alias("mapgen_river_water_source", "pyutest_blocks:water_source") +minetest.register_alias("mapgen_lava_source", "pyutest_blocks:lava_source") +minetest.register_alias("mapgen_singlenode", "air") + +local mg_flags = minetest.settings:get_flags("mg_flags") +local mg_name = minetest.get_mapgen_setting("mg_name") +minetest.set_mapgen_setting(string.format("mg%s_cavern_threshold", mg_name), "0.20", true) + +mg_flags.caverns = true +mg_flags.dungeons = false + +-- https://git.minetest.land/VoxeLibre/VoxeLibre/src/branch/master/mods/MAPGEN/mcl_mapgen_core/init.lua#L127 +local mg_flags_str = "" +for k,v in pairs(mg_flags) do + if v == false then + k = "no" .. k + end + mg_flags_str = mg_flags_str .. k .. "," +end +if string.len(mg_flags_str) > 0 then + mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str)-1) +end +minetest.set_mapgen_setting("mg_flags", mg_flags_str, true) diff --git a/mods/MAPGEN/pyutest_mapgen/mod.conf b/mods/WORLD/pyutest_mapgen/mod.conf similarity index 100% rename from mods/MAPGEN/pyutest_mapgen/mod.conf rename to mods/WORLD/pyutest_mapgen/mod.conf diff --git a/mods/MAPGEN/pyutest_mapgen/structures.lua b/mods/WORLD/pyutest_mapgen/structures.lua similarity index 100% rename from mods/MAPGEN/pyutest_mapgen/structures.lua rename to mods/WORLD/pyutest_mapgen/structures.lua diff --git a/mods/MAPGEN/pyutest_mapgen/trees.lua b/mods/WORLD/pyutest_mapgen/trees.lua similarity index 100% rename from mods/MAPGEN/pyutest_mapgen/trees.lua rename to mods/WORLD/pyutest_mapgen/trees.lua diff --git a/mods/MAPGEN/pyutest_ores/init.lua b/mods/WORLD/pyutest_ores/init.lua similarity index 100% rename from mods/MAPGEN/pyutest_ores/init.lua rename to mods/WORLD/pyutest_ores/init.lua diff --git a/mods/WORLD/pyutest_ores/mod.conf b/mods/WORLD/pyutest_ores/mod.conf new file mode 100644 index 0000000..d3c5936 --- /dev/null +++ b/mods/WORLD/pyutest_ores/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks diff --git a/mods/MAPGEN/pyutest_worlds/api.lua b/mods/WORLD/pyutest_worlds/api.lua similarity index 69% rename from mods/MAPGEN/pyutest_worlds/api.lua rename to mods/WORLD/pyutest_worlds/api.lua index 465e626..ecc9dbf 100644 --- a/mods/MAPGEN/pyutest_worlds/api.lua +++ b/mods/WORLD/pyutest_worlds/api.lua @@ -92,33 +92,58 @@ PyuTest.register_world = function (options) on_use = function (itemstack, user, pointed_thing) local pos = user:get_pos() local npos = vector.new(pos.x, average, pos.y) - minetest.do_item_eat(0, "", itemstack, user, pointed_thing) local range = 1 + itemstack:take_item() user:set_pos(npos) minetest.sound_play({name = "spellbook_action", gain = 1}, {pos = npos}) - -- Spent hours trying to get this to work using mapblocks, just resorted to waiting a second. - minetest.after(1.2, function () - PyuTest.dorange(npos, range, function (p) - minetest.remove_node(p) - end) + local min = npos - vector.new(range, range, range) + local max = npos + vector.new(range, range, range) - for dx = -range, range do - for dz = -range, range do - minetest.set_node(npos + vector.new(dx, -2, dz), { - name = "pyutest_blocks:obsidian_block" - }) + local c_air = minetest.get_content_id("air") + local c_obsidian = minetest.get_content_id("pyutest_blocks:obsidian_block") + local vm = minetest.get_voxel_manip() + local emin, emax = vm:read_from_map(min, max) + local a = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + + local center + for x = emin.x, emax.x do + for y = emin.y, emax.y do + for z = emin.z, emax.z do + local vi = a:index(x, y, z) + + if data[vi] ~= c_air then + data[vi] = c_air + end + + if y == emin.y then + data[vi] = c_obsidian + end end end + end - minetest.set_node(npos + vector.new(0, -1, 0), { - name = "pyutest_blocks:light" - }) + vm:set_data(data) + vm:write_to_map(true) - user:set_pos(npos) - end) + local ax = (emax.x + emin.x) / 2 + local az = (emax.z + emin.z) / 2 + local p = vector.new(ax, emin.y + 1, az) + + + minetest.set_node(p, { + name = "pyutest_blocks:light" + }) + + user:set_pos(p) + + return itemstack end }) diff --git a/mods/MAPGEN/pyutest_worlds/ice.lua b/mods/WORLD/pyutest_worlds/ice.lua similarity index 100% rename from mods/MAPGEN/pyutest_worlds/ice.lua rename to mods/WORLD/pyutest_worlds/ice.lua diff --git a/mods/MAPGEN/pyutest_worlds/init.lua b/mods/WORLD/pyutest_worlds/init.lua similarity index 100% rename from mods/MAPGEN/pyutest_worlds/init.lua rename to mods/WORLD/pyutest_worlds/init.lua diff --git a/mods/MAPGEN/pyutest_worlds/lava.lua b/mods/WORLD/pyutest_worlds/lava.lua similarity index 100% rename from mods/MAPGEN/pyutest_worlds/lava.lua rename to mods/WORLD/pyutest_worlds/lava.lua diff --git a/mods/MAPGEN/pyutest_worlds/mod.conf b/mods/WORLD/pyutest_worlds/mod.conf similarity index 100% rename from mods/MAPGEN/pyutest_worlds/mod.conf rename to mods/WORLD/pyutest_worlds/mod.conf diff --git a/mods/MAPGEN/pyutest_worlds/mushroom.lua b/mods/WORLD/pyutest_worlds/mushroom.lua similarity index 100% rename from mods/MAPGEN/pyutest_worlds/mushroom.lua rename to mods/WORLD/pyutest_worlds/mushroom.lua diff --git a/mods/MAPGEN/pyutest_worlds/slime.lua b/mods/WORLD/pyutest_worlds/slime.lua similarity index 100% rename from mods/MAPGEN/pyutest_worlds/slime.lua rename to mods/WORLD/pyutest_worlds/slime.lua diff --git a/textures/pyutest-lilypad.png b/textures/pyutest-lilypad.png index 705b70d..14100a5 100644 Binary files a/textures/pyutest-lilypad.png and b/textures/pyutest-lilypad.png differ