2016-05-17 23:40:05 +03:00
|
|
|
|
2016-06-09 17:08:34 +03:00
|
|
|
local S = ethereal.intllib
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- override default dirt (to stop caves cutting away dirt)
|
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
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- green dirt
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_node("ethereal:green_dirt", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Green Dirt"),
|
2015-08-31 19:40:29 +03:00
|
|
|
tiles = {
|
|
|
|
"default_grass.png",
|
|
|
|
"default_dirt.png",
|
|
|
|
"default_dirt.png^default_grass_side.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, soil = 1, ethereal_grass = 1},
|
2015-11-23 12:59:18 +03:00
|
|
|
soil = {
|
|
|
|
base = "ethereal:green_dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
drop = "default:dirt",
|
|
|
|
sounds = default.node_sound_dirt_defaults()
|
|
|
|
})
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- dry dirt
|
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},
|
2014-11-09 22:17:41 +03:00
|
|
|
sounds = default.node_sound_dirt_defaults()
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
output = "ethereal:dry_dirt",
|
|
|
|
recipe = "default:dirt",
|
|
|
|
cooktime = 3,
|
|
|
|
})
|
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
local dirts = {
|
|
|
|
"Bamboo", "Jungle", "Grove", "Prairie", "Cold",
|
|
|
|
"Crystal", "Mushroom", "Fiery", "Gray"
|
2014-11-09 22:17:41 +03:00
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
minetest.register_node("ethereal:"..name.."_dirt", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S(desc.." Dirt"),
|
2015-08-31 19:40:29 +03:00
|
|
|
tiles = {
|
|
|
|
"ethereal_grass_"..name.."_top.png",
|
|
|
|
"default_dirt.png",
|
|
|
|
"default_dirt.png^ethereal_grass_"..name.."_side.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, soil = 1, ethereal_grass = 1},
|
2015-11-23 12:59:18 +03:00
|
|
|
soil = {
|
|
|
|
base = "ethereal:"..name.."_dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
drop = "default:dirt",
|
|
|
|
sounds = default.node_sound_dirt_defaults()
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
-- re-register dirt types for abm
|
|
|
|
dirts = {
|
|
|
|
"ethereal:bamboo_dirt", "ethereal:jungle_dirt", "ethereal:grove_dirt",
|
|
|
|
"ethereal:prairie_dirt", "ethereal:cold_dirt", "ethereal:crystal_dirt",
|
|
|
|
"ethereal:mushroom_dirt", "ethereal:fiery_dirt", "ethereal:gray_dirt",
|
|
|
|
"default:dirt_with_dry_grass"
|
|
|
|
}
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
-- check surrounding grass and change dirt to same colour
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_abm({
|
2016-05-17 23:40:05 +03:00
|
|
|
nodenames = {"default:dirt_with_grass", "default:dirt"},
|
|
|
|
neighbors = {"air"},
|
|
|
|
interval = 6,
|
|
|
|
chance = 65,
|
2015-11-07 23:50:50 +03:00
|
|
|
catch_up = false,
|
2016-05-17 23:40:05 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
action = function(pos, node)
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
-- not enough light
|
|
|
|
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
|
|
|
|
|
|
if (minetest.get_node_light(above) or 0) < 13 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- water above grass
|
|
|
|
local name = minetest.get_node(above).name
|
|
|
|
local nodef = minetest.registered_nodes[name]
|
|
|
|
|
|
|
|
if name == "ignore" or not nodef or nodef.liquidtype ~= "none" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local curr_max, num = 0
|
2015-05-12 12:11:32 +03:00
|
|
|
local curr_type = "ethereal:green_dirt" -- fallback
|
2016-05-17 23:40:05 +03:00
|
|
|
local positions, grasses = minetest.find_nodes_in_area(
|
|
|
|
{x = (pos.x - 2), y = (pos.y - 2), z = (pos.z - 2)},
|
|
|
|
{x = (pos.x + 2), y = (pos.y + 2), z = (pos.z + 2)},
|
2015-04-10 17:38:53 +03:00
|
|
|
"group:ethereal_grass")
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- count new grass nodes
|
2016-06-05 13:39:20 +03:00
|
|
|
for n = 1, #dirts do
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-06-05 13:39:20 +03:00
|
|
|
num = grasses[dirts[n]] or 0
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
if num > curr_max then
|
|
|
|
curr_max = num
|
2016-06-05 13:39:20 +03:00
|
|
|
curr_type = dirts[n]
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
end
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2016-01-09 15:25:33 +03:00
|
|
|
minetest.swap_node(pos, {name = curr_type})
|
2015-07-04 14:22:39 +03:00
|
|
|
end
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
-- have dirt with dry grass spreads like ethereal grasses
|
2015-11-13 18:09:00 +03:00
|
|
|
minetest.override_item("default:dirt_with_dry_grass", {
|
|
|
|
groups = {crumbly = 3, soil = 1, ethereal_grass = 1},
|
|
|
|
})
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- if grass devoid of light, change to dirt
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"group:ethereal_grass"},
|
2016-05-17 23:40:05 +03:00
|
|
|
interval = 8,
|
|
|
|
chance = 40, -- 50
|
2015-11-07 23:50:50 +03:00
|
|
|
catch_up = false,
|
2014-11-09 22:17:41 +03:00
|
|
|
action = function(pos, node)
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2015-11-13 18:09:00 +03:00
|
|
|
local name = minetest.get_node({
|
|
|
|
x = pos.x,
|
|
|
|
y = pos.y + 1,
|
|
|
|
z = pos.z
|
|
|
|
}).name
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
local nodedef = minetest.registered_nodes[name]
|
2016-01-21 17:59:28 +03:00
|
|
|
|
|
|
|
if name ~= "ignore" and nodedef
|
|
|
|
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
|
|
|
and nodedef.liquidtype == "none") then
|
|
|
|
|
2016-01-09 15:25:33 +03:00
|
|
|
minetest.swap_node(pos, {name = "default:dirt"})
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
-- If Baked Clay mod not active, make Red, Orange and Grey nodes
|
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,
|
2014-11-09 22:17:41 +03:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
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,
|
2014-11-09 22:17:41 +03:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
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,
|
2015-08-27 18:35:27 +03:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
|
|
|
|
2016-01-10 21:43:29 +03:00
|
|
|
end
|
2016-05-17 23:40:05 +03:00
|
|
|
|
|
|
|
-- Quicksand (old style, sinking inside shows black instead of yellow effect,
|
|
|
|
-- works ok with noclip enabled though)
|
|
|
|
minetest.register_node("ethereal:quicksand", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Quicksand"),
|
2016-05-17 23:40:05 +03:00
|
|
|
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},
|
|
|
|
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", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Quicksand"),
|
2016-05-17 23:40:05 +03:00
|
|
|
tiles = {"default_sand.png"},
|
|
|
|
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},
|
|
|
|
sounds = default.node_sound_sand_defaults(),
|
|
|
|
})
|