From c292a0a345cd00d102e068587b4527b758ebf5c1 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 16 Aug 2024 11:05:33 +0100 Subject: [PATCH] Tidy and tweak with minetest 5.1 as base --- README.md | 1 + biomes.lua | 92 +++-------- biomes_init.lua | 31 ++-- compatibility.lua | 8 +- crystal.lua | 143 +++++++---------- decor.lua | 400 ++++++++++++++++++++++++---------------------- dirt.lua | 93 ++++------- extra.lua | 86 ++++++---- fences.lua | 16 +- fishing.lua | 117 +++++--------- flight.lua | 66 ++++---- food.lua | 160 ++++++++++++------- init.lua | 32 ++-- leaves.lua | 151 ++++++++--------- lucky_block.lua | 6 + mod.conf | 2 +- onion.lua | 30 ++-- ores.lua | 19 ++- plantlife.lua | 79 +++++---- sapling.lua | 146 +++++++---------- schems.lua | 72 ++++++--- sealife.lua | 107 +++++-------- stairs.lua | 84 +++------- strawberry.lua | 29 ++-- water.lua | 28 ++-- wood.lua | 12 +- 26 files changed, 929 insertions(+), 1081 deletions(-) diff --git a/README.md b/README.md index f1fc871..07942a1 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ who helped make this mod bigger and better throughout it's release :) - Add {eatable} groups to food items - Use underground decoration placement for illumishrooms to improve performance - Use worldalign textures for stairs + - Tidy and tweak code to run on Minetest 5.1 and above ### 1.31 - Fix fishing biome checks diff --git a/biomes.lua b/biomes.lua index b212624..ac2189d 100644 --- a/biomes.lua +++ b/biomes.lua @@ -1,40 +1,9 @@ -local S = ethereal.translate - - --- Blue Marble Nodes -minetest.register_node("ethereal:blue_marble", { - description = S("Blue Marble"), - tiles = {"ethereal_blue_marble.png"}, - groups = {cracky = 1, stone = 1}, - sounds = default.node_sound_stone_defaults() -}) - -minetest.register_node("ethereal:blue_marble_tile", { - description = S("Blue Marble Tile"), - tiles = {"ethereal_blue_marble_tile.png"}, - groups = {cracky = 1, stone = 1}, - sounds = default.node_sound_stone_defaults() -}) - -minetest.register_craft({ - output = "ethereal:blue_marble_tile 9", - recipe = { - {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"}, - {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"}, - {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"} - } -}) - - --- helper strings -local tmp, tmp2 - -- helper function -local add_biome = function(a, l, m, n, o, p, b, c, d, e, f, g, nd, na, ns) - -- if not 1 then biome disabled, don't add - if p ~= 1 then return end +local function add_biome(a, l, m, n, o, p, b, c, d, e, f, g, nd, na, ns) + + if p ~= 1 then return end -- if not 1 then biome disabled minetest.register_biome({ name = a, @@ -59,8 +28,8 @@ local add_biome = function(a, l, m, n, o, p, b, c, d, e, f, g, nd, na, ns) }) end - -- always registered biomes + add_biome("mountain", 140, 31000, 50, 50, 1, nil, "default:snow", 1, "default:snowblock", 2) @@ -85,19 +54,18 @@ minetest.register_biome({ --add_biome("underground", -31000, -192, 50, 50, 1, -- nil, nil, nil, nil, nil) - -- biomes with disable setting -tmp = "default:desert_stone" add_biome("desert", 3, 23, 35, 20, ethereal.desert, - nil, "default:desert_sand", 1, "default:desert_sand", 3, tmp, + nil, "default:desert_sand", 1, "default:desert_sand", 3, "default:desert_stone", "default:desert_stone", nil, "stairs:stair_desert_stone") add_biome("desert_ocean", -192, 3, 35, 20, ethereal.desert, - nil, "default:sand", 1, "default:sand", 2, tmp, + nil, "default:sand", 1, "default:sand", 2, "default:desert_stone", "default:desert_stone", nil, "stairs:stair_desert_stone") if ethereal.desert then + minetest.register_biome({ name = "desert_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -127,21 +95,15 @@ add_biome("mesa", 1, 71, 25, 28, ethereal.mesa, add_biome("mesa_ocean", -192, 2, 25, 28, ethereal.mesa, nil, "default:sand", 1, "default:sand", 2) - -tmp = "default:dirt_with_coniferous_litter" - -if not minetest.registered_nodes[tmp] then - tmp = "ethereal:cold_dirt" -end - -- was 'snowy' biome add_biome("coniferous_forest", 5, 40, 10, 40, ethereal.snowy, - nil, tmp, 1, "default:dirt", 2) + nil, "default:dirt_with_coniferous_litter", 1, "default:dirt", 2) add_biome("coniferous_forest_ocean", -192, 1, 10, 40, (ethereal.snowy or ethereal.frost), nil, "default:silver_sand", 1, "default:sand", 2) if ethereal.snowy then + minetest.register_biome({ name = "coniferous_forest_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -159,6 +121,7 @@ add_biome("taiga", 40, 140, 10, 40, ethereal.alpine, nil, "default:dirt_with_snow", 1, "default:dirt", 2) if ethereal.alpine then + minetest.register_biome({ name = "taiga_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -186,6 +149,7 @@ add_biome("deciduous_forest_ocean", -31000, 3, 13, 40, ethereal.grassy, nil, "default:sand", 2, "default:gravel", 1) if ethereal.grassy then + minetest.register_biome({ name = "deciduous_forest_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -202,20 +166,14 @@ end add_biome("caves", 4, 41, 15, 25, ethereal.caves, nil, "default:desert_stone", 3, "air", 8) - -tmp = "default:silver_sand" - -if not minetest.registered_nodes[tmp] then - tmp = "default:sand" -end - add_biome("grayness", 2, 41, 15, 30, ethereal.grayness, nil, "ethereal:gray_dirt", 1, "default:dirt", 3) add_biome("grayness_ocean", -18, 2, 15, 30, ethereal.grayness, - nil, tmp, 2, "default:sand", 2, "ethereal:blue_marble") + nil, "default:silver_sand", 2, "default:sand", 2, "ethereal:blue_marble") if ethereal.grayness then + minetest.register_biome({ name = "grayness_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -249,19 +207,14 @@ add_biome("jumble", 1, 71, 25, 50, ethereal.jumble, add_biome("jumble_ocean", -192, 1, 25, 50, ethereal.jumble, nil, "default:sand", 1, "default:sand", 2) -tmp = "default:dirt_with_rainforest_litter" - -if not minetest.registered_nodes[tmp] then - tmp = "ethereal:jungle_dirt" -end - add_biome("junglee", 1, 71, 30, 60, ethereal.junglee, - nil, tmp, 1, "default:dirt", 3) + nil, "default:dirt_with_rainforest_litter", 1, "default:dirt", 3) add_biome("junglee_ocean", -192, 2, 30, 60, ethereal.junglee, nil, "default:sand", 1, "default:sand", 2) if ethereal.junglee then + minetest.register_biome({ name = "junglee_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -302,6 +255,7 @@ add_biome("sandstone_desert_ocean", -192, 2, 50, 20, ethereal.sandstone, "default:sandstone", nil, "stairs:stair_sandstone") if ethereal.sandstone then + minetest.register_biome({ name = "sandstone_desert_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -325,21 +279,14 @@ add_biome("plains", 3, 25, 65, 25, ethereal.plains, add_biome("plains_ocean", -192, 2, 55, 25, ethereal.plains, nil, "default:sand", 1, "default:sand", 2) -tmp = "default:dry_dirt_with_dry_grass" -tmp2 = "default:dry_dirt" - -if not minetest.registered_nodes[tmp] then - tmp = "default:dirt_with_dry_grass" - tmp2 = "default:dirt" -end - add_biome("savanna", 3, 50, 55, 25, ethereal.savanna, - nil, tmp, 1, tmp2, 3) + nil, "default:dry_dirt_with_dry_grass", 1, "default:dry_dirt", 3) add_biome("savanna_ocean", -192, 2, 55, 25, ethereal.savanna, nil, "default:sand", 1, "default:sand", 2) if ethereal.savanna then + minetest.register_biome({ name = "savanna_under", node_cave_liquid = {"default:water_source", "default:lava_source"}, @@ -363,6 +310,7 @@ add_biome("fiery_ocean", -192, 2, 75, 10, ethereal.fiery, nil, "default:sand", 1, "default:sand", 2) if ethereal.fiery then + minetest.register_biome({ name = "fiery_under", node_cave_liquid = {"default:lava_source"}, @@ -437,7 +385,7 @@ if ethereal.glacier == 1 then end -if ethereal.tundra == 1 and minetest.registered_nodes["default:permafrost"] then +if ethereal.tundra == 1 then minetest.register_biome({ name = "tundra_highland", diff --git a/biomes_init.lua b/biomes_init.lua index ff8aee2..3420d05 100644 --- a/biomes_init.lua +++ b/biomes_init.lua @@ -1,24 +1,29 @@ + +-- storage tables + local old_biomes = {} local old_decor = {} +-- backup registered biomes --- backup registered biome data for key, def in pairs(minetest.registered_biomes) do old_biomes[key] = def end +-- backup registered decorations + for key, def in pairs(minetest.registered_decorations) do old_decor[key] = def end - -- clear current biome data + minetest.clear_registered_biomes() minetest.clear_registered_decorations() -- minetest.clear_registered_ores() - -- create list of default biomes to remove + local def_biomes = { ["rainforest_swamp"] = 1, ["grassland_dunes"] = 1, @@ -65,17 +70,15 @@ local def_biomes = { ["coniferous_forest"] = 1 } - -- only re-register biomes that aren't on the list + for key, def in pairs(old_biomes) do - if not def_biomes[key] then - minetest.register_biome(def) - end + if not def_biomes[key] then minetest.register_biome(def) end end - -- loop through decorations + for key, def in pairs(old_decor) do local can_add = true @@ -86,15 +89,11 @@ for key, def in pairs(old_decor) do -- loop through decoration biomes, only re-add one's not on above list for num, bio in pairs(def.biomes) do - if not def_biomes[bio] then - table.insert(new_biomes, bio) - end + if not def_biomes[bio] then table.insert(new_biomes, bio) end end -- if no biomes are left on new list, do not re-add decoration - if #new_biomes == 0 then - can_add = false - end + if #new_biomes == 0 then can_add = false end elseif type(def.biomes) == "string" then @@ -104,9 +103,7 @@ for key, def in pairs(old_decor) do new_biomes = {def.biomes} -- convert to table end - elseif not def.biomes then - new_biomes = nil -- keep it nil for re-adding - end + elseif not def.biomes then new_biomes = nil end -- keep it nil for re-adding if can_add == true then diff --git a/compatibility.lua b/compatibility.lua index da49bec..5dcffb3 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -1,5 +1,6 @@ --- add compatibility for ethereal nodes already in default game or name changed +-- add compatibility for ethereal nodes already added to default game or name changed + minetest.register_alias("ethereal:acacia_trunk", "default:acacia_tree") minetest.register_alias("ethereal:acacia_wood", "default:acacia_wood") @@ -44,8 +45,3 @@ minetest.register_alias("ethereal:tree_sapling", "default:sapling") minetest.register_alias("ethereal:jungle_tree_sapling", "default:junglesapling") minetest.register_alias("ethereal:acacia_sapling", "default:acacia_sapling") minetest.register_alias("ethereal:pine_tree_sapling", "default:pine_sapling") - --- check if pine bush stem exists, if not create alias -if not minetest.registered_nodes["default:pine_bush_stem"] then - minetest.register_alias("default:pine_bush_stem", "default:wood") -end diff --git a/crystal.lua b/crystal.lua index 30eb8c5..017579c 100644 --- a/crystal.lua +++ b/crystal.lua @@ -1,8 +1,26 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") +-- Crystal Ingot and recipe + +minetest.register_craftitem("ethereal:crystal_ingot", { + description = S("Crystal Ingot"), + inventory_image = "ethereal_crystal_ingot.png", + wield_image = "ethereal_crystal_ingot.png" +}) + +minetest.register_craft({ + output = "ethereal:crystal_ingot", + recipe = { + {"default:mese_crystal", "ethereal:crystal_spike"}, + {"ethereal:crystal_spike", "default:mese_crystal"}, + {"bucket:bucket_water", ""} + }, + replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} +}) -- Crystal Spike (Hurts if you touch it) + minetest.register_node("ethereal:crystal_spike", { description = S("Crystal Spike"), drawtype = "plantlike", @@ -21,83 +39,55 @@ minetest.register_node("ethereal:crystal_spike", { }, node_box = { type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0, 5 / 16} - } -}) + }, + dropped_step = function(self, pos, dtime) -- custom function for builtin_item use --- Crystal Ingot -minetest.register_craftitem("ethereal:crystal_ingot", { - description = S("Crystal Ingot"), - inventory_image = "ethereal_crystal_ingot.png", - wield_image = "ethereal_crystal_ingot.png" -}) + self.ctimer = (self.ctimer or 0) + dtime + if self.ctimer < 5.0 then return end -- 5 second timer + self.ctimer = 0 --- Check for builtin_item mod and add custom drop code to crystal spikes -if minetest.get_modpath("builtin_item") then + if self.node_inside and self.node_inside.name ~= "default:water_source" then + return + end - minetest.override_item("ethereal:crystal_spike", { + local objs = minetest.get_objects_inside_radius(pos, 0.8) - dropped_step = function(self, pos, dtime) + if not objs or #objs ~= 2 then return end - self.ctimer = (self.ctimer or 0) + dtime - if self.ctimer < 5.0 then return end - self.ctimer = 0 + local crystal, mese, ent = nil, nil, nil - if self.node_inside - and self.node_inside.name ~= "default:water_source" then - return - end + for k, obj in pairs(objs) do - local objs = minetest.get_objects_inside_radius(pos, 0.8) + ent = obj:get_luaentity() - if not objs or #objs ~= 2 then return end + if ent and ent.name == "__builtin:item" then - local crystal, mese, ent = nil, nil, nil + if ent.itemstring == "default:mese_crystal 2" and not mese then - for k, obj in pairs(objs) do + mese = obj - ent = obj:get_luaentity() + elseif ent.itemstring == "ethereal:crystal_spike 2" and not crystal then - if ent and ent.name == "__builtin:item" then - - if ent.itemstring == "default:mese_crystal 2" - and not mese then - - mese = obj - - elseif ent.itemstring == "ethereal:crystal_spike 2" - and not crystal then - - crystal = obj - end + crystal = obj end end - - if mese and crystal then - - mese:remove() - crystal:remove() - - minetest.add_item(pos, "ethereal:crystal_ingot") - - return false - end end - }) -end -minetest.register_craft({ - output = "ethereal:crystal_ingot", - recipe = { - {"default:mese_crystal", "ethereal:crystal_spike"}, - {"ethereal:crystal_spike", "default:mese_crystal"}, - {"bucket:bucket_water", ""} - }, - replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} + if mese and crystal then + + mese:remove() + crystal:remove() + + minetest.add_item(pos, "ethereal:crystal_ingot") + + return false + end + end }) +-- Crystal Block and recipe --- Crystal Block minetest.register_node("ethereal:crystal_block", { description = S("Crystal Block"), tiles = {"ethereal_crystal_block.png"}, @@ -121,8 +111,8 @@ minetest.register_craft({ recipe = {{"ethereal:crystal_block"}} }) - -- Crystal Sword (Powerful wee beastie) + minetest.register_tool("ethereal:sword_crystal", { description = S("Crystal Sword"), inventory_image = "ethereal_crystal_sword.png", @@ -132,9 +122,7 @@ minetest.register_tool("ethereal:sword_crystal", { max_drop_level = 1, groupcaps = { snappy = { - times = {[1] = 1.70, [2] = 0.70, [3] = 0.25}, - uses = 50, - maxlevel = 3 + times = {[1] = 1.70, [2] = 0.70, [3] = 0.25}, uses = 50, maxlevel = 3 } }, damage_groups = {fleshy = 10} @@ -152,8 +140,8 @@ minetest.register_craft({ } }) - -- Crystal Axe + minetest.register_tool("ethereal:axe_crystal", { description = S("Crystal Axe"), inventory_image = "ethereal_crystal_axe.png", @@ -163,9 +151,7 @@ minetest.register_tool("ethereal:axe_crystal", { max_drop_level = 1, groupcaps = { choppy = { - times = {[1] = 2.00, [2] = 0.80, [3] = 0.40}, - uses = 40, - maxlevel = 3 + times = {[1] = 2.00, [2] = 0.80, [3] = 0.40}, uses = 40, maxlevel = 3 } }, damage_groups = {fleshy = 7} @@ -192,8 +178,8 @@ minetest.register_craft({ } }) - -- Crystal Pick (This will last a while) + minetest.register_tool("ethereal:pick_crystal", { description = S("Crystal Pickaxe"), inventory_image = "ethereal_crystal_pick.png", @@ -203,9 +189,7 @@ minetest.register_tool("ethereal:pick_crystal", { max_drop_level = 3, groupcaps={ cracky = { - times = {[1] = 1.8, [2] = 0.8, [3] = 0.40}, - uses = 40, - maxlevel = 3 + times = {[1] = 1.8, [2] = 0.8, [3] = 0.40}, uses = 40, maxlevel = 3 } }, damage_groups = {fleshy = 6} @@ -223,8 +207,8 @@ minetest.register_craft({ } }) +-- backup old function and replace with new silk touch ability for crystal shovel --- dig override for crystal shovel's silk touch ability local old_handle_node_drops = minetest.handle_node_drops function minetest.handle_node_drops(pos, drops, digger) @@ -245,6 +229,8 @@ function minetest.handle_node_drops(pos, drops, digger) return old_handle_node_drops(pos, {ItemStack(nn)}, digger) end +-- Crystal Shovel + minetest.register_tool("ethereal:shovel_crystal", { description = S("Crystal Shovel"), inventory_image = "ethereal_crystal_shovel.png", @@ -254,9 +240,7 @@ minetest.register_tool("ethereal:shovel_crystal", { max_drop_level = 1, groupcaps = { crumbly = { - times = {[1] = 1.10, [2] = 0.50, [3] = 0.30}, - uses = 30, - maxlevel = 3 + times = {[1] = 1.10, [2] = 0.50, [3] = 0.30}, uses = 30, maxlevel = 3 } }, damage_groups = {fleshy = 4} @@ -274,8 +258,8 @@ minetest.register_craft({ } }) - -- Crystal Gilly Staff (replenishes air supply when used) + minetest.register_tool("ethereal:crystal_gilly_staff", { description = S("Crystal Gilly Staff"), inventory_image = "ethereal_crystal_gilly_staff.png", @@ -283,9 +267,7 @@ minetest.register_tool("ethereal:crystal_gilly_staff", { on_use = function(itemstack, user, pointed_thing) - if user and user:get_breath() < 10 then - user:set_breath(10) - end + if user and user:get_breath() < 10 then user:set_breath(10) end end }) @@ -298,12 +280,11 @@ minetest.register_craft({ }, }) +-- Add Toolranks mod support --- Add [toolranks] mod support if found if minetest.get_modpath("toolranks") then - -- Helper function - local function add_tool(name, desc, afteruse) + local function add_tool(name, desc, afteruse) -- helper function minetest.override_item(name, { original_description = desc, diff --git a/decor.lua b/decor.lua index 7ef39cc..31a2c48 100644 --- a/decor.lua +++ b/decor.lua @@ -1,4 +1,6 @@ +-- wild cotton added in 5.3.0 + if minetest.registered_nodes["farming:cotton_wild"] then minetest.register_decoration({ @@ -21,69 +23,67 @@ if minetest.registered_nodes["farming:cotton_wild"] then }) end --- water pools in swamp areas if 5.0 detected -if minetest.registered_nodes["default:permafrost"] then +-- water pools in swamp areas - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - place_offset_y = -1, - sidelen = 16, - fill_ratio = 0.01, - biomes = {"swamp"}, - y_max = 2, - y_min = 1, - flags = "force_placement", - decoration = "default:water_source", - spawn_by = "default:dirt_with_grass", - num_spawn_by = 8 - }) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + place_offset_y = -1, + sidelen = 16, + fill_ratio = 0.01, + biomes = {"swamp"}, + y_max = 2, + y_min = 1, + flags = "force_placement", + decoration = "default:water_source", + spawn_by = "default:dirt_with_grass", + num_spawn_by = 8 +}) - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - place_offset_y = -1, - sidelen = 16, - fill_ratio = 0.1, - biomes = {"swamp"}, - y_max = 2, - y_min = 1, - flags = "force_placement", - decoration = "default:water_source", - spawn_by = {"default:dirt_with_grass", "default:water_source"}, - num_spawn_by = 8 - }) -end +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + place_offset_y = -1, + sidelen = 16, + fill_ratio = 0.1, + biomes = {"swamp"}, + y_max = 2, + y_min = 1, + flags = "force_placement", + decoration = "default:water_source", + spawn_by = {"default:dirt_with_grass", "default:water_source"}, + num_spawn_by = 8 +}) -if minetest.registered_nodes["default:dry_dirt_with_dry_grass"] then - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dry_dirt_with_dry_grass"}, - sidelen = 4, - noise_params = { - offset = -1.5, - scale = -1.5, - spread = {x = 200, y = 200, z = 200}, - seed = 329, - octaves = 4, - persist = 1.0 - }, - biomes = {"savanna"}, - y_max = 31000, - y_min = 1, - decoration = "default:dry_dirt", - place_offset_y = -1, - flags = "force_placement" - }) -end +-- dry dirt patches +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dry_dirt_with_dry_grass"}, + sidelen = 4, + noise_params = { + offset = -1.5, + scale = -1.5, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 4, + persist = 1.0 + }, + biomes = {"savanna"}, + y_max = 31000, + y_min = 1, + decoration = "default:dry_dirt", + place_offset_y = -1, + flags = "force_placement" +}) -- helper string + local tmp --- helper function -local add_node = function(a, b, c, d, e, f, g, h, i, j) +-- decoration helper function + +local function add_deco(a, b, c, d, e, f, g, h, i, j) if j ~= 1 then return end @@ -102,60 +102,65 @@ local add_node = function(a, b, c, d, e, f, g, h, i, j) }) end - --firethorn shrub -add_node({"default:snowblock"}, 0.001, {"glacier"}, 1, 30, + +add_deco({"default:snowblock"}, 0.001, {"glacier"}, 1, 30, {"ethereal:firethorn"}, nil, nil, nil, ethereal.glacier) -- scorched tree -add_node({"ethereal:dry_dirt"}, 0.006, {"plains"}, 1, 100, + +add_deco({"ethereal:dry_dirt"}, 0.006, {"plains"}, 1, 100, {"ethereal:scorched_tree"}, 6, nil, nil, ethereal.plains) -- dry shrub -add_node({"ethereal:dry_dirt"}, 0.015, {"plains"}, 1, 100, + +add_deco({"ethereal:dry_dirt"}, 0.015, {"plains"}, 1, 100, {"default:dry_shrub"}, nil, nil, nil, ethereal.plains) -add_node({"default:sand"}, 0.015, {"deciduous_forest_ocean"}, 1, 100, +add_deco({"default:sand"}, 0.015, {"deciduous_forest_ocean"}, 1, 100, {"default:dry_shrub"}, nil, nil, nil, ethereal.grassy) -add_node({"default:desert_sand"}, 0.015, {"desert"}, 1, 100, +add_deco({"default:desert_sand"}, 0.015, {"desert"}, 1, 100, {"default:dry_shrub"}, nil, nil, nil, ethereal.desert) -add_node({"default:sandstone"}, 0.015, {"sandstone_desert"}, 1, 100, +add_deco({"default:sandstone"}, 0.015, {"sandstone_desert"}, 1, 100, {"default:dry_shrub"}, nil, nil, nil, ethereal.sandstone) -add_node({"bakedclay:red", "bakedclay:orange"}, 0.015, {"mesa"}, 1, 100, +add_deco({"bakedclay:red", "bakedclay:orange"}, 0.015, {"mesa"}, 1, 100, {"default:dry_shrub"}, nil, nil, nil, ethereal.mesa) -- dry grass -add_node({"default:dry_dirt_with_dry_grass", + +add_deco({"default:dry_dirt_with_dry_grass", "default:dirt_with_dry_grass"}, 0.25, {"savanna"}, 1, 100, {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", "default:dry_grass_5"}, nil, nil, nil, ethereal.savanna) -add_node({"default:dirt_with_dry_grass"}, 0.10, {"mesa"}, 1, 100, +add_deco({"default:dirt_with_dry_grass"}, 0.10, {"mesa"}, 1, 100, {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", "default:dry_grass_5"}, nil, nil, nil, ethereal.mesa) -add_node({"default:desert_stone"}, 0.005, {"caves"}, 5, 40, +add_deco({"default:desert_stone"}, 0.005, {"caves"}, 5, 40, {"default:dry_grass_2", "default:dry_grass_3", "default:dry_shrub"}, nil, nil, nil, ethereal.caves) -- flowers & strawberry -add_node({"default:dirt_with_grass"}, 0.025, {"deciduous_forest"}, 1, 100, + +add_deco({"default:dirt_with_grass"}, 0.025, {"deciduous_forest"}, 1, 100, {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "ethereal:strawberry_7"}, nil, nil, nil, ethereal.grassy) -add_node({"default:dirt_with_grass"}, 0.025, {"grassytwo"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.025, {"grassytwo"}, 1, 100, {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "ethereal:strawberry_7"}, nil, nil, nil, ethereal.grassytwo) -- prairie flowers & strawberry -add_node({"ethereal:prairie_dirt"}, 0.035, {"prairie"}, 1, 100, + +add_deco({"ethereal:prairie_dirt"}, 0.035, {"prairie"}, 1, 100, {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "ethereal:strawberry_7", @@ -163,40 +168,43 @@ add_node({"ethereal:prairie_dirt"}, 0.035, {"prairie"}, 1, 100, ethereal.prairie) -- crystal spike & crystal grass -add_node({"ethereal:crystal_dirt"}, 0.02, {"frost", "frost_floatland"}, 1, 1750, + +add_deco({"ethereal:crystal_dirt"}, 0.02, {"frost", "frost_floatland"}, 1, 1750, {"ethereal:crystal_spike", "ethereal:crystalgrass"}, nil, nil, nil, ethereal.frost) -- red shrub -add_node({"ethereal:fiery_dirt"}, 0.10, {"fiery"}, 1, 100, + +add_deco({"ethereal:fiery_dirt"}, 0.10, {"fiery"}, 1, 100, {"ethereal:dry_shrub"}, nil, nil, nil, ethereal.fiery) -- snowy grass -add_node({"ethereal:gray_dirt"}, 0.05, {"grayness"}, 1, 100, +add_deco({"ethereal:gray_dirt"}, 0.05, {"grayness"}, 1, 100, {"ethereal:snowygrass"}, nil, nil, nil, ethereal.grayness) -add_node({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, 0.05, +add_deco({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, 0.05, {"coniferous_forest"}, 1, 100, {"ethereal:snowygrass"}, nil, nil, nil, ethereal.snowy) -- cactus -add_node({"default:sandstone"}, 0.002, {"sandstone_desert"}, 1, 100, + +add_deco({"default:sandstone"}, 0.002, {"sandstone_desert"}, 1, 100, {"default:cactus"}, 3, nil, nil, ethereal.sandstone) -add_node({"default:desert_sand"}, 0.005, {"desert"}, 1, 100, +add_deco({"default:desert_sand"}, 0.005, {"desert"}, 1, 100, {"default:cactus"}, 4, nil, nil, ethereal.desert) -- spore grass -add_node({"ethereal:mushroom_dirt"}, 0.1, {"mushroom"}, 1, 100, + +add_deco({"ethereal:mushroom_dirt"}, 0.1, {"mushroom"}, 1, 100, {"ethereal:spore_grass"}, nil, nil, nil, ethereal.mushroom) -- red and brown mushrooms + minetest.register_decoration({ deco_type = "simple", place_on = { - "default:dirt_with_rainforest_litter", - "default:dirt_with_grass", - "ethereal:prairie_dirt", - "ethereal:mushroom_dirt" + "default:dirt_with_rainforest_litter", "default:dirt_with_grass", + "ethereal:prairie_dirt", "ethereal:mushroom_dirt" }, sidelen = 16, fill_ratio = 0.01, @@ -209,105 +217,107 @@ minetest.register_decoration({ }) -- jungle grass -add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, + +add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.10, {"junglee"}, 1, 100, {"default:junglegrass"}, nil, nil, nil, ethereal.junglee) -add_node({"default:dirt_with_grass"}, 0.15, {"jumble"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.15, {"jumble"}, 1, 100, {"default:junglegrass"}, nil, nil, nil, ethereal.jumble) -add_node({"default:dirt_with_grass"}, 0.25, {"swamp"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.25, {"swamp"}, 1, 100, {"default:junglegrass"}, nil, nil, nil, ethereal.swamp) -- grass -add_node({"default:dirt_with_grass"}, 0.35, {"deciduous_forest"}, 1, 100, + +add_deco({"default:dirt_with_grass"}, 0.35, {"deciduous_forest"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.grassy) -add_node({"default:dirt_with_grass"}, 0.35, {"grassytwo"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.35, {"grassytwo"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.grassytwo) -add_node({"default:dirt_with_grass"}, 0.35, {"jumble"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.35, {"jumble"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.jumble) -add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, +add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.35, {"junglee"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.junglee) -add_node({"ethereal:prairie_dirt"}, 0.35, {"prairie"}, 1, 100, +add_deco({"ethereal:prairie_dirt"}, 0.35, {"prairie"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.prairie) -add_node({"ethereal:grove_dirt"}, 0.35, {"grove"}, 1, 100, +add_deco({"ethereal:grove_dirt"}, 0.35, {"grove"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.grove) -add_node({"ethereal:grove_dirt"}, 0.35, {"mediterranean"}, 1, 100, +add_deco({"ethereal:grove_dirt"}, 0.35, {"mediterranean"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.mediterranean) -add_node({"ethereal:bamboo_dirt"}, 0.35, {"bamboo"}, 1, 100, +add_deco({"ethereal:bamboo_dirt"}, 0.35, {"bamboo"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.bamboo) -add_node({"default:dirt_with_grass"}, 0.35, {"grassland", "swamp"}, +add_deco({"default:dirt_with_grass"}, 0.35, {"grassland", "swamp"}, 1, 100, {"default:grass_3", "default:grass_4"}, nil, nil, nil, 1) -add_node({"ethereal:bamboo_dirt"}, 0.35, {"sakura"}, 1, 100, +add_deco({"ethereal:bamboo_dirt"}, 0.35, {"sakura"}, 1, 100, {"default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.sakura) -add_node({"ethereal:bamboo_dirt"}, 0.025, {"sakura"}, 1, 100, +add_deco({"ethereal:bamboo_dirt"}, 0.025, {"sakura"}, 1, 100, {"ethereal:lilac"}, nil, nil, nil, ethereal.sakura) --- grass on sand -if minetest.registered_nodes["default:marram_grass_1"] then +-- marram grass - add_node({"default:sand"}, 0.25, {"sandclay"}, 3, 4, {"default:marram_grass_1", - "default:marram_grass_2", "default:marram_grass_3"}, nil, nil, nil, - ethereal.sandclay) -else - add_node({"default:sand"}, 0.25, {"sandclay"}, 3, 4, {"default:grass_2", - "default:grass_3"}, nil, nil, nil, ethereal.sandclay) -end +add_deco({"default:sand"}, 0.25, {"sandclay"}, 3, 4, {"default:marram_grass_1", + "default:marram_grass_2", "default:marram_grass_3"}, nil, nil, nil, + ethereal.sandclay) -- ferns -add_node({"ethereal:grove_dirt"}, 0.2, {"grove"}, 1, 100, {"ethereal:fern"}, + +add_deco({"ethereal:grove_dirt"}, 0.2, {"grove"}, 1, 100, {"ethereal:fern"}, nil, nil, nil, ethereal.grove) -add_node({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 100, {"ethereal:fern"}, nil, nil, nil, ethereal.swamp) -add_node({"ethereal:crystal_dirt"}, 0.001, {"frost_floatlands"}, 1025, 1750, +add_deco({"ethereal:crystal_dirt"}, 0.001, {"frost_floatlands"}, 1025, 1750, {"ethereal:fern"}, nil, nil, nil, ethereal.frost) -- snow -add_node({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, + +add_deco({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, 0.8, {"coniferous_forest"}, 20, 40, {"default:snow"}, nil, nil, nil, ethereal.snowy) -add_node({"default:dirt_with_snow"}, 0.8, {"taiga"}, 40, 140, +add_deco({"default:dirt_with_snow"}, 0.8, {"taiga"}, 40, 140, {"default:snow"}, nil, nil, nil, ethereal.alpine) -- Check onion setting + local abundant = minetest.settings:get_bool("ethereal.abundant_onions") ~= false local onion_rate = abundant and 0.025 or 0.005 -- wild onion -add_node({"default:dirt_with_grass", "ethereal:prairie_dirt"}, onion_rate, + +add_deco({"default:dirt_with_grass", "ethereal:prairie_dirt"}, onion_rate, {"deciduous_forest", "grassytwo", "jumble", "prairie"}, 1, 100, {"ethereal:onion_4"}, nil, nil, nil, 1) -- papyrus -add_node({"default:dirt_with_grass"}, 0.1, {"deciduous_forest"}, 1, 1, + +add_deco({"default:dirt_with_grass"}, 0.1, {"deciduous_forest"}, 1, 1, {"default:papyrus"}, 4, "default:water_source", 1, ethereal.grassy) -add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, +add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.1, {"junglee"}, 1, 1, {"default:papyrus"}, 4, "default:water_source", 1, ethereal.junglee) -add_node({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 1, +add_deco({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 1, {"default:papyrus"}, 4, "default:water_source", 1, ethereal.swamp) --= Farming Redo plants @@ -317,12 +327,14 @@ if farming and farming.mod and farming.mod == "redo" then print ("[MOD] Ethereal - Farming Redo detected and in use") -- potato -add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, + +add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.002, {"junglee"}, 1, 100, {"farming:potato_3"}, nil, nil, nil, ethereal.junglee) -- carrot, cucumber, potato, tomato, corn, coffee, raspberry, rhubarb -add_node({"default:dirt_with_grass"}, 0.002, {"grassytwo"}, 1, 100, + +add_deco({"default:dirt_with_grass"}, 0.002, {"grassytwo"}, 1, 100, {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", @@ -330,66 +342,72 @@ add_node({"default:dirt_with_grass"}, 0.002, {"grassytwo"}, 1, 100, "farming:asparagus"}, nil, nil, nil, ethereal.grassytwo) -add_node({"default:dirt_with_grass"}, 0.002, {"deciduous_forest"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.002, {"deciduous_forest"}, 1, 100, {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", "farming:beetroot_5", "farming:sunflower_8", "farming:eggplant_3"}, nil, nil, nil, ethereal.grassy) -add_node({"default:dirt_with_grass"}, 0.002, {"jumble"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.002, {"jumble"}, 1, 100, {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", "farming:cabbage_6", "farming:lettuce_5", "farming:spinach_3"}, nil, nil, nil, ethereal.jumble) -add_node({"ethereal:prairie_dirt"}, 0.025, {"prairie"}, 1, 100, +add_deco({"ethereal:prairie_dirt"}, 0.025, {"prairie"}, 1, 100, {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:parsley_3", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", "farming:pea_5", "farming:beetroot_5", "farming:sunflower_8"}, nil, nil, nil, ethereal.prairie) -add_node({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 1, 100, +add_deco({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 1, 100, {"farming:parsley_3"}, nil, nil, nil, ethereal.mediterranean) -- melon and pumpkin -add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, + +add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.001, {"junglee"}, 1, 1, {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", 1, ethereal.junglee) -add_node({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 1, +add_deco({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 1, {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", 1, ethereal.grassy) -add_node({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 1, +add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 1, {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", 1, ethereal.grassytwo) -add_node({"default:dirt_with_grass"}, 0.001, {"jumble"}, 1, 1, +add_deco({"default:dirt_with_grass"}, 0.001, {"jumble"}, 1, 1, {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", 1, ethereal.jumble) -- mint -add_node({"default:dirt_with_grass", "default:dirt_with_coniferous_litter", + +add_deco({"default:dirt_with_grass", "default:dirt_with_coniferous_litter", "ethereal:bamboo_dirt"}, 0.005, nil, 1, 75, "farming:mint_4", nil, {"group:water", "group:sand"}, 1, 1) -- green beans -add_node({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, + +add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, {"farming:beanbush"}, nil, nil, nil, ethereal.grassytwo) -- grape bushel -add_node({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, + +add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, {"farming:grapebush"}, nil, nil, nil, ethereal.grassytwo) -add_node({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 100, +add_deco({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 100, {"farming:grapebush"}, nil, nil, nil, ethereal.grassy) -add_node({"ethereal:prairie_dirt"}, 0.001, {"prairie"}, 1, 100, +add_deco({"ethereal:prairie_dirt"}, 0.001, {"prairie"}, 1, 100, {"farming:grapebush"}, nil, nil, nil, ethereal.prairie) +-- chili, garlic, pepper, onion, hemp, soy, ginger + minetest.register_decoration({ deco_type = "simple", place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt", @@ -414,6 +432,8 @@ minetest.register_decoration({ num_spawn_by = 1 }) +-- pineapple,soy + minetest.register_decoration({ deco_type = "simple", place_on = {"default:dirt_with_dry_grass"}, @@ -431,6 +451,8 @@ minetest.register_decoration({ decoration = {"farming:pineapple_8", "farming:soy_5"} }) +-- artichoke + minetest.register_decoration({ deco_type = "simple", place_on = {"ethereal:grove_dirt"}, @@ -451,15 +473,14 @@ minetest.register_decoration({ }) end +-- new flowers from baked clay mod --- is baked clay mod active? add new flowers if so if minetest.get_modpath("bakedclay") then minetest.register_decoration({ deco_type = "simple", place_on = { - "ethereal:prairie_dirt", "default:dirt_with_grass", - "ethereal:grove_dirt" + "ethereal:prairie_dirt", "default:dirt_with_grass", "ethereal:grove_dirt" }, sidelen = 16, noise_params = { @@ -534,6 +555,7 @@ minetest.register_decoration({ }) end +-- blue agave from wine mod if ethereal.desert == 1 and minetest.get_modpath("wine") then @@ -548,7 +570,7 @@ if ethereal.desert == 1 and minetest.get_modpath("wine") then end -if ethereal.snowy == 1 and minetest.registered_nodes["default:fern_1"] then +if ethereal.snowy == 1 then local function register_fern_decoration(seed, length) @@ -577,8 +599,9 @@ if ethereal.snowy == 1 and minetest.registered_nodes["default:fern_1"] then register_fern_decoration(5, 1) end +-- Tundra moss and stones -if ethereal.tundra == 1 and minetest.registered_nodes["default:permafrost"] then +if ethereal.tundra == 1 then -- Tundra moss @@ -628,6 +651,7 @@ if ethereal.tundra == 1 and minetest.registered_nodes["default:permafrost"] then }) end +-- butterflies mod if minetest.get_modpath("butterflies") then @@ -659,12 +683,11 @@ if minetest.get_modpath("butterflies") then }, run_at_every_load = true, - action = function(pos) - minetest.get_node_timer(pos):start(5) - end + action = function(pos) minetest.get_node_timer(pos):start(5) end }) end +-- fireflies mod if minetest.get_modpath("fireflies") then @@ -694,70 +717,65 @@ if minetest.get_modpath("fireflies") then nodenames = {"fireflies:firefly", "fireflies:hidden_firefly"}, run_at_every_load = true, - action = function(pos) - minetest.get_node_timer(pos):start(5) - end + action = function(pos) minetest.get_node_timer(pos):start(5) end }) end +-- Coral Reef --- Coral Reef (Minetest 5.0) -if minetest.registered_nodes["default:coral_green"] then +minetest.register_decoration({ + name = "default:corals", + deco_type = "simple", + place_on = {"default:sand"}, + place_offset_y = -1, + sidelen = 4, + noise_params = { + offset = -4, + scale = 4, + spread = {x = 50, y = 50, z = 50}, + seed = 7013, + octaves = 3, + persist = 0.7, + }, + biomes = {"desert_ocean", "savanna_ocean", "junglee_ocean"}, + y_max = -2, + y_min = -8, + flags = "force_placement", + decoration = { + "default:coral_green", "default:coral_pink", + "default:coral_cyan", "default:coral_brown", + "default:coral_orange", "default:coral_skeleton" + } +}) - minetest.register_decoration({ - name = "default:corals", - deco_type = "simple", - place_on = {"default:sand"}, - place_offset_y = -1, - sidelen = 4, - noise_params = { - offset = -4, - scale = 4, - spread = {x = 50, y = 50, z = 50}, - seed = 7013, - octaves = 3, - persist = 0.7, - }, - biomes = {"desert_ocean", "savanna_ocean", "junglee_ocean"}, - y_max = -2, - y_min = -8, - flags = "force_placement", - decoration = { - "default:coral_green", "default:coral_pink", - "default:coral_cyan", "default:coral_brown", - "default:coral_orange", "default:coral_skeleton" - } - }) - - -- Kelp - - minetest.register_decoration({ - name = "default:kelp", - deco_type = "simple", - place_on = {"default:sand"}, - place_offset_y = -1, - sidelen = 16, - noise_params = { - offset = -0.04, - scale = 0.1, - spread = {x = 200, y = 200, z = 200}, - seed = 87112, - octaves = 3, - persist = 0.7 - }, - biomes = { - "frost_ocean", "deciduous_forest_ocean", "sandstone_ocean", "swamp_ocean"}, - y_max = -5, - y_min = -10, - flags = "force_placement", - decoration = "default:sand_with_kelp", - param2 = 48, - param2_max = 96 - }) -end +-- Kelp +minetest.register_decoration({ + name = "default:kelp", + deco_type = "simple", + place_on = {"default:sand"}, + place_offset_y = -1, + sidelen = 16, + noise_params = { + offset = -0.04, + scale = 0.1, + spread = {x = 200, y = 200, z = 200}, + seed = 87112, + octaves = 3, + persist = 0.7 + }, + biomes = { + "frost_ocean", "deciduous_forest_ocean", "sandstone_ocean", "swamp_ocean"}, + y_max = -5, + y_min = -10, + flags = "force_placement", + decoration = "default:sand_with_kelp", + param2 = 48, + param2_max = 96 +}) -- illumishrooms using underground decoration placement + local function add_illumishroom(low, high, nodename) minetest.register_decoration({ diff --git a/dirt.lua b/dirt.lua index 73ef7c9..0b80f8c 100644 --- a/dirt.lua +++ b/dirt.lua @@ -1,14 +1,16 @@ -local S = ethereal.translate - +local S = minetest.get_translator("ethereal") -- override default dirt (to stop caves cutting away dirt) + minetest.override_item("default:dirt", {is_ground_content = ethereal.cavedirt}) +-- replace old green_dirt with default grass + minetest.register_alias("ethereal:green_dirt", "default:dirt_with_grass") - -- dry dirt + minetest.register_node("ethereal:dry_dirt", { description = S("Dried Dirt"), tiles = {"ethereal_dry_dirt.png"}, @@ -24,12 +26,14 @@ minetest.register_craft({ cooktime = 3, }) +-- ethereal dirt types --- register ethereal dirt types local dirts = { "Bamboo", "Jungle", "Grove", "Prairie", "Cold", "Crystal", "Mushroom", "Fiery", "Gray" } +-- loop through and register dirts + for n = 1, #dirts do local desc = dirts[n] @@ -38,8 +42,7 @@ for n = 1, #dirts do minetest.register_node("ethereal:" .. name .. "_dirt", { description = S(desc .. " Dirt"), tiles = { - "ethereal_grass_" .. name .. "_top.png", - "default_dirt.png", + "ethereal_grass_" .. name .. "_top.png", "default_dirt.png", { name = "default_dirt.png^ethereal_grass_" .. name .. "_side.png", tileable_vertical = false @@ -59,23 +62,18 @@ for n = 1, #dirts do }) end - -- flower spread, also crystal and fire flower regeneration + local flower_spread = function(pos, node) - if (minetest.get_node_light(pos) or 0) < 13 then - return - end + if (minetest.get_node_light(pos) or 0) < 13 then return end local pos0 = {x = pos.x - 4, y = pos.y - 2, z = pos.z - 4} local pos1 = {x = pos.x + 4, y = pos.y + 2, z = pos.z + 4} - local num = #minetest.find_nodes_in_area(pos0, pos1, "group:flora") -- stop flowers spreading too much just below top of map block - if minetest.find_node_near(pos, 2, "ignore") then - return - end + if minetest.find_node_near(pos, 2, "ignore") then return end if num > 3 and node.name == "ethereal:crystalgrass" then @@ -135,8 +133,7 @@ local flower_spread = function(pos, node) return end - local seedling = minetest.find_nodes_in_area_under_air( - pos0, pos1, {under.name}) + local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, {under.name}) if #seedling > 0 then @@ -144,16 +141,14 @@ local flower_spread = function(pos, node) pos.y = pos.y + 1 - if (minetest.get_node_light(pos) or 0) < 13 then - return - end + if (minetest.get_node_light(pos) or 0) < 13 then return end minetest.swap_node(pos, {name = node.name}) end end - -- grow papyrus up to 4 high and bamboo up to 8 high + local grow_papyrus = function(pos, node) local oripos = pos.y @@ -165,32 +160,24 @@ local grow_papyrus = function(pos, node) if not nod or minetest.get_item_group(nod.name, "soil") < 1 - or minetest.find_node_near(pos, 3, {"group:water"}) == nil then - return - end + or minetest.find_node_near(pos, 3, {"group:water"}) == nil then return end - if node.name == "ethereal:bamboo" then - high = 8 - end + if node.name == "ethereal:bamboo" then high = 8 end pos.y = pos.y + 1 local height = 0 - while height < high - and minetest.get_node(pos).name == node.name do + while height < high and minetest.get_node(pos).name == node.name do height = height + 1 pos.y = pos.y + 1 end nod = minetest.get_node_or_nil(pos) - if nod - and nod.name == "air" - and height < high then + if nod and nod.name == "air" and height < high then - if node.name == "ethereal:bamboo" - and height == (high - 1) then + if node.name == "ethereal:bamboo" and height == (high - 1) then ethereal.grow_bamboo_tree({x = pos.x, y = oripos, z = pos.z}) else @@ -201,11 +188,10 @@ local grow_papyrus = function(pos, node) end -- override abm function + local function override_abm(name, redef) - if not name or not redef then - return - end + if not name or not redef then return end for _, ab in pairs(minetest.registered_abms) do @@ -241,8 +227,8 @@ override_abm("Mushroom spread", { nodenames = {"group:mushroom"} }) +-- Add Red, Orange and Grey baked clay if mod isn't active --- If Baked Clay mod not active, make Red, Orange and Grey nodes if not minetest.get_modpath("bakedclay") then minetest.register_node(":bakedclay:red", { @@ -270,30 +256,8 @@ if not minetest.get_modpath("bakedclay") then }) end +-- Quicksand (new style, sinking inside shows yellow effect --- Quicksand (old style, sinking inside shows black instead of yellow effect, --- works ok with noclip enabled though) -minetest.register_node("ethereal:quicksand", { - description = S("Quicksand"), - tiles = {"default_sand.png"}, - drop = "default:sand", - liquid_viscosity = 15, - liquidtype = "source", - liquid_alternative_flowing = "ethereal:quicksand", - liquid_alternative_source = "ethereal:quicksand", - liquid_renewable = false, - liquid_range = 0, - drowning = 1, - walkable = false, - climbable = false, - post_effect_color = {r = 230, g = 210, b = 160, a = 245}, - groups = {crumbly = 3, sand = 1, liquid = 3, disable_jump = 1, - not_in_creative_inventory = 1}, - sounds = default.node_sound_sand_defaults() -}) - --- Quicksand (new style, sinking inside shows yellow effect with or without noclip, --- but old quicksand is shown as black until block placed nearby to update light) minetest.register_node("ethereal:quicksand2", { description = S("Quicksand"), tiles = {"default_sand.png^[colorize:#00004F10"}, @@ -314,7 +278,12 @@ minetest.register_node("ethereal:quicksand2", { sounds = default.node_sound_sand_defaults() }) +-- alias old quicksand to new + +minetest.register_alias("ethereal:quicksand", "ethereal:quicksand2") + -- craft quicksand + minetest.register_craft({ output = "ethereal:quicksand2", recipe = { @@ -322,7 +291,5 @@ minetest.register_craft({ {"group:sand", "bucket:bucket_water", "group:sand"}, {"group:sand", "group:sand", "group:sand"} }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"} - } + replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} }) diff --git a/extra.lua b/extra.lua index d98df2d..dc9aece 100644 --- a/extra.lua +++ b/extra.lua @@ -1,8 +1,33 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") +-- Blue Marble Nodes and recipe + +minetest.register_node("ethereal:blue_marble", { + description = S("Blue Marble"), + tiles = {"ethereal_blue_marble.png"}, + groups = {cracky = 1, stone = 1}, + sounds = default.node_sound_stone_defaults() +}) + +minetest.register_node("ethereal:blue_marble_tile", { + description = S("Blue Marble Tile"), + tiles = {"ethereal_blue_marble_tile.png"}, + groups = {cracky = 1, stone = 1}, + sounds = default.node_sound_stone_defaults() +}) + +minetest.register_craft({ + output = "ethereal:blue_marble_tile 9", + recipe = { + {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"}, + {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"}, + {"ethereal:blue_marble", "ethereal:blue_marble", "ethereal:blue_marble"} + } +}) -- Etherium Dust + minetest.register_craftitem("ethereal:etherium_dust", { description = S("Etherium Dust"), inventory_image = "ethereal_etherium_dust.png", @@ -10,6 +35,7 @@ minetest.register_craftitem("ethereal:etherium_dust", { }) -- Ethereium Ore + minetest.register_node("ethereal:etherium_ore", { description = S("Etherium Ore"), tiles = {"default_desert_stone.png^ethereal_etherium_ore.png"}, @@ -26,8 +52,8 @@ minetest.register_node("ethereal:stone_with_etherium_ore", { sounds = default.node_sound_stone_defaults() }) - -- Bamboo Flooring + minetest.register_node("ethereal:bamboo_floor", { description = S("Bamboo Floor"), drawtype = "nodebox", @@ -56,8 +82,8 @@ minetest.register_craft({ } }) - -- Bamboo Block + minetest.register_node("ethereal:bamboo_block", { description = S("Bamboo Block"), tiles = {"ethereal_bamboo_floor.png"}, @@ -83,8 +109,8 @@ minetest.register_craft({ } }) - -- Paper recipes + minetest.register_craft({ output = "default:paper 6", recipe = { @@ -101,8 +127,8 @@ minetest.register_craft({ } }) - -- 4x red mushrooms make mushroom block + minetest.register_craft({ output = "ethereal:mushroom", recipe = { @@ -120,6 +146,7 @@ minetest.register_craft({ }) -- X pattern craft recipes (5x 'a' in X pattern gives 5 of 'b') + if ethereal.xcraft == true then local cheat = { @@ -144,8 +171,8 @@ if ethereal.xcraft == true then end end - -- Palm Wax + minetest.register_craftitem("ethereal:palm_wax", { description = S("Palm Wax"), inventory_image = "ethereal_palm_wax.png", @@ -159,6 +186,7 @@ minetest.register_craft({ recipe = "ethereal:palmleaves" }) +-- candle helper function local function add_candle(col, dcol) @@ -178,10 +206,7 @@ local function add_candle(col, dcol) { name = "ethereal_candle" .. col .. ".png", animation = { - type="vertical_frames", - aspect_w = 32, - aspect_h = 32, - length = 1.0 + type="vertical_frames", aspect_w = 32, aspect_h = 32, length = 1.0 } } }, @@ -192,8 +217,7 @@ local function add_candle(col, dcol) groups = {candle = 1, dig_immediate = 3, attached_node = 1}, sounds = default.node_sound_defaults(), selection_box = { - type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0, 0.15 } + type = "fixed", fixed = { -0.15, -0.5, -0.15, 0.15, 0, 0.15 } } }) @@ -224,8 +248,8 @@ add_candle("red", "Red ") add_candle("violet", "Violet ") add_candle("yellow", "Yellow ") - -- white candle recipe + minetest.register_craft({ output = "ethereal:candle", recipe = { @@ -233,7 +257,8 @@ minetest.register_craft({ } }) --- candle recipe +-- base candle recipe + minetest.register_craft({ output = "ethereal:candle 2", recipe = { @@ -243,15 +268,16 @@ minetest.register_craft({ } }) - -- Wooden Bowl + minetest.register_craftitem("ethereal:bowl", { description = S("Bowl"), inventory_image = "ethereal_bowl.png", groups = {food_bowl = 1, flammable = 2} }) --- use farming redo's recipe if found +-- dont add bowl recipe if farming redo already has one + if not minetest.registered_items["farming:bowl"] then minetest.register_craft({ @@ -263,8 +289,8 @@ if not minetest.registered_items["farming:bowl"] then }) end - -- stone Ladder + minetest.register_node("ethereal:stone_ladder", { description = S("Stone Ladder"), drawtype = "signlike", @@ -277,9 +303,7 @@ minetest.register_node("ethereal:stone_ladder", { walkable = false, climbable = true, is_ground_content = false, - selection_box = { - type = "wallmounted" - }, + selection_box = {type = "wallmounted"}, groups = {cracky = 3, oddly_breakable_by_hand = 1}, legacy_wallmounted = true, sounds = default.node_sound_stone_defaults() @@ -294,8 +318,8 @@ minetest.register_craft({ } }) - -- Paper Wall + minetest.register_node("ethereal:paper_wall", { drawtype = "nodebox", description = S("Paper Wall"), @@ -310,14 +334,10 @@ minetest.register_node("ethereal:paper_wall", { sunlight_propagates = true, paramtype2 = "facedir", selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, 5/11, 0.5, 0.5, 8/16} + type = "fixed", fixed = {-0.5, -0.5, 5/11, 0.5, 0.5, 8/16} }, node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 5/11, 0.5, 0.5, 8/16} - } + type = "fixed", fixed = {{-0.5, -0.5, 5/11, 0.5, 0.5, 8/16}} } }) @@ -330,8 +350,8 @@ minetest.register_craft({ } }) - -- Glostone (A little bit of light decoration) + minetest.register_node("ethereal:glostone", { description = S("Glo Stone"), tiles = {"ethereal_glostone.png"}, @@ -350,8 +370,8 @@ minetest.register_craft({ } }) - -- Charcoal Lump + minetest.register_craftitem("ethereal:charcoal_lump", { description = S("Lump of Charcoal"), inventory_image = "ethereal_charcoal_lump.png" @@ -378,6 +398,7 @@ minetest.register_craft({ }) -- Make Torch from Charcoal Lump + minetest.register_craft({ output = "default:torch 4", recipe = { @@ -386,14 +407,15 @@ minetest.register_craft({ } }) - -- staff of light alternative node list + ethereal.lightstaff_recipes = { ["nether:rack"] = "nether:glowstone", ["nether:rack_deep"] = "nether:glowstone_deep" } -- Staff of Light (by Xanthin) + minetest.register_tool("ethereal:light_staff", { description = S("Staff of Light"), inventory_image = "ethereal_light_staff.png", @@ -404,9 +426,7 @@ minetest.register_tool("ethereal:light_staff", { on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "node" then - return - end + if pointed_thing.type ~= "node" then return end local pos = pointed_thing.under local pname = user:get_player_name() diff --git a/fences.lua b/fences.lua index 37a4500..919d499 100644 --- a/fences.lua +++ b/fences.lua @@ -1,9 +1,12 @@ -local S = ethereal.translate +-- translation and mod check +local S = minetest.get_translator("ethereal") local door_mod = minetest.get_modpath("doors") -local add_fence = function(name, node, desc, texture) +-- fence registration helper (fence, rail, gate, mese post) + +local function add_fence(name, node, desc, texture) if default.register_fence then @@ -48,6 +51,7 @@ local add_fence = function(name, node, desc, texture) end end +-- add wooden fences, gates and mese posts add_fence("scorched", "scorched_tree", "Scorched", "ethereal_scorched_tree") add_fence("frostwood", "frost_wood", "Frost", "ethereal_frost_wood") @@ -63,21 +67,19 @@ add_fence("olive", "olive_wood", "Olive", "ethereal_olive_wood") add_fence("basandra", "basandra_wood", "Basandra", "ethereal_basandra_bush_wood") --- add compatibility for ethereal's to default wooden gates +-- add compatibility for previous ethereal gates + minetest.register_alias("ethereal:fencegate_wood_open", "doors:gate_wood_open") minetest.register_alias("ethereal:fencegate_wood_closed", "doors:gate_wood_closed") - minetest.register_alias("ethereal:fencegate_acacia_open", "doors:gate_acacia_wood_open") minetest.register_alias("ethereal:fencegate_acacia_closed", "doors:gate_acacia_wood_closed") - minetest.register_alias("ethereal:fencegate_junglewood_open", "doors:gate_junglewood_open") minetest.register_alias("ethereal:fencegate_junglewood_closed", "doors:gate_junglewood_closed") - minetest.register_alias("ethereal:fencegate_pine_open", "doors:gate_pine_wood_open") minetest.register_alias("ethereal:fencegate_pine_closed", "doors:gate_pine_wood_closed") - -- sakura door + if door_mod then doors.register("ethereal:door_sakura", { diff --git a/fishing.lua b/fishing.lua index 5d281b5..2a4adfd 100644 --- a/fishing.lua +++ b/fishing.lua @@ -4,7 +4,7 @@ ]]-- -local S = ethereal.translate +-- fish and where they can be caught local fish_items = { "ethereal:fish_bluefin", @@ -46,10 +46,15 @@ local fish_items = { -- sandstone_desert_ocean, plains_ocean, savanna_ocean, fiery_ocean, swamp_ocean, -- glacier_ocean, tundra_ocean +-- translation and mod checks + +local S = minetest.get_translator("ethereal") local mod_bonemeal = minetest.get_modpath("bonemeal") local mod_armor = minetest.get_modpath("3d_armor") local mod_mobs = minetest.get_modpath("mobs") +-- junk items to be found + local junk_items = { "ethereal:bowl", "default:stick", @@ -65,6 +70,8 @@ local junk_items = { mod_armor and "3d_armor:boots_wood 6000" or "default:stick" } +-- bonus items to be found + local bonus_items = { mod_mobs and "mobs:nametag" or "fireflies:bug_net", mod_mobs and "mobs:net" or "default:sapling", @@ -80,28 +87,25 @@ local bonus_items = { "ethereal:fishing_rod 9000" } +-- helpers + local default_item = "default:dirt" local random = math.random -- yup we use this a lot +-- global add item function --- add item function ethereal.add_item = function(fish, junk, bonus) - if fish and fish ~= "" then - table.insert(fish_items, fish) - end + if fish and fish ~= "" then table.insert(fish_items, fish) end - if junk and junk ~= "" then - table.insert(junk_items, junk) - end + if junk and junk ~= "" then table.insert(junk_items, junk) end - if bonus and bonus ~= "" then - table.insert(bonus_items, bonus) - end + if bonus and bonus ~= "" then table.insert(bonus_items, bonus) end end +-- bubble particle effect -local effect = function(pos) +local function effect(pos) minetest.add_particle({ pos = { @@ -119,8 +123,8 @@ local effect = function(pos) }) end - -- fishing bob entity + minetest.register_entity("ethereal:bob_entity", { initial_properties = { @@ -157,8 +161,8 @@ if not self.cast then -- incase of lag find water level local free_fall, blocker = minetest.line_of_sight( - {x = pos.x, y = pos.y + 2, z = pos.z}, - {x = pos.x, y = pos.y , z = pos.z}) + {x = pos.x, y = pos.y + 2, z = pos.z}, + {x = pos.x, y = pos.y , z = pos.z}) -- do we have worms for bait, if so take one local player = self.fisher and minetest.get_player_by_name(self.fisher) @@ -185,8 +189,8 @@ if not self.cast then -- splash effect(pos) ; effect(pos) ; effect(pos) ; effect(pos) - minetest.sound_play("default_water_footstep", { - pos = pos, gain = 0.1}, true) + minetest.sound_play("default_water_footstep", + {pos = pos, gain = 0.1}, true) end else -- already cast and waiting for fish @@ -222,12 +226,9 @@ else -- already cast and waiting for fish -- remove bob if player is too far away local pla_pos = player:get_pos() - if (pla_pos.y - pos.y) > 15 - or (pla_pos.y - pos.y) < -15 - or (pla_pos.x - pos.x) > 15 - or (pla_pos.x - pos.x) < -15 - or (pla_pos.z - pos.z) > 15 - or (pla_pos.z - pos.z) < -15 then + if (pla_pos.y - pos.y) > 15 or (pla_pos.y - pos.y) < -15 + or (pla_pos.x - pos.x) > 15 or (pla_pos.x - pos.x) < -15 + or (pla_pos.z - pos.z) > 15 or (pla_pos.z - pos.z) < -15 then self.object:remove() ; --print("-- out of range") @@ -298,8 +299,8 @@ end -- if not self.cast end -- on_step }) +-- narrow item list depending on biome --- narrow item list depending on biome if applicable local find_item = function(list, pos) local item @@ -327,15 +328,13 @@ local find_item = function(list, pos) --print("==biome: " .. biome, dump(items)) - if #items > 0 then - return items[random(#items)] - end + if #items > 0 then return items[random(#items)] end return "" end - -- fishing rod function that throws pre bob, places bob and catches fish when it moves + local use_rod = function(itemstack, player, pointed_thing) local pos = player:get_pos() @@ -348,9 +347,7 @@ local use_rod = function(itemstack, player, pointed_thing) ent = objs[n]:get_luaentity() - if ent - and ent.fisher - and ent.name == "ethereal:bob_entity" + if ent and ent.fisher and ent.name == "ethereal:bob_entity" and player:get_player_name() == ent.fisher then found = false @@ -364,6 +361,7 @@ local use_rod = function(itemstack, player, pointed_thing) -- lower position to be in water rodpos.y = rodpos.y - 1 + -- chance between catching fish, bonuns item or junk if r < 86 then item = find_item(fish_items, rodpos) @@ -415,9 +413,7 @@ local use_rod = function(itemstack, player, pointed_thing) ent = objs[n]:get_luaentity() - if ent - and ent.fisher - and ent.name == "ethereal:bob_entity" + if ent and ent.fisher and ent.name == "ethereal:bob_entity" and player:get_player_name() == ent.fisher then found = false @@ -433,7 +429,7 @@ local use_rod = function(itemstack, player, pointed_thing) local pos = {x = playerpos.x, y = playerpos.y + 1.5, z = playerpos.z} minetest.sound_play("ethereal_casting_rod", - {pos = pos, gain = 1.0, max_hear_distance = 10}, true) + {pos = pos, gain = 1.0, max_hear_distance = 10}, true) -- place actual bob local obj = minetest.add_entity(pos, "ethereal:bob_entity") @@ -449,8 +445,8 @@ local use_rod = function(itemstack, player, pointed_thing) return itemstack end - -- scan area for bobs that belong to player and remove + local remove_bob = function(player) local objs = minetest.get_objects_inside_radius(player:get_pos(), 15) @@ -471,20 +467,20 @@ local remove_bob = function(player) end end - -- remove bob if player signs off + minetest.register_on_leaveplayer(function(player) remove_bob(player) end) - -- remove bob if player dies + minetest.register_on_dieplayer(function(player) remove_bob(player) end) - -- fishing rod + minetest.register_tool("ethereal:fishing_rod", { description = S("Fishing Rod (USE to cast and again when the time is right)"), groups = {tool = 1}, @@ -511,6 +507,7 @@ minetest.register_craft({ burntime = 15 }) +-- table of fish and edibility local fish = { {"Blue Fin", "bluefin", 2}, @@ -547,6 +544,8 @@ local fish = { {"Stoplight Parrotfish", "parrot", 2} } +-- register above fish + for n = 1, #fish do local usage @@ -569,47 +568,12 @@ for n = 1, #fish do end end - -- Make Neon Tetra glow slightly + minetest.override_item("ethereal:fish_tetra", {light_source = 3}) - --- cooked fish -minetest.register_craftitem(":ethereal:fish_cooked", { - description = S("Cooked Fish"), - inventory_image = "ethereal_fish_cooked.png", - wield_image = "ethereal_fish_cooked.png", - groups = {food_fish = 1}, - on_use = minetest.item_eat(5) -}) - -ethereal.add_eatable("ethereal:fish_cooked", 5) - -minetest.register_craft({ - type = "cooking", - output = "ethereal:fish_cooked", - recipe = "group:ethereal_fish", - cooktime = 8 -}) - --- Sashimi -minetest.register_craftitem("ethereal:sashimi", { - description = S("Sashimi"), - inventory_image = "ethereal_sashimi.png", - wield_image = "ethereal_sashimi.png", - on_use = minetest.item_eat(4) -}) - -ethereal.add_eatable("ethereal:sashimi", 4) - -minetest.register_craft({ - output = "ethereal:sashimi 2", - recipe = { - {"group:food_seaweed", "group:food_fish_raw", "group:food_seaweed"}, - } -}) - -- Worm + minetest.register_craftitem("ethereal:worm", { description = S("Worm"), inventory_image = "ethereal_worm.png", @@ -624,6 +588,7 @@ minetest.register_craft({ }) -- compatibility + minetest.register_alias("ethereal:fish_raw", "ethereal:fish_cichlid") minetest.register_alias("ethereal:fishing_rod_baited", "ethereal:fishing_rod") minetest.register_alias("ethereal:fish_chichlid", "ethereal:fish_cichlid") diff --git a/flight.lua b/flight.lua index 58b6e13..dd2eb22 100644 --- a/flight.lua +++ b/flight.lua @@ -1,24 +1,28 @@ + +-- translation and settings + +local S = minetest.get_translator("ethereal") local flight_secs = minetest.settings:get("ethereal.flightpotion_duration") or (5 * 60) local timer_check = 5 -- seconds per check -local S = ethereal.translate +-- get player timer local function get_timer(user) if not user then return end - local meta = user:get_meta() - - if not meta then return "" end + local meta = user:get_meta() ; if not meta then return "" end return meta:get_string("ethereal:fly_timer") or "" end +-- do we have fly privs local function has_fly(name) return minetest.get_player_privs(name).fly end +-- set player timer local function set_timer(user, timer) @@ -27,6 +31,7 @@ local function set_timer(user, timer) meta:set_string("ethereal:fly_timer", timer) end +-- give or revoke fly priv local function set_flight(user, set) @@ -38,13 +43,11 @@ local function set_flight(user, set) minetest.set_player_privs(name, privs) -- when flight removed set timer to temp position - if set ~= true then - set_timer(user, "-99") - end + if set ~= true then set_timer(user, "-99") end end - -- after function + local function ethereal_set_flight(user) local name = user and user:get_player_name() ; if not name then return end @@ -62,9 +65,7 @@ local function ethereal_set_flight(user) local privs = minetest.get_player_privs(name) -- have we already applied 'fly' privelage? - if not privs.fly then - set_flight(user, true) - end + if not privs.fly then set_flight(user, true) end -- handle timer timer = timer - timer_check @@ -72,16 +73,14 @@ local function ethereal_set_flight(user) -- show expiration message and play sound if timer <= 10 then - minetest.chat_send_player(name, - minetest.get_color_escape_sequence("#ff5500") + minetest.chat_send_player(name, minetest.get_color_escape_sequence("#ff5500") .. S("Flight timer about to expire!")) minetest.sound_play("default_dig_dig_immediate", {to_player = name, gain = 1.0}, true) end - -- set updated timer - set_timer(user, timer) + set_timer(user, timer) -- set update timer -- restart checks minetest.after(timer_check, function() @@ -89,8 +88,8 @@ local function ethereal_set_flight(user) end) end - -- on join / leave + minetest.register_on_joinplayer(function(player) -- wait 2 seconds before doing flight checks on player @@ -111,9 +110,7 @@ minetest.register_on_joinplayer(function(player) timer = tonumber(timer) or 0 -- if timer is set to default then return - if timer == -99 then - return - end + if timer == -99 then return end -- if we got this far and player is flying then start countdown check if has_fly(name) then @@ -126,8 +123,8 @@ minetest.register_on_joinplayer(function(player) end, player) end) - -- potion item + minetest.register_node("ethereal:flight_potion", { description = S("Flight Potion"), drawtype = "plantlike", @@ -138,19 +135,16 @@ minetest.register_node("ethereal:flight_potion", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.2, -0.37, -0.2, 0.2, 0.31, 0.2} + type = "fixed", fixed = {-0.2, -0.37, -0.2, 0.2, 0.31, 0.2} }, groups = {dig_immediate = 3}, sounds = default.node_sound_glass_defaults(), on_use = function(itemstack, user, pointed_thing) - if user.is_fake_player then - return - end + if user.is_fake_player then return end - -- get privs + -- get info local name = user:get_player_name() local privs = minetest.get_player_privs(name) local timer = get_timer(user) @@ -159,30 +153,24 @@ minetest.register_node("ethereal:flight_potion", { local msg = timer - if timer == "" or timer == "-99" then - msg = S("unlimited") - end + if timer == "" or timer == "-99" then msg = S("unlimited") end - minetest.chat_send_player(name, - minetest.get_color_escape_sequence("#ffff00") - .. S("Flight already granted, @1 seconds left!", msg)) + minetest.chat_send_player(name, minetest.get_color_escape_sequence("#ffff00") + .. S("Flight already granted, @1 seconds left!", msg)) return end - -- set flight timer - set_timer(user, flight_secs) + set_timer(user, flight_secs) -- set flight timer -- show time remaining minetest.chat_send_player(name, minetest.get_color_escape_sequence("#1eff00") .. S("Flight granted, you have @1 seconds!", flight_secs)) - -- start check - ethereal_set_flight(user) + ethereal_set_flight(user) -- start check - -- take item - itemstack:take_item() + itemstack:take_item() -- take item -- return empty bottle local inv = user:get_inventory() @@ -197,8 +185,8 @@ minetest.register_node("ethereal:flight_potion", { end }) - -- recipe + minetest.register_craft({ output = "ethereal:flight_potion", recipe = { diff --git a/food.lua b/food.lua index e5c2557..885062a 100644 --- a/food.lua +++ b/food.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") +-- Banana --- Banana (Heals one heart when eaten) minetest.register_node("ethereal:banana", { description = S("Banana"), drawtype = "torchlike", @@ -13,8 +13,7 @@ minetest.register_node("ethereal:banana", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.31, -0.5, -0.31, 0.31, 0.5, 0.31} + type = "fixed", fixed = {-0.31, -0.5, -0.31, 0.31, 0.5, 0.31} }, groups = { food_banana = 1, fleshy = 3, dig_immediate = 3, leafdecay = 1, leafdecay_drop = 1 @@ -31,6 +30,7 @@ minetest.register_node("ethereal:banana", { ethereal.add_eatable("ethereal:banana", 2) -- Banana Bunch + minetest.register_node("ethereal:banana_bunch", { description = S("Banana Bunch"), drawtype = "torchlike", @@ -41,8 +41,7 @@ minetest.register_node("ethereal:banana_bunch", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.31, -0.5, -0.31, 0.31, 0.5, 0.31} + type = "fixed", fixed = {-0.31, -0.5, -0.31, 0.31, 0.5, 0.31} }, groups = { fleshy = 3, dig_immediate = 3, leafdecay = 1, leafdecay_drop = 1 @@ -58,7 +57,6 @@ minetest.register_node("ethereal:banana_bunch", { ethereal.add_eatable("ethereal:banana_bunch", 6) --- Bunch to Single minetest.register_craft({ output = "ethereal:banana 3", recipe = {{"ethereal:banana_bunch"}} @@ -70,6 +68,7 @@ minetest.register_craft({ }) -- Banana Dough + minetest.register_craftitem("ethereal:banana_dough", { description = S("Banana Dough"), inventory_image = "ethereal_banana_dough.png" @@ -87,8 +86,8 @@ minetest.register_craft({ recipe = "ethereal:banana_dough" }) +-- Orange --- Orange (Heals 2 hearts when eaten) minetest.register_node("ethereal:orange", { description = S("Orange"), drawtype = "plantlike", @@ -99,8 +98,7 @@ minetest.register_node("ethereal:orange", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} + type = "fixed", fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} }, groups = { food_orange = 1, fleshy = 3, dig_immediate = 3, @@ -117,8 +115,8 @@ minetest.register_node("ethereal:orange", { ethereal.add_eatable("ethereal:orange", 4) +-- Pine Nuts --- Pine Nuts (Heals 1/2 heart when eaten) minetest.register_craftitem("ethereal:pine_nuts", { description = S("Pine Nuts"), inventory_image = "ethereal_pine_nuts.png", @@ -129,7 +127,8 @@ minetest.register_craftitem("ethereal:pine_nuts", { ethereal.add_eatable("ethereal:pine_nuts", 1) --- Banana Loaf (Heals 3 hearts when eaten) +-- Banana Loaf + minetest.register_craftitem("ethereal:banana_bread", { description = S("Banana Loaf"), inventory_image = "ethereal_banana_bread.png", @@ -141,6 +140,7 @@ minetest.register_craftitem("ethereal:banana_bread", { ethereal.add_eatable("ethereal:banana_bread", 6) -- coconut settings if farming redo found + local fredo = minetest.get_modpath("farming") and farming and farming.mod and farming.mod == "redo" @@ -148,6 +148,7 @@ local cdrp = fredo and "ethereal:coconut" or "ethereal:coconut_slice 4" local cgrp = fredo and {3, 2} or {1, 1} -- Coconut (drops 4x coconut slice by default, whole coconut if farming redo found) + minetest.register_node("ethereal:coconut", { description = S("Coconut"), drawtype = "plantlike", @@ -158,8 +159,7 @@ minetest.register_node("ethereal:coconut", { inventory_image = "moretrees_coconut.png", wield_image = "moretrees_coconut.png", selection_box = { - type = "fixed", - fixed = {-0.31, -0.43, -0.31, 0.31, 0.44, 0.31} + type = "fixed", fixed = {-0.31, -0.43, -0.31, 0.31, 0.44, 0.31} }, groups = { food_coconut = 1, snappy = cgrp[1], oddly_breakable_by_hand = cgrp[2], @@ -174,7 +174,8 @@ minetest.register_node("ethereal:coconut", { end }) --- Coconut Slice (Heals half heart when eaten) +-- Coconut Slice + minetest.register_craftitem("ethereal:coconut_slice", { description = S("Coconut Slice"), inventory_image = "moretrees_coconut_slice.png", @@ -186,6 +187,7 @@ minetest.register_craftitem("ethereal:coconut_slice", { ethereal.add_eatable("ethereal:coconut_slice", 1) -- coconut slice recipe (farming redo) + if fredo then minetest.register_craft({ @@ -196,6 +198,7 @@ if fredo then end -- coconut slice into whole coconut + minetest.register_craft({ output = "ethereal:coconut", recipe = { @@ -204,8 +207,8 @@ minetest.register_craft({ } }) +-- Golden Apple --- Golden Apple (Found on Healing Tree, heals all 10 hearts) minetest.register_node("ethereal:golden_apple", { description = S("Golden Apple"), drawtype = "plantlike", @@ -216,8 +219,7 @@ minetest.register_node("ethereal:golden_apple", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.2, -0.37, -0.2, 0.2, 0.31, 0.2} + type = "fixed", fixed = {-0.2, -0.37, -0.2, 0.2, 0.31, 0.2} }, groups = { fleshy = 3, dig_immediate = 3, leafdecay = 3,leafdecay_drop = 1, eatable = 2 @@ -240,8 +242,8 @@ minetest.register_node("ethereal:golden_apple", { end }) +-- Hearty Stew --- Hearty Stew (Heals 5 hearts) minetest.register_craftitem("ethereal:hearty_stew", { description = S("Hearty Stew"), inventory_image = "ethereal_hearty_stew.png", @@ -261,6 +263,7 @@ minetest.register_craft({ }) -- Extra recipe for hearty stew + if fredo then minetest.register_craft({ @@ -273,8 +276,8 @@ if fredo then }) end - -- Bucket of Cactus Pulp + minetest.register_craftitem("ethereal:bucket_cactus", { description = S("Bucket of Cactus Pulp"), inventory_image = "bucket_cactus.png", @@ -291,8 +294,8 @@ minetest.register_craft({ recipe = {{"bucket:bucket_empty","default:cactus"}} }) - -- firethorn jelly + minetest.register_craftitem("ethereal:firethorn_jelly", { description = S("Firethorn Jelly"), inventory_image = "ethereal_firethorn_jelly.png", @@ -303,7 +306,7 @@ minetest.register_craftitem("ethereal:firethorn_jelly", { ethereal.add_eatable("ethereal:firethorn_jelly", 2) -if minetest.registered_items["farming:bowl"] then +if fredo then minetest.register_craft({ output = "ethereal:firethorn_jelly", @@ -319,8 +322,8 @@ if minetest.registered_items["farming:bowl"] then }) end - -- Lemon + minetest.register_node("ethereal:lemon", { description = S("Lemon"), drawtype = "plantlike", @@ -331,12 +334,10 @@ minetest.register_node("ethereal:lemon", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} + type = "fixed", fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} }, groups = { - food_lemon = 1, fleshy = 3, dig_immediate = 3, - leafdecay = 3, leafdecay_drop = 1 + food_lemon = 1, fleshy = 3, dig_immediate = 3, leafdecay = 3, leafdecay_drop = 1 }, drop = "ethereal:lemon", on_use = minetest.item_eat(3), @@ -350,6 +351,7 @@ minetest.register_node("ethereal:lemon", { ethereal.add_eatable("ethereal:lemon", 3) -- Candied Lemon + minetest.register_craftitem("ethereal:candied_lemon", { description = S("Candied Lemon"), inventory_image = "ethereal_candied_lemon.png", @@ -371,6 +373,7 @@ minetest.register_craft({ }) -- Lemonade + minetest.register_node("ethereal:lemonade", { description = S("Lemonade"), drawtype = "plantlike", @@ -380,8 +383,7 @@ minetest.register_node("ethereal:lemonade", { paramtype = "light", walkable = false, selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} + type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} }, groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1}, on_use = minetest.item_eat(5, "vessels:drinking_glass"), @@ -401,8 +403,8 @@ minetest.register_craft({ } }) - -- Olive + minetest.register_node("ethereal:olive", { description = S("Olive"), drawtype = "plantlike", @@ -414,13 +416,9 @@ minetest.register_node("ethereal:olive", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-0.1, -0.5, -0.1, 0.1, -0.3, 0.1} + type = "fixed", fixed = {-0.1, -0.5, -0.1, 0.1, -0.3, 0.1} }, - groups = { - fleshy = 3, dig_immediate = 3, leafdecay = 3, leafdecay_drop = 1 - }, - drop = "ethereal:olive", + groups = {fleshy = 3, dig_immediate = 3, leafdecay = 3, leafdecay_drop = 1}, on_use = minetest.item_eat(1), sounds = default.node_sound_leaves_defaults(), @@ -432,6 +430,7 @@ minetest.register_node("ethereal:olive", { ethereal.add_eatable("ethereal:olive", 1) -- Olive Oil + minetest.register_craftitem("ethereal:olive_oil", { description = S("Olive Oil"), inventory_image = "ethereal_olive_oil.png", @@ -446,13 +445,11 @@ minetest.register_craft({ {"ethereal:olive", "ethereal:olive", "ethereal:olive"}, {"farming:juicer", "vessels:glass_bottle", ""} }, - replacements = { - {"farming:juicer", "farming:juicer"} - } + replacements = {{"farming:juicer", "farming:juicer"}} }) - -- Kappa Maki (sushi with cucumber) + minetest.register_craftitem("ethereal:sushi_kappamaki", { description = S("Kappa Maki Sushi"), inventory_image = "ethereal_sushi_kappa_maki.png", @@ -468,8 +465,8 @@ minetest.register_craft({ } }) - -- Nigiri (sushi with raw fish) + minetest.register_craftitem("ethereal:sushi_nigiri", { description = S("Nigiri Sushi"), inventory_image = "ethereal_sushi_nigiri.png", @@ -485,8 +482,8 @@ minetest.register_craft({ } }) - -- Tamago (sushi with sweet egg) + minetest.register_craftitem("ethereal:sushi_tamago", { description = S("Tamago Sushi"), inventory_image = "ethereal_sushi_tamago.png", @@ -502,8 +499,8 @@ minetest.register_craft({ } }) - -- Fugu (prepared pufferfish) + minetest.register_craftitem("ethereal:fugu", { description = S("Fugusashi"), inventory_image = "ethereal_fugu.png", @@ -534,8 +531,8 @@ minetest.register_craft({ } }) - -- Teriyaki Chicken + minetest.register_craftitem("ethereal:teriyaki_chicken", { description = S("Teriyaki Chicken"), inventory_image = "ethereal_teriyaki_chicken.png", @@ -556,8 +553,8 @@ minetest.register_craft({ } }) - -- Teriyaki Beef + minetest.register_craftitem("ethereal:teriyaki_beef", { description = S("Teriyaki Beef"), inventory_image = "ethereal_teriyaki_beef.png", @@ -579,8 +576,8 @@ minetest.register_craft({ } }) +-- mushroom soup --- mushroom soup (Heals 1 heart) minetest.register_craftitem("ethereal:mushroom_soup", { description = S("Mushroom Soup"), inventory_image = "ethereal_mushroom_soup.png", @@ -599,8 +596,8 @@ minetest.register_craft({ } }) - -- boiled shrimp + minetest.register_craftitem("ethereal:fish_shrimp_cooked", { description = S("Boiled Shrimp"), inventory_image = "ethereal_fish_shrimp_cooked.png", @@ -616,13 +613,11 @@ minetest.register_craft({ {"ethereal:fish_shrimp", "group:water_bucket", "ethereal:fish_shrimp"}, {"", "ethereal:fire_dust", ""} }, - replacements = { - {"group:water_bucket", "bucket:bucket_empty"}, - } + replacements = {{"group:water_bucket", "bucket:bucket_empty"}} }) - -- garlic butter shrimp + minetest.register_craftitem("ethereal:garlic_shrimp", { description = S("Garlic Butter Shrimp"), inventory_image = "ethereal_garlic_butter_shrimp.png", @@ -640,8 +635,8 @@ minetest.register_craft({ replacements = {{"farming:skillet", "farming:skillet"}} }) - -- jellyfish salad + minetest.register_craftitem("ethereal:jellyfish_salad", { description = S("Jellyfish Salad"), inventory_image = "ethereal_jellyfish_salad.png", @@ -658,8 +653,8 @@ minetest.register_craft({ replacements = {{"farming:cutting_board", "farming:cutting_board"}} }) - -- raw calamari + minetest.register_craftitem("ethereal:calamari_raw", { description = S("Raw Calamari"), inventory_image = "ethereal_calamari_raw.png", @@ -677,6 +672,7 @@ minetest.register_craft({ }) -- cooked calamari + minetest.register_craftitem("ethereal:calamari_cooked", { description = S("Calamari"), inventory_image = "ethereal_calamari_cooked.png", @@ -694,6 +690,7 @@ minetest.register_craft({ }) -- fish & chips + minetest.register_craftitem("ethereal:fish_n_chips", { description = S("Fish & Chips"), inventory_image = "ethereal_fish_chips.png", @@ -707,7 +704,60 @@ minetest.register_craft({ recipe = { {"farming:baking_tray", "group:ethereal_fish", "group:food_potato"} }, - replacements = { - {"farming:baking_tray", "farming:baking_tray"} + replacements = {{"farming:baking_tray", "farming:baking_tray"}} +}) + +-- cooked fish + +minetest.register_craftitem(":ethereal:fish_cooked", { + description = S("Cooked Fish"), + inventory_image = "ethereal_fish_cooked.png", + wield_image = "ethereal_fish_cooked.png", + groups = {food_fish = 1}, + on_use = minetest.item_eat(5) +}) + +ethereal.add_eatable("ethereal:fish_cooked", 5) + +minetest.register_craft({ + type = "cooking", + output = "ethereal:fish_cooked", + recipe = "group:ethereal_fish", + cooktime = 8 +}) + +-- Sashimi + +minetest.register_craftitem("ethereal:sashimi", { + description = S("Sashimi"), + inventory_image = "ethereal_sashimi.png", + wield_image = "ethereal_sashimi.png", + on_use = minetest.item_eat(4) +}) + +ethereal.add_eatable("ethereal:sashimi", 4) + +minetest.register_craft({ + output = "ethereal:sashimi 2", + recipe = { + {"group:food_seaweed", "group:food_fish_raw", "group:food_seaweed"}, } }) + +-- agar powder + +minetest.register_craftitem("ethereal:agar_powder", { + description = S("Agar Powder"), + inventory_image = "ethereal_agar_powder.png", + groups = {food_gelatin = 1, flammable = 2} +}) + +minetest.register_craft({ + output = "ethereal:agar_powder 3", + recipe = { + {"group:food_seaweed", "group:food_seaweed", "group:food_seaweed"}, + {"bucket:bucket_water", "bucket:bucket_water", "default:torch"}, + {"bucket:bucket_water", "bucket:bucket_water", "default:torch"} + }, + replacements = {{"bucket:bucket_water", "bucket:bucket_empty 4"}} +}) diff --git a/init.lua b/init.lua index f0cf95a..505ada9 100644 --- a/init.lua +++ b/init.lua @@ -6,9 +6,11 @@ Updated by TenPlus1 ]] +-- global -ethereal = {version = "20240803"} +ethereal = {version = "20240816"} +-- setting helper local function setting(stype, name, default) @@ -22,14 +24,11 @@ local function setting(stype, name, default) value = tonumber(minetest.settings:get("ethereal." .. name)) end - if value == nil then - value = default - end + if value == nil then value = default end ethereal[name] = value end - -- DO NOT change settings below, use the settings.conf file instead setting("number", "leaftype", 0) @@ -76,28 +75,27 @@ setting("bool", "wood_rotate", true) local path = minetest.get_modpath("ethereal") -- Load settings.conf file if found + local input = io.open(path.."/settings.conf", "r") if input then - dofile(path .. "/settings.conf") - input:close() - input = nil + dofile(path .. "/settings.conf") ; input:close() ; input = nil end - --- Translation support -ethereal.translate = minetest.get_translator("ethereal") - -- Falling node function + ethereal.check_falling = minetest.check_for_falling or nodeupdate -- creative check + local creative_mode_cache = minetest.settings:get_bool("creative_mode") + function ethereal.check_creative(name) return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) end -- helper function to add {eatable} group to food items + function ethereal.add_eatable(item, hp) local def = minetest.registered_items[item] @@ -112,12 +110,16 @@ function ethereal.add_eatable(item, hp) end end +-- strawberry check and load + if minetest.get_modpath("farming") and farming.mod and farming.mod == "redo" then -- farming redo already has strawberry included else dofile(path .. "/strawberry.lua") end +-- load mod sections + dofile(path .. "/plantlife.lua") dofile(path .. "/onion.lua") dofile(path .. "/crystal.lua") @@ -144,16 +146,19 @@ dofile(path .. "/compatibility.lua") dofile(path .. "/stairs.lua") -- add flight if enabled + if ethereal.flight then dofile(path .. "/flight.lua") end -- add lucky blocks if mod active + if minetest.get_modpath("lucky_block") then dofile(path .. "/lucky_block.lua") end -- Set bonemeal aliases + if minetest.get_modpath("bonemeal") then minetest.register_alias("ethereal:bone", "bonemeal:bone") minetest.register_alias("ethereal:bonemeal", "bonemeal:bonemeal") @@ -162,9 +167,10 @@ else -- or return to where it came from minetest.register_alias("ethereal:bonemeal", "default:dirt") end +-- Xanadu specific decoration + if minetest.get_modpath("xanadu") then dofile(path .. "/plantpack.lua") end print ("[MOD] Ethereal loaded") - diff --git a/leaves.lua b/leaves.lua index c7784bc..1c59e0d 100644 --- a/leaves.lua +++ b/leaves.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") +-- set leaftype (0 for block, 1 for plantlike) --- set leaftype (value inside init.lua) local leaftype = "plantlike" local leafscale = 1.4 @@ -12,6 +12,7 @@ if ethereal.leaftype ~= 0 then end -- default apple tree leaves + minetest.override_item("default:leaves", { drawtype = leaftype, visual_scale = leafscale, @@ -21,12 +22,14 @@ minetest.override_item("default:leaves", { }) -- ability to craft big tree sapling + minetest.register_craft({ recipe = {{"default:sapling", "default:sapling", "default:sapling"}}, output = "ethereal:big_tree_sapling" }) -- default jungle tree leaves + minetest.override_item("default:jungleleaves", { drawtype = leaftype, visual_scale = leafscale, @@ -36,6 +39,7 @@ minetest.override_item("default:jungleleaves", { }) -- default pine tree leaves + minetest.override_item("default:pine_needles", { drawtype = leaftype, visual_scale = leafscale, @@ -53,6 +57,7 @@ minetest.override_item("default:pine_needles", { }) -- default acacia tree leaves + minetest.override_item("default:acacia_leaves", { drawtype = leaftype, inventory_image = "default_acacia_leaves.png", @@ -62,6 +67,7 @@ minetest.override_item("default:acacia_leaves", { }) -- default aspen tree leaves + minetest.override_item("default:aspen_leaves", { drawtype = leaftype, inventory_image = "default_aspen_leaves.png", @@ -71,6 +77,7 @@ minetest.override_item("default:aspen_leaves", { }) -- willow twig + minetest.register_node("ethereal:willow_twig", { description = S("Willow Twig"), drawtype = "plantlike", @@ -94,6 +101,7 @@ minetest.register_node("ethereal:willow_twig", { }) -- redwood leaves + minetest.register_node("ethereal:redwood_leaves", { description = S("Redwood Leaves"), drawtype = leaftype, @@ -117,6 +125,7 @@ minetest.register_node("ethereal:redwood_leaves", { }) -- orange tree leaves + minetest.register_node("ethereal:orange_leaves", { description = S("Orange Leaves"), drawtype = leaftype, @@ -140,6 +149,7 @@ minetest.register_node("ethereal:orange_leaves", { }) -- banana tree leaves + minetest.register_node("ethereal:bananaleaves", { description = S("Banana Leaves"), drawtype = leaftype, @@ -163,6 +173,7 @@ minetest.register_node("ethereal:bananaleaves", { }) -- healing tree leaves + minetest.register_node("ethereal:yellowleaves", { description = S("Healing Tree Leaves"), drawtype = leaftype, @@ -181,7 +192,6 @@ minetest.register_node("ethereal:yellowleaves", { {items = {"ethereal:yellowleaves"}} } }, - -- one leaf heals half a heart when eaten on_use = minetest.item_eat(1), sounds = default.node_sound_leaves_defaults(), after_place_node = default.after_place_leaves, @@ -189,6 +199,7 @@ minetest.register_node("ethereal:yellowleaves", { }) -- palm tree leaves + minetest.register_node("ethereal:palmleaves", { description = S("Palm Leaves"), drawtype = leaftype, @@ -212,6 +223,7 @@ minetest.register_node("ethereal:palmleaves", { }) -- birch tree leaves + minetest.register_node("ethereal:birch_leaves", { description = S("Birch Leaves"), drawtype = leaftype, @@ -235,6 +247,7 @@ minetest.register_node("ethereal:birch_leaves", { }) -- frost tree leaves + minetest.register_node("ethereal:frost_leaves", { description = S("Frost Leaves"), drawtype = leaftype, @@ -259,6 +272,7 @@ minetest.register_node("ethereal:frost_leaves", { }) -- bamboo stalk leaves + minetest.register_node("ethereal:bamboo_leaves", { description = S("Bamboo Leaves"), drawtype = leaftype, @@ -282,6 +296,7 @@ minetest.register_node("ethereal:bamboo_leaves", { }) -- sakura leaves + minetest.register_node("ethereal:sakura_leaves", { description = S("Sakura Leaves"), drawtype = leaftype, @@ -327,6 +342,7 @@ minetest.register_node("ethereal:sakura_leaves2", { }) -- lemon tree leaves + minetest.register_node("ethereal:lemon_leaves", { description = S("Lemon Tree Leaves"), drawtype = leaftype, @@ -350,6 +366,7 @@ minetest.register_node("ethereal:lemon_leaves", { }) -- olive tree leaves + minetest.register_node("ethereal:olive_leaves", { description = S("Olive Tree Leaves"), drawtype = leaftype, @@ -372,7 +389,8 @@ minetest.register_node("ethereal:olive_leaves", { after_place_node = default.after_place_leaves }) --- mushroom tops +-- red mushroom top + minetest.register_node("ethereal:mushroom", { description = S("Mushroom Cap"), tiles = {"ethereal_mushroom_block.png"}, @@ -393,7 +411,8 @@ minetest.register_craft({ burntime = 10 }) --- brown mushroom tops +-- brown mushroom top + minetest.register_node("ethereal:mushroom_brown", { description = S("Brown Mushroom Cap"), tiles = {"ethereal_mushroom_block_brown.png"}, @@ -415,6 +434,7 @@ minetest.register_craft({ }) -- mushroom pore (spongelike material found inside giant shrooms) + minetest.register_node("ethereal:mushroom_pore", { description = S("Mushroom Pore"), tiles = {"ethereal_mushroom_pore.png"}, @@ -433,6 +453,7 @@ minetest.register_craft({ }) -- hedge block + minetest.register_node("ethereal:bush", { description = S("Bush"), tiles = {"ethereal_bush.png"}, @@ -457,6 +478,7 @@ minetest.register_craft({ }) -- bush block #2 + minetest.register_node("ethereal:bush2", { drawtype = "allfaces_optional", description = S("Bush #2"), @@ -483,6 +505,7 @@ minetest.register_craft({ }) -- bush block #3 + minetest.register_node("ethereal:bush3", { drawtype = "allfaces_optional", description = S("Bush #3"), @@ -509,6 +532,7 @@ minetest.register_craft({ }) -- basandra bush stem, leaves + minetest.register_node("ethereal:basandra_bush_stem", { description = S("Basandra Bush Stem"), drawtype = "plantlike", @@ -523,8 +547,7 @@ minetest.register_node("ethereal:basandra_bush_stem", { groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, sounds = default.node_sound_wood_defaults(), selection_box = { - type = "fixed", - fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + type = "fixed", fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, } }) @@ -544,86 +567,38 @@ minetest.register_node("ethereal:basandra_bush_leaves", { sounds = default.node_sound_leaves_defaults() }) --- compatibility check for new mt version with leafdecay function -if default.register_leafdecay then +-- leafdecay helper function - default.register_leafdecay({ - trunks = {"default:tree"}, - leaves = { - "default:apple", "default:leaves", - "ethereal:orange", "ethereal:orange_leaves", - "ethereal:lemon", "ethereal:lemon_leaves", - "ethereal:vine" - }, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:willow_trunk"}, - leaves = {"ethereal:willow_twig"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:redwood_trunk"}, - leaves = {"ethereal:redwood_leaves"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:frost_tree"}, - leaves = {"ethereal:frost_leaves"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:yellow_trunk"}, - leaves = {"ethereal:yellowleaves", "ethereal:golden_apple"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:palm_trunk"}, - leaves = {"ethereal:palmleaves", "ethereal:coconut"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:banana_trunk"}, - leaves = {"ethereal:bananaleaves", "ethereal:banana", "ethereal:banana_bunch"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:birch_trunk"}, - leaves = {"ethereal:birch_leaves"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:bamboo"}, - leaves = {"ethereal:bamboo_leaves"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:sakura_trunk"}, - leaves = {"ethereal:sakura_leaves", "ethereal:sakura_leaves2"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:olive_trunk"}, - leaves = {"ethereal:olive_leaves", "ethereal:olive"}, - radius = 3 - }) - - default.register_leafdecay({ - trunks = {"ethereal:mushroom_trunk"}, - leaves = { - "ethereal:mushroom", "ethereal:mushroom_brown", "ethereal:mushroom_pore", - "ethereal:lightstring" - }, - radius = 4 - }) +local function decay(tru, lea, rad) + default.register_leafdecay({trunks = tru, leaves = lea, radius = rad}) end + +-- add leafdecay registrations + +decay({"default:tree"}, {"default:apple", "default:leaves", "ethereal:orange", + "ethereal:orange_leaves", "ethereal:lemon", "ethereal:lemon_leaves", + "ethereal:vine"}, 3) + +decay({"ethereal:willow_trunk"}, {"ethereal:willow_twig"}, 3) + +decay({"ethereal:redwood_trunk"}, {"ethereal:redwood_leaves"}, 3) + +decay({"ethereal:frost_tree"}, {"ethereal:frost_leaves"}, 3) + +decay({"ethereal:yellow_trunk"}, {"ethereal:yellowleaves", "ethereal:golden_apple"}, 3) + +decay({"ethereal:palm_trunk"}, {"ethereal:palmleaves", "ethereal:coconut"}, 3) + +decay({"ethereal:banana_trunk"}, {"ethereal:bananaleaves", "ethereal:banana", + "ethereal:banana_bunch"}, 3) + +decay({"ethereal:birch_trunk"}, {"ethereal:birch_leaves"}, 3) + +decay({"ethereal:bamboo"}, {"ethereal:bamboo_leaves"}, 3) + +decay({"ethereal:sakura_trunk"}, {"ethereal:sakura_leaves", "ethereal:sakura_leaves2"}, 3) + +decay({"ethereal:olive_trunk"}, {"ethereal:olive_leaves", "ethereal:olive"}, 3) + +decay({"ethereal:mushroom_trunk"}, {"ethereal:mushroom", "ethereal:mushroom_brown", + "ethereal:mushroom_pore", "ethereal:lightstring"}, 4) diff --git a/lucky_block.lua b/lucky_block.lua index 5c21d66..1489358 100644 --- a/lucky_block.lua +++ b/lucky_block.lua @@ -1,6 +1,10 @@ +-- ethereal schematic path + local epath = minetest.get_modpath("ethereal") .. "/schematics/" +-- add schematics + lucky_block:add_schematics({ {"pinetree", ethereal.pinetree, {x = 3, y = 0, z = 3}}, {"palmtree", ethereal.palmtree, {x = 4, y = 0, z = 4}}, @@ -12,6 +16,8 @@ lucky_block:add_schematics({ {"mushroomtwo", ethereal.mushroomtwo, {x = 1, y = 0, z = 1}}, }) +-- add lucky blocks + lucky_block:add_blocks({ {"sch", "basandrabush", 0, false}, {"dro", {"ethereal:basandra_wood"}, 5}, diff --git a/mod.conf b/mod.conf index 1e4533f..22be5c3 100644 --- a/mod.conf +++ b/mod.conf @@ -2,4 +2,4 @@ name = ethereal description = Adds many new biomes, items and features into your world. depends = default, flowers optional_depends = stairs, doors, farming, bakedclay, moreblocks, lucky_block, toolranks -min_minetest_version = 5.0 +min_minetest_version = 5.1 diff --git a/onion.lua b/onion.lua index ada63d1..9633e4b 100644 --- a/onion.lua +++ b/onion.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate - +local S = minetest.get_translator("ethereal") -- wild onion + minetest.register_craftitem("ethereal:wild_onion_plant", { description = S("Wild Onion"), inventory_image = "ethereal_wild_onion.png", @@ -17,7 +17,8 @@ minetest.register_craftitem("ethereal:wild_onion_plant", { ethereal.add_eatable("ethereal:wild_onion_plant", 2) --- Define Onion growth stages +-- Onion definition + local def = { drawtype = "plantlike", tiles = {"ethereal_wild_onion_1.png"}, @@ -27,8 +28,7 @@ local def = { buildable_to = true, drop = "", selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} }, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -37,19 +37,22 @@ local def = { sounds = default.node_sound_leaves_defaults() } - --stage 1 + minetest.register_node("ethereal:onion_1", table.copy(def)) --stage 2 + def.tiles = {"ethereal_wild_onion_2.png"} minetest.register_node("ethereal:onion_2", table.copy(def)) --stage 3 + def.tiles = {"ethereal_wild_onion_3.png"} minetest.register_node("ethereal:onion_3", table.copy(def)) --stage 4 + def.tiles = {"ethereal_wild_onion_4.png"} def.drop = { items = { @@ -60,11 +63,11 @@ def.drop = { minetest.register_node("ethereal:onion_4", table.copy(def)) --stage 5 + def.tiles = {"ethereal_wild_onion_5.png"} def.groups.growing = nil def.selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -2.5/16, 0.5} + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -2.5/16, 0.5} } def.drop = { items = { @@ -74,8 +77,8 @@ def.drop = { } minetest.register_node("ethereal:onion_5", table.copy(def)) +-- register for use with farming redo growth routines --- register for use with farming redo growth routines if present if farming and farming.mod and farming.mod == "redo" then -- add to registered_plants @@ -86,9 +89,7 @@ if farming and farming.mod and farming.mod == "redo" then maxlight = farming.max_light, steps = 5 } - else - minetest.register_abm({ label = "Ethereal grow onion", nodenames = { @@ -112,11 +113,9 @@ else pos.y = pos.y + 1 -- do we have enough light? - local light = minetest.get_node_light(pos) + local light = minetest.get_node_light(pos) or 0 - if not light or light < 13 then - return - end + if light < 13 then return end -- grow to next stage local num = node.name:split("_")[2] @@ -127,4 +126,3 @@ else end }) end - diff --git a/ores.lua b/ores.lua index 6dd013e..a791bc7 100644 --- a/ores.lua +++ b/ores.lua @@ -1,7 +1,7 @@ --- Baked Clay (mesa biome is between 1 and 71) +-- stratum ore helper -local add_stratum = function(y_min, y_max, node) +local function add_stratum(y_min, y_max, node) minetest.register_ore({ ore_type = "stratum", @@ -14,6 +14,8 @@ local add_stratum = function(y_min, y_max, node) }) end +-- add baked clay layers (mesa biome is between 1 and 71) + add_stratum(5, 10, "bakedclay:red") add_stratum(15, 20, "bakedclay:grey") add_stratum(25, 30, "bakedclay:red") @@ -21,8 +23,9 @@ add_stratum(35, 40, "bakedclay:grey") add_stratum(45, 50, "bakedclay:red") add_stratum(55, 60, "bakedclay:grey") +-- scatter ore helper -local add_ore = function(a, b, c, d, e, f, g) +local function add_ore(a, b, c, d, e, f, g) minetest.register_ore({ ore_type = "scatter", @@ -36,32 +39,39 @@ local add_ore = function(a, b, c, d, e, f, g) }) end - -- Coal + add_ore("default:stone_with_coal", "default:desert_stone", 24*24*24, 27, 6, -31000, -16) -- Iron + add_ore("default:stone_with_iron", "default:desert_stone", 9*9*9, 5, 3, -63, -16) add_ore("default:stone_with_iron", "default:desert_stone", 24*24*24, 27, 6, -31000, -64) --Mese + add_ore("default:stone_with_mese", "default:desert_stone", 14*14*14, 5, 3, -31000, -256) -- Gold + add_ore("default:stone_with_gold", "default:desert_stone", 15*15*15, 3, 2, -255, -64) add_ore("default:stone_with_gold", "default:desert_stone", 13*13*13, 5, 3, -31000, -256) -- Diamond + add_ore("default:stone_with_diamond", "default:desert_stone", 17*17*17, 4, 3, -255, -128) add_ore("default:stone_with_diamond", "default:desert_stone", 15*15*15, 4, 3, -31000, -256) -- Copper + add_ore("default:stone_with_copper", "default:desert_stone", 9*9*9, 5, 3, -31000, -64) -- Coral Sand + add_ore("ethereal:sandy", "default:sand", 10*10*10, 24, 4, -100, -10) -- Etherium + minetest.register_ore({ ore_type = "scatter", ore = "ethereal:etherium_ore", @@ -75,6 +85,7 @@ minetest.register_ore({ }) -- Etherium in floatlands + minetest.register_ore({ ore_type = "scatter", ore = "ethereal:stone_with_etherium_ore", diff --git a/plantlife.lua b/plantlife.lua index 9d7db71..7fd8ca6 100644 --- a/plantlife.lua +++ b/plantlife.lua @@ -1,7 +1,8 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") -- Spore Grass + minetest.register_node("ethereal:spore_grass", { description = S("Spore Grass"), drawtype = "plantlike", @@ -16,12 +17,12 @@ minetest.register_node("ethereal:spore_grass", { groups = {snappy = 3, flora = 1, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} } }) --- Firethorn (poisonous when eaten raw, must be crushed and washed in flowing water 1st) +-- Firethorn (poisonous when eaten raw, must be crushed and washed water 1st) + minetest.register_node("ethereal:firethorn", { description = S("Firethorn Shrub"), drawtype = "plantlike", @@ -36,13 +37,12 @@ minetest.register_node("ethereal:firethorn", { groups = {snappy = 3, flora = 1, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} } }) - -- Fire Flower + minetest.register_node("ethereal:fire_flower", { description = S("Fire Flower"), drawtype = "plantlike", @@ -58,16 +58,13 @@ minetest.register_node("ethereal:fire_flower", { groups = {snappy = 1, oddly_breakable_by_hand = 3, igniter = 2}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 1 / 2, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 1 / 2, 5 / 16} }, - on_punch = function(pos, node, puncher) + on_punch = function(pos, node, puncher) -- hurts when punched puncher:punch(puncher, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 2} - }, nil) + full_punch_interval = 1.0, damage_groups = {fleshy = 2}}, nil) end }) @@ -77,8 +74,8 @@ minetest.register_craft({ burntime = 20 }) - -- Fire Dust + minetest.register_craftitem("ethereal:fire_dust", { description = S("Fire Dust"), inventory_image = "ethereal_fire_dust.png" @@ -95,8 +92,8 @@ minetest.register_craft({ burntime = 10 }) - -- vines + minetest.register_node("ethereal:vine", { description = S("Vine"), drawtype = "signlike", @@ -108,9 +105,7 @@ minetest.register_node("ethereal:vine", { walkable = false, climbable = true, is_ground_content = false, - selection_box = { - type = "wallmounted" - }, + selection_box = {type = "wallmounted"}, groups = {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2}, legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults() @@ -125,8 +120,8 @@ minetest.register_craft({ } }) - -- light strings (glowing vine) + minetest.register_node("ethereal:lightstring", { description = S("Light String Vine"), drawtype = "signlike", @@ -139,9 +134,7 @@ minetest.register_node("ethereal:lightstring", { walkable = false, climbable = true, is_ground_content = false, - selection_box = { - type = "wallmounted" - }, + selection_box = {type = "wallmounted"}, groups = {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2}, legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults() @@ -156,8 +149,8 @@ minetest.register_craft({ } }) +-- Boston Fern --- Fern (boston) minetest.register_node("ethereal:fern", { description = S("Fern"), drawtype = "plantlike", @@ -180,12 +173,12 @@ minetest.register_node("ethereal:fern", { groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 2}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0.67, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0.67, 5 / 16} } }) --- Boston Ferns sometimes drop edible Tubers (heals 1/2 heart when eaten) +-- Boston Ferns sometimes drop edible Tubers + minetest.register_craftitem("ethereal:fern_tubers", { description = S("Fern Tubers"), inventory_image = "ethereal_fern_tubers.png", @@ -196,6 +189,7 @@ minetest.register_craftitem("ethereal:fern_tubers", { ethereal.add_eatable("ethereal:fern_tubers", 1) -- Red Shrub (not flammable) + minetest.register_node("ethereal:dry_shrub", { description = S("Fiery Dry Shrub"), drawtype = "plantlike", @@ -210,13 +204,12 @@ minetest.register_node("ethereal:dry_shrub", { groups = {snappy = 3, flora = 1, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16} } }) - -- Grey Shrub (not Flammable - too cold to burn) + minetest.register_node("ethereal:snowygrass", { description = S("Snowy Grass"), drawtype = "plantlike", @@ -232,13 +225,12 @@ minetest.register_node("ethereal:snowygrass", { groups = {snappy = 3, flora = 1, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16} } }) - -- Crystal Shrub (not Flammable - too cold to burn) + minetest.register_node("ethereal:crystalgrass", { description = S("Crystal Grass"), drawtype = "plantlike", @@ -254,13 +246,12 @@ minetest.register_node("ethereal:crystalgrass", { groups = {snappy = 3, flora = 1, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16} } }) +-- tall lilac --- lilac minetest.register_node("ethereal:lilac", { description = S("Lilac"), drawtype = "plantlike", @@ -276,8 +267,7 @@ minetest.register_node("ethereal:lilac", { groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 2}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0.67, 5 / 16} + type = "fixed", fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0.67, 5 / 16} } }) @@ -286,9 +276,9 @@ minetest.register_craft({ recipe = {{"ethereal:lilac"}} }) +-- moss helper function --- Define Moss Types (Has grass textures on all sides) -local add_moss = function(typ, descr, texture, receipe_item) +local function add_moss(typ, descr, texture, receipe_item) minetest.register_node("ethereal:" .. typ .. "_moss", { description = S(descr .. " Moss"), @@ -304,15 +294,17 @@ local add_moss = function(typ, descr, texture, receipe_item) }) end +-- add moss types (has grass texture on all sides) + add_moss("crystal", "Crystal", "ethereal_grass_crystal_top.png", "ethereal:frost_leaves") add_moss("mushroom", "Mushroom", "ethereal_grass_mushroom_top.png", "ethereal:spore_grass") add_moss("fiery", "Fiery", "ethereal_grass_fiery_top.png", "ethereal:dry_shrub") add_moss("gray", "Gray", "ethereal_grass_gray_top.png", "ethereal:snowygrass") add_moss("green", "Green", "default_grass.png", "default:jungleleaves") +-- shroom helper function --- Illuminated Cave Shrooms (Red, Green and Blue) -local add_shroom = function(name, desc, ad) +local function add_shroom(name, desc, ad) minetest.register_node("ethereal:illumishroom" .. ad, { description = S(desc .. " Illumishroom"), @@ -327,12 +319,13 @@ local add_shroom = function(name, desc, ad) groups = {dig_immediate = 3, attached_node = 1, flammable = 3}, sounds = default.node_sound_leaves_defaults(), selection_box = { - type = "fixed", - fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.47, 6 / 16} + type = "fixed", fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.47, 6 / 16} } }) end +-- add illuminated cave shrooms + add_shroom("red", "Red", "") add_shroom("green", "Green", "2") add_shroom("cyan", "Cyan", "3") diff --git a/sapling.lua b/sapling.lua index 5554353..6c450f5 100644 --- a/sapling.lua +++ b/sapling.lua @@ -1,17 +1,19 @@ -local S = ethereal.translate +-- translator and protection check setting --- Sapling protection check function +local S = minetest.get_translator("ethereal") local sapling_protection_check = minetest.settings:get_bool( "ethereal.sapling_protection_check", false) +-- sapling placement helper + local function prepare_on_place(itemstack, placer, pointed_thing, name, w, h) if sapling_protection_check then -- check if grown tree area intersects any players protected area return default.sapling_on_place(itemstack, placer, pointed_thing, - name, {x = -w, y = 1, z = -w}, {x = w, y = h, z = w}, 4) + name, {x = -w, y = 1, z = -w}, {x = w, y = h, z = w}, 4) end -- Position of sapling @@ -21,8 +23,7 @@ local function prepare_on_place(itemstack, placer, pointed_thing, name, w, h) -- Check if node clicked on has it's own on_rightclick function if pdef and pdef.on_rightclick - and not (placer and placer:is_player() - and placer:get_player_control().sneak) then + and not (placer and placer:is_player() and placer:get_player_control().sneak) then return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) end @@ -30,8 +31,8 @@ local function prepare_on_place(itemstack, placer, pointed_thing, name, w, h) return minetest.item_place_node(itemstack, placer, pointed_thing) end - -- Basandra Bush Sapling + minetest.register_node("ethereal:basandra_bush_sapling", { description = S("Basandra Bush Sapling"), drawtype = "plantlike", @@ -42,21 +43,21 @@ minetest.register_node("ethereal:basandra_bush_sapling", { sunlight_propagates = true, walkable = false, selection_box = { - type = "fixed", - fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + type = "fixed", fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, attached_node = 1, ethereal_sapling = 1, sapling = 1}, sounds = default.node_sound_leaves_defaults(), grown_height = 2, + on_place = function(itemstack, placer, pointed_thing) return prepare_on_place(itemstack, placer, pointed_thing, "ethereal:basandra_bush_sapling", 1, 2) end }) - -- Bamboo Sprout + minetest.register_node("ethereal:bamboo_sprout", { description = S("Bamboo Sprout"), drawtype = "plantlike", @@ -72,20 +73,20 @@ minetest.register_node("ethereal:bamboo_sprout", { }, sounds = default.node_sound_defaults(), selection_box = { - type = "fixed", - fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 0, 4 / 16} + type = "fixed", fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 0, 4 / 16} }, on_use = minetest.item_eat(2), grown_height = 11, + on_place = function(itemstack, placer, pointed_thing) return prepare_on_place(itemstack, placer, pointed_thing, "ethereal:bamboo_sprout", 1, 18) end }) +-- register Sapling helper --- Register Saplings -local register_sapling = function(name, desc, texture, width, height) +local function register_sapling(name, desc, texture, width, height) minetest.register_node(name .. "_sapling", { description = S(desc .. " Tree Sapling"), @@ -98,8 +99,7 @@ local register_sapling = function(name, desc, texture, width, height) is_ground_content = false, walkable = false, selection_box = { - type = "fixed", - fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + type = "fixed", fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = { snappy = 2, dig_immediate = 3, flammable = 2, @@ -107,6 +107,7 @@ local register_sapling = function(name, desc, texture, width, height) }, sounds = default.node_sound_leaves_defaults(), grown_height = height, + on_place = function(itemstack, placer, pointed_thing) return prepare_on_place(itemstack, placer, pointed_thing, name .. "_sapling", width, height) @@ -114,13 +115,16 @@ local register_sapling = function(name, desc, texture, width, height) }) end +-- add saplings + register_sapling("ethereal:willow", "Willow", "ethereal_willow_sapling", 5, 14) register_sapling("ethereal:yellow_tree", "Healing", "ethereal_yellow_tree_sapling", 4, 19) register_sapling("ethereal:big_tree", "Big", "ethereal_big_tree_sapling", 4, 7) register_sapling("ethereal:banana_tree", "Banana", "ethereal_banana_tree_sapling", 3, 8) register_sapling("ethereal:frost_tree", "Frost", "ethereal_frost_tree_sapling", 4, 19) register_sapling("ethereal:mushroom", "Mushroom", "ethereal_mushroom_sapling", 4, 11) -register_sapling("ethereal:mushroom_brown", "Brown Mushroom", "ethereal_mushroom_brown_sapling", 1, 11) +register_sapling("ethereal:mushroom_brown", "Brown Mushroom", + "ethereal_mushroom_brown_sapling", 1, 11) register_sapling("ethereal:palm", "Palm", "moretrees_palm_sapling", 4, 9) register_sapling("ethereal:giant_redwood", "Giant Redwood", "ethereal_giant_redwood_sapling", 7, 33) @@ -131,26 +135,23 @@ register_sapling("ethereal:sakura", "Sakura", "ethereal_sakura_sapling", 4, 10) register_sapling("ethereal:lemon_tree", "Lemon", "ethereal_lemon_tree_sapling", 2, 7) register_sapling("ethereal:olive_tree", "Olive", "ethereal_olive_tree_sapling", 3, 10) +-- add tree schematic -local add_tree = function (pos, ofx, ofy, ofz, schem, replace) +local function add_tree(pos, ofx, ofy, ofz, schem, replace) - -- check for schematic - if not schem then - print (S("Schematic not found")) - return - end + if not schem then print("Schematic not found") ; return end - -- remove sapling and place schematic minetest.swap_node(pos, {name = "air"}) minetest.place_schematic({x = pos.x - ofx, y = pos.y - ofy, z = pos.z - ofz}, schem, 0, replace, false) end +-- get mod path and schematic folder local path = minetest.get_modpath("ethereal") .. "/schematics/" --- grow tree functions +-- global tree grow functions function ethereal.grow_basandra_bush(pos) add_tree(pos, 1, 0, 1, ethereal.basandrabush) @@ -234,129 +235,96 @@ function ethereal.grow_olive_tree(pos) add_tree(pos, 3, 0, 3, ethereal.olivetree) end +-- return True if sapling has enough height room to grow --- check if sapling has enough height room to grow -local enough_height = function(pos, height) +local function enough_height(pos, height) - local nod = minetest.line_of_sight( + return minetest.line_of_sight( {x = pos.x, y = pos.y + 1, z = pos.z}, {x = pos.x, y = pos.y + height, z = pos.z}) - - if not nod then - return false -- obstructed - else - return true -- can grow - end end +-- global function run by Abm -ethereal.grow_sapling = function(pos, node) +function ethereal.grow_sapling(pos, node) - local light_level = minetest.get_node_light(pos) or 0 - - if light_level < 13 then - return - end + if (minetest.get_node_light(pos) or 0) < 13 then return end + -- get node below sapling local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name - - if not minetest.registered_nodes[node.name] then - return - end - - local height = minetest.registered_nodes[node.name].grown_height + local def = minetest.registered_nodes[node.name] ; if not def then return end + local height = def.grown_height -- do we have enough height to grow sapling into tree? - if not height or not enough_height(pos, height) then - return - end + if not height or not enough_height(pos, height) then return end - -- Check if Ethereal Sapling is growing on correct substrate + -- check if Ethereal Sapling is growing on correct substrate if node.name == "ethereal:basandra_bush_sapling" - and under == "ethereal:fiery_dirt" then - ethereal.grow_basandra_bush(pos) + and under == "ethereal:fiery_dirt" then ethereal.grow_basandra_bush(pos) elseif node.name == "ethereal:yellow_tree_sapling" - and minetest.get_item_group(under, "soil") > 0 then - ethereal.grow_yellow_tree(pos) + and minetest.get_item_group(under, "soil") > 0 then ethereal.grow_yellow_tree(pos) elseif node.name == "ethereal:big_tree_sapling" - and under == "default:dirt_with_grass" then - ethereal.grow_big_tree(pos) + and under == "default:dirt_with_grass" then ethereal.grow_big_tree(pos) elseif node.name == "ethereal:banana_tree_sapling" - and under == "ethereal:grove_dirt" then - ethereal.grow_banana_tree(pos) + and under == "ethereal:grove_dirt" then ethereal.grow_banana_tree(pos) elseif node.name == "ethereal:frost_tree_sapling" - and under == "ethereal:crystal_dirt" then - ethereal.grow_frost_tree(pos) + and under == "ethereal:crystal_dirt" then ethereal.grow_frost_tree(pos) elseif node.name == "ethereal:mushroom_sapling" - and under == "ethereal:mushroom_dirt" then - ethereal.grow_mushroom_tree(pos) + and under == "ethereal:mushroom_dirt" then ethereal.grow_mushroom_tree(pos) elseif node.name == "ethereal:mushroom_brown_sapling" - and under == "ethereal:mushroom_dirt" then - ethereal.grow_mushroom_brown_tree(pos) + and under == "ethereal:mushroom_dirt" then ethereal.grow_mushroom_brown_tree(pos) elseif node.name == "ethereal:palm_sapling" - and under == "default:sand" then - ethereal.grow_palm_tree(pos) + and under == "default:sand" then ethereal.grow_palm_tree(pos) elseif node.name == "ethereal:willow_sapling" - and under == "ethereal:gray_dirt" then - ethereal.grow_willow_tree(pos) + and under == "ethereal:gray_dirt" then ethereal.grow_willow_tree(pos) elseif node.name == "ethereal:redwood_sapling" - and under == "default:dirt_with_dry_grass" then - ethereal.grow_redwood_tree(pos) + and under == "default:dirt_with_dry_grass" then ethereal.grow_redwood_tree(pos) elseif node.name == "ethereal:giant_redwood_sapling" - and under == "default:dirt_with_dry_grass" then - ethereal.grow_giant_redwood_tree(pos) + and under == "default:dirt_with_dry_grass" then ethereal.grow_giant_redwood_tree(pos) elseif node.name == "ethereal:orange_tree_sapling" - and under == "ethereal:prairie_dirt" then - ethereal.grow_orange_tree(pos) + and under == "ethereal:prairie_dirt" then ethereal.grow_orange_tree(pos) elseif node.name == "ethereal:bamboo_sprout" - and under == "ethereal:bamboo_dirt" then - ethereal.grow_bamboo_tree(pos) + and under == "ethereal:bamboo_dirt" then ethereal.grow_bamboo_tree(pos) elseif node.name == "ethereal:birch_sapling" - and under == "default:dirt_with_grass" then - ethereal.grow_birch_tree(pos) + and under == "default:dirt_with_grass" then ethereal.grow_birch_tree(pos) elseif node.name == "ethereal:sakura_sapling" - and under == "ethereal:bamboo_dirt" then - ethereal.grow_sakura_tree(pos) + and under == "ethereal:bamboo_dirt" then ethereal.grow_sakura_tree(pos) elseif node.name == "ethereal:olive_tree_sapling" - and under == "ethereal:grove_dirt" then - ethereal.grow_olive_tree(pos) + and under == "ethereal:grove_dirt" then ethereal.grow_olive_tree(pos) elseif node.name == "ethereal:lemon_tree_sapling" - and under == "ethereal:grove_dirt" then - ethereal.grow_lemon_tree(pos) - end + and under == "ethereal:grove_dirt" then ethereal.grow_lemon_tree(pos) end end --- Grow saplings +-- grow saplings Abm + minetest.register_abm({ label = "Ethereal grow sapling", nodenames = {"group:ethereal_sapling"}, interval = 10, chance = 50, catch_up = false, - action = function(pos, node) - ethereal.grow_sapling(pos, node) - end + action = ethereal.grow_sapling -- (pos, node) }) -- 2x redwood saplings make 1x giant redwood sapling + minetest.register_craft({ output = "ethereal:giant_redwood_sapling", recipe = {{"ethereal:redwood_sapling", "ethereal:redwood_sapling"}} }) - diff --git a/schems.lua b/schems.lua index c769924..7ccbb7d 100644 --- a/schems.lua +++ b/schems.lua @@ -1,9 +1,11 @@ +-- path to default and ethereal schematics + local path = minetest.get_modpath("ethereal") .. "/schematics/" local dpath = minetest.get_modpath("default") .. "/schematics/" - -- load schematic tables + dofile(path .. "orange_tree.lua") dofile(path .. "banana_tree.lua") dofile(path .. "bamboo_tree.lua") @@ -29,12 +31,11 @@ dofile(path .. "lemon_tree.lua") dofile(path .. "olive_tree.lua") dofile(path .. "basandra_bush.lua") +-- add chematic helper function --- helper function -local add_schem = function(a, b, c, d, e, f, g, h, i, j, k) +local function add_schem(a, b, c, d, e, f, g, h, i, j, k) - -- if not 1 then biome disabled, don't add - if g ~= 1 then return end + if g ~= 1 then return end -- add if setting is 1 minetest.register_decoration({ deco_type = "schematic", @@ -53,125 +54,149 @@ local add_schem = function(a, b, c, d, e, f, g, h, i, j, k) }) end - -- igloo + add_schem("default:snowblock", 0.0005, {"glacier"}, 3, 50, ethereal.igloo, ethereal.glacier, nil, "default:snowblock", 8, "random") -- sakura tree + add_schem({"ethereal:bamboo_dirt"}, 0.001, {"sakura"}, 7, 100, ethereal.sakura_tree, ethereal.sakura, nil, "ethereal:bamboo_dirt", 6) -- redwood tree + add_schem({"default:dirt_with_dry_grass"}, 0.0025, {"mesa"}, 1, 100, ethereal.redwood_tree, ethereal.mesa, nil, "default:dirt_with_dry_grass", 8) -- banana tree + add_schem({"ethereal:grove_dirt"}, 0.015, {"grove"}, 1, 100, ethereal.bananatree, ethereal.grove) -- healing tree + add_schem({"default:dirt_with_snow"}, 0.01, {"taiga"}, 120, 140, ethereal.yellowtree, ethereal.alpine, nil, "default:dirt_with_snow", 8) -- crystal frost tree + add_schem({"ethereal:crystal_dirt"}, 0.01, {"frost", "frost_floatland"}, 1, 1750, ethereal.frosttrees, ethereal.frost, nil, "ethereal:crystal_dirt", 8) -- giant mushroom + add_schem("ethereal:mushroom_dirt", 0.02, {"mushroom"}, 3, 25, ethereal.mushroomone, ethereal.mushroom, nil, "ethereal:mushroom_dirt", 8) -- giant brown mushroom + add_schem("ethereal:mushroom_dirt", 0.02, {"mushroom"}, 26, 50, ethereal.mushroomtwo, ethereal.mushroom, nil, nil, nil, "random") -- small lava crater + add_schem("ethereal:fiery_dirt", 0.01, {"fiery"}, 1, 100, ethereal.volcanom, ethereal.fiery, nil, "ethereal:fiery_dirt", 8) -- large lava crater + add_schem("ethereal:fiery_dirt", 0.003, {"fiery"}, 1, 100, ethereal.volcanol, ethereal.fiery, nil, "ethereal:fiery_dirt", 8, "random") -- basandra bush + add_schem("ethereal:fiery_dirt", 0.03, {"fiery"}, 1, 100, ethereal.basandrabush, ethereal.fiery) -- default jungle tree + add_schem({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, 0.08, {"junglee"}, 1, 100, dpath .. "jungle_tree.mts", ethereal.junglee) -- willow tree + add_schem({"ethereal:gray_dirt"}, 0.02, {"grayness"}, 1, 100, - ethereal.willow, ethereal.grayness, nil, - "ethereal:gray_dirt", 6) + ethereal.willow, ethereal.grayness, nil, "ethereal:gray_dirt", 6) -- default large pine tree for lower elevation + add_schem({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, 0.025, {"coniferous_forest"}, 10, 40, dpath .. "pine_tree.mts", ethereal.snowy) -- small pine for higher elevation + add_schem({"default:dirt_with_snow"}, 0.025, {"taiga"}, 40, 140, ethereal.pinetree, ethereal.alpine) -- default apple tree + add_schem({"default:dirt_with_grass"}, 0.025, {"jumble", "deciduous_forest"}, 1, 100, dpath .. "apple_tree.mts", ethereal.grassy) -- big old tree + add_schem({"default:dirt_with_grass"}, 0.001, {"jumble"}, 1, 100, - ethereal.bigtree, ethereal.jumble, nil, - "default:dirt_with_grass", 8) + ethereal.bigtree, ethereal.jumble, nil, "default:dirt_with_grass", 8) -- default aspen tree + add_schem({"default:dirt_with_grass"}, 0.02, {"grassytwo"}, 1, 50, dpath .. "aspen_tree.mts", ethereal.jumble) -- birch tree + add_schem({"default:dirt_with_grass"}, 0.02, {"grassytwo"}, 50, 100, ethereal.birchtree, ethereal.grassytwo) -- orange tree + add_schem({"ethereal:prairie_dirt"}, 0.01, {"prairie"}, 1, 100, ethereal.orangetree, ethereal.prairie) -- default acacia tree + add_schem({"default:dry_dirt_with_dry_grass", "default:dirt_with_dry_grass"}, 0.004, {"savanna"}, 1, 100, dpath .. "acacia_tree.mts", ethereal.savanna) -- palm tree + add_schem("default:sand", 0.0025, {"desert_ocean", "plains_ocean", "sandclay", "sandstone_ocean", "mesa_ocean", "grove_ocean", "deciduous_forest_ocean"}, 1, 1, ethereal.palmtree, 1) -- bamboo tree + add_schem({"ethereal:bamboo_dirt"}, 0.025, {"bamboo"}, 1, 100, ethereal.bambootree, ethereal.bamboo) -- bush + add_schem({"ethereal:bamboo_dirt"}, 0.08, {"bamboo"}, 1, 100, ethereal.bush, ethereal.bamboo) -- vine tree + add_schem({"default:dirt_with_grass"}, 0.02, {"swamp"}, 1, 100, ethereal.vinetree, ethereal.swamp) -- lemon tree + add_schem({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 5, 50, ethereal.lemontree, ethereal.mediterranean) -- olive tree + add_schem({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 5, 35, ethereal.olivetree, ethereal.mediterranean) - -- default large cactus + if ethereal.desert == 1 then minetest.register_decoration({ @@ -195,8 +220,8 @@ if ethereal.desert == 1 then }) end - -- default bush + minetest.register_decoration({ deco_type = "schematic", place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, @@ -216,8 +241,8 @@ minetest.register_decoration({ flags = "place_center_x, place_center_z" }) - -- default acacia bush + minetest.register_decoration({ deco_type = "schematic", place_on = { @@ -238,8 +263,8 @@ minetest.register_decoration({ flags = "place_center_x, place_center_z" }) - -- default pine bush + if minetest.registered_nodes["default:pine_bush"] then minetest.register_decoration({ @@ -263,8 +288,8 @@ if minetest.registered_nodes["default:pine_bush"] then }) end - -- default blueberry bush + if minetest.registered_nodes["default:blueberry_bush_leaves"] then minetest.register_decoration({ @@ -290,8 +315,8 @@ if minetest.registered_nodes["default:blueberry_bush_leaves"] then }) end - -- place waterlily in beach areas + minetest.register_decoration({ deco_type = "schematic", place_on = {"default:sand"}, @@ -312,8 +337,8 @@ minetest.register_decoration({ rotation = "random" }) - -- coral reef + if ethereal.reefs == 1 then -- override corals so crystal shovel can pick them up intact @@ -341,12 +366,13 @@ if ethereal.reefs == 1 then }) end - -- tree logs + if ethereal.logs == 1 then if ethereal.grassy == 1 or ethereal.prairie == 1 then -minetest.register_decoration({ + + minetest.register_decoration({ name = "default:apple_log", deco_type = "schematic", place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt"}, @@ -365,6 +391,7 @@ minetest.register_decoration({ end if ethereal.junglee == 1 then + minetest.register_decoration({ name = "default:jungle_log", deco_type = "schematic", @@ -384,6 +411,7 @@ if ethereal.junglee == 1 then end if ethereal.snowy == 1 then + minetest.register_decoration({ name = "default:pine_log", deco_type = "schematic", @@ -403,6 +431,7 @@ if ethereal.snowy == 1 then end if ethereal.savanna == 1 then + minetest.register_decoration({ name = "default:acacia_log", deco_type = "schematic", @@ -429,6 +458,7 @@ if ethereal.savanna == 1 then end if ethereal.plains == 1 then + minetest.register_decoration({ name = "ethereal:scorched_log", deco_type = "schematic", @@ -456,6 +486,7 @@ if ethereal.plains == 1 then end if ethereal.grove == 1 then + minetest.register_decoration({ name = "ethereal:banana_log", deco_type = "schematic", @@ -482,5 +513,4 @@ if ethereal.grove == 1 then }) end -end - +end -- end if ethereal.logs diff --git a/sealife.lua b/sealife.lua index 35bec91..1955e32 100644 --- a/sealife.lua +++ b/sealife.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate - +local S = minetest.get_translator("ethereal") -- Seaweed + minetest.register_node("ethereal:seaweed", { description = S("Seaweed"), drawtype = "plantlike", @@ -14,8 +14,7 @@ minetest.register_node("ethereal:seaweed", { climbable = true, drowning = 1, selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} }, post_effect_color = {a = 64, r = 100, g = 100, b = 200}, groups = {food_seaweed = 1, snappy = 3}, @@ -33,9 +32,7 @@ minetest.register_node("ethereal:seaweed", { if def_up.liquidtype == nil or def_up.liquidtype ~= "none" then - if minetest.is_protected(pos, pname) then - return - end + if minetest.is_protected(pos, pname) then return end if def_down.name ~= "default:sand" and def_down.name ~= "ethereal:sandy" then return @@ -60,6 +57,8 @@ minetest.register_node("ethereal:seaweed", { ethereal.add_eatable("ethereal:seaweed", 1) +-- seaweed rooted in sand + minetest.register_node("ethereal:seaweed_rooted", { description = S("Seaweed"), drop = "ethereal:seaweed", @@ -74,8 +73,7 @@ minetest.register_node("ethereal:seaweed_rooted", { selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - {-2/16, 0.5, -2/16, 2/16, 3.5, 2/16}, + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, {-2/16, 0.5, -2/16, 2/16, 3.5, 2/16}, }, }, node_dig_prediction = "default:sand", @@ -114,6 +112,7 @@ minetest.register_node("ethereal:seaweed_rooted", { end }) +-- update old style seaweed nodes to new minetest.register_lbm({ label = "[ethereal] Upgrade seaweed", @@ -132,8 +131,7 @@ minetest.register_lbm({ local height = 0 - while height < 14 - and minetest.get_node(pos_up).name == "ethereal:seaweed" do + while height < 14 and minetest.get_node(pos_up).name == "ethereal:seaweed" do minetest.remove_node(pos_up) height = height + 1 pos_up.y = pos_up.y + 1 @@ -147,34 +145,16 @@ minetest.register_lbm({ end }) +-- seaweed to dark green dye --- seaweed to d.green dye minetest.register_craft( { output = "dye:dark_green 3", recipe = {{"ethereal:seaweed"}} - -}) --- agar powder -minetest.register_craftitem("ethereal:agar_powder", { - description = S("Agar Powder"), - inventory_image = "ethereal_agar_powder.png", - groups = {food_gelatin = 1, flammable = 2} -}) - -minetest.register_craft({ - output = "ethereal:agar_powder 3", - recipe = { - {"group:food_seaweed", "group:food_seaweed", "group:food_seaweed"}, - {"bucket:bucket_water", "bucket:bucket_water", "default:torch"}, - {"bucket:bucket_water", "bucket:bucket_water", "default:torch"} - }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty 4"} - } }) --- Corals +-- coral on_place helper function + local coral_nodes = {} local function register_coral(name, description, texture) @@ -190,9 +170,7 @@ local function register_coral(name, description, texture) if def_up.liquidtype == nil or def_up.liquidtype ~= "none" then - if minetest.is_protected(pos, pname) then - return - end + if minetest.is_protected(pos, pname) then return end if def_down.name ~= "default:sand"and def_down.name ~= "ethereal:sandy" then return @@ -221,6 +199,7 @@ local function register_coral(name, description, texture) return res end + -- decorative coral node minetest.register_node("ethereal:" .. name, { description = description, drawtype = "plantlike", @@ -229,8 +208,7 @@ local function register_coral(name, description, texture) wield_image = texture, paramtype = "light", selection_box = { - type = "fixed", - fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 1 / 4, 6 / 16} + type = "fixed", fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 1 / 4, 6 / 16} }, light_source = 3, groups = {snappy = 3}, @@ -238,6 +216,7 @@ local function register_coral(name, description, texture) on_place = plantlike_on_place }) + -- coral node rooted in sand minetest.register_node("ethereal:" .. name .. "_rooted", { description = description, drop = "ethereal:" .. name, @@ -248,8 +227,7 @@ local function register_coral(name, description, texture) wield_image = texture, paramtype = "light", selection_box = { - type = "fixed", - fixed = {-6 / 16, 0.5, -6 / 16, 6 / 16, 1.25, 6 / 16} + type = "fixed", fixed = {-6 / 16, 0.5, -6 / 16, 6 / 16, 1.25, 6 / 16} }, light_source = 3, groups = {snappy = 3, not_in_creative_inventory = 1}, @@ -260,6 +238,7 @@ local function register_coral(name, description, texture) table.insert(coral_nodes, "ethereal:" .. name) end +-- update old style coral to new minetest.register_lbm({ label = "[ethereal] Upgrade corals", @@ -284,44 +263,32 @@ minetest.register_lbm({ end }) - -- Blua Coral + register_coral("coral2", S("Blue Glow Coral"), "ethereal_coral_blue.png") -minetest.register_craft( { - output = "dye:cyan 3", - recipe = {{"ethereal:coral2"}} -}) - +minetest.register_craft({output = "dye:cyan 3", recipe = {{"ethereal:coral2"}}}) -- Orange Coral + register_coral("coral3", S("Orange Glow Coral"), "ethereal_coral_orange.png") -minetest.register_craft( { - output = "dye:orange 3", - recipe = {{"ethereal:coral3"}} -}) - +minetest.register_craft({output = "dye:orange 3", recipe = {{"ethereal:coral3"}}}) -- Pink Coral + register_coral("coral4", S("Pink Glow Coral"), "ethereal_coral_pink.png") -minetest.register_craft( { - output = "dye:pink 3", - recipe = {{"ethereal:coral4"}} -}) - +minetest.register_craft({output = "dye:pink 3", recipe = {{"ethereal:coral4"}}}) -- Green Coral + register_coral("coral5", S("Green Glow Coral"), "ethereal_coral_green.png") -minetest.register_craft( { - output = "dye:green 3", - recipe = {{"ethereal:coral5"}} -}) - +minetest.register_craft({output = "dye:green 3", recipe = {{"ethereal:coral5"}}}) -- Undersea Sand (used for growing seaweed and corals) + minetest.register_node("ethereal:sandy", { description = S("Sandy"), tiles = {"default_sand.png"}, @@ -333,8 +300,8 @@ minetest.register_node("ethereal:sandy", { sounds = default.node_sound_sand_defaults() }) - -- randomly generate coral or seaweed and have seaweed grow up to 14 high + if ethereal.sealife == 1 then minetest.register_abm({ @@ -353,9 +320,7 @@ if ethereal.sealife == 1 then local p2 = node.param2 or 16 local height = math.max(1, math.floor(p2 / 16)) - if height > 13 then - return - end + if height > 13 then return end height = height + 1 @@ -397,8 +362,7 @@ if ethereal.sealife == 1 then }) end - --- sponge nodes +-- sponge nodes (place dry sponge to suck up all water surrounding it, cook to dry) minetest.register_node("ethereal:sponge_air", { drawtype = "airlike", @@ -430,14 +394,12 @@ minetest.register_node("ethereal:sponge", { local name = placer:get_player_name() -- is area protected - if minetest.is_protected(pos, name) then - return - end + if minetest.is_protected(pos, name) then return end -- get water nodes within range local num = minetest.find_nodes_in_area( - {x = pos.x - 3, y = pos.y - 3, z = pos.z - 3}, - {x = pos.x + 3, y = pos.y + 3, z = pos.z + 3}, {"group:water"}) + {x = pos.x - 3, y = pos.y - 3, z = pos.z - 3}, + {x = pos.x + 3, y = pos.y + 3, z = pos.z + 3}, {"group:water"}) -- no water if #num == 0 then return end @@ -456,6 +418,7 @@ minetest.register_node("ethereal:sponge", { }) -- cook wet sponge into dry sponge + minetest.register_craft({ type = "cooking", recipe = "ethereal:sponge_wet", @@ -464,6 +427,7 @@ minetest.register_craft({ }) -- use leaf decay to remove sponge air nodes + default.register_leafdecay({ trunks = {"ethereal:sponge_wet"}, leaves = {"ethereal:sponge_air"}, @@ -471,6 +435,7 @@ default.register_leafdecay({ }) -- dry sponges can be used as fuel + minetest.register_craft({ type = "fuel", recipe = "ethereal:sponge", diff --git a/stairs.lua b/stairs.lua index 1552c61..9fecb67 100644 --- a/stairs.lua +++ b/stairs.lua @@ -1,13 +1,13 @@ --- language support -local S = ethereal.translate +-- translation and mod check --- stair mods active +local S = minetest.get_translator("ethereal") local stairs_mod = minetest.get_modpath("stairs") local stairs_redo = stairs_mod and stairs.mod and stairs.mod == "redo" local stairs_plus = minetest.global_exists("stairsplus") --- stair selection function +-- register stair function (stair mod will be auto-selected) + local do_stair = function(description, name, node, groups, texture, sound) if stairs_redo then @@ -39,51 +39,39 @@ local do_stair = function(description, name, node, groups, texture, sound) mod .. ":slab_" .. name) else - stairs.register_stair_and_slab(name, node, groups, texture, S(description .. " Stair"), S(description .. " Slab"), sound, true) end end - --- Register Stairs (stair mod will be auto-selected) +-- Register Stairs do_stair( - "Blue Marble", - "blue_marble", - "ethereal:blue_marble", + "Blue Marble", "blue_marble", "ethereal:blue_marble", {cracky = 1}, {"ethereal_blue_marble.png"}, default.node_sound_stone_defaults()) do_stair( - "Blue Marble Tile", - "blue_marble_tile", - "ethereal:blue_marble_tile", + "Blue Marble Tile", "blue_marble_tile", "ethereal:blue_marble_tile", {cracky = 1}, {"ethereal_blue_marble_tile.png"}, default.node_sound_stone_defaults()) do_stair( - "Crystal Block", - "crystal_block", - "ethereal:crystal_block", + "Crystal Block", "crystal_block", "ethereal:crystal_block", {cracky = 1, level = 2, puts_out_fire = 1, cools_lava = 1}, {"ethereal_crystal_block.png"}, default.node_sound_glass_defaults()) do_stair( - "Ice Brick", - "icebrick", - "ethereal:icebrick", + "Ice Brick", "icebrick", "ethereal:icebrick", {cracky = 3, puts_out_fire = 1, cools_lava = 1, slippery = 3}, {"ethereal_brick_ice.png"}, default.node_sound_glass_defaults()) do_stair( - "Snow Brick", - "snowbrick", - "ethereal:snowbrick", + "Snow Brick", "snowbrick", "ethereal:snowbrick", {crumbly = 3, puts_out_fire = 1, cools_lava = 1}, {"ethereal_brick_snow.png"}, default.node_sound_dirt_defaults({ @@ -92,105 +80,79 @@ do_stair( })) do_stair( - "Dried Dirt", - "dry_dirt", - "ethereal:dry_dirt", + "Dried Dirt", "dry_dirt", "ethereal:dry_dirt", {crumbly = 3}, {"ethereal_dry_dirt.png"}, default.node_sound_dirt_defaults()) do_stair( - "Mushroom Trunk", - "mushroom_trunk", - "ethereal:mushroom_trunk", + "Mushroom Trunk", "mushroom_trunk", "ethereal:mushroom_trunk", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, {"ethereal_mushroom_trunk.png"}, default.node_sound_wood_defaults()) do_stair( - "Mushroom Top", - "mushroom", - "ethereal:mushroom", + "Mushroom Top", "mushroom", "ethereal:mushroom", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, {"ethereal_mushroom_block.png"}, default.node_sound_wood_defaults()) do_stair( - "Frost Wood", - "frost_wood", - "ethereal:frost_wood", + "Frost Wood", "frost_wood", "ethereal:frost_wood", {choppy = 2, oddly_breakable_by_hand = 1, put_out_fire = 1}, {"ethereal_frost_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Healing Wood", - "yellow_wood", - "ethereal:yellow_wood", + "Healing Wood", "yellow_wood", "ethereal:yellow_wood", {choppy = 2, oddly_breakable_by_hand = 1, put_out_fire = 1}, {"ethereal_yellow_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Palm Wood", - "palm_wood", - "ethereal:palm_wood", + "Palm Wood", "palm_wood", "ethereal:palm_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"moretrees_palm_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Birch Wood", - "birch_wood", - "ethereal:birch_wood", + "Birch Wood", "birch_wood", "ethereal:birch_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"moretrees_birch_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Banana Wood", - "banana_wood", - "ethereal:banana_wood", + "Banana Wood", "banana_wood", "ethereal:banana_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_banana_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Willow Wood", - "willow_wood", - "ethereal:willow_wood", + "Willow Wood", "willow_wood", "ethereal:willow_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_willow_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Redwood", - "redwood_wood", - "ethereal:redwood_wood", + "Redwood", "redwood_wood", "ethereal:redwood_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_redwood_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Bamboo", - "bamboo_wood", - "ethereal:bamboo_block", + "Bamboo", "bamboo_wood", "ethereal:bamboo_block", {snappy = 3, choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_bamboo_floor.png"}, default.node_sound_wood_defaults()) do_stair( - "Sakura Wood", - "sakura_wood", - "ethereal:sakura_wood", + "Sakura Wood", "sakura_wood", "ethereal:sakura_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_sakura_wood.png"}, default.node_sound_wood_defaults()) do_stair( - "Olive Wood", - "olive_wood", - "ethereal:olive_wood", + "Olive Wood", "olive_wood", "ethereal:olive_wood", {choppy = 2, oddly_breakable_by_hand = 1, flammable = 3}, {"ethereal_olive_wood.png"}, default.node_sound_wood_defaults()) diff --git a/strawberry.lua b/strawberry.lua index 198694c..505cda2 100644 --- a/strawberry.lua +++ b/strawberry.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") +-- Strawberry (can also be planted directly as seed) --- Strawberry (can also be planted as seed) minetest.register_craftitem("ethereal:strawberry", { description = S("Strawberry"), inventory_image = "ethereal_strawberry.png", @@ -17,7 +17,8 @@ minetest.register_craftitem("ethereal:strawberry", { ethereal.add_eatable("ethereal:strawberry", 1) --- Define Strawberry Bush growth stages +-- Strawberry definition + local def = { drawtype = "plantlike", tiles = {"ethereal_strawberry_1.png"}, @@ -28,8 +29,7 @@ local def = { buildable_to = true, drop = "", selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} }, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -39,25 +39,31 @@ local def = { } --stage 1 + minetest.register_node("ethereal:strawberry_1", table.copy(def)) -- stage 2 + def.tiles = {"ethereal_strawberry_2.png"} minetest.register_node("ethereal:strawberry_2", table.copy(def)) -- stage 3 + def.tiles = {"ethereal_strawberry_3.png"} minetest.register_node("ethereal:strawberry_3", table.copy(def)) -- stage 4 + def.tiles = {"ethereal_strawberry_4.png"} minetest.register_node("ethereal:strawberry_4", table.copy(def)) -- stage 5 + def.tiles = {"ethereal_strawberry_5.png"} minetest.register_node("ethereal:strawberry_5", table.copy(def)) -- stage 6 + def.tiles = {"ethereal_strawberry_6.png"} def.drop = { items = { @@ -68,6 +74,7 @@ def.drop = { minetest.register_node("ethereal:strawberry_6", table.copy(def)) -- stage 7 + def.tiles = {"ethereal_strawberry_7.png"} def.drop = { items = { @@ -78,11 +85,11 @@ def.drop = { minetest.register_node("ethereal:strawberry_7", table.copy(def)) -- stage 8 (final) + def.tiles = {"ethereal_strawberry_8.png"} def.groups.growing = nil def.selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -2.5/16, 0.5} + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -2.5/16, 0.5} } def.drop = { items = { @@ -92,6 +99,7 @@ def.drop = { } minetest.register_node("ethereal:strawberry_8", table.copy(def)) +-- register Abm to grow strawberry (this file wont be loaded if farming redo active) minetest.register_abm({ label = "Ethereal grow strawberry", @@ -117,11 +125,9 @@ minetest.register_abm({ pos.y = pos.y + 1 -- do we have enough light? - local light = minetest.get_node_light(pos) + local light = minetest.get_node_light(pos) or 0 - if not light or light < 13 then - return - end + if light < 13 then return end -- grow to next stage local num = node.name:split("_")[2] @@ -131,4 +137,3 @@ minetest.register_abm({ minetest.swap_node(pos, node) end }) - diff --git a/water.lua b/water.lua index fe0b7c2..0bf6b32 100644 --- a/water.lua +++ b/water.lua @@ -1,8 +1,8 @@ -local S = ethereal.translate - +local S = minetest.get_translator("ethereal") -- Ice Brick + minetest.register_node("ethereal:icebrick", { description = S("Ice Brick"), tiles = {"ethereal_brick_ice.png"}, @@ -20,8 +20,8 @@ minetest.register_craft({ } }) - -- Snow Brick + minetest.register_node("ethereal:snowbrick", { description = S("Snow Brick"), tiles = {"ethereal_brick_snow.png"}, @@ -43,8 +43,8 @@ minetest.register_craft({ } }) +-- If Crystal Spike or Snow near Water, change Water to Ice --- If Crystal Spike, Snow near Water, change Water to Ice minetest.register_abm({ label = "Ethereal freeze water", nodenames = { @@ -59,7 +59,7 @@ minetest.register_abm({ action = function(pos, node) local near = minetest.find_node_near(pos, 1, - {"default:water_source", "default:river_water_source"}) + {"default:water_source", "default:river_water_source"}) if near then minetest.swap_node(near, {name = "default:ice"}) @@ -67,8 +67,8 @@ minetest.register_abm({ end }) - -- If Heat Source near Ice or Snow then melt. + minetest.register_abm({ label = "Ethereal melt snow/ice", nodenames = { @@ -109,8 +109,8 @@ minetest.register_abm({ end }) - -- If Water Source near Dry Dirt, change to normal Dirt + minetest.register_abm({ label = "Ethereal wet dry dirt", nodenames = { @@ -135,8 +135,8 @@ minetest.register_abm({ end }) - -- when enabled, drop torches that are touching water + if ethereal.torchdrop == true and not minetest.get_modpath("real_torch") then minetest.register_abm({ @@ -150,21 +150,21 @@ if ethereal.torchdrop == true and not minetest.get_modpath("real_torch") then action = function(pos, node) local num = #minetest.find_nodes_in_area( - {x = pos.x - 1, y = pos.y, z = pos.z}, - {x = pos.x + 1, y = pos.y, z = pos.z}, {"group:water"}) + {x = pos.x - 1, y = pos.y, z = pos.z}, + {x = pos.x + 1, y = pos.y, z = pos.z}, {"group:water"}) if num == 0 then num = num + #minetest.find_nodes_in_area( - {x = pos.x, y = pos.y, z = pos.z - 1}, - {x = pos.x, y = pos.y, z = pos.z + 1}, {"group:water"}) + {x = pos.x, y = pos.y, z = pos.z - 1}, + {x = pos.x, y = pos.y, z = pos.z + 1}, {"group:water"}) end if num == 0 then num = num + #minetest.find_nodes_in_area( - {x = pos.x, y = pos.y + 1, z = pos.z}, - {x = pos.x, y = pos.y + 1, z = pos.z}, {"group:water"}) + {x = pos.x, y = pos.y + 1, z = pos.z}, + {x = pos.x, y = pos.y + 1, z = pos.z}, {"group:water"}) end if num > 0 then diff --git a/wood.lua b/wood.lua index bf53b53..b9967b1 100644 --- a/wood.lua +++ b/wood.lua @@ -1,7 +1,7 @@ -local S = ethereal.translate +local S = minetest.get_translator("ethereal") --- helper function +-- register wood and placement helper local function add_wood(name, def) @@ -146,7 +146,6 @@ minetest.register_craft({ recipe = {{"ethereal:frost_tree"}} }) - -- healing minetest.register_node("ethereal:yellow_trunk", { @@ -314,12 +313,10 @@ minetest.register_node("ethereal:bamboo", { sunlight_propagates = true, walkable = true, selection_box = { - type = "fixed", - fixed = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} + type = "fixed", fixed = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} }, collision_box = { - type = "fixed", - fixed = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} + type = "fixed", fixed = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} }, groups = {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2}, sounds = default.node_sound_leaves_defaults(), @@ -363,4 +360,3 @@ minetest.register_craft({ output = "ethereal:olive_wood 4", recipe = {{"ethereal:olive_trunk"}} }) -