forked from mtcontrib/minetest-mod-sea
[seaplants] Optimise pour Minetest 5
This commit is contained in:
parent
ef1efe65d9
commit
5ec73557de
@ -1,9 +1,7 @@
|
|||||||
-- NODES
|
-- NODES
|
||||||
|
|
||||||
-- Add magenta, aqua, skyblue seacorals
|
-- Add magenta, aqua, skyblue seacorals
|
||||||
local colors = {magenta = "Magenta", aqua = "Aqua", skyblue = "Skyblue"}
|
for color, cname in pairs({magenta = "Magenta", aqua = "Aqua", skyblue = "Skyblue"}) do
|
||||||
|
|
||||||
for color, cname in pairs(colors) do
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"seacoral:coral_"..color, {
|
"seacoral:coral_"..color, {
|
||||||
description = cname.." Coral",
|
description = cname.." Coral",
|
||||||
@ -62,6 +60,11 @@ for color, cname in pairs(colors) do
|
|||||||
minetest.set_node(pos, {name = "default:coral_skeleton"})
|
minetest.set_node(pos, {name = "default:coral_skeleton"})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Replace Old seacorals with new defined ones
|
||||||
|
minetest.register_alias("seacoral:coral"..color, "default:water_source")
|
||||||
|
minetest.register_alias("seacoral:seacoralsand"..color, "seacoral:coral_"..color)
|
||||||
|
minetest.register_alias("seacoral:seacoraldirt"..color, "seacoral:coral_"..color)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Replace cyan, redviolet, lime seacorals with default Minetest's ones
|
-- Replace cyan, redviolet, lime seacorals with default Minetest's ones
|
||||||
@ -80,19 +83,6 @@ minetest.register_alias("seacoral:seacoralsandlime", "default:coral_green")
|
|||||||
minetest.register_alias("seacoral:seacoraldirtlime", "default:coral_green")
|
minetest.register_alias("seacoral:seacoraldirtlime", "default:coral_green")
|
||||||
nalc.add_group("default:coral_green", "seacoral", 1)
|
nalc.add_group("default:coral_green", "seacoral", 1)
|
||||||
|
|
||||||
-- Replace Old magenta, aqua, skyblue seacorals with new defined ones
|
|
||||||
minetest.register_alias("seacoral:coralmagenta", "default:water_source")
|
|
||||||
minetest.register_alias("seacoral:seacoralsandmagenta", "seacoral:coral_magenta")
|
|
||||||
minetest.register_alias("seacoral:seacoraldirtmagenta", "seacoral:coral_magenta")
|
|
||||||
|
|
||||||
minetest.register_alias("seacoral:coralaqua", "default:water_source")
|
|
||||||
minetest.register_alias("seacoral:seacoralsandaqua", "seacoral:coral_aqua")
|
|
||||||
minetest.register_alias("seacoral:seacoraldirtaqua", "seacoral:coral_aqua")
|
|
||||||
|
|
||||||
minetest.register_alias("seacoral:coralskyblue", "default:water_source")
|
|
||||||
minetest.register_alias("seacoral:seacoralsandskyblue", "seacoral:coral_skyblue")
|
|
||||||
minetest.register_alias("seacoral:seacoraldirtskyblue", "seacoral:coral_skyblue")
|
|
||||||
|
|
||||||
-- CRAFTING
|
-- CRAFTING
|
||||||
|
|
||||||
if( minetest.get_modpath( "colormachine") == nil ) then
|
if( minetest.get_modpath( "colormachine") == nil ) then
|
||||||
@ -144,6 +134,8 @@ minetest.register_decoration(
|
|||||||
"seacoral:coral_magenta", "default:coral_orange",
|
"seacoral:coral_magenta", "default:coral_orange",
|
||||||
"seacoral:coral_aqua", "default:coral_brown",
|
"seacoral:coral_aqua", "default:coral_brown",
|
||||||
"seacoral:coral_skyblue", "default:coral_skeleton",
|
"seacoral:coral_skyblue", "default:coral_skeleton",
|
||||||
|
"default:coral_green", "default:coral_pink",
|
||||||
|
"default:coral_cyan"
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
default
|
default
|
||||||
noairblocks
|
|
@ -1,202 +1,155 @@
|
|||||||
-- NODES
|
-- NODES
|
||||||
|
|
||||||
minetest.register_node("seaplants:kelpgreen", {
|
for color, cname in pairs({green = "Green", brown = "Brown"}) do
|
||||||
description = "Green Kelp",
|
minetest.register_node(
|
||||||
drawtype = "plantlike",
|
"seaplants:sand_with_kelp_"..color, {
|
||||||
tiles = {"seaplants_kelpgreen.png"},
|
description = cname.." Kelp",
|
||||||
inventory_image = "seaplants_kelpgreen.png",
|
drawtype = "plantlike_rooted",
|
||||||
wield_image = "seaplants_kelpgreen.png",
|
waving = 1,
|
||||||
paramtype = "light",
|
tiles = {"default_sand.png"},
|
||||||
walkable = false,
|
special_tiles = {{name = "seaplants_kelp"..color.."middle.png", tileable_vertical = true}},
|
||||||
climbable = true,
|
inventory_image = "seaplants_kelp"..color..".png",
|
||||||
drowning = 1,
|
paramtype = "light",
|
||||||
is_ground_content = true,
|
paramtype2 = "leveled",
|
||||||
selection_box = {
|
groups = {snappy = 3},
|
||||||
type = "fixed",
|
selection_box = {
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}
|
type = "fixed",
|
||||||
},
|
fixed = {
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
{-2/16, 0.5, -2/16, 2/16, 3.5, 2/16},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
},
|
||||||
on_use = minetest.item_eat(1)
|
},
|
||||||
})
|
node_dig_prediction = "default:sand",
|
||||||
|
node_placement_prediction = "",
|
||||||
|
sounds = default.node_sound_sand_defaults(
|
||||||
|
{
|
||||||
|
dig = {name = "default_dig_snappy", gain = 0.2},
|
||||||
|
dug = {name = "default_grass_footstep", gain = 0.25},
|
||||||
|
}),
|
||||||
|
|
||||||
minetest.register_node("seaplants:kelpgreenmiddle", {
|
on_use = minetest.item_eat(1),
|
||||||
description = "Green Kelp middle",
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = {"seaplants_kelpgreenmiddle.png"},
|
|
||||||
inventory_image = "seaplants_kelpgreenmiddle.png",
|
|
||||||
wield_image = "seaplants_kelpgreenmiddle.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drowning = 1,
|
|
||||||
is_ground_content = true,
|
|
||||||
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},
|
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
|
||||||
drop = "seaplants:kelpgreen",
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:kelpbrown", {
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
description = "Brown Kelp ",
|
-- Call on_rightclick if the pointed node defines it
|
||||||
drawtype = "plantlike",
|
if pointed_thing.type == "node" and placer and
|
||||||
tiles = {"seaplants_kelpbrown.png"},
|
not placer:get_player_control().sneak then
|
||||||
inventory_image = "seaplants_kelpbrown.png",
|
local node_ptu = minetest.get_node(pointed_thing.under)
|
||||||
wield_image = "seaplants_kelpbrown.png",
|
local def_ptu = minetest.registered_nodes[node_ptu.name]
|
||||||
paramtype = "light",
|
if def_ptu and def_ptu.on_rightclick then
|
||||||
walkable = false,
|
return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer,
|
||||||
climbable = true,
|
itemstack, pointed_thing)
|
||||||
drowning = 1,
|
end
|
||||||
is_ground_content = true,
|
end
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
on_use = minetest.item_eat(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:kelpbrownmiddle", {
|
local pos = pointed_thing.under
|
||||||
description = "Brown Kelp middle",
|
if minetest.get_node(pos).name ~= "default:sand" then
|
||||||
drawtype = "plantlike",
|
return itemstack
|
||||||
tiles = {"seaplants_kelpbrownmiddle.png"},
|
end
|
||||||
inventory_image = "seaplants_kelpbrownmiddle.png",
|
|
||||||
wield_image = "seaplants_kelpbrownmiddle.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drowning = 1,
|
|
||||||
is_ground_content = true,
|
|
||||||
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},
|
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
|
||||||
drop = "seaplants:kelpbrown",
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seagrassgreen", {
|
local height = math.random(4, 6)
|
||||||
description = "Green Seagrass",
|
local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
|
||||||
drawtype = "plantlike",
|
local node_top = minetest.get_node(pos_top)
|
||||||
tiles = {"seaplants_seagrassgreen.png"},
|
local def_top = minetest.registered_nodes[node_top.name]
|
||||||
inventory_image = "seaplants_seagrassgreen.png",
|
local player_name = placer:get_player_name()
|
||||||
wield_image = "seaplants_seagrassgreen.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drowning = 1,
|
|
||||||
is_ground_content = true,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
on_use = minetest.item_eat(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seagrassred", {
|
if def_top and def_top.liquidtype == "source" and
|
||||||
description = "Red Seagrass",
|
minetest.get_item_group(node_top.name, "water") > 0 then
|
||||||
drawtype = "plantlike",
|
if not minetest.is_protected(pos, player_name) and
|
||||||
tiles = {"seaplants_seagrassred.png"},
|
not minetest.is_protected(pos_top, player_name) then
|
||||||
inventory_image = "seaplants_seagrassred.png",
|
minetest.set_node(pos, {name = "seaplants:sand_with_kelp_"..color,
|
||||||
wield_image = "seaplants_seagrassred.png",
|
param2 = height * 16})
|
||||||
paramtype = "light",
|
if not (creative and creative.is_enabled_for
|
||||||
walkable = false,
|
and creative.is_enabled_for(player_name)) then
|
||||||
climbable = true,
|
itemstack:take_item()
|
||||||
drowning = 1,
|
end
|
||||||
is_ground_content = true,
|
else
|
||||||
selection_box = {
|
minetest.chat_send_player(player_name, "Node is protected")
|
||||||
type = "fixed",
|
minetest.record_protection_violation(pos, player_name)
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}
|
end
|
||||||
},
|
end
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
|
||||||
groups = {snappy=3, seaplants=1, sea=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
on_use = minetest.item_eat(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantssandkelpgreen", {
|
return itemstack
|
||||||
description = "Sea plants sand kelp green",
|
end,
|
||||||
tiles = {"default_sand.png"},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {crumbly=3, falling_node=1, sand=1, soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:sand',
|
|
||||||
sounds = default.node_sound_sand_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantsdirtkelpgreen", {
|
after_destruct = function(pos, oldnode)
|
||||||
description = "Sea plants dirt kelp green",
|
minetest.set_node(pos, {name = "default:sand"})
|
||||||
tiles = {"default_dirt.png"},
|
end
|
||||||
is_ground_content = true,
|
})
|
||||||
groups = {crumbly=3,soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:dirt',
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantssandkelpbrown", {
|
-- Replace Old Kelps by new ones
|
||||||
description = "Sea plants sand kelp brown",
|
minetest.register_alias("seaplants:kelp"..color, "default:water_source")
|
||||||
tiles = {"default_sand.png"},
|
minetest.register_alias("seaplants:kelp"..color.."middle", "default:water_source")
|
||||||
is_ground_content = true,
|
minetest.register_alias("seaplants:seaplantssandkelp"..color, "seaplants:sand_with_kelp_"..color)
|
||||||
groups = {crumbly=3, falling_node=1, sand=1, soil=1, not_in_creative_inventory=1},
|
minetest.register_alias("seaplants:seaplantsdirtkelp"..color, "seaplants:sand_with_kelp_"..color)
|
||||||
drop = 'default:sand',
|
end
|
||||||
sounds = default.node_sound_sand_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantsdirtkelpbrown", {
|
for color, cname in pairs({green = "Green", red = "Red"}) do
|
||||||
description = "Sea plants dirt kelp brown",
|
minetest.register_node(
|
||||||
tiles = {"default_dirt.png"},
|
"seaplants:seagrass_"..color, {
|
||||||
is_ground_content = true,
|
description = cname.." Seagrass",
|
||||||
groups = {crumbly=3,soil=1, not_in_creative_inventory=1},
|
drawtype = "plantlike_rooted",
|
||||||
drop = 'default:dirt',
|
waving = 1,
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
paramtype = "light",
|
||||||
})
|
tiles = {"default_sand.png"},
|
||||||
|
special_tiles = {{name = "seaplants_seagrass"..color..".png", tileable_vertical = true}},
|
||||||
|
inventory_image = "seaplants_seagrass"..color..".png",
|
||||||
|
groups = {snappy = 3},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
{-4/16, 0.5, -4/16, 4/16, 1.5, 4/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
node_dig_prediction = "default:sand",
|
||||||
|
node_placement_prediction = "",
|
||||||
|
sounds = default.node_sound_sand_defaults(
|
||||||
|
{
|
||||||
|
dig = {name = "default_dig_snappy", gain = 0.2},
|
||||||
|
dug = {name = "default_grass_footstep", gain = 0.25},
|
||||||
|
}),
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantssandseagrassgreen", {
|
on_use = minetest.item_eat(1),
|
||||||
description = "Sea plants sand seagrass green",
|
|
||||||
tiles = {"default_sand.png"},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {crumbly=3, falling_node=1, sand=1, soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:sand',
|
|
||||||
sounds = default.node_sound_sand_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantsdirtseagrassgreen", {
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
description = "Sea plants dirt seagrass green",
|
if pointed_thing.type ~= "node" or not placer then
|
||||||
tiles = {"default_dirt.png"},
|
return itemstack
|
||||||
is_ground_content = true,
|
end
|
||||||
groups = {crumbly=3,soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:dirt',
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantssandseagrassred", {
|
local player_name = placer:get_player_name()
|
||||||
description = "Sea plants sand seagrass red",
|
local pos_under = pointed_thing.under
|
||||||
tiles = {"default_sand.png"},
|
local pos_above = pointed_thing.above
|
||||||
is_ground_content = true,
|
|
||||||
groups = {crumbly=3, falling_node=1, sand=1, soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:sand',
|
|
||||||
sounds = default.node_sound_sand_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seaplants:seaplantsdirtseagrassred", {
|
if minetest.get_node(pos_under).name ~= "default:sand" or
|
||||||
description = "Sea plants dirt seagrass red",
|
minetest.get_node(pos_above).name ~= "default:water_source" then
|
||||||
tiles = {"default_dirt.png"},
|
return itemstack
|
||||||
is_ground_content = true,
|
end
|
||||||
groups = {crumbly=3,soil=1, not_in_creative_inventory=1},
|
|
||||||
drop = 'default:dirt',
|
if minetest.is_protected(pos_under, player_name) or
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
minetest.is_protected(pos_above, player_name) then
|
||||||
})
|
minetest.chat_send_player(player_name, "Node is protected")
|
||||||
|
minetest.record_protection_violation(pos_under, player_name)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.set_node(pos_under, {name = "seaplants:seagrass_"..color})
|
||||||
|
if not (creative and creative.is_enabled_for(player_name)) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_destruct = function(pos, oldnode)
|
||||||
|
minetest.set_node(pos, {name = "default:sand"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Replace Old seagrasses by new ones
|
||||||
|
minetest.register_alias("seaplants:seagrass"..color, "default:water_source")
|
||||||
|
minetest.register_alias("seaplants:seaplantssandseagrass"..color, "seaplants:seagrass_"..color)
|
||||||
|
minetest.register_alias("seaplants:seaplantsdirtseagrass"..color, "seaplants:seagrass_"..color)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- CRAFT ITEMS
|
-- CRAFT ITEMS
|
||||||
@ -214,328 +167,61 @@ minetest.register_craftitem("seaplants:seasaladmix", {
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "seaplants:seasaladmix",
|
output = "seaplants:seasaladmix",
|
||||||
recipe = {"seaplants:kelpgreen", "seaplants:kelpbrown", "seaplants:seagrassgreen", "seaplants:seagrassred"}
|
recipe = {"seaplants:sand_with_kelp_green", "seaplants:sand_with_kelp_brown", "seaplants:seagrass_green", "seaplants:seagrass_red"}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- SEAPLANTS SAND AND DIRT GENERATION
|
-- SEAPLANTS GENERATION
|
||||||
|
|
||||||
|
-- Kelp
|
||||||
|
|
||||||
minetest.register_ore({
|
minetest.register_decoration(
|
||||||
ore_type = "scatter",
|
{
|
||||||
ore = "seaplants:seaplantssandkelpgreen",
|
name = "seaplants:seaplants",
|
||||||
wherein = "default:sand",
|
deco_type = "simple",
|
||||||
clust_scarcity = 10*10*10,
|
place_on = {"default:sand"},
|
||||||
clust_num_ores = 24,
|
place_offset_y = -1,
|
||||||
clust_size = 4,
|
sidelen = 16,
|
||||||
y_max = -14,
|
noise_params = {
|
||||||
y_min = -31000,
|
offset = -0.04,
|
||||||
})
|
scale = 0.1,
|
||||||
|
spread = {x = 200, y = 200, z = 200},
|
||||||
minetest.register_ore({
|
seed = 87113,
|
||||||
ore_type = "scatter",
|
octaves = 3,
|
||||||
ore = "seaplants:seaplantsdirtkelpgreen",
|
persist = 0.7
|
||||||
wherein = "default:dirt",
|
},
|
||||||
clust_scarcity = 10*10*10,
|
biomes = {
|
||||||
clust_num_ores = 24,
|
"taiga_ocean",
|
||||||
clust_size = 4,
|
"snowy_grassland_ocean",
|
||||||
y_max = -14,
|
"grassland_ocean",
|
||||||
y_min = -31000,
|
"coniferous_forest_ocean",
|
||||||
})
|
"deciduous_forest_ocean",
|
||||||
|
"sandstone_desert_ocean",
|
||||||
minetest.register_ore({
|
"cold_desert_ocean"},
|
||||||
ore_type = "scatter",
|
y_max = -5,
|
||||||
ore = "seaplants:seaplantssandkelpbrown",
|
y_min = -10,
|
||||||
wherein = "default:sand",
|
flags = "force_placement",
|
||||||
clust_scarcity = 10*10*10,
|
decoration = {
|
||||||
clust_num_ores = 24,
|
"default:sand_with_kelp", "seaplants:sand_with_kelp_green",
|
||||||
clust_size = 4,
|
"seaplants:sand_with_kelp_brown", "seaplants:seagrass_green",
|
||||||
y_max = -14,
|
"seaplants:seagrass_red"
|
||||||
y_min = -31000,
|
},
|
||||||
})
|
param2 = 48,
|
||||||
|
param2_max = 96,
|
||||||
minetest.register_ore({
|
})
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seaplants:seaplantsdirtkelpbrown",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -14,
|
|
||||||
y_min = -31000,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seaplants:seaplantssandseagrassgreen",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -14,
|
|
||||||
y_min = -31000,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seaplants:seaplantsdirtseagrassgreen",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -14,
|
|
||||||
y_min = -31000,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seaplants:seaplantssandseagrassred",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -14,
|
|
||||||
y_min = -31000,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seaplants:seaplantsdirtseagrassred",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -14,
|
|
||||||
y_min = -31000,
|
|
||||||
})
|
|
||||||
|
|
||||||
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, y_min, y_max)
|
|
||||||
if maxp.y < y_min or minp.y > y_max then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local y_min = math.max(minp.y, y_min)
|
|
||||||
local y_max = math.min(maxp.y, y_max)
|
|
||||||
if chunk_size >= y_max - y_min + 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
|
||||||
local pr = PseudoRandom(seed)
|
|
||||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
|
||||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
|
||||||
for i=1,num_chunks do
|
|
||||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
|
||||||
if y0 >= y_min and y0 <= y_max then
|
|
||||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
|
||||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
|
||||||
local p0 = {x=x0, y=y0, z=z0}
|
|
||||||
for x1=0,chunk_size-1 do
|
|
||||||
for y1=0,chunk_size-1 do
|
|
||||||
for z1=0,chunk_size-1 do
|
|
||||||
if pr:next(1,inverse_chance) == 1 then
|
|
||||||
local x2 = x0+x1
|
|
||||||
local y2 = y0+y1
|
|
||||||
local z2 = z0+z1
|
|
||||||
local p2 = {x=x2, y=y2, z=z2}
|
|
||||||
if minetest.get_node(p2).name == wherein then
|
|
||||||
minetest.set_node(p2, {name=name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- ABM'S
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantsdirtkelpgreen"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpgreen"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantssandkelpgreen"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpgreen"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:kelpgreen"},
|
|
||||||
interval = 6,
|
|
||||||
chance = 3,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
local yyp = {x = pos.x, y = pos.y + 2, z = pos.z}
|
|
||||||
local yyyp = {x = pos.x, y = pos.y + 3, z = pos.z}
|
|
||||||
if minetest.get_node(pos).name == "seaplants:kelpgreen" and
|
|
||||||
(minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
if (minetest.get_node(yyp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yyp).name == "noairblocks:water_sourcex") then
|
|
||||||
if (minetest.get_node(yyyp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yyyp).name == "noairblocks:water_sourcex") then
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpgreenmiddle"})
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpgreen"})
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantsdirtkelpbrown"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpbrown"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantssandkelpbrown"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpbrown"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:kelpbrown"},
|
|
||||||
interval = 6,
|
|
||||||
chance = 3,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
local yyp = {x = pos.x, y = pos.y + 2, z = pos.z}
|
|
||||||
local yyyp = {x = pos.x, y = pos.y + 3, z = pos.z}
|
|
||||||
if minetest.get_node(pos).name == "seaplants:kelpbrown" and
|
|
||||||
(minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
if (minetest.get_node(yyp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yyp).name == "noairblocks:water_sourcex") then
|
|
||||||
if (minetest.get_node(yyyp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yyyp).name == "noairblocks:water_sourcex") then
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpbrownmiddle"})
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:kelpbrown"})
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantsdirtseagrassgreen"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:seagrassgreen"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantssandseagrassgreen"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:seagrassgreen"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantsdirtseagrassred"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:seagrassred"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seaplants:seaplantssandseagrassred"},
|
|
||||||
interval = 12,
|
|
||||||
chance = 12,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
minetest.add_node(pos, {name = "seaplants:seagrassred"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- ALIASES
|
-- ALIASES
|
||||||
|
|
||||||
|
|
||||||
minetest.register_alias("seaplants:stemsgreen","default:sand")
|
minetest.register_alias("seaplants:stemsgreen","default:sand")
|
||||||
minetest.register_alias("seaplants:stemsbrown","default:dirt")
|
minetest.register_alias("seaplants:stemsbrown","default:dirt")
|
||||||
minetest.register_alias("seaplants:leafyblue","default:sand")
|
minetest.register_alias("seaplants:leafyblue","default:sand")
|
||||||
minetest.register_alias("seaplants:leafygreen","default:dirt")
|
minetest.register_alias("seaplants:leafygreen","default:dirt")
|
||||||
|
|
||||||
minetest.register_alias("seaplants:chewstickgreen","seaplants:kelpgreen")
|
minetest.register_alias("seaplants:chewstickgreen","seaplants:sand_with_kelp_green")
|
||||||
minetest.register_alias("seaplants:chewstickbrown","seaplants:kelpbrown")
|
minetest.register_alias("seaplants:chewstickbrown","seaplants:sand_with_kelp_brown")
|
||||||
minetest.register_alias("seaplants:leavysnackgreen","seaplants:seagrassgreen")
|
minetest.register_alias("seaplants:leavysnackgreen","seaplants:seagrass_green")
|
||||||
minetest.register_alias("seaplants:leavysnackblue","seaplants:seagrassred")
|
minetest.register_alias("seaplants:leavysnackblue","seaplants:seagrass_red")
|
||||||
minetest.register_alias("seaplants:seasalad","seaplants:seasaladmix")
|
minetest.register_alias("seaplants:seasalad","seaplants:seasaladmix")
|
||||||
|
|
||||||
minetest.log("action", "[sea - seaplants] loaded.")
|
minetest.log("action", "[sea - seaplants] loaded.")
|
||||||
|
Loading…
Reference in New Issue
Block a user