forked from mtcontrib/minetest-mod-sea
Optimisation des coraux pour Minetest 5
This commit is contained in:
parent
d537a679a3
commit
ef1efe65d9
@ -1,4 +1,4 @@
|
|||||||
default
|
default
|
||||||
noairblocks
|
nalc_lib
|
||||||
unifieddyes
|
unifieddyes
|
||||||
colormachine?
|
colormachine?
|
@ -1,639 +1,182 @@
|
|||||||
-- NODES
|
-- NODES
|
||||||
|
|
||||||
|
-- Add magenta, aqua, skyblue seacorals
|
||||||
|
local colors = {magenta = "Magenta", aqua = "Aqua", skyblue = "Skyblue"}
|
||||||
|
|
||||||
minetest.register_node("seacoral:coralcyan", {
|
for color, cname in pairs(colors) do
|
||||||
description = "Cyan Coral",
|
minetest.register_node(
|
||||||
drawtype = "plantlike",
|
"seacoral:coral_"..color, {
|
||||||
tiles = {"seacoral_coralcyan.png"},
|
description = cname.." Coral",
|
||||||
inventory_image = "seacoral_coralcyan.png",
|
drawtype = "plantlike_rooted",
|
||||||
wield_image = "seacoral_coralcyan.png",
|
waving = 1,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
tiles = {"default_coral_skeleton.png"},
|
||||||
climbable = true,
|
special_tiles = {{name = "seacoral_coral"..color..".png", tileable_vertical = true}},
|
||||||
drowning = 1,
|
inventory_image = "seacoral_coral"..color..".png",
|
||||||
is_ground_content = true,
|
groups = {snappy = 3, seacoral = 1},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3}
|
fixed = {
|
||||||
},
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
{-4/16, 0.5, -4/16, 4/16, 1.5, 4/16},
|
||||||
groups = {snappy=3, seacoral=1, sea=1,basecolor_cyan=1},
|
},
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
},
|
||||||
|
node_dig_prediction = "default:coral_skeleton",
|
||||||
|
node_placement_prediction = "",
|
||||||
|
sounds = default.node_sound_stone_defaults(
|
||||||
|
{
|
||||||
|
dig = {name = "default_dig_snappy", gain = 0.2},
|
||||||
|
dug = {name = "default_grass_footstep", gain = 0.25},
|
||||||
|
}),
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" or not placer then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local player_name = placer:get_player_name()
|
||||||
|
local pos_under = pointed_thing.under
|
||||||
|
local pos_above = pointed_thing.above
|
||||||
|
|
||||||
|
if minetest.get_node(pos_under).name ~= "default:coral_skeleton" or
|
||||||
|
minetest.get_node(pos_above).name ~= "default:water_source" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos_under, player_name) or
|
||||||
|
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 = "seacoral:coral"..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:coral_skeleton"})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("seacoral:coralmagenta", {
|
-- Replace cyan, redviolet, lime seacorals with default Minetest's ones
|
||||||
description = "Magenta Coral",
|
minetest.register_alias("seacoral:coralcyan", "default:water_source")
|
||||||
drawtype = "plantlike",
|
minetest.register_alias("seacoral:seacoralsandcyan", "default:coral_cyan")
|
||||||
tiles = {"seacoral_coralmagenta.png"},
|
minetest.register_alias("seacoral:seacoraldirtcyan", "default:coral_cyan")
|
||||||
inventory_image = "seacoral_coralmagenta.png",
|
nalc.add_group("default:coral_cyan", "seacoral", 1)
|
||||||
wield_image = "seacoral_coralmagenta.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, seacoral=1, sea=1,basecolor_magenta=1},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seacoral:coralaqua", {
|
minetest.register_alias("seacoral:coralredviolet", "default:water_source")
|
||||||
description = "Aqua Coral",
|
minetest.register_alias("seacoral:seacoralsandredviolet", "default:coral_pink")
|
||||||
drawtype = "plantlike",
|
minetest.register_alias("seacoral:seacoraldirtredviolet", "default:coral_pink")
|
||||||
tiles = {"seacoral_coralaqua.png"},
|
nalc.add_group("default:coral_pink", "seacoral", 1)
|
||||||
inventory_image = "seacoral_coralaqua.png",
|
|
||||||
wield_image = "seacoral_coralaqua.png",
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drowning = 1,
|
|
||||||
is_ground_content = true,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3}
|
|
||||||
},
|
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
|
||||||
groups = {snappy=3, seacoral=1, sea=1,excolor_aqua=1},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seacoral:corallime", {
|
minetest.register_alias("seacoral:corallime", "default:water_source")
|
||||||
description = "Lime Coral",
|
minetest.register_alias("seacoral:seacoralsandlime", "default:coral_green")
|
||||||
drawtype = "plantlike",
|
minetest.register_alias("seacoral:seacoraldirtlime", "default:coral_green")
|
||||||
tiles = {"seacoral_corallime.png"},
|
nalc.add_group("default:coral_green", "seacoral", 1)
|
||||||
inventory_image = "seacoral_corallime.png",
|
|
||||||
wield_image = "seacoral_corallime.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, seacoral=1, sea=1,excolor_lime=1},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seacoral:coralskyblue", {
|
-- Replace Old magenta, aqua, skyblue seacorals with new defined ones
|
||||||
description = "Skyblue Coral",
|
minetest.register_alias("seacoral:coralmagenta", "default:water_source")
|
||||||
drawtype = "plantlike",
|
minetest.register_alias("seacoral:seacoralsandmagenta", "seacoral:coral_magenta")
|
||||||
tiles = {"seacoral_coralskyblue.png"},
|
minetest.register_alias("seacoral:seacoraldirtmagenta", "seacoral:coral_magenta")
|
||||||
inventory_image = "seacoral_coralskyblue.png",
|
|
||||||
wield_image = "seacoral_coralskyblue.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, seacoral=1, sea=1,excolor_skyblue=1},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seacoral:coralredviolet", {
|
minetest.register_alias("seacoral:coralaqua", "default:water_source")
|
||||||
description = "Redviolet Coral",
|
minetest.register_alias("seacoral:seacoralsandaqua", "seacoral:coral_aqua")
|
||||||
drawtype = "plantlike",
|
minetest.register_alias("seacoral:seacoraldirtaqua", "seacoral:coral_aqua")
|
||||||
tiles = {"seacoral_coralredviolet.png"},
|
|
||||||
inventory_image = "seacoral_coralredviolet.png",
|
|
||||||
wield_image = "seacoral_coralredviolet.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, seacoral=1, sea=1,excolor_redviolet=1},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("seacoral:seacoralsandcyan", {
|
|
||||||
description = "Sea coral sand cyan",
|
|
||||||
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("seacoral:seacoraldirtcyan", {
|
|
||||||
description = "Sea coral dirt cyan",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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("seacoral:seacoralsandmagenta", {
|
|
||||||
description = "Sea coral sand magenta",
|
|
||||||
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("seacoral:seacoraldirtmagenta", {
|
|
||||||
description = "Sea coral dirt magenta",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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("seacoral:seacoralsandaqua", {
|
|
||||||
description = "Sea coral sand aqua",
|
|
||||||
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("seacoral:seacoraldirtaqua", {
|
|
||||||
description = "Sea coral dirt aqua",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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("seacoral:seacoralsandlime", {
|
|
||||||
description = "Sea coral sand lime",
|
|
||||||
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("seacoral:seacoraldirtlime", {
|
|
||||||
description = "Sea coral dirt lime",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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("seacoral:seacoralsandskyblue", {
|
|
||||||
description = "Sea coral sand skyblue",
|
|
||||||
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("seacoral:seacoraldirtskyblue", {
|
|
||||||
description = "Sea coral dirt skyblue",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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("seacoral:seacoralsandredviolet", {
|
|
||||||
description = "Sea coral sand redviolet",
|
|
||||||
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("seacoral:seacoraldirtredviolet", {
|
|
||||||
description = "Sea coral dirt redviolet",
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
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_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
|
||||||
register_seacoral_craft = function(output,recipe)
|
register_seacoral_craft = function(output,recipe)
|
||||||
minetest.register_craft({
|
minetest.register_craft(
|
||||||
type = 'shapeless',
|
{
|
||||||
output = output,
|
type = 'shapeless',
|
||||||
recipe = recipe,
|
output = output,
|
||||||
})
|
recipe = recipe,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
register_seacoral_craft('dye:cyan 4', {'seacoral:coralcyan'})
|
register_seacoral_craft('dye:cyan 4', {'default:coral_cyan'})
|
||||||
register_seacoral_craft('dye:magenta 4', {'seacoral:coralmagenta'})
|
register_seacoral_craft('dye:magenta 4', {'seacoral:coral_magenta'})
|
||||||
register_seacoral_craft('dye:lime 4', {'seacoral:corallime'})
|
register_seacoral_craft('dye:lime 4', {'default:coral_green'})
|
||||||
register_seacoral_craft('dye:aqua 4', {'seacoral:coralaqua'})
|
register_seacoral_craft('dye:spring 4', {'seacoral:coral_aqua'})
|
||||||
register_seacoral_craft('dye:skyblue 4', {'seacoral:coralskyblue'})
|
register_seacoral_craft('dye:azure 4', {'seacoral:coral_skyblue'})
|
||||||
register_seacoral_craft('dye:redviolet 4', {'seacoral:coralredviolet'})
|
register_seacoral_craft('dye:pink 4', {'default:coral_pink'})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- SEACORAL SAND AND DIRT GENERATION
|
-- SEACORAL SAND AND DIRT GENERATION
|
||||||
|
|
||||||
|
-- Coral reef
|
||||||
|
|
||||||
minetest.register_ore({
|
minetest.register_decoration(
|
||||||
ore_type = "scatter",
|
{
|
||||||
ore = "seacoral:seacoralsandcyan",
|
name = "seacoral:corals",
|
||||||
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 = 4,
|
||||||
y_max = -4,
|
noise_params = {
|
||||||
y_min = -8,
|
offset = -4,
|
||||||
})
|
scale = 4,
|
||||||
|
spread = {x = 50, y = 50, z = 50},
|
||||||
minetest.register_ore({
|
seed = 7014,
|
||||||
ore_type = "scatter",
|
octaves = 3,
|
||||||
ore = "seacoral:seacoraldirtcyan",
|
persist = 0.7,
|
||||||
wherein = "default:dirt",
|
},
|
||||||
clust_scarcity = 10*10*10,
|
biomes = {
|
||||||
clust_num_ores = 24,
|
"desert_ocean",
|
||||||
clust_size = 4,
|
"savanna_ocean",
|
||||||
y_max = -4,
|
"rainforest_ocean",
|
||||||
y_min = -8,
|
},
|
||||||
})
|
y_max = -2,
|
||||||
|
y_min = -8,
|
||||||
minetest.register_ore({
|
flags = "force_placement",
|
||||||
ore_type = "scatter",
|
decoration = {
|
||||||
ore = "seacoral:seacoralsandmagenta",
|
"seacoral:coral_magenta", "default:coral_orange",
|
||||||
wherein = "default:sand",
|
"seacoral:coral_aqua", "default:coral_brown",
|
||||||
clust_scarcity = 10*10*10,
|
"seacoral:coral_skyblue", "default:coral_skeleton",
|
||||||
clust_num_ores = 24,
|
},
|
||||||
clust_size = 4,
|
})
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoraldirtmagenta",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoralsandaqua",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoraldirtaqua",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoralsandlime",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoraldirtlime",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoralsandskyblue",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoraldirtskyblue",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoralsandredviolet",
|
|
||||||
wherein = "default:sand",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "seacoral:seacoraldirtredviolet",
|
|
||||||
wherein = "default:dirt",
|
|
||||||
clust_scarcity = 10*10*10,
|
|
||||||
clust_num_ores = 24,
|
|
||||||
clust_size = 4,
|
|
||||||
y_max = -4,
|
|
||||||
y_min = -8,
|
|
||||||
})
|
|
||||||
|
|
||||||
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
|
-- ABM'S
|
||||||
|
|
||||||
|
minetest.register_abm(
|
||||||
minetest.register_abm({
|
{
|
||||||
nodenames = {"seacoral:seacoraldirtcyan"},
|
nodenames = {"group:seacoral"},
|
||||||
interval = 12,
|
interval = 3,
|
||||||
chance = 12,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
local yp = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
if (minetest.get_node(yp).name == "default:water_source" or
|
local yyp = {x = pos.x, y = pos.y + 2, z = pos.z}
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") then
|
if ((minetest.get_node(yp).name == "default:water_source" or
|
||||||
pos.y = pos.y + 1
|
minetest.get_node(yp).name == "noairblocks:water_sourcex") and
|
||||||
minetest.add_node(pos, {name = "seacoral:coralcyan"}) else
|
(minetest.get_node(yyp).name == "default:water_source" or
|
||||||
return
|
minetest.get_node(yyp).name == "noairblocks:water_sourcex")) then
|
||||||
end
|
local objs = minetest.get_objects_inside_radius(pos, 2)
|
||||||
end
|
for k, obj in pairs(objs) do
|
||||||
})
|
obj:set_hp(obj:get_hp()+ 1)
|
||||||
|
end
|
||||||
minetest.register_abm({
|
else
|
||||||
nodenames = {"seacoral:seacoralsandcyan"},
|
return
|
||||||
interval = 12,
|
end
|
||||||
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 = "seacoral:coralcyan"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoraldirtmagenta"},
|
|
||||||
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 = "seacoral:coralmagenta"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoralsandmagenta"},
|
|
||||||
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 = "seacoral:coralmagenta"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoraldirtaqua"},
|
|
||||||
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 = "seacoral:coralaqua"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoralsandaqua"},
|
|
||||||
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 = "seacoral:coralaqua"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoraldirtlime"},
|
|
||||||
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 = "seacoral:corallime"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoralsandlime"},
|
|
||||||
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 = "seacoral:corallime"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoraldirtskyblue"},
|
|
||||||
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 = "seacoral:coralskyblue"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoralsandskyblue"},
|
|
||||||
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 = "seacoral:coralskyblue"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoraldirtredviolet"},
|
|
||||||
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 = "seacoral:coralredviolet"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"seacoral:seacoralsandredviolet"},
|
|
||||||
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 = "seacoral:coralredviolet"}) else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"group:seacoral"},
|
|
||||||
interval = 3,
|
|
||||||
chance = 1,
|
|
||||||
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}
|
|
||||||
if ((minetest.get_node(yp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yp).name == "noairblocks:water_sourcex") and
|
|
||||||
(minetest.get_node(yyp).name == "default:water_source" or
|
|
||||||
minetest.get_node(yyp).name == "noairblocks:water_sourcex")) then
|
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 2)
|
|
||||||
for k, obj in pairs(objs) do
|
|
||||||
obj:set_hp(obj:get_hp()+ 1)
|
|
||||||
end
|
end
|
||||||
else
|
})
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- OPTIONAL DEPENDENCY
|
-- OPTIONAL DEPENDENCY
|
||||||
|
|
||||||
|
|
||||||
if( minetest.get_modpath( "colormachine") ~= nil ) then
|
if( minetest.get_modpath( "colormachine") ~= nil ) then
|
||||||
colormachine.basic_dye_sources = { "flowers:rose", "flowers:tulip", "flowers:dandelion_yellow", "seacoral:corallime", "default:cactus", "seacoral:coralaqua", "seacoral:coralcyan", "seacoral:coralskyblue", "flowers:geranium", "flowers:viola", "seacoral:coralmagenta", "seacoral:coralredviolet", "default:stone", "", "", "", "default:coal_lump" };
|
colormachine.basic_dye_sources = { "flowers:rose", "flowers:tulip", "flowers:dandelion_yellow", "default:coral_green", "default:cactus", "seacoral:coral_aqua", "default::coral_cyan", "seacoral:coral_skyblue", "flowers:geranium", "flowers:viola", "seacoral:coral_magenta", "default:coral_pink", "default:stone", "", "", "", "default:coal_lump" };
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -645,8 +188,8 @@ end
|
|||||||
minetest.register_alias("seadye:cyan","dye:cyan")
|
minetest.register_alias("seadye:cyan","dye:cyan")
|
||||||
minetest.register_alias("seadye:magenta","dye:magenta")
|
minetest.register_alias("seadye:magenta","dye:magenta")
|
||||||
minetest.register_alias("seadye:lime","dye:lime")
|
minetest.register_alias("seadye:lime","dye:lime")
|
||||||
minetest.register_alias("seadye:aqua","dye:aqua")
|
minetest.register_alias("seadye:aqua","dye:spring")
|
||||||
minetest.register_alias("seadye:skyblue","dye:skyblue")
|
minetest.register_alias("seadye:skyblue","dye:azure")
|
||||||
minetest.register_alias("seadye:redviolet","dye:redviolet")
|
minetest.register_alias("seadye:redviolet","dye:pink")
|
||||||
|
|
||||||
minetest.log("action", "[sea - seacoral] loaded.")
|
minetest.log("action", "[sea - seacoral] loaded.")
|
||||||
|
Loading…
Reference in New Issue
Block a user