Optimize variables.
This commit is contained in:
parent
26d4d7cc86
commit
1a9afc9ede
10 changed files with 317 additions and 317 deletions
15
deco.lua
15
deco.lua
|
@ -113,10 +113,11 @@ minetest.register_decoration({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
dofile(fun_caves.path.."/deco_caves.lua")
|
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
--dofile(fun_caves.path.."/deco_dirt.lua")
|
dofile(path.."/deco_caves.lua")
|
||||||
dofile(fun_caves.path.."/deco_plants.lua")
|
--dofile(path.."/deco_dirt.lua")
|
||||||
dofile(fun_caves.path.."/deco_rocks.lua")
|
dofile(path.."/deco_plants.lua")
|
||||||
--dofile(fun_caves.path.."/deco_ferns.lua")
|
dofile(path.."/deco_rocks.lua")
|
||||||
--dofile(fun_caves.path.."/deco_ferns_tree.lua")
|
--dofile(path.."/deco_ferns.lua")
|
||||||
dofile(fun_caves.path.."/deco_water.lua")
|
--dofile(path.."/deco_ferns_tree.lua")
|
||||||
|
dofile(path.."/deco_water.lua")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
local node = fun_caves.node
|
|
||||||
local min_surface = -80
|
local min_surface = -80
|
||||||
|
|
||||||
function fun_caves.decorate_cave(data, area, minp, y, ivm, biome_val_in)
|
function fun_caves.decorate_cave(node, data, area, minp, y, ivm, biome_val_in)
|
||||||
if not (data[ivm] == node("air") or data[ivm] == node("default:stone")) then
|
if not (data[ivm] == node("air") or data[ivm] == node("default:stone")) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -113,9 +112,9 @@ function fun_caves.decorate_cave(data, area, minp, y, ivm, biome_val_in)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- fluids
|
-- fluids
|
||||||
if y > minp.y and (node_below == node("default:stone") or node_below == node("fun_caves:hot_cobble")) and sr < 3 then
|
if y > minp.y and y < -100 and (node_below == node("default:stone") or node_below == node("fun_caves:hot_cobble")) and sr < 3 then
|
||||||
return node("default:lava_source")
|
return node("default:lava_source")
|
||||||
elseif node_below == node("fun_caves:stone_with_moss") and sr < 3 then
|
elseif y < -100 and node_below == node("fun_caves:stone_with_moss") and sr < 3 then
|
||||||
return node("default:water_source")
|
return node("default:water_source")
|
||||||
|
|
||||||
-- standing up
|
-- standing up
|
||||||
|
@ -130,7 +129,7 @@ function fun_caves.decorate_cave(data, area, minp, y, ivm, biome_val_in)
|
||||||
elseif node_below == node("default:stone") and sr < 80 then
|
elseif node_below == node("default:stone") and sr < 80 then
|
||||||
return node("fun_caves:stalagmite")
|
return node("fun_caves:stalagmite")
|
||||||
elseif node_below == node("fun_caves:hot_cobble") and sr < 80 then
|
elseif node_below == node("fun_caves:hot_cobble") and sr < 80 then
|
||||||
if sr < 20 then
|
if sr <= 20 then
|
||||||
return node("fun_caves:hot_spike")
|
return node("fun_caves:hot_spike")
|
||||||
else
|
else
|
||||||
return node("fun_caves:hot_spike_"..math.ceil(sr / 20))
|
return node("fun_caves:hot_spike_"..math.ceil(sr / 20))
|
||||||
|
@ -155,7 +154,7 @@ function fun_caves.decorate_cave(data, area, minp, y, ivm, biome_val_in)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if air_count > 5 then
|
if air_count > 5 then
|
||||||
fun_caves.make_fungal_tree(data, area, ivm, math.random(2,math.min(air_count, 12)), node(fun_caves.fungal_tree_leaves[math.random(1,#fun_caves.fungal_tree_leaves)]), node("fun_caves:fungal_tree_fruit"))
|
fun_caves.make_fungal_tree(data, area, ivm, math.random(2,math.min(air_count, 12)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif node_below == node("fun_caves:giant_mushroom_stem") and data[ivm - area.ystride * 2] == node("fun_caves:giant_mushroom_stem") then
|
elseif node_below == node("fun_caves:giant_mushroom_stem") and data[ivm - area.ystride * 2] == node("fun_caves:giant_mushroom_stem") then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fun_caves.water_plants = {}
|
fun_caves.water_plants = {}
|
||||||
function fun_caves.register_water_plant(desc)
|
local function register_water_plant(desc)
|
||||||
fun_caves.water_plants[#fun_caves.water_plants+1] = desc
|
fun_caves.water_plants[#fun_caves.water_plants+1] = desc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ do
|
||||||
water_plant_1_def_soil.place_on = {"group:soil"}
|
water_plant_1_def_soil.place_on = {"group:soil"}
|
||||||
water_plant_1_def_soil.decoration = {"fun_caves:water_plant_1_water_soil",}
|
water_plant_1_def_soil.decoration = {"fun_caves:water_plant_1_water_soil",}
|
||||||
|
|
||||||
fun_caves.register_water_plant(water_plant_1_def_sand)
|
register_water_plant(water_plant_1_def_sand)
|
||||||
fun_caves.register_water_plant(water_plant_1_def_soil)
|
register_water_plant(water_plant_1_def_soil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
local node = fun_caves.node
|
|
||||||
local light_depth = -13
|
local light_depth = -13
|
||||||
local water_level = 1
|
local water_level = 1
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ end
|
||||||
|
|
||||||
plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z = 200}, seed = 33, octaves = 3, persist = 0.7, lacunarity = 2.0}
|
plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z = 200}, seed = 33, octaves = 3, persist = 0.7, lacunarity = 2.0}
|
||||||
|
|
||||||
local function surround(data, area, ivm)
|
local function surround(node, data, area, ivm)
|
||||||
local n
|
local n
|
||||||
|
|
||||||
-- Check to make sure that a plant root is fully surrounded.
|
-- Check to make sure that a plant root is fully surrounded.
|
||||||
|
@ -35,7 +34,9 @@ local function surround(data, area, ivm)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function fun_caves.decorate_water(data, area, minp, maxp, pos, ivm, biome_in, pn)
|
local node_match_cache = {}
|
||||||
|
|
||||||
|
function fun_caves.decorate_water(node, data, area, minp, maxp, pos, ivm, biome_in, pn)
|
||||||
if pos.y < light_depth then
|
if pos.y < light_depth then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -50,7 +51,7 @@ function fun_caves.decorate_water(data, area, minp, maxp, pos, ivm, biome_in, pn
|
||||||
inside = true
|
inside = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if pos.y < water_level and data[ivm] == node("default:sand") and node_above == node("default:water_source") and data[ivm + area.ystride * 2] == node("default:water_source") and coral_biomes[biome] and pn < -0.1 and math.random(5) == 1 and surround(data, area, ivm) then
|
if pos.y < water_level and data[ivm] == node("default:sand") and node_above == node("default:water_source") and data[ivm + area.ystride * 2] == node("default:water_source") and coral_biomes[biome] and pn < -0.1 and math.random(5) == 1 and surround(node, data, area, ivm) then
|
||||||
return node("fun_caves:staghorn_coral_water_sand")
|
return node("fun_caves:staghorn_coral_water_sand")
|
||||||
elseif pos.y < water_level and node_below == node("default:sand") and node_above == node("default:water_source") and data[ivm] == node("default:water_source") and coral_biomes[biome] and pn < -0.1 and math.random(5) < 3 then
|
elseif pos.y < water_level and node_below == node("default:sand") and node_above == node("default:water_source") and data[ivm] == node("default:water_source") and coral_biomes[biome] and pn < -0.1 and math.random(5) < 3 then
|
||||||
local sr = math.random(65)
|
local sr = math.random(65)
|
||||||
|
@ -63,30 +64,30 @@ function fun_caves.decorate_water(data, area, minp, maxp, pos, ivm, biome_in, pn
|
||||||
end
|
end
|
||||||
elseif inside and (node_above == node("default:water_source") or node_above == node("default:river_water_source")) and (data[ivm] == node("default:sand") or data[ivm] == node("default:dirt")) then
|
elseif inside and (node_above == node("default:water_source") or node_above == node("default:river_water_source")) and (data[ivm] == node("default:sand") or data[ivm] == node("default:dirt")) then
|
||||||
-- Check the biomes and plant water plants, if called for.
|
-- Check the biomes and plant water plants, if called for.
|
||||||
if not surround(data, area, ivm) then
|
if not surround(node, data, area, ivm) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, desc in pairs(fun_caves.water_plants) do
|
for _, desc in pairs(fun_caves.water_plants) do
|
||||||
if desc.content_id then
|
if desc.content_id then
|
||||||
if not fun_caves.node_match_cache[desc.content_id] then
|
if not node_match_cache[desc.content_id] then
|
||||||
fun_caves.node_match_cache[desc.content_id] = {}
|
node_match_cache[desc.content_id] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
if not fun_caves.node_match_cache[desc.content_id][data[ivm]] then
|
if not node_match_cache[desc.content_id][data[ivm]] then
|
||||||
-- This is a great way to match all node type strings
|
-- This is a great way to match all node type strings
|
||||||
-- against a given node (or nodes). However, it's slow.
|
-- against a given node (or nodes). However, it's slow.
|
||||||
-- To speed it up, we cache the results for each plant
|
-- To speed it up, we cache the results for each plant
|
||||||
-- on each node, and avoid calling find_nodes every time.
|
-- on each node, and avoid calling find_nodes every time.
|
||||||
local posm, count = minetest.find_nodes_in_area(pos, pos, desc.place_on)
|
local posm, count = minetest.find_nodes_in_area(pos, pos, desc.place_on)
|
||||||
if #posm > 0 then
|
if #posm > 0 then
|
||||||
fun_caves.node_match_cache[desc.content_id][data[ivm]] = "good"
|
node_match_cache[desc.content_id][data[ivm]] = "good"
|
||||||
else
|
else
|
||||||
fun_caves.node_match_cache[desc.content_id][data[ivm]] = "bad"
|
node_match_cache[desc.content_id][data[ivm]] = "bad"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if fun_caves.node_match_cache[desc.content_id][data[ivm]] == "good" and desc.fill_ratio and (not desc.biomes or (biome and desc.biomes and table.contains(desc.biomes, biome))) and math.random() <= desc.fill_ratio then
|
if node_match_cache[desc.content_id][data[ivm]] == "good" and desc.fill_ratio and (not desc.biomes or (biome and desc.biomes and table.contains(desc.biomes, biome))) and math.random() <= desc.fill_ratio then
|
||||||
return desc.content_id
|
return desc.content_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
328
fungal_tree.lua
328
fungal_tree.lua
|
@ -2,179 +2,19 @@
|
||||||
-- Fungal Tree --
|
-- Fungal Tree --
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
local light_max = 9
|
local light_max = 8
|
||||||
|
|
||||||
local colors = {}
|
local colors = {}
|
||||||
colors["^[colorize:#FF00FF:60"] = "dye:violet"
|
colors["^[colorize:#FF00FF:60"] = "dye:violet"
|
||||||
colors["^[colorize:#0000FF:60"] = "dye:blue"
|
colors["^[colorize:#0000FF:60"] = "dye:blue"
|
||||||
colors["^[colorize:#FF4500:80"] = "dye:green"
|
colors["^[colorize:#FF4500:80"] = "dye:green"
|
||||||
colors[""] = "dye:white"
|
colors[""] = "dye:white"
|
||||||
fun_caves.fungal_tree_leaves = {}
|
local fungal_tree_leaves = {}
|
||||||
|
|
||||||
local newnode = fun_caves.clone_node("farming:straw")
|
local newnode = fun_caves.clone_node("farming:straw")
|
||||||
newnode.description = "Dry Fiber"
|
newnode.description = "Dry Fiber"
|
||||||
minetest.register_node("fun_caves:dry_fiber", newnode)
|
minetest.register_node("fun_caves:dry_fiber", newnode)
|
||||||
|
|
||||||
-- all leaves
|
|
||||||
function fun_caves.make_fungal_tree(data, area, ivm, height, leaves, fruit)
|
|
||||||
for y = 0, height do
|
|
||||||
local radius = 1
|
|
||||||
if y > 1 and y < height - 2 then
|
|
||||||
radius = 2
|
|
||||||
end
|
|
||||||
for z = -radius,radius do
|
|
||||||
for x = -radius,radius do
|
|
||||||
local sr = math.random(1,100)
|
|
||||||
local i = ivm + z*area.zstride + y*area.ystride + x
|
|
||||||
if x == 0 and y == 0 and z == 0 then
|
|
||||||
data[i] = leaves
|
|
||||||
elseif sr == 1 then
|
|
||||||
data[i] = fruit
|
|
||||||
elseif sr < 50 then
|
|
||||||
data[i] = leaves
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- multicolored growths
|
|
||||||
local count = 0
|
|
||||||
for color, dye in pairs(colors) do
|
|
||||||
count = count + 1
|
|
||||||
local name = "fun_caves:fungal_tree_leaves_"..count
|
|
||||||
fun_caves.fungal_tree_leaves[#fun_caves.fungal_tree_leaves+1] = name
|
|
||||||
|
|
||||||
minetest.register_node(name, {
|
|
||||||
description = "Fungal tree growths",
|
|
||||||
drawtype = "allfaces_optional",
|
|
||||||
waving = 1,
|
|
||||||
visual_scale = 1.3,
|
|
||||||
tiles = {"fun_caves_fungal_tree_leaves.png"..color},
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {snappy=3, flammable=3, leaves=1, plant=1},
|
|
||||||
drop = {
|
|
||||||
max_items = 1,
|
|
||||||
items = {
|
|
||||||
--{items = {"fun_caves:"..tree.name.."_sapling"}, rarity = tree.drop_rarity },
|
|
||||||
{items = {name} }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
after_place_node = default.after_place_leaves,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fun_caves:dry_fiber",
|
|
||||||
recipe = name,
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
if dye then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = dye,
|
|
||||||
recipe = {
|
|
||||||
{name}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "dye:yellow",
|
|
||||||
recipe = {
|
|
||||||
{"flowers:mushroom_brown"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local leaves_and_air = table.copy(fun_caves.fungal_tree_leaves)
|
|
||||||
leaves_and_air[#leaves_and_air+1] = "air"
|
|
||||||
local good_stone = {}
|
|
||||||
good_stone["fun_caves:stone_with_lichen"] = true
|
|
||||||
good_stone["fun_caves:stone_with_algae"] = true
|
|
||||||
|
|
||||||
local function find_ground(pos)
|
|
||||||
for y1 = 1, 16 do
|
|
||||||
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-y1, z=pos.z})
|
|
||||||
if node then
|
|
||||||
if minetest.get_item_group(node.name, "soil") ~= 0 or
|
|
||||||
good_stone[node.name] then
|
|
||||||
return y1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return 1000
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- fungal spread
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = fun_caves.fungal_tree_leaves,
|
|
||||||
interval = 2 * fun_caves.time_factor,
|
|
||||||
chance = 10,
|
|
||||||
action = function(pos, node)
|
|
||||||
if minetest.get_node_light(pos, nil) == 15 then
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if find_ground(pos) > 16 then
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local grow_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
|
||||||
local grow_node = minetest.get_node_or_nil(grow_pos)
|
|
||||||
if grow_node and grow_node.name == "air" then
|
|
||||||
minetest.set_node(grow_pos, {name = node.name})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if math.random(1,3) ~= 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local foreign = {}
|
|
||||||
for _, i in pairs(fun_caves.fungal_tree_leaves) do
|
|
||||||
if i ~= node.name then
|
|
||||||
foreign[#foreign+1] = i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local pos1, count = minetest.find_nodes_in_area(vector.subtract(pos, 3), vector.add(pos, 3), foreign)
|
|
||||||
if #pos1 > 0 then
|
|
||||||
minetest.set_node(pos1[math.random(1,#pos1)], {name="air"})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if math.random(1,201) == 1 then
|
|
||||||
local new = fun_caves.fungal_tree_leaves[math.random(1,#fun_caves.fungal_tree_leaves)]
|
|
||||||
local pos1, count = minetest.find_nodes_in_area({x=pos.x-8, y=pos.y-16, z=pos.z-8}, {x=pos.x+8, y=pos.y+16, z=pos.z+8}, node.name)
|
|
||||||
for _, p in pairs(pos1) do
|
|
||||||
minetest.set_node(p, {name=new})
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
grow_pos = {x = pos.x + math.random(-1,1), y = pos.y + math.random(-1,1), z = pos.z + math.random(-1,1)}
|
|
||||||
grow_node = minetest.get_node_or_nil(grow_pos)
|
|
||||||
--if math.random(1,2) == 1 then
|
|
||||||
minetest.set_node(pos, {name = "air"})
|
|
||||||
--end
|
|
||||||
if not grow_node or not table.contains(leaves_and_air, grow_node.name) or find_ground(grow_pos) > 16 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if minetest.get_node_light(grow_pos, nil) <= light_max then
|
|
||||||
minetest.set_node(pos, {name = "air"})
|
|
||||||
if math.random(1,27) == 1 then
|
|
||||||
minetest.set_node(grow_pos, {name = "fun_caves:fungal_tree_fruit"})
|
|
||||||
else
|
|
||||||
minetest.set_node(grow_pos, {name = node.name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Fill a list with data for content IDs, after all nodes are registered
|
-- Fill a list with data for content IDs, after all nodes are registered
|
||||||
local cid_data = {}
|
local cid_data = {}
|
||||||
|
@ -302,7 +142,6 @@ local function entity_physics(pos, radius)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function boom(pos)
|
local function boom(pos)
|
||||||
if not pos then
|
if not pos then
|
||||||
return
|
return
|
||||||
|
@ -324,6 +163,23 @@ local function burn(pos)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local good_stone = {}
|
||||||
|
good_stone["fun_caves:stone_with_lichen"] = true
|
||||||
|
good_stone["fun_caves:stone_with_algae"] = true
|
||||||
|
local function find_ground(pos)
|
||||||
|
for y1 = 1, 16 do
|
||||||
|
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-y1, z=pos.z})
|
||||||
|
if node then
|
||||||
|
if minetest.get_item_group(node.name, "soil") ~= 0 or
|
||||||
|
good_stone[node.name] then
|
||||||
|
return y1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return 1000
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Exploding fruit
|
-- Exploding fruit
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
@ -337,7 +193,7 @@ minetest.register_abm({
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos1, count = minetest.find_nodes_in_area(vector.subtract(pos, 1), vector.add(pos, 1), fun_caves.fungal_tree_leaves)
|
local pos1, count = minetest.find_nodes_in_area(vector.subtract(pos, 1), vector.add(pos, 1), fungal_tree_leaves)
|
||||||
if #pos1 < 3 then
|
if #pos1 < 3 then
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name="air"})
|
||||||
return
|
return
|
||||||
|
@ -377,4 +233,148 @@ minetest.register_node("fun_caves:fungal_tree_fruit", {
|
||||||
on_punch = boom,
|
on_punch = boom,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local fruit = minetest.get_content_id("fun_caves:fungal_tree_fruit")
|
||||||
|
|
||||||
|
function fun_caves.make_fungal_tree(data, area, ivm, height)
|
||||||
|
local leaf = minetest.get_content_id(fungal_tree_leaves[math.random(#fungal_tree_leaves)])
|
||||||
|
for y = 0, height do
|
||||||
|
local radius = 1
|
||||||
|
if y > 1 and y < height - 2 then
|
||||||
|
radius = 2
|
||||||
|
end
|
||||||
|
for z = -radius,radius do
|
||||||
|
for x = -radius,radius do
|
||||||
|
local sr = math.random(1,100)
|
||||||
|
local i = ivm + z*area.zstride + y*area.ystride + x
|
||||||
|
if x == 0 and y == 0 and z == 0 then
|
||||||
|
data[i] = leaf
|
||||||
|
elseif sr == 1 then
|
||||||
|
data[i] = fruit
|
||||||
|
elseif sr < 50 then
|
||||||
|
data[i] = leaf
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- multicolored growths
|
||||||
|
local count = 0
|
||||||
|
for color, dye in pairs(colors) do
|
||||||
|
count = count + 1
|
||||||
|
local name = "fun_caves:fungal_tree_leaves_"..count
|
||||||
|
fungal_tree_leaves[#fungal_tree_leaves+1] = name
|
||||||
|
|
||||||
|
minetest.register_node(name, {
|
||||||
|
description = "Fungal tree growths",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
waving = 1,
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {"fun_caves_fungal_tree_leaves.png"..color},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy=3, flammable=3, leaves=1, plant=1},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
--{items = {"fun_caves:"..tree.name.."_sapling"}, rarity = tree.drop_rarity },
|
||||||
|
{items = {name} }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
after_place_node = default.after_place_leaves,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fun_caves:dry_fiber",
|
||||||
|
recipe = name,
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
if dye then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = dye,
|
||||||
|
recipe = {
|
||||||
|
{name}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "dye:yellow",
|
||||||
|
recipe = {
|
||||||
|
{"flowers:mushroom_brown"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local leaves_and_air = table.copy(fungal_tree_leaves)
|
||||||
|
leaves_and_air[#leaves_and_air+1] = "air"
|
||||||
|
|
||||||
|
|
||||||
|
-- fungal spread
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = fungal_tree_leaves,
|
||||||
|
interval = 2 * fun_caves.time_factor,
|
||||||
|
chance = 10,
|
||||||
|
action = function(pos, node)
|
||||||
|
if minetest.get_node_light(pos, nil) >= default.LIGHT_MAX - 2 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if find_ground(pos) > 16 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local grow_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
local grow_node = minetest.get_node_or_nil(grow_pos)
|
||||||
|
if grow_node and grow_node.name == "air" then
|
||||||
|
minetest.set_node(grow_pos, {name = node.name})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if math.random(1,3) ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local foreign = {}
|
||||||
|
for _, i in pairs(fungal_tree_leaves) do
|
||||||
|
if i ~= node.name then
|
||||||
|
foreign[#foreign+1] = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local pos1, count = minetest.find_nodes_in_area(vector.subtract(pos, 3), vector.add(pos, 3), foreign)
|
||||||
|
if #pos1 > 0 then
|
||||||
|
minetest.set_node(pos1[math.random(1,#pos1)], {name="air"})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if math.random(1,201) == 1 then
|
||||||
|
local new = fungal_tree_leaves[math.random(1,#fungal_tree_leaves)]
|
||||||
|
local pos1, count = minetest.find_nodes_in_area({x=pos.x-8, y=pos.y-16, z=pos.z-8}, {x=pos.x+8, y=pos.y+16, z=pos.z+8}, node.name)
|
||||||
|
for _, p in pairs(pos1) do
|
||||||
|
minetest.set_node(p, {name=new})
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
grow_pos = {x = pos.x + math.random(-1,1), y = pos.y + math.random(-1,1), z = pos.z + math.random(-1,1)}
|
||||||
|
grow_node = minetest.get_node_or_nil(grow_pos)
|
||||||
|
--if math.random(1,2) == 1 then
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
--end
|
||||||
|
if not grow_node or not table.contains(leaves_and_air, grow_node.name) or find_ground(grow_pos) > 16 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.get_node_light(grow_pos, nil) <= light_max then
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
if math.random(1,27) == 1 then
|
||||||
|
minetest.set_node(grow_pos, {name = "fun_caves:fungal_tree_fruit"})
|
||||||
|
else
|
||||||
|
minetest.set_node(grow_pos, {name = node.name})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -9,7 +9,7 @@ local diggable_nodes = {"group:stone", "group:sand", "group:soil", "group:plant"
|
||||||
-- This translates yaw into vectors.
|
-- This translates yaw into vectors.
|
||||||
local cardinals = {{x=0,y=0,z=0.75}, {x=-0.75,y=0,z=0}, {x=0,y=0,z=-0.75}, {x=0.75,y=0,z=0}}
|
local cardinals = {{x=0,y=0,z=0.75}, {x=-0.75,y=0,z=0}, {x=0,y=0,z=-0.75}, {x=0.75,y=0,z=0}}
|
||||||
|
|
||||||
fun_caves.goblin_tunneling = function(self, type)
|
local goblin_tunneling = function(self, type)
|
||||||
-- Types are available for fine-tuning.
|
-- Types are available for fine-tuning.
|
||||||
if type == nil then
|
if type == nil then
|
||||||
type = "digger"
|
type = "digger"
|
||||||
|
@ -203,7 +203,7 @@ mobs:register_mob("fun_caves:goblin_digger", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
fun_caves.goblin_tunneling(self, "digger")
|
goblin_tunneling(self, "digger")
|
||||||
|
|
||||||
fun_caves.search_replace(self.object:getpos(), 5, {"default:torch"}, "air")
|
fun_caves.search_replace(self.object:getpos(), 5, {"default:torch"}, "air")
|
||||||
fun_caves.search_replace(self.object:getpos(), 10, {"default:stone", "default:desert_stone", "default:sandstone"}, "default:mossycobble")
|
fun_caves.search_replace(self.object:getpos(), 10, {"default:stone", "default:desert_stone", "default:sandstone"}, "default:mossycobble")
|
||||||
|
|
34
init.lua
34
init.lua
|
@ -1,9 +1,8 @@
|
||||||
fun_caves = {}
|
fun_caves = {}
|
||||||
fun_caves.version = "1.0"
|
fun_caves.version = "1.0"
|
||||||
fun_caves.path = minetest.get_modpath(minetest.get_current_modname())
|
|
||||||
fun_caves.world = false
|
|
||||||
fun_caves.time_factor = 10
|
fun_caves.time_factor = 10
|
||||||
fun_caves.node_match_cache = {}
|
|
||||||
|
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_mapgen_init(function(mgparams)
|
minetest.register_on_mapgen_init(function(mgparams)
|
||||||
|
@ -49,28 +48,9 @@ function fun_caves.clone_node(name)
|
||||||
return node2
|
return node2
|
||||||
end
|
end
|
||||||
|
|
||||||
function fun_caves.node(name)
|
|
||||||
if not fun_caves.node_cache then
|
|
||||||
fun_caves.node_cache = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
if not fun_caves.node_cache[name] then
|
dofile(path .. "/nodes.lua")
|
||||||
fun_caves.node_cache[name] = minetest.get_content_id(name)
|
dofile(path .. "/deco.lua")
|
||||||
if name ~= "ignore" and fun_caves.node_cache[name] == 127 then
|
dofile(path .. "/fungal_tree.lua")
|
||||||
print("*** Failure to find node: "..name)
|
dofile(path .. "/mapgen.lua")
|
||||||
end
|
dofile(path .. "/mobs.lua")
|
||||||
end
|
|
||||||
|
|
||||||
return fun_caves.node_cache[name]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
dofile(fun_caves.path .. "/nodes.lua")
|
|
||||||
dofile(fun_caves.path .. "/deco.lua")
|
|
||||||
dofile(fun_caves.path .. "/fungal_tree.lua")
|
|
||||||
dofile(fun_caves.path .. "/mapgen.lua")
|
|
||||||
dofile(fun_caves.path .. "/mobs.lua")
|
|
||||||
|
|
||||||
|
|
||||||
-- Inserting helps to ensure that fun_caves operates first.
|
|
||||||
table.insert(minetest.registered_on_generateds, 1, fun_caves.generate)
|
|
||||||
|
|
168
mapgen.lua
168
mapgen.lua
|
@ -7,7 +7,23 @@ local seed_noise = {offset = 0, scale = 32768, seed = 5202, spread = {x = 80, y
|
||||||
local biome_noise = {offset = 0.0, scale = 1.0, spread = {x = 400, y = 400, z = 400}, seed = 903, octaves = 3, persist = 0.5, lacunarity = 2.0}
|
local biome_noise = {offset = 0.0, scale = 1.0, spread = {x = 400, y = 400, z = 400}, seed = 903, octaves = 3, persist = 0.5, lacunarity = 2.0}
|
||||||
|
|
||||||
|
|
||||||
local node = fun_caves.node
|
local node_cache = {}
|
||||||
|
local function get_node(name)
|
||||||
|
if not node_cache then
|
||||||
|
node_cache = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
if not node_cache[name] then
|
||||||
|
node_cache[name] = minetest.get_content_id(name)
|
||||||
|
if name ~= "ignore" and node_cache[name] == 127 then
|
||||||
|
print("*** Failure to find node: "..name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return node_cache[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = get_node
|
||||||
local min_surface = -80
|
local min_surface = -80
|
||||||
|
|
||||||
local data = {}
|
local data = {}
|
||||||
|
@ -15,80 +31,78 @@ local data = {}
|
||||||
local vm, emin, emax, area, noise_area, csize, minp, maxp
|
local vm, emin, emax, area, noise_area, csize, minp, maxp
|
||||||
|
|
||||||
-- Create a table of biome ids, so I can use the biomemap.
|
-- Create a table of biome ids, so I can use the biomemap.
|
||||||
if not fun_caves.biome_ids then
|
local biome_ids = {}
|
||||||
fun_caves.biome_ids = {}
|
for name, desc in pairs(minetest.registered_biomes) do
|
||||||
for name, desc in pairs(minetest.registered_biomes) do
|
|
||||||
local i = minetest.get_biome_id(desc.name)
|
local i = minetest.get_biome_id(desc.name)
|
||||||
fun_caves.biome_ids[i] = desc.name
|
biome_ids[i] = desc.name
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function place_schematic(pos, schem, center)
|
--local function place_schematic(pos, schem, center)
|
||||||
local rot = math.random(4) - 1
|
-- local rot = math.random(4) - 1
|
||||||
local yslice = {}
|
-- local yslice = {}
|
||||||
if schem.yslice_prob then
|
-- if schem.yslice_prob then
|
||||||
for _, ys in pairs(schem.yslice_prob) do
|
-- for _, ys in pairs(schem.yslice_prob) do
|
||||||
yslice[ys.ypos] = ys.prob
|
-- yslice[ys.ypos] = ys.prob
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
|
-- if center then
|
||||||
|
-- pos.x = pos.x - math.floor(schem.size.x / 2)
|
||||||
|
-- pos.z = pos.z - math.floor(schem.size.z / 2)
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- for z1 = 0, schem.size.z - 1 do
|
||||||
|
-- for x1 = 0, schem.size.x - 1 do
|
||||||
|
-- local x, z
|
||||||
|
-- if rot == 0 then
|
||||||
|
-- x, z = x1, z1
|
||||||
|
-- elseif rot == 1 then
|
||||||
|
-- x, z = schem.size.z - z1 - 1, x1
|
||||||
|
-- elseif rot == 2 then
|
||||||
|
-- x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
|
||||||
|
-- elseif rot == 3 then
|
||||||
|
-- x, z = z1, schem.size.x - x1 - 1
|
||||||
|
-- end
|
||||||
|
-- local dz = pos.z - minp.z + z
|
||||||
|
-- local dx = pos.x - minp.x + x
|
||||||
|
-- if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
|
||||||
|
-- local ivm = area:index(pos.x + x, pos.y, pos.z + z)
|
||||||
|
-- local isch = z1 * schem.size.y * schem.size.x + x1 + 1
|
||||||
|
-- for y = 0, schem.size.y - 1 do
|
||||||
|
-- local dy = pos.y - minp.y + y
|
||||||
|
-- if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
|
||||||
|
-- if yslice[y] or 255 >= math.random(255) then
|
||||||
|
-- local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
||||||
|
-- if prob >= math.random(255) and schem.data[isch].name ~= "air" then
|
||||||
|
-- data[ivm] = node(schem.data[isch].name)
|
||||||
|
-- end
|
||||||
|
-- local param2 = schem.data[isch].param2 or 0
|
||||||
|
-- p2data[ivm] = param2
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- ivm = ivm + area.ystride
|
||||||
|
-- isch = isch + schem.size.x
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--end
|
||||||
|
|
||||||
if center then
|
--local function get_decoration(biome)
|
||||||
pos.x = pos.x - math.floor(schem.size.x / 2)
|
-- for i, deco in pairs(fun_caves.decorations) do
|
||||||
pos.z = pos.z - math.floor(schem.size.z / 2)
|
-- if not deco.biomes or deco.biomes[biome] then
|
||||||
end
|
-- local range = 1000
|
||||||
|
-- if deco.deco_type == "simple" then
|
||||||
for z1 = 0, schem.size.z - 1 do
|
-- if deco.fill_ratio and math.random(range) - 1 < deco.fill_ratio * 1000 then
|
||||||
for x1 = 0, schem.size.x - 1 do
|
-- return deco.decoration
|
||||||
local x, z
|
-- end
|
||||||
if rot == 0 then
|
-- else
|
||||||
x, z = x1, z1
|
-- -- nop
|
||||||
elseif rot == 1 then
|
-- end
|
||||||
x, z = schem.size.z - z1 - 1, x1
|
-- end
|
||||||
elseif rot == 2 then
|
-- end
|
||||||
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
|
--end
|
||||||
elseif rot == 3 then
|
|
||||||
x, z = z1, schem.size.x - x1 - 1
|
|
||||||
end
|
|
||||||
local dz = pos.z - minp.z + z
|
|
||||||
local dx = pos.x - minp.x + x
|
|
||||||
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
|
|
||||||
local ivm = area:index(pos.x + x, pos.y, pos.z + z)
|
|
||||||
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
|
|
||||||
for y = 0, schem.size.y - 1 do
|
|
||||||
local dy = pos.y - minp.y + y
|
|
||||||
if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
|
|
||||||
if yslice[y] or 255 >= math.random(255) then
|
|
||||||
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
|
||||||
if prob >= math.random(255) and schem.data[isch].name ~= "air" then
|
|
||||||
data[ivm] = node(schem.data[isch].name)
|
|
||||||
end
|
|
||||||
local param2 = schem.data[isch].param2 or 0
|
|
||||||
p2data[ivm] = param2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ivm = ivm + area.ystride
|
|
||||||
isch = isch + schem.size.x
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_decoration(biome)
|
|
||||||
for i, deco in pairs(fun_caves.decorations) do
|
|
||||||
if not deco.biomes or deco.biomes[biome] then
|
|
||||||
local range = 1000
|
|
||||||
if deco.deco_type == "simple" then
|
|
||||||
if deco.fill_ratio and math.random(range) - 1 < deco.fill_ratio * 1000 then
|
|
||||||
return deco.decoration
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- nop
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local function detect_bull(heightmap, csize)
|
local function detect_bull(heightmap, csize)
|
||||||
|
@ -115,7 +129,7 @@ local function detect_bull(heightmap, csize)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function fun_caves.generate(p_minp, p_maxp, seed)
|
local function generate(p_minp, p_maxp, seed)
|
||||||
minp, maxp = p_minp, p_maxp
|
minp, maxp = p_minp, p_maxp
|
||||||
vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
vm:get_data(data)
|
vm:get_data(data)
|
||||||
|
@ -184,21 +198,21 @@ function fun_caves.generate(p_minp, p_maxp, seed)
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
local pn = minetest.get_perlin(plant_noise):get2d({x=x, y=z})
|
local pn = minetest.get_perlin(plant_noise):get2d({x=x, y=z})
|
||||||
local biome = fun_caves.biome_ids[biomemap[index]]
|
local biome = biome_ids[biomemap[index]]
|
||||||
index3d = noise_area:index(x - minp.x, 0, z - minp.z)
|
index3d = noise_area:index(x - minp.x, 0, z - minp.z)
|
||||||
local ivm = area:index(x, minp.y, z)
|
local ivm = area:index(x, minp.y, z)
|
||||||
write = true
|
write = true
|
||||||
|
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
if bullshit_heightmap or y <= heightmap[index] - 20 then
|
if bullshit_heightmap or y <= heightmap[index] - 20 then
|
||||||
data[ivm] = fun_caves.decorate_cave(data, area, minp, y, ivm, biome_n[index3d]) or data[ivm]
|
data[ivm] = fun_caves.decorate_cave(node, data, area, minp, y, ivm, biome_n[index3d]) or data[ivm]
|
||||||
elseif y < heightmap[index] and not bullshit_heightmap then
|
elseif y < heightmap[index] and not bullshit_heightmap then
|
||||||
--if data[ivm] == node("air") and data[ivm - area.ystride] ~= node('air') then
|
--if data[ivm] == node("air") and data[ivm - area.ystride] ~= node('air') then
|
||||||
if data[ivm] == node("air") and (data[ivm - area.ystride] == node('default:stone') or data[ivm - area.ystride] == node('default:sandstone')) then
|
if data[ivm] == node("air") and (data[ivm - area.ystride] == node('default:stone') or data[ivm - area.ystride] == node('default:sandstone')) then
|
||||||
data[ivm - area.ystride] = node("dirt")
|
data[ivm - area.ystride] = node("dirt")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
data[ivm] = fun_caves.decorate_water(data, area, minp, maxp, {x=x,y=y,z=z}, ivm, biome, pn) or data[ivm]
|
data[ivm] = fun_caves.decorate_water(node, data, area, minp, maxp, {x=x,y=y,z=z}, ivm, biome, pn) or data[ivm]
|
||||||
end
|
end
|
||||||
|
|
||||||
ivm = ivm + area.ystride
|
ivm = ivm + area.ystride
|
||||||
|
@ -222,3 +236,7 @@ function fun_caves.generate(p_minp, p_maxp, seed)
|
||||||
|
|
||||||
vm, area, noise_area = nil, nil, nil
|
vm, area, noise_area = nil, nil, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Inserting helps to ensure that fun_caves operates first.
|
||||||
|
table.insert(minetest.registered_on_generateds, 1, generate)
|
||||||
|
|
31
mobs.lua
31
mobs.lua
|
@ -48,12 +48,13 @@ fun_caves.surface_damage = function(self, cold_natured)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
dofile(fun_caves.path .. "/danglers.lua")
|
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
dofile(fun_caves.path .. "/spider.lua")
|
dofile(path .. "/danglers.lua")
|
||||||
dofile(fun_caves.path .. "/tarantula.lua")
|
dofile(path .. "/spider.lua")
|
||||||
dofile(fun_caves.path .. "/spider_ice.lua")
|
dofile(path .. "/tarantula.lua")
|
||||||
--dofile(fun_caves.path .. "/dirt_monster.lua")
|
dofile(path .. "/spider_ice.lua")
|
||||||
dofile(fun_caves.path .. "/sand_monster.lua")
|
--dofile(path .. "/dirt_monster.lua")
|
||||||
|
dofile(path .. "/sand_monster.lua")
|
||||||
|
|
||||||
if minetest.registered_entities["mobs_monster:dirt_monster"] then
|
if minetest.registered_entities["mobs_monster:dirt_monster"] then
|
||||||
-- check this
|
-- check this
|
||||||
|
@ -90,12 +91,12 @@ fun_caves.goblin_spawn_frequency = 150
|
||||||
fun_caves.goblin_drops = { "default:pick_steel", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water", "default:pick_stone", "default:sword_stone" }
|
fun_caves.goblin_drops = { "default:pick_steel", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water", "default:pick_stone", "default:sword_stone" }
|
||||||
--{"group:stone"} = { "default:stone", "default:mossycobble", "default:sandstone", "default:desert_stone", "default:stone_with_coal", "default:stone_with_iron", "default:stone_with_copper", "default:stone_with_gold", "default:stone_with_diamond" }
|
--{"group:stone"} = { "default:stone", "default:mossycobble", "default:sandstone", "default:desert_stone", "default:stone_with_coal", "default:stone_with_iron", "default:stone_with_copper", "default:stone_with_gold", "default:stone_with_diamond" }
|
||||||
|
|
||||||
dofile(fun_caves.path.."/goblin_cobbler.lua")
|
dofile(path.."/goblin_cobbler.lua")
|
||||||
dofile(fun_caves.path.."/goblin_digger.lua")
|
dofile(path.."/goblin_digger.lua")
|
||||||
dofile(fun_caves.path.."/goblin_coal.lua")
|
dofile(path.."/goblin_coal.lua")
|
||||||
dofile(fun_caves.path.."/goblin_ice.lua")
|
dofile(path.."/goblin_ice.lua")
|
||||||
dofile(fun_caves.path.."/goblin_copper.lua")
|
dofile(path.."/goblin_copper.lua")
|
||||||
dofile(fun_caves.path.."/goblin_iron.lua")
|
dofile(path.."/goblin_iron.lua")
|
||||||
dofile(fun_caves.path.."/goblin_gold.lua")
|
dofile(path.."/goblin_gold.lua")
|
||||||
dofile(fun_caves.path.."/goblin_diamond.lua")
|
dofile(path.."/goblin_diamond.lua")
|
||||||
dofile(fun_caves.path.."/goblin_king.lua")
|
dofile(path.."/goblin_king.lua")
|
||||||
|
|
12
nodes.lua
12
nodes.lua
|
@ -1,4 +1,4 @@
|
||||||
local light_max = 13
|
local light_max = 8
|
||||||
|
|
||||||
minetest.add_group("default:ice", {surface_cold = 3})
|
minetest.add_group("default:ice", {surface_cold = 3})
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ minetest.register_node("fun_caves:huge_mushroom_cap", {
|
||||||
{-0.33, -0.5, -0.33, 0.33, -0.33, -0.5},
|
{-0.33, -0.5, -0.33, 0.33, -0.33, -0.5},
|
||||||
{-0.33, -0.33, -0.33, 0.33, -0.17, 0.33},
|
{-0.33, -0.33, -0.33, 0.33, -0.17, 0.33},
|
||||||
} },
|
} },
|
||||||
light_source = 11,
|
light_source = light_max,
|
||||||
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
|
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ minetest.register_node("fun_caves:giant_mushroom_cap", {
|
||||||
{-0.4, -0.5, -0.75, 0.4, -0.25, -0.4},
|
{-0.4, -0.5, -0.75, 0.4, -0.25, -0.4},
|
||||||
{-0.4, -0.5, 0.4, 0.4, -0.25, 0.75},
|
{-0.4, -0.5, 0.4, 0.4, -0.25, 0.75},
|
||||||
} },
|
} },
|
||||||
light_source = 14,
|
light_source = light_max,
|
||||||
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
|
groups = {fleshy=1, dig_immediate=3, flammable=2, plant=1, leafdecay=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ minetest.register_node("fun_caves:glowing_fungal_stone", {
|
||||||
description = "Glowing Fungal Stone",
|
description = "Glowing Fungal Stone",
|
||||||
tiles = {"default_stone.png^vmg_glowing_fungal.png",},
|
tiles = {"default_stone.png^vmg_glowing_fungal.png",},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
light_source = 6,
|
light_source = light_max - 4,
|
||||||
groups = {cracky=3, stone=1},
|
groups = {cracky=3, stone=1},
|
||||||
drop = {items={ {items={"default:cobble"},}, {items={"fun_caves:glowing_fungus",},},},},
|
drop = {items={ {items={"default:cobble"},}, {items={"fun_caves:glowing_fungus",},},},},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
@ -467,7 +467,7 @@ minetest.register_abm({
|
||||||
interval = 500 * fun_caves.time_factor,
|
interval = 500 * fun_caves.time_factor,
|
||||||
chance = 30,
|
chance = 30,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
if minetest.get_node_light(pos, nil) >= 14 then
|
if minetest.get_node_light(pos, nil) >= default.LIGHT_MAX - 2 then
|
||||||
minetest.set_node(pos, {name = "air"})
|
minetest.set_node(pos, {name = "air"})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -551,7 +551,7 @@ minetest.register_abm({
|
||||||
interval = 15 * fun_caves.time_factor,
|
interval = 15 * fun_caves.time_factor,
|
||||||
chance = 10,
|
chance = 10,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
if minetest.get_node_light(pos, nil) == 15 then
|
if minetest.get_node_light(pos, nil) >= default.LIGHT_MAX - 2 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue