tidy code

This commit is contained in:
tenplus1 2024-04-17 12:15:33 +01:00
parent a6b38705e2
commit 4912e50f4c
7 changed files with 23 additions and 45 deletions

View File

@ -283,7 +283,7 @@ minetest.register_tool("ethereal:crystal_gilly_staff", {
on_use = function(itemstack, user, pointed_thing)
if user:get_breath() < 10 then
if user and user:get_breath() < 10 then
user:set_breath(10)
end
end

View File

@ -185,48 +185,28 @@ add_node({"default:sandstone"}, 0.002, {"sandstone_desert"}, 1, 100,
add_node({"default:desert_sand"}, 0.005, {"desert"}, 1, 100,
{"default:cactus"}, 4, nil, nil, ethereal.desert)
-- wild red mushroom
add_node({"ethereal:mushroom_dirt"}, 0.01, {"mushroom"}, 1, 100,
{"flowers:mushroom_red"}, nil, nil, nil, ethereal.mushroom)
-- spore grass
add_node({"ethereal:mushroom_dirt"}, 0.1, {"mushroom"}, 1, 100,
{"ethereal:spore_grass"}, nil, nil, nil, ethereal.mushroom)
local list = {
{"junglee", {"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, ethereal.junglee},
{"deciduous_forest", {"default:dirt_with_grass"}, ethereal.grassy},
{"grassytwo", {"default:dirt_with_grass"}, ethereal.grassytwo},
{"prairie", {"ethereal:prairie_dirt"}, ethereal.prairie},
{"mushroom", {"ethereal:mushroom_dirt"}, ethereal.mushroom},
{"swamp", {"default:dirt_with_grass"}, ethereal.swamp}
}
-- wild red and brown mushrooms
for _, row in pairs(list) do
if row[3] == 1 then
minetest.register_decoration({
deco_type = "simple",
place_on = row[2],
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.009,
spread = {x = 200, y = 200, z = 200},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {row[1]},
y_min = 1,
y_max = 120,
decoration = {"flowers:mushroom_brown", "flowers:mushroom_red"}
})
end
end
-- 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"
},
sidelen = 16,
fill_ratio = 0.01,
biomes = {
"junglee", "deciduous_forest", "grassytwo", "prairie", "swamp", "mushroom"
},
y_min = 1,
y_max = 120,
decoration = {"flowers:mushroom_brown", "flowers:mushroom_red"}
})
-- jungle grass
add_node({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"},

View File

@ -27,8 +27,7 @@ minetest.register_craft({
-- register ethereal dirt types
local dirts = {
"Bamboo", "Jungle", "Grove", "Prairie", "Cold",
"Crystal", "Mushroom", "Fiery", "Gray"
"Bamboo", "Jungle", "Grove", "Prairie", "Cold", "Crystal", "Mushroom", "Fiery", "Gray"
}
for n = 1, #dirts do

View File

@ -3,7 +3,6 @@ local S = ethereal.translate
local door_mod = minetest.get_modpath("doors")
local add_fence = function(name, node, desc, texture)
if default.register_fence then

View File

@ -7,7 +7,7 @@
]]
ethereal = {version = "20240320"}
ethereal = {version = "20240417"}
local function setting(stype, name, default)

View File

@ -524,7 +524,7 @@ minetest.register_node("ethereal:basandra_bush_leaves", {
})
-- compatibility check for new mt version with leafdecay function
if minetest.registered_nodes["default:dirt_with_rainforest_litter"] then
if default.register_leafdecay then
default.register_leafdecay({
trunks = {"default:tree"},

View File

@ -153,7 +153,7 @@ end
function ethereal.grow_banana_tree(pos)
if math.random(3) == 1 and minetest.find_node_near(pos, 1, {"farming:soil_wet"}) then
if math.random(2) == 1 and minetest.find_node_near(pos, 1, {"farming:soil_wet"}) then
add_tree(pos, 3, 0, 3, ethereal.bananatree,
{{"ethereal:banana", "ethereal:banana_bunch"}})