2016-05-17 23:40:05 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
local S = minetest.get_translator("ethereal")
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- override default dirt (to stop caves cutting away dirt)
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2016-01-21 23:35:40 +03:00
|
|
|
minetest.override_item("default:dirt", {is_ground_content = ethereal.cavedirt})
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- replace old green_dirt with default grass
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
minetest.register_alias("ethereal:green_dirt", "default:dirt_with_grass")
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- dry dirt
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_node("ethereal:dry_dirt", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Dried Dirt"),
|
2014-11-09 22:17:41 +03:00
|
|
|
tiles = {"ethereal_dry_dirt.png"},
|
2016-01-21 23:35:40 +03:00
|
|
|
is_ground_content = ethereal.cavedirt,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {crumbly = 3},
|
2016-12-13 23:04:58 +03:00
|
|
|
sounds = default.node_sound_dirt_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
output = "ethereal:dry_dirt",
|
|
|
|
recipe = "default:dirt",
|
|
|
|
cooktime = 3,
|
|
|
|
})
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- ethereal dirt types
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
local dirts = {
|
2024-04-17 14:15:33 +03:00
|
|
|
"Bamboo", "Jungle", "Grove", "Prairie", "Cold", "Crystal", "Mushroom", "Fiery", "Gray"
|
2014-11-09 22:17:41 +03:00
|
|
|
}
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- loop through and register dirts
|
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
for n = 1, #dirts do
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
local desc = dirts[n]
|
2014-11-09 22:17:41 +03:00
|
|
|
local name = desc:lower()
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.register_node("ethereal:" .. name .. "_dirt", {
|
|
|
|
description = S(desc .. " Dirt"),
|
2015-08-31 19:40:29 +03:00
|
|
|
tiles = {
|
2024-08-16 13:05:33 +03:00
|
|
|
"ethereal_grass_" .. name .. "_top.png", "default_dirt.png",
|
2020-04-30 16:07:12 +03:00
|
|
|
{
|
2022-09-30 19:26:44 +03:00
|
|
|
name = "default_dirt.png^ethereal_grass_" .. name .. "_side.png",
|
2020-04-30 16:07:12 +03:00
|
|
|
tileable_vertical = false
|
|
|
|
}
|
2015-08-31 19:40:29 +03:00
|
|
|
},
|
2016-01-21 23:35:40 +03:00
|
|
|
is_ground_content = ethereal.cavedirt,
|
2020-04-30 16:07:12 +03:00
|
|
|
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
|
2015-11-23 12:59:18 +03:00
|
|
|
soil = {
|
2022-09-30 19:26:44 +03:00
|
|
|
base = "ethereal:" .. name .. "_dirt",
|
2015-11-23 12:59:18 +03:00
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
drop = "default:dirt",
|
2016-12-07 13:56:30 +03:00
|
|
|
sounds = default.node_sound_dirt_defaults({
|
2022-09-30 19:26:44 +03:00
|
|
|
footstep = {name = "default_grass_footstep", gain = 0.25}
|
|
|
|
})
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
-- flower spread, also crystal and fire flower regeneration
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
local flower_spread = function(pos, node)
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if (minetest.get_node_light(pos) or 0) < 13 then return end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
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}
|
2017-03-01 12:58:46 +03:00
|
|
|
local num = #minetest.find_nodes_in_area(pos0, pos1, "group:flora")
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-11-16 20:35:31 +03:00
|
|
|
-- stop flowers spreading too much just below top of map block
|
2024-08-16 13:05:33 +03:00
|
|
|
if minetest.find_node_near(pos, 2, "ignore") then return end
|
2016-11-16 20:35:31 +03:00
|
|
|
|
2021-11-27 13:54:46 +03:00
|
|
|
if num > 3 and node.name == "ethereal:crystalgrass" then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
local grass = minetest.find_nodes_in_area_under_air(
|
|
|
|
pos0, pos1, {"ethereal:crystalgrass"})
|
|
|
|
|
|
|
|
if #grass > 4
|
|
|
|
and not minetest.find_node_near(pos, 4, {"ethereal:crystal_spike"}) then
|
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos = grass[math.random(#grass)]
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos.y = pos.y - 1
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
if minetest.get_node(pos).name == "ethereal:crystal_dirt" then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos.y = pos.y + 1
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:crystal_spike"})
|
2016-08-19 19:22:09 +03:00
|
|
|
end
|
2016-05-17 23:40:05 +03:00
|
|
|
end
|
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
return
|
|
|
|
|
2021-11-27 13:54:46 +03:00
|
|
|
elseif num > 3 and node.name == "ethereal:dry_shrub" then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
local grass = minetest.find_nodes_in_area_under_air(
|
|
|
|
pos0, pos1, {"ethereal:dry_shrub"})
|
|
|
|
|
|
|
|
if #grass > 8
|
|
|
|
and not minetest.find_node_near(pos, 4, {"ethereal:fire_flower"}) then
|
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos = grass[math.random(#grass)]
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos.y = pos.y - 1
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
if minetest.get_node(pos).name == "ethereal:fiery_dirt" then
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos.y = pos.y + 1
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:fire_flower"})
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
end
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
return
|
|
|
|
|
|
|
|
elseif num > 3 then
|
|
|
|
return
|
2015-07-04 14:22:39 +03:00
|
|
|
end
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2021-04-01 13:18:34 +03:00
|
|
|
pos.y = pos.y - 1
|
|
|
|
|
|
|
|
local under = minetest.get_node(pos)
|
|
|
|
|
|
|
|
-- make sure we have soil underneath
|
|
|
|
if minetest.get_item_group(under.name, "soil") == 0
|
|
|
|
or under.name == "default:desert_sand" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, {under.name})
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
if #seedling > 0 then
|
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos = seedling[math.random(#seedling)]
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
pos.y = pos.y + 1
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if (minetest.get_node_light(pos) or 0) < 13 then return end
|
2015-11-13 18:09:00 +03:00
|
|
|
|
2016-10-04 23:05:06 +03:00
|
|
|
minetest.swap_node(pos, {name = node.name})
|
2016-08-19 19:22:09 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- grow papyrus up to 4 high and bamboo up to 8 high
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
local grow_papyrus = function(pos, node)
|
|
|
|
|
|
|
|
local oripos = pos.y
|
|
|
|
local high = 4
|
|
|
|
|
|
|
|
pos.y = pos.y - 1
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
local nod = minetest.get_node_or_nil(pos)
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
if not nod
|
|
|
|
or minetest.get_item_group(nod.name, "soil") < 1
|
2024-08-16 13:05:33 +03:00
|
|
|
or minetest.find_node_near(pos, 3, {"group:water"}) == nil then return end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if node.name == "ethereal:bamboo" then high = 8 end
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
pos.y = pos.y + 1
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-08-19 19:22:09 +03:00
|
|
|
local height = 0
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
while height < high and minetest.get_node(pos).name == node.name do
|
2016-08-19 19:22:09 +03:00
|
|
|
height = height + 1
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
|
|
|
|
|
|
|
nod = minetest.get_node_or_nil(pos)
|
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if nod and nod.name == "air" and height < high then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if node.name == "ethereal:bamboo" and height == (high - 1) then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
ethereal.grow_bamboo_tree({x = pos.x, y = oripos, z = pos.z})
|
|
|
|
else
|
|
|
|
minetest.swap_node(pos, {name = node.name})
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
-- override abm function
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
local function override_abm(name, redef)
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
if not name or not redef then return end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
for _, ab in pairs(minetest.registered_abms) do
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
if name == ab.label then
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
for k, v in pairs(redef) do
|
|
|
|
ab[k] = v
|
|
|
|
end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
return ab
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-08-19 19:22:09 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
override_abm("Flower spread", {
|
|
|
|
--interval = 1, chance = 1, -- testing only
|
|
|
|
chance = 96, -- moved back to original chance from 300
|
|
|
|
nodenames = {"group:flora"},
|
|
|
|
neighbors = {"group:soil"},
|
|
|
|
action = flower_spread
|
|
|
|
})
|
2021-04-29 21:42:31 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
override_abm("Grow papyrus", {
|
|
|
|
--interval = 2, chance = 1, -- testing only
|
|
|
|
nodenames = {"default:papyrus", "ethereal:bamboo"},
|
|
|
|
neighbors = {"group:soil"},
|
|
|
|
action = grow_papyrus
|
|
|
|
})
|
2021-04-29 21:42:31 +03:00
|
|
|
|
2023-07-18 10:53:56 +03:00
|
|
|
override_abm("Mushroom spread", {
|
|
|
|
--interval = 1, chance = 1, -- testing only
|
|
|
|
chance = 50, -- moved back to original chance from 150
|
|
|
|
nodenames = {"group:mushroom"}
|
|
|
|
})
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- Add Red, Orange and Grey baked clay if mod isn't active
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
if not minetest.get_modpath("bakedclay") then
|
|
|
|
|
|
|
|
minetest.register_node(":bakedclay:red", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Red Baked Clay"),
|
2014-11-09 22:17:41 +03:00
|
|
|
tiles = {"baked_clay_red.png"},
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {cracky = 3},
|
2016-01-21 23:35:40 +03:00
|
|
|
is_ground_content = ethereal.cavedirt,
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_stone_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
2015-08-27 18:35:27 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_node(":bakedclay:orange", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Orange Baked Clay"),
|
2014-11-09 22:17:41 +03:00
|
|
|
tiles = {"baked_clay_orange.png"},
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {cracky = 3},
|
2016-01-21 23:35:40 +03:00
|
|
|
is_ground_content = ethereal.cavedirt,
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_stone_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
2015-08-27 18:35:27 +03:00
|
|
|
|
|
|
|
minetest.register_node(":bakedclay:grey", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Grey Baked Clay"),
|
2015-08-27 18:35:27 +03:00
|
|
|
tiles = {"baked_clay_grey.png"},
|
|
|
|
groups = {cracky = 3},
|
2016-01-21 23:35:40 +03:00
|
|
|
is_ground_content = ethereal.cavedirt,
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_stone_defaults()
|
2015-08-27 18:35:27 +03:00
|
|
|
})
|
2016-01-10 21:43:29 +03:00
|
|
|
end
|
2016-05-17 23:40:05 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- Quicksand (new style, sinking inside shows yellow effect
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
minetest.register_node("ethereal:quicksand2", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Quicksand"),
|
2020-10-21 19:07:05 +03:00
|
|
|
tiles = {"default_sand.png^[colorize:#00004F10"},
|
2016-05-17 23:40:05 +03:00
|
|
|
drawtype = "glasslike",
|
|
|
|
paramtype = "light",
|
|
|
|
drop = "default:sand",
|
|
|
|
liquid_viscosity = 15,
|
|
|
|
liquidtype = "source",
|
|
|
|
liquid_alternative_flowing = "ethereal:quicksand2",
|
|
|
|
liquid_alternative_source = "ethereal:quicksand2",
|
|
|
|
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},
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_sand_defaults()
|
2016-05-17 23:40:05 +03:00
|
|
|
})
|
2016-12-06 13:48:31 +03:00
|
|
|
|
2024-08-16 13:05:33 +03:00
|
|
|
-- alias old quicksand to new
|
|
|
|
|
|
|
|
minetest.register_alias("ethereal:quicksand", "ethereal:quicksand2")
|
|
|
|
|
2016-12-06 13:48:31 +03:00
|
|
|
-- craft quicksand
|
2024-08-16 13:05:33 +03:00
|
|
|
|
2016-12-06 13:48:31 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "ethereal:quicksand2",
|
|
|
|
recipe = {
|
|
|
|
{"group:sand", "group:sand", "group:sand"},
|
2018-11-19 12:29:14 +03:00
|
|
|
{"group:sand", "bucket:bucket_water", "group:sand"},
|
2021-04-02 23:06:43 +03:00
|
|
|
{"group:sand", "group:sand", "group:sand"}
|
2016-12-06 13:48:31 +03:00
|
|
|
},
|
2024-08-16 13:05:33 +03:00
|
|
|
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
|
2016-12-06 13:48:31 +03:00
|
|
|
})
|