429 lines
12 KiB
Lua
429 lines
12 KiB
Lua
local get_node_or_nil = minetest.get_node_or_nil
|
|
local get_item_group = minetest.get_item_group
|
|
local max_depth = 31000
|
|
|
|
local old_is_protected = minetest.is_protected
|
|
function minetest.is_protected(pos, name)
|
|
local node = get_node_or_nil(pos)
|
|
if node and get_item_group(node.name, "fortress") ~= 0 then
|
|
return true
|
|
end
|
|
if node and node.name == 'fun_caves:translocator' and (name == '' or not minetest.get_player_by_name(name)) then
|
|
return true
|
|
end
|
|
return old_is_protected(pos, name)
|
|
end
|
|
|
|
-- dirt, cave
|
|
local newnode = fun_caves.clone_node("default:dirt")
|
|
newnode.drop = "default:dirt"
|
|
newnode.groups.soil = 0
|
|
minetest.register_node("fun_caves:dirt", newnode)
|
|
|
|
newnode = fun_caves.clone_node("default:dirt")
|
|
newnode.description = "Polluted Dirt"
|
|
newnode.tiles = {"default_dirt.png^[colorize:#100020:100"}
|
|
newnode.groups.soil = 0
|
|
minetest.register_node("fun_caves:polluted_dirt", newnode)
|
|
|
|
-- ice -- add cold damage
|
|
minetest.add_group("default:ice", {surface_cold = 3})
|
|
|
|
-- ice, thin -- transparent
|
|
minetest.register_node("fun_caves:thin_ice", {
|
|
description = "Thin Ice",
|
|
tiles = {"caverealms_thin_ice.png"},
|
|
is_ground_content = true,
|
|
groups = {cracky=3},
|
|
sounds = default.node_sound_glass_defaults(),
|
|
use_texture_alpha = true,
|
|
light_source = 1,
|
|
drawtype = "glasslike",
|
|
sunlight_propagates = true,
|
|
freezemelt = "default:water_source",
|
|
paramtype = "light",
|
|
})
|
|
|
|
minetest.register_node('fun_caves:sticks_default', {
|
|
description = 'Sticks',
|
|
drawtype = 'allfaces_optional',
|
|
waving = 1,
|
|
visual_scale = 1.3,
|
|
tiles = {'fun_caves_dry_twigs.png'},
|
|
paramtype = 'light',
|
|
is_ground_content = false,
|
|
drop = 'default:stick 2',
|
|
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
|
})
|
|
|
|
newnode = fun_caves.clone_node("default:leaves")
|
|
newnode.description = "Blackened Leaves"
|
|
newnode.tiles = {"default_leaves.png^[colorize:#100020:200"}
|
|
newnode.special_tiles = {"default_leaves_simple.png^[colorize:#100020:200"}
|
|
newnode.groups = {snappy = 3, flammable = 2}
|
|
minetest.register_node("fun_caves:leaves_black", newnode)
|
|
|
|
newnode = fun_caves.clone_node("default:water_source")
|
|
newnode.description = "Poisonous Water"
|
|
newnode.groups.poison = 3
|
|
newnode.light_source = 6
|
|
newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing"
|
|
newnode.liquid_alternative_source = "fun_caves:water_poison_source"
|
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
|
newnode.special_tiles[1].name = "fun_caves_water_poison_source_animated.png"
|
|
newnode.tiles[1].name = "fun_caves_water_poison_source_animated.png"
|
|
minetest.register_node("fun_caves:water_poison_source", newnode)
|
|
|
|
newnode = fun_caves.clone_node("default:water_flowing")
|
|
newnode.description = "Poisonous Water"
|
|
newnode.groups.poison = 3
|
|
newnode.light_source = 6
|
|
newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing"
|
|
newnode.liquid_alternative_source = "fun_caves:water_poison_source"
|
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
|
newnode.special_tiles[1].name = "fun_caves_water_poison_flowing_animated.png"
|
|
newnode.tiles[1] = "fun_caves_water_poison.png"
|
|
minetest.register_node("fun_caves:water_poison_flowing", newnode)
|
|
|
|
--minetest.register_node("fun_caves:bright_air", {
|
|
-- drawtype = "glasslike",
|
|
-- tiles = {"technic_light.png"},
|
|
-- paramtype = "light",
|
|
-- groups = {not_in_creative_inventory=1},
|
|
-- drop = "",
|
|
-- walkable = false,
|
|
-- buildable_to = true,
|
|
-- sunlight_propagates = true,
|
|
-- light_source = LIGHT_MAX,
|
|
-- pointable = false,
|
|
--})
|
|
|
|
local newnode = fun_caves.clone_node("default:dirt")
|
|
newnode.description = "Meteor Crater"
|
|
newnode.tiles = {"fun_caves_crater.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"}
|
|
newnode.drop = "fun_caves:meteorite"
|
|
newnode.groups.soil = 0
|
|
minetest.register_node("fun_caves:meteorite_crater", newnode)
|
|
|
|
|
|
newnode = fun_caves.clone_node("default:stone")
|
|
newnode.tiles = {'dna.png'}
|
|
minetest.register_node("fun_caves:dna", newnode)
|
|
|
|
newnode = fun_caves.clone_node("farming:straw")
|
|
newnode.description = 'Bundle of Grass'
|
|
newnode.tiles = {'farming_straw.png^[colorize:#00FF00:50'}
|
|
minetest.register_node("fun_caves:bundle_of_grass", newnode)
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:bundle_of_grass',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'default:junglegrass', 'default:junglegrass',
|
|
'default:junglegrass', 'default:junglegrass',
|
|
}
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "cooking",
|
|
output = "fun_caves:dry_fiber",
|
|
recipe = 'fun_caves:bundle_of_grass',
|
|
cooktime = 3,
|
|
})
|
|
|
|
local function rope_remove(pos)
|
|
for i = 1, 100 do
|
|
local newpos = table.copy(pos)
|
|
newpos.y = newpos.y - i
|
|
local node = minetest.get_node_or_nil(newpos)
|
|
if node and node.name and node.name == 'fun_caves:rope_ladder_piece' then
|
|
minetest.set_node(newpos, {name='air'})
|
|
else
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
local good_params = {nil, true, true, true, true}
|
|
for length = 10, 50, 10 do
|
|
minetest.register_node("fun_caves:rope_ladder_"..length, {
|
|
description = "Rope Ladder ("..length.." meter)",
|
|
drawtype = "signlike",
|
|
tiles = {"fun_caves_rope_ladder.png"},
|
|
inventory_image = "fun_caves_rope_ladder.png",
|
|
wield_image = "fun_caves_rope_ladder.png",
|
|
paramtype = "light",
|
|
paramtype2 = "wallmounted",
|
|
sunlight_propagates = true,
|
|
walkable = false,
|
|
climbable = true,
|
|
is_ground_content = false,
|
|
selection_box = {
|
|
type = "wallmounted",
|
|
},
|
|
groups = {snappy = 2, oddly_breakable_by_hand = 3, flammable = 2},
|
|
legacy_wallmounted = true,
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
if pointed_thing and pointed_thing.above then
|
|
local pos = pointed_thing.above
|
|
local orig = minetest.get_node_or_nil(pos)
|
|
if orig and orig.name and orig.param2 and good_params[orig.param2] then
|
|
for i = 1, length do
|
|
local newpos = table.copy(pos)
|
|
newpos.y = newpos.y - i
|
|
local node = minetest.get_node_or_nil(newpos)
|
|
if node and node.name and node.name == 'air' then
|
|
minetest.set_node(newpos, {name='fun_caves:rope_ladder_piece', param2=orig.param2})
|
|
else
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end,
|
|
on_destruct = rope_remove,
|
|
})
|
|
|
|
if length > 10 then
|
|
rec = {}
|
|
for i = 10, length, 10 do
|
|
rec[#rec+1] = 'fun_caves:rope_ladder_10'
|
|
end
|
|
minetest.register_craft({
|
|
output = 'fun_caves:rope_ladder_'..length,
|
|
type = 'shapeless',
|
|
recipe = rec,
|
|
})
|
|
end
|
|
end
|
|
|
|
minetest.register_node("fun_caves:rope_ladder_piece", {
|
|
description = "Rope Ladder",
|
|
drawtype = "signlike",
|
|
tiles = {"fun_caves_rope_ladder.png"},
|
|
inventory_image = "fun_caves_rope_ladder.png",
|
|
wield_image = "fun_caves_rope_ladder.png",
|
|
drop = {},
|
|
paramtype = "light",
|
|
paramtype2 = "wallmounted",
|
|
buildable_to = true,
|
|
sunlight_propagates = true,
|
|
walkable = false,
|
|
climbable = true,
|
|
is_ground_content = false,
|
|
selection_box = {
|
|
type = "wallmounted",
|
|
},
|
|
groups = {snappy = 2, oddly_breakable_by_hand = 3, flammable = 2},
|
|
legacy_wallmounted = true,
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
on_destruct = rope_remove,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:rope_ladder_10',
|
|
recipe = {
|
|
{'fun_caves:dry_fiber', '', 'fun_caves:dry_fiber'},
|
|
{'fun_caves:dry_fiber', 'fun_caves:dry_fiber', 'fun_caves:dry_fiber'},
|
|
{'fun_caves:dry_fiber', '', 'fun_caves:dry_fiber'},
|
|
}
|
|
})
|
|
|
|
minetest.register_craftitem("fun_caves:apple_pie_slice", {
|
|
description = "Apple Pie Slice",
|
|
inventory_image = "fun_caves_apple_pie_slice.png",
|
|
on_use = minetest.item_eat(5),
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:apple_pie_slice 6',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'fun_caves:apple_pie',
|
|
}
|
|
})
|
|
|
|
minetest.register_node("fun_caves:apple_pie", {
|
|
description = "Apple Pie",
|
|
drawtype = "raillike",
|
|
tiles = {"fun_caves_apple_pie.png"},
|
|
inventory_image = "fun_caves_apple_pie.png",
|
|
paramtype = "light",
|
|
walkable = false,
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-0.4, -0.5, -0.4, 0.5, -0.4, 0.4}
|
|
},
|
|
groups = {dig_immediate = 3, attached_node = 1},
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
})
|
|
|
|
minetest.register_craftitem("fun_caves:apple_pie_uncooked", {
|
|
description = "Uncooked Apple Pie",
|
|
inventory_image = "fun_caves_apple_pie_uncooked.png",
|
|
})
|
|
|
|
if mobs and mobs.mod == "redo" then
|
|
minetest.register_craft({
|
|
output = 'fun_caves:apple_pie_uncooked',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'default:apple',
|
|
'default:apple',
|
|
'farming:flour',
|
|
'mobs:honey',
|
|
},
|
|
})
|
|
|
|
minetest.register_craftitem("fun_caves:meat_pie_uncooked", {
|
|
description = "Uncooked Meat Pie",
|
|
inventory_image = "fun_caves_meat_pie_uncooked.png",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:meat_pie_uncooked',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'mobs:meat_raw',
|
|
'mobs:meat_raw',
|
|
'fun_caves:onion',
|
|
'farming:flour',
|
|
},
|
|
})
|
|
|
|
minetest.register_node("fun_caves:meat_pie", {
|
|
description = "Meat Pie",
|
|
drawtype = "raillike",
|
|
tiles = {"fun_caves_meat_pie.png"},
|
|
inventory_image = "fun_caves_meat_pie.png",
|
|
paramtype = "light",
|
|
walkable = false,
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-0.4, -0.5, -0.4, 0.5, -0.4, 0.4}
|
|
},
|
|
groups = {dig_immediate = 3, attached_node = 1},
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "cooking",
|
|
cooktime = 15,
|
|
output = "fun_caves:meat_pie",
|
|
recipe = "fun_caves:meat_pie_uncooked"
|
|
})
|
|
|
|
minetest.register_craftitem("fun_caves:meat_pie_slice", {
|
|
description = "Meat Pie Slice",
|
|
inventory_image = "fun_caves_meat_pie_slice.png",
|
|
on_use = minetest.item_eat(9),
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:meat_pie_slice 5',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'fun_caves:meat_pie',
|
|
}
|
|
})
|
|
end
|
|
|
|
farming.register_plant("fun_caves:onion", {
|
|
description = "Onion",
|
|
inventory_image = "fun_caves_onion.png",
|
|
steps = 3,
|
|
minlight = 13,
|
|
maxlight = default.LIGHT_MAX,
|
|
fertility = {"grassland"}
|
|
})
|
|
|
|
minetest.registered_items['fun_caves:seed_onion'] = nil
|
|
minetest.registered_nodes['fun_caves:seed_onion'] = nil
|
|
minetest.registered_craftitems['fun_caves:seed_onion'] = nil
|
|
minetest.register_alias('fun_caves:seed_onion', 'fun_caves:onion')
|
|
for i = 1, 3 do
|
|
local onion = minetest.registered_items['fun_caves:onion_'..i]
|
|
if onion then
|
|
onion.drop = {
|
|
max_items = i,
|
|
items = {
|
|
{ items = {'fun_caves:onion'}, rarity = 4 - i, },
|
|
{ items = {'fun_caves:onion'}, rarity = (4 - i) * 3, },
|
|
{ items = {'fun_caves:onion'}, rarity = (4 - i) * 6, },
|
|
},
|
|
}
|
|
end
|
|
end
|
|
|
|
minetest.register_node("fun_caves:onion", {
|
|
description = "Onion",
|
|
drawtype = "plantlike",
|
|
visual_scale = 0.75,
|
|
tiles = {"fun_caves_onion.png"},
|
|
inventory_image = "fun_caves_onion.png",
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
walkable = false,
|
|
is_ground_content = false,
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
|
},
|
|
fertility = {'grassland'},
|
|
groups = {seed = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
|
|
on_use = minetest.item_eat(2),
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
next_plant = 'fun_caves:onion_1',
|
|
on_timer = farming.grow_plant,
|
|
minlight = 10,
|
|
maxlight = 15,
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
local stack = farming.place_seed(itemstack, placer, pointed_thing, 'fun_caves:onion')
|
|
if stack then
|
|
return stack
|
|
end
|
|
|
|
return minetest.item_place(itemstack, placer, pointed_thing)
|
|
end,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = 'fun_caves:apple_pie_uncooked',
|
|
type = 'shapeless',
|
|
recipe = {
|
|
'default:apple',
|
|
'default:apple',
|
|
'farming:flour',
|
|
'fun_caves:syrup',
|
|
'fun_caves:syrup',
|
|
'fun_caves:syrup',
|
|
},
|
|
replacements = {
|
|
{'fun_caves:syrup', 'vessels:glass_bottle'},
|
|
{'fun_caves:syrup', 'vessels:glass_bottle'},
|
|
{'fun_caves:syrup', 'vessels:glass_bottle'},
|
|
},
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "cooking",
|
|
cooktime = 15,
|
|
output = "fun_caves:apple_pie",
|
|
recipe = "fun_caves:apple_pie_uncooked"
|
|
})
|
|
|
|
|
|
for i = 3, 5 do
|
|
minetest.override_item("default:grass_" .. i, {
|
|
drop = {
|
|
max_items = 2,
|
|
items = {
|
|
{ items = { "default:grass_1"}, },
|
|
{ items = {'farming:seed_wheat'},rarity = 5 },
|
|
{ items = {"fun_caves:onion",}, rarity = 5 },
|
|
},
|
|
},
|
|
})
|
|
end
|