mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-07-19 08:50:25 +02:00
remove mese water, add cave coral and snareweed to sunless sea
This commit is contained in:
113
features/cave_coral.lua
Normal file
113
features/cave_coral.lua
Normal file
@ -0,0 +1,113 @@
|
||||
-- internationalization boilerplate
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
minetest.register_node("dfcaverns:cave_coral_3", {
|
||||
description = S("Cave Coral"),
|
||||
_doc_items_longdesc = dfcaverns.doc.cave_coral_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.cave_coral_usage,
|
||||
tiles = {"dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral.png"},
|
||||
is_ground_content = true,
|
||||
drop = "default:coral_skeleton",
|
||||
light_source = 3,
|
||||
groups = {cracky = 3, dfcaverns_cave_coral = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("dfcaverns:cave_coral_2", {
|
||||
description = S("Cave Coral"),
|
||||
_doc_items_longdesc = dfcaverns.doc.cave_coral_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.cave_coral_usage,
|
||||
tiles = {"dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral.png"},
|
||||
is_ground_content = true,
|
||||
drop = "default:coral_skeleton",
|
||||
light_source = 2,
|
||||
groups = {cracky = 3, dfcaverns_cave_coral = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("dfcaverns:cave_coral_1", {
|
||||
description = S("Cave Coral"),
|
||||
_doc_items_longdesc = dfcaverns.doc.cave_coral_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.cave_coral_usage,
|
||||
tiles = {"dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral_end.png", "dfcaverns_cave_coral.png"},
|
||||
is_ground_content = true,
|
||||
drop = "default:coral_skeleton",
|
||||
light_source = 1,
|
||||
groups = {cracky = 3, dfcaverns_cave_coral = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
local coral_names = {"dfcaverns:cave_coral_1", "dfcaverns:cave_coral_2", "dfcaverns:cave_coral_3"}
|
||||
minetest.register_abm{
|
||||
label = "dfcaverns:shifting_coral",
|
||||
nodenames = {"group:dfcaverns_cave_coral"},
|
||||
interval = 2,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
minetest.swap_node(pos, {name=coral_names[math.random(1,3)]})
|
||||
end,
|
||||
}
|
||||
|
||||
local c_coral_1 = minetest.get_content_id("dfcaverns:cave_coral_1")
|
||||
local c_coral_2 = minetest.get_content_id("dfcaverns:cave_coral_2")
|
||||
local c_coral_3 = minetest.get_content_id("dfcaverns:cave_coral_3")
|
||||
local c_coral_skeleton = minetest.get_content_id("default:coral_skeleton")
|
||||
local c_dirt = minetest.get_content_id("default:dirt")
|
||||
local c_stone = minetest.get_content_id("default:stone")
|
||||
|
||||
local corals = {c_coral_1, c_coral_2, c_coral_3}
|
||||
local get_coral = function()
|
||||
return corals[math.random(1,3)]
|
||||
end
|
||||
|
||||
dfcaverns.spawn_cave_coral = function(area, data, vi, iterations)
|
||||
local run = math.random(2,4)
|
||||
local index = vi
|
||||
local zstride = area.zstride
|
||||
local ystride = area.ystride
|
||||
while run > 0 do
|
||||
if math.random() > 0.95 or data[index] == c_stone or not area:containsi(index) then return end
|
||||
data[index] = get_coral()
|
||||
if iterations > 2 then
|
||||
data[index + 1] = get_coral()
|
||||
data[index - 1] = get_coral()
|
||||
data[index + zstride] = get_coral()
|
||||
data[index - zstride] = get_coral()
|
||||
end
|
||||
if iterations > 3 then
|
||||
data[index + 2] = get_coral()
|
||||
data[index - 2] = get_coral()
|
||||
data[index + zstride * 2] = get_coral()
|
||||
data[index - zstride * 2] = get_coral()
|
||||
data[index + 1 + zstride] = get_coral()
|
||||
data[index - 1 + zstride] = get_coral()
|
||||
data[index + 1 - zstride] = get_coral()
|
||||
data[index - 1 - zstride] = get_coral()
|
||||
end
|
||||
index = index - ystride
|
||||
run = run - 1
|
||||
end
|
||||
|
||||
local newiterations = iterations - 1
|
||||
if newiterations == 0 then return end
|
||||
|
||||
if math.random() > 0.5 then
|
||||
dfcaverns.spawn_cave_coral(area, data, index + 1 + ystride, newiterations)
|
||||
dfcaverns.spawn_cave_coral(area, data, index - 1 + ystride, newiterations)
|
||||
else
|
||||
dfcaverns.spawn_cave_coral(area, data, index + zstride + ystride, newiterations)
|
||||
dfcaverns.spawn_cave_coral(area, data, index - zstride + ystride, newiterations)
|
||||
end
|
||||
end
|
||||
|
||||
dfcaverns.spawn_coral_pile = function(area, data, vi, radius)
|
||||
local pos = area:position(vi)
|
||||
for li in area:iterp(vector.add(pos, -radius), vector.add(pos, radius)) do
|
||||
local adjacent = li + area.ystride
|
||||
local node_type = data[li]
|
||||
if math.random() < 0.2 and (node_type == c_stone or node_type == c_dirt) and data[adjacent] == c_water then
|
||||
data[adjacent] = c_coral_skeleton
|
||||
end
|
||||
end
|
||||
end
|
@ -1,166 +0,0 @@
|
||||
-- internationalization boilerplate
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
minetest.register_node("dfcaverns:glow_water_source", {
|
||||
description = S("Mese Water"),
|
||||
_doc_items_longdesc = dfcaverns.doc.glow_water_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.glow_water_usage,
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
alpha = 204,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "dfcaverns:glow_water_flowing",
|
||||
liquid_alternative_source = "dfcaverns:glow_water_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
light_source = default.LIGHT_MAX,
|
||||
post_effect_color = {a = 204, r = 250, g = 250, b = 10},
|
||||
groups = {liquid = 3, flammable = 2},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("dfcaverns:glow_water_flowing", {
|
||||
description = S("Flowing Mese Water"),
|
||||
_doc_items_longdesc = dfcaverns.doc.glow_water_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.glow_water_usage,
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
alpha = 204,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "dfcaverns:glow_water_flowing",
|
||||
liquid_alternative_source = "dfcaverns:glow_water_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
light_source = 8,
|
||||
post_effect_color = {a = 204, r = 250, g = 250, b = 10},
|
||||
groups = {liquid = 3, flammable = 2, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
})
|
||||
|
||||
local random_direction ={
|
||||
{x=0,y=0,z=1},
|
||||
{x=0,y=0,z=-1},
|
||||
{x=0,y=1,z=0},
|
||||
{x=0,y=-1,z=0},
|
||||
{x=1,y=0,z=0},
|
||||
{x=-1,y=0,z=0},
|
||||
}
|
||||
|
||||
local get_node = minetest.get_node
|
||||
local set_node = minetest.set_node
|
||||
|
||||
local spark_spawner = {
|
||||
amount = 5,
|
||||
time = 0.1,
|
||||
minvel = {x=1, y=1, z=1},
|
||||
maxvel = {x=-1, y=-1, z=-1},
|
||||
minacc = {x=0, y= 2, z=0},
|
||||
maxacc = {x=0, y= 2, z=0},
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
texture = "dfcaverns_spark.png",
|
||||
}
|
||||
|
||||
minetest.register_abm({
|
||||
label = "dfcaverns glow_water",
|
||||
nodenames = {"dfcaverns:glow_water_source"},
|
||||
neighbors = {"default:water_source"},
|
||||
interval = 2,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
action = function(pos,node) -- Do everything possible to optimize this method
|
||||
spark_spawner.minpos = vector.add(pos, -0.5)
|
||||
spark_spawner.maxpos = vector.add(pos, 0.5)
|
||||
minetest.add_particlespawner(spark_spawner)
|
||||
|
||||
local check_pos = vector.add(pos, random_direction[math.random(6)])
|
||||
local check_node = get_node(check_pos)
|
||||
local check_node_name = check_node.name
|
||||
if check_node_name == "default:water_source" then
|
||||
set_node(pos, check_node)
|
||||
set_node(check_pos, node)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("bucket") then
|
||||
bucket.register_liquid(
|
||||
"dfcaverns:glow_water_source",
|
||||
"dfcaverns:glow_water_flowing",
|
||||
"dfcaverns:glow_water_bucket",
|
||||
"dfcaverns_bucket_glow_water.png",
|
||||
S("Glow Water Bucket")
|
||||
)
|
||||
end
|
||||
|
||||
if minetest.get_modpath("dynamic_liquid") then
|
||||
dynamic_liquid.liquid_abm("dfcaverns:glow_water_source", "dfcaverns:glow_water_flowing", 5)
|
||||
end
|
49
features/snareweed.lua
Normal file
49
features/snareweed.lua
Normal file
@ -0,0 +1,49 @@
|
||||
-- internationalization boilerplate
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
minetest.register_node("dfcaverns:snareweed", {
|
||||
description = S("Snareweed"),
|
||||
_doc_items_longdesc = dfcaverns.doc.snareweed_desc,
|
||||
_doc_items_usagehelp = dfcaverns.doc.snareweed_usage,
|
||||
tiles = {"default_dirt.png^dfcaverns_snareweed_roots.png", "default_dirt.png"},
|
||||
drawtype="plantlike_rooted",
|
||||
-- paramtype = "light",
|
||||
paramtype2 = "leveled",
|
||||
special_tiles = {{name = "dfcaverns_snareweed.png", tileable_vertical = true}},
|
||||
is_ground_content = true,
|
||||
drop = 'default:dirt',
|
||||
light_source = 6,
|
||||
groups = {crumbly = 3, soil = 1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
local c_water = minetest.get_content_id("default:water_source")
|
||||
local c_dirt = minetest.get_content_id("default:dirt")
|
||||
local c_snareweed = minetest.get_content_id("dfcaverns:snareweed")
|
||||
|
||||
dfcaverns.place_snareweed = function(area, data, bi, param2_data)
|
||||
local max_height = 0
|
||||
local index = bi + area.ystride
|
||||
while area:containsi(index) and data[index] == c_water and max_height <= 8*16 do
|
||||
index = index + area.ystride
|
||||
max_height = max_height + 16
|
||||
end
|
||||
if max_height > 0 then
|
||||
data[bi] = c_snareweed
|
||||
param2_data[bi] = math.min(math.random(3*16, 8*16), max_height)
|
||||
else
|
||||
data[bi] = c_dirt
|
||||
end
|
||||
end
|
||||
|
||||
dfcaverns.place_snareweed_patch = function(area, data, bi, param2_data, radius)
|
||||
local pos = area:position(bi)
|
||||
for li in area:iterp(vector.add(pos, -radius), vector.add(pos, radius)) do
|
||||
local adjacent = li + area.ystride
|
||||
local node_type = data[li]
|
||||
if math.random() < 0.1 and (node_type == c_stone or node_type == c_dirt) and data[adjacent] == c_water then
|
||||
dfcaverns.place_snareweed(area, data, li, param2_data)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user