2016-05-17 23:40:05 +03:00
|
|
|
|
2023-08-14 10:08:04 +03:00
|
|
|
local S = ethereal.translate
|
2016-06-09 17:08:34 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
-- Seaweed
|
|
|
|
minetest.register_node("ethereal:seaweed", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Seaweed"),
|
2014-11-09 22:17:41 +03:00
|
|
|
drawtype = "plantlike",
|
2021-04-02 23:06:43 +03:00
|
|
|
tiles = {"ethereal_seaweed.png"},
|
|
|
|
inventory_image = "ethereal_seaweed.png",
|
|
|
|
wield_image = "ethereal_seaweed.png",
|
2014-11-09 22:17:41 +03:00
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
climbable = true,
|
|
|
|
drowning = 1,
|
2015-07-04 14:22:39 +03:00
|
|
|
selection_box = {
|
|
|
|
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},
|
2018-03-12 21:40:36 +03:00
|
|
|
groups = {food_seaweed = 1, snappy = 3, flammable = 3},
|
2014-11-09 22:17:41 +03:00
|
|
|
on_use = minetest.item_eat(1),
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2016-05-17 23:40:05 +03:00
|
|
|
after_dig_node = function(pos, node, metadata, digger)
|
|
|
|
default.dig_up(pos, node, digger)
|
2021-04-02 23:06:43 +03:00
|
|
|
end
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
type = "shapeless",
|
|
|
|
output = "dye:dark_green 3",
|
2021-04-02 23:06:43 +03:00
|
|
|
recipe = {"ethereal:seaweed"}
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2018-05-31 11:35:27 +03:00
|
|
|
-- agar powder
|
|
|
|
minetest.register_craftitem("ethereal:agar_powder", {
|
|
|
|
description = S("Agar Powder"),
|
|
|
|
inventory_image = "ethereal_agar_powder.png",
|
2021-04-02 23:06:43 +03:00
|
|
|
groups = {food_gelatin = 1, flammable = 2}
|
2018-05-31 11:35:27 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
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"},
|
2021-04-02 23:06:43 +03:00
|
|
|
{"bucket:bucket_water", "bucket:bucket_water", "default:torch"}
|
2018-05-31 11:35:27 +03:00
|
|
|
},
|
|
|
|
replacements = {
|
2021-04-02 23:06:43 +03:00
|
|
|
{"bucket:bucket_water", "bucket:bucket_empty 4"}
|
|
|
|
}
|
2018-05-31 11:35:27 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
-- Blue Coral
|
|
|
|
minetest.register_node("ethereal:coral2", {
|
2020-09-15 13:50:10 +03:00
|
|
|
description = S("Blue Glow Coral"),
|
2014-11-09 22:17:41 +03:00
|
|
|
drawtype = "plantlike",
|
2021-04-02 23:06:43 +03:00
|
|
|
tiles = {"ethereal_coral_blue.png"},
|
|
|
|
inventory_image = "ethereal_coral_blue.png",
|
|
|
|
wield_image = "ethereal_coral_blue.png",
|
2014-11-09 22:17:41 +03:00
|
|
|
paramtype = "light",
|
2015-07-04 14:22:39 +03:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2021-04-02 23:06:43 +03:00
|
|
|
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 1 / 4, 6 / 16}
|
2015-07-04 14:22:39 +03:00
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
light_source = 3,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {snappy = 3},
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_leaves_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "dye:cyan 3",
|
2021-11-27 13:54:46 +03:00
|
|
|
recipe = {{"ethereal:coral2"}}
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
-- Orange Coral
|
|
|
|
minetest.register_node("ethereal:coral3", {
|
2020-09-15 13:50:10 +03:00
|
|
|
description = S("Orange Glow Coral"),
|
2014-11-09 22:17:41 +03:00
|
|
|
drawtype = "plantlike",
|
2021-04-02 23:06:43 +03:00
|
|
|
tiles = {"ethereal_coral_orange.png"},
|
|
|
|
inventory_image = "ethereal_coral_orange.png",
|
|
|
|
wield_image = "ethereal_coral_orange.png",
|
2014-11-09 22:17:41 +03:00
|
|
|
paramtype = "light",
|
2015-07-04 14:22:39 +03:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2021-04-02 23:06:43 +03:00
|
|
|
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 1 / 4, 6 / 16}
|
2015-07-04 14:22:39 +03:00
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
light_source = 3,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {snappy = 3},
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_leaves_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "dye:orange 3",
|
2021-11-27 13:54:46 +03:00
|
|
|
recipe = {{"ethereal:coral3"}}
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
-- Pink Coral
|
|
|
|
minetest.register_node("ethereal:coral4", {
|
2020-09-15 13:50:10 +03:00
|
|
|
description = S("Pink Glow Coral"),
|
2014-11-09 22:17:41 +03:00
|
|
|
drawtype = "plantlike",
|
2021-04-02 23:06:43 +03:00
|
|
|
tiles = {"ethereal_coral_pink.png"},
|
|
|
|
inventory_image = "ethereal_coral_pink.png",
|
|
|
|
wield_image = "ethereal_coral_pink.png",
|
2014-11-09 22:17:41 +03:00
|
|
|
paramtype = "light",
|
2015-07-04 14:22:39 +03:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2021-04-02 23:06:43 +03:00
|
|
|
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 8 / 16, 6 / 16}
|
2015-07-04 14:22:39 +03:00
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
light_source = 3,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {snappy = 3},
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_leaves_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "dye:pink 3",
|
2021-11-27 13:54:46 +03:00
|
|
|
recipe = {{"ethereal:coral4"}}
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2014-11-09 22:17:41 +03:00
|
|
|
-- Green Coral
|
|
|
|
minetest.register_node("ethereal:coral5", {
|
2020-09-15 13:50:10 +03:00
|
|
|
description = S("Green Glow Coral"),
|
2014-11-09 22:17:41 +03:00
|
|
|
drawtype = "plantlike",
|
2021-04-02 23:06:43 +03:00
|
|
|
tiles = {"ethereal_coral_green.png"},
|
|
|
|
inventory_image = "ethereal_coral_green.png",
|
|
|
|
wield_image = "ethereal_coral_green.png",
|
2014-11-09 22:17:41 +03:00
|
|
|
paramtype = "light",
|
2015-07-04 14:22:39 +03:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2021-04-02 23:06:43 +03:00
|
|
|
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 3 / 16, 6 / 16}
|
2015-07-04 14:22:39 +03:00
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
light_source = 3,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {snappy = 3},
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_leaves_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "dye:green 3",
|
2021-11-27 13:54:46 +03:00
|
|
|
recipe = {{"ethereal:coral5"}}
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
|
|
|
-- Undersea Sand (used for growing seaweed and corals)
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_node("ethereal:sandy", {
|
2016-06-09 17:08:34 +03:00
|
|
|
description = S("Sandy"),
|
2014-11-09 22:17:41 +03:00
|
|
|
tiles = {"default_sand.png"},
|
|
|
|
is_ground_content = true,
|
2015-07-04 14:22:39 +03:00
|
|
|
groups = {
|
2016-05-17 23:40:05 +03:00
|
|
|
crumbly = 3, falling_node = 1, sand = 1, not_in_creative_inventory = 1
|
2015-07-04 14:22:39 +03:00
|
|
|
},
|
2014-11-09 22:17:41 +03:00
|
|
|
drop = "default:sand",
|
2021-04-02 23:06:43 +03:00
|
|
|
sounds = default.node_sound_sand_defaults()
|
2014-11-09 22:17:41 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
2016-01-21 17:59:28 +03:00
|
|
|
-- randomly generate coral or seaweed and have seaweed grow up to 14 high
|
2017-02-10 21:35:16 +03:00
|
|
|
if ethereal.sealife == 1 then
|
2021-11-27 13:54:46 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.register_abm({
|
|
|
|
label = "Grow coral/seaweed",
|
|
|
|
nodenames = {"ethereal:sandy"},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
interval = 15,
|
|
|
|
chance = 10,
|
|
|
|
catch_up = false,
|
|
|
|
action = function(pos, node)
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
local sel = math.random(6)
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
pos.y = pos.y + 1
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
local nod = minetest.get_node(pos).name
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
if nod == "default:water_source"
|
|
|
|
and sel == 6 then
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:sponge_wet"})
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
return
|
|
|
|
end
|
2020-02-28 22:42:00 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
if nod == "default:water_source"
|
|
|
|
and sel > 1 then
|
2020-02-28 22:42:00 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:coral" .. sel})
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
return
|
|
|
|
end
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
if nod == "ethereal:seaweed"
|
|
|
|
or sel == 1 then
|
2016-01-21 17:59:28 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
local height = 0
|
|
|
|
local high = 14
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
while height < high
|
|
|
|
and minetest.get_node(pos).name == "ethereal:seaweed" do
|
|
|
|
height = height + 1
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
end
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
if pos.y < 1
|
|
|
|
and height < high
|
|
|
|
and minetest.get_node(pos).name == "default:water_source" then
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:seaweed"})
|
|
|
|
end
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
end
|
2022-09-30 19:26:44 +03:00
|
|
|
})
|
2017-02-10 21:35:16 +03:00
|
|
|
end
|
2020-02-28 22:42:00 +03:00
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
|
|
|
|
-- sponge nodes
|
2020-02-28 22:42:00 +03:00
|
|
|
|
|
|
|
minetest.register_node("ethereal:sponge_air", {
|
|
|
|
drawtype = "airlike",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
buildable_to = true,
|
|
|
|
sunlight_propagates = true,
|
|
|
|
pointable = false,
|
|
|
|
drop = "",
|
2021-04-02 23:06:43 +03:00
|
|
|
groups = {not_in_creative_inventory = 1}
|
2020-02-28 22:42:00 +03:00
|
|
|
})
|
|
|
|
|
2022-09-30 19:26:44 +03:00
|
|
|
minetest.register_node("ethereal:sponge_wet", {
|
|
|
|
description = S("Wet sponge"),
|
|
|
|
tiles = {"ethereal_sponge_wet.png"},
|
|
|
|
groups = {crumbly = 3},
|
|
|
|
sounds = default.node_sound_sand_defaults()
|
|
|
|
})
|
2020-02-28 22:42:00 +03:00
|
|
|
|
|
|
|
minetest.register_node("ethereal:sponge", {
|
|
|
|
description = S("Sponge"),
|
|
|
|
tiles = {"ethereal_sponge.png"},
|
|
|
|
groups = {crumbly = 3},
|
|
|
|
sounds = default.node_sound_sand_defaults(),
|
|
|
|
|
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
|
|
|
|
-- get player name
|
|
|
|
local name = placer:get_player_name()
|
|
|
|
|
|
|
|
-- is area protected
|
|
|
|
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"})
|
|
|
|
|
|
|
|
-- no water
|
|
|
|
if #num == 0 then return end
|
|
|
|
|
|
|
|
-- replace water nodes with sponge air
|
|
|
|
for _, w in pairs(num) do
|
|
|
|
|
|
|
|
if not minetest.is_protected(pos, name) then
|
|
|
|
minetest.swap_node(w, {name = "ethereal:sponge_air"})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- replace dry sponge with wet sponge
|
2020-09-15 13:50:10 +03:00
|
|
|
minetest.swap_node(pos, {name = "ethereal:sponge_wet"})
|
2020-02-28 22:42:00 +03:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
-- cook wet sponge into dry sponge
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
recipe = "ethereal:sponge_wet",
|
|
|
|
output = "ethereal:sponge",
|
2021-04-02 23:06:43 +03:00
|
|
|
cooktime = 3
|
2020-02-28 22:42:00 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
-- use leaf decay to remove sponge air nodes
|
|
|
|
default.register_leafdecay({
|
|
|
|
trunks = {"ethereal:sponge_wet"},
|
|
|
|
leaves = {"ethereal:sponge_air"},
|
|
|
|
radius = 3
|
|
|
|
})
|
|
|
|
|
|
|
|
-- dry sponges can be used as fuel
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "ethereal:sponge",
|
2021-04-02 23:06:43 +03:00
|
|
|
burntime = 5
|
2020-02-28 22:42:00 +03:00
|
|
|
})
|