Remove most of mcl_core
|
@ -63,4 +63,3 @@ local function register_drop(liquid, glow, sound, nodes)
|
|||
end
|
||||
|
||||
register_drop("water", 1, "", {"group:opaque", "group:leaves"})
|
||||
register_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"})
|
|
@ -1,560 +0,0 @@
|
|||
-- mods/default/crafting.lua
|
||||
|
||||
--
|
||||
-- Crafting definition
|
||||
--
|
||||
|
||||
local function craft_planks(output, input)
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:"..output.."wood 4",
|
||||
recipe = {
|
||||
{"mcl_core:"..input},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local planks = {
|
||||
{"", "oak"},
|
||||
{"dark", "dark_oak"},
|
||||
{"jungle", "jungle"},
|
||||
{"acacia", "acacia"},
|
||||
{"spruce", "spruce"},
|
||||
{"birch", "birch"}
|
||||
}
|
||||
|
||||
for _, p in pairs(planks) do
|
||||
craft_planks(p[1], p[1].."tree")
|
||||
craft_planks(p[1], p[1].."tree_bark")
|
||||
craft_planks(p[1], "stripped_"..p[2])
|
||||
craft_planks(p[1], "stripped_"..p[2].."_bark")
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_core:mossycobble",
|
||||
recipe = { "mcl_core:cobble", "mcl_core:vine" },
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_core:stonebrickmossy",
|
||||
recipe = { "mcl_core:stonebrick", "mcl_core:vine" },
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:coarse_dirt 4",
|
||||
recipe = {
|
||||
{"mcl_core:dirt", "mcl_core:gravel"},
|
||||
{"mcl_core:gravel", "mcl_core:dirt"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:coarse_dirt 4",
|
||||
recipe = {
|
||||
{"mcl_core:gravel", "mcl_core:dirt"},
|
||||
{"mcl_core:dirt", "mcl_core:gravel"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:sandstonesmooth 4",
|
||||
recipe = {
|
||||
{"mcl_core:sandstone","mcl_core:sandstone"},
|
||||
{"mcl_core:sandstone","mcl_core:sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:redsandstonesmooth 4",
|
||||
recipe = {
|
||||
{"mcl_core:redsandstone","mcl_core:redsandstone"},
|
||||
{"mcl_core:redsandstone","mcl_core:redsandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:granite_smooth 4",
|
||||
recipe = {
|
||||
{"mcl_core:granite", "mcl_core:granite"},
|
||||
{"mcl_core:granite", "mcl_core:granite"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:andesite_smooth 4",
|
||||
recipe = {
|
||||
{"mcl_core:andesite", "mcl_core:andesite"},
|
||||
{"mcl_core:andesite", "mcl_core:andesite"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:diorite_smooth 4",
|
||||
recipe = {
|
||||
{"mcl_core:diorite", "mcl_core:diorite"},
|
||||
{"mcl_core:diorite", "mcl_core:diorite"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_core:granite",
|
||||
recipe = {"mcl_core:diorite", "mcl_nether:quartz"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_core:andesite 2",
|
||||
recipe = {"mcl_core:diorite", "mcl_core:cobble"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:diorite 2",
|
||||
recipe = {
|
||||
{"mcl_core:cobble", "mcl_nether:quartz"},
|
||||
{"mcl_nether:quartz", "mcl_core:cobble"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:diorite 2",
|
||||
recipe = {
|
||||
{"mcl_nether:quartz", "mcl_core:cobble"},
|
||||
{"mcl_core:cobble", "mcl_nether:quartz"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:bone_block",
|
||||
recipe = {
|
||||
{ "mcl_dye:white", "mcl_dye:white", "mcl_dye:white" },
|
||||
{ "mcl_dye:white", "mcl_dye:white", "mcl_dye:white" },
|
||||
{ "mcl_dye:white", "mcl_dye:white", "mcl_dye:white" },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_dye:white 9",
|
||||
recipe = {
|
||||
{ "mcl_core:bone_block" },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:stick 4",
|
||||
recipe = {
|
||||
{"group:wood"},
|
||||
{"group:wood"},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:coalblock",
|
||||
recipe = {
|
||||
{"mcl_core:coal_lump", "mcl_core:coal_lump", "mcl_core:coal_lump"},
|
||||
{"mcl_core:coal_lump", "mcl_core:coal_lump", "mcl_core:coal_lump"},
|
||||
{"mcl_core:coal_lump", "mcl_core:coal_lump", "mcl_core:coal_lump"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:coal_lump 9",
|
||||
recipe = {
|
||||
{"mcl_core:coalblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:ironblock",
|
||||
recipe = {
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:iron_ingot 9",
|
||||
recipe = {
|
||||
{"mcl_core:ironblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:goldblock",
|
||||
recipe = {
|
||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:gold_ingot 9",
|
||||
recipe = {
|
||||
{"mcl_core:goldblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:gold_nugget 9",
|
||||
recipe = {{"mcl_core:gold_ingot"}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:iron_nugget 9",
|
||||
recipe = {{"mcl_core:iron_ingot"}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:gold_ingot",
|
||||
recipe = {
|
||||
{"mcl_core:gold_nugget", "mcl_core:gold_nugget", "mcl_core:gold_nugget"},
|
||||
{"mcl_core:gold_nugget", "mcl_core:gold_nugget", "mcl_core:gold_nugget"},
|
||||
{"mcl_core:gold_nugget", "mcl_core:gold_nugget", "mcl_core:gold_nugget"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:iron_ingot",
|
||||
recipe = {
|
||||
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
|
||||
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
|
||||
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:iron_nugget",
|
||||
recipe = "mcl_mobitems:iron_horse_armor",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:gold_nugget",
|
||||
recipe = "mcl_mobitems:gold_horse_armor",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:sandstone",
|
||||
recipe = {
|
||||
{"mcl_core:sand", "mcl_core:sand"},
|
||||
{"mcl_core:sand", "mcl_core:sand"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:redsandstone",
|
||||
recipe = {
|
||||
{"mcl_core:redsand", "mcl_core:redsand"},
|
||||
{"mcl_core:redsand", "mcl_core:redsand"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:clay",
|
||||
recipe = {
|
||||
{"mcl_core:clay_lump", "mcl_core:clay_lump"},
|
||||
{"mcl_core:clay_lump", "mcl_core:clay_lump"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:brick_block",
|
||||
recipe = {
|
||||
{"mcl_core:brick", "mcl_core:brick"},
|
||||
{"mcl_core:brick", "mcl_core:brick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:paper 3",
|
||||
recipe = {
|
||||
{"mcl_core:reeds", "mcl_core:reeds", "mcl_core:reeds"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:ladder 3",
|
||||
recipe = {
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "mcl_core:stick", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:stonebrick 4",
|
||||
recipe = {
|
||||
{"mcl_core:stone", "mcl_core:stone"},
|
||||
{"mcl_core:stone", "mcl_core:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:lapisblock",
|
||||
recipe = {
|
||||
{"mcl_dye:blue", "mcl_dye:blue", "mcl_dye:blue"},
|
||||
{"mcl_dye:blue", "mcl_dye:blue", "mcl_dye:blue"},
|
||||
{"mcl_dye:blue", "mcl_dye:blue", "mcl_dye:blue"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_dye:blue 9",
|
||||
recipe = {
|
||||
{"mcl_core:lapisblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:emeraldblock",
|
||||
recipe = {
|
||||
{"mcl_core:emerald", "mcl_core:emerald", "mcl_core:emerald"},
|
||||
{"mcl_core:emerald", "mcl_core:emerald", "mcl_core:emerald"},
|
||||
{"mcl_core:emerald", "mcl_core:emerald", "mcl_core:emerald"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:emerald 9",
|
||||
recipe = {
|
||||
{"mcl_core:emeraldblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:diamondblock",
|
||||
recipe = {
|
||||
{"mcl_core:diamond", "mcl_core:diamond", "mcl_core:diamond"},
|
||||
{"mcl_core:diamond", "mcl_core:diamond", "mcl_core:diamond"},
|
||||
{"mcl_core:diamond", "mcl_core:diamond", "mcl_core:diamond"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:diamond 9",
|
||||
recipe = {
|
||||
{"mcl_core:diamondblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:apple_gold",
|
||||
recipe = {
|
||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||
{"mcl_core:gold_ingot", "mcl_core:apple", "mcl_core:gold_ingot"},
|
||||
{"mcl_core:gold_ingot", "mcl_core:gold_ingot", "mcl_core:gold_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:sugar",
|
||||
recipe = {
|
||||
{"mcl_core:reeds"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:bowl 4",
|
||||
recipe = {
|
||||
{"group:wood", "", "group:wood"},
|
||||
{"", "group:wood", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:snowblock",
|
||||
recipe = {
|
||||
{"mcl_throwing:snowball", "mcl_throwing:snowball"},
|
||||
{"mcl_throwing:snowball", "mcl_throwing:snowball"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:snow 6",
|
||||
recipe = {
|
||||
{"mcl_core:snowblock", "mcl_core:snowblock", "mcl_core:snowblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mcl_core:packed_ice 1',
|
||||
recipe = {
|
||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||
}
|
||||
})
|
||||
|
||||
--
|
||||
-- Crafting (tool repair)
|
||||
--
|
||||
minetest.register_craft({
|
||||
type = "toolrepair",
|
||||
additional_wear = -mcl_core.repair,
|
||||
})
|
||||
|
||||
--
|
||||
-- Cooking recipes
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:glass",
|
||||
recipe = "group:sand",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:stone",
|
||||
recipe = "mcl_core:cobble",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:stone_smooth",
|
||||
recipe = "mcl_core:stone",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:stonebrickcracked",
|
||||
recipe = "mcl_core:stonebrick",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:iron_ingot",
|
||||
recipe = "mcl_core:stone_with_iron",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:gold_ingot",
|
||||
recipe = "mcl_core:stone_with_gold",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:brick",
|
||||
recipe = "mcl_core:clay_lump",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:charcoal_lump",
|
||||
recipe = "group:tree",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:coal_lump",
|
||||
recipe = "mcl_core:stone_with_coal",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:diamond",
|
||||
recipe = "mcl_core:stone_with_diamond",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_core:emerald",
|
||||
recipe = "mcl_core:stone_with_emerald",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_dye:blue",
|
||||
recipe = "mcl_core:stone_with_lapis",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
--
|
||||
-- Fuels
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:coalblock",
|
||||
burntime = 800,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:coal_lump",
|
||||
burntime = 80,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:charcoal_lump",
|
||||
burntime = 80,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:tree",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:bark",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:ladder",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:wood",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:sapling",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:sapling",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:bowl",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_core:stick",
|
||||
burntime = 5,
|
||||
})
|
|
@ -1,194 +0,0 @@
|
|||
-- mods/default/craftitems.lua
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
--
|
||||
-- Crafting items
|
||||
--
|
||||
|
||||
minetest.register_craftitem("mcl_core:stick", {
|
||||
description = S("Stick"),
|
||||
_doc_items_longdesc = S("Sticks are a very versatile crafting material; used in countless crafting recipes."),
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = "default_stick.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1, stick=1 },
|
||||
_mcl_toollike_wield = true,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:paper", {
|
||||
description = S("Paper"),
|
||||
_doc_items_longdesc = S("Paper is used to craft books and maps."),
|
||||
inventory_image = "default_paper.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:coal_lump", {
|
||||
description = S("Coal"),
|
||||
_doc_items_longdesc = S("“Coal” refers to coal lumps obtained by digging coal ore which can be found underground. Coal is your standard furnace fuel, but it can also be used to make torches, coal blocks and a few other things."),
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = "default_coal_lump.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1, coal=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:charcoal_lump", {
|
||||
description = S("Charcoal"),
|
||||
_doc_items_longdesc = S("Charcoal is an alternative furnace fuel created by cooking wood in a furnace. It has the same burning time as coal and also shares many of its crafting recipes, but it can not be used to create coal blocks."),
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = "mcl_core_charcoal.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1, coal=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:iron_nugget", {
|
||||
description = S("Iron Nugget"),
|
||||
_doc_items_longdesc = S("Iron nuggets are very small pieces of molten iron; the main purpose is to create iron ingots."),
|
||||
inventory_image = "mcl_core_iron_nugget.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:gold_nugget", {
|
||||
description = S("Gold Nugget"),
|
||||
_doc_items_longdesc = S("Gold nuggets are very small pieces of molten gold; the main purpose is to create gold ingots."),
|
||||
inventory_image = "mcl_core_gold_nugget.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:diamond", {
|
||||
description = S("Diamond"),
|
||||
_doc_items_longdesc = S("Diamonds are precious minerals and useful to create the highest tier of armor and tools."),
|
||||
inventory_image = "default_diamond.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:clay_lump", {
|
||||
description = S("Clay Ball"),
|
||||
_doc_items_longdesc = S("Clay balls are a raw material, mainly used to create bricks in the furnace."),
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = "default_clay_lump.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:iron_ingot", {
|
||||
description = S("Iron Ingot"),
|
||||
_doc_items_longdesc = S("Molten iron. It is used to craft armor, tools, and whatnot."),
|
||||
inventory_image = "default_steel_ingot.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:gold_ingot", {
|
||||
description = S("Gold Ingot"),
|
||||
_doc_items_longdesc = S("Molten gold. It is used to craft armor, tools, and whatnot."),
|
||||
inventory_image = "default_gold_ingot.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:emerald", {
|
||||
description = S("Emerald"),
|
||||
_doc_items_longdesc = S("Emeralds are used in villager trades as currency."),
|
||||
inventory_image = "mcl_core_emerald.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:brick", {
|
||||
description = S("Brick"),
|
||||
_doc_items_longdesc = S("Bricks are used to craft brick blocks."),
|
||||
inventory_image = "default_clay_brick.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:flint", {
|
||||
description = S("Flint"),
|
||||
_doc_items_longdesc = S("Flint is a raw material."),
|
||||
inventory_image = "default_flint.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:sugar", {
|
||||
description = S("Sugar"),
|
||||
_doc_items_longdesc = S("Sugar comes from sugar canes and is used to make sweet foods."),
|
||||
inventory_image = "mcl_core_sugar.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem = 1, brewitem=1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:bowl",{
|
||||
description = S("Bowl"),
|
||||
_doc_items_longdesc = S("Bowls are mainly used to hold tasty soups."),
|
||||
inventory_image = "mcl_core_bowl.png",
|
||||
stack_max = 64,
|
||||
groups = { craftitem = 1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:apple", {
|
||||
description = S("Apple"),
|
||||
_doc_items_longdesc = S("Apples are food items which can be eaten."),
|
||||
wield_image = "default_apple.png",
|
||||
inventory_image = "default_apple.png",
|
||||
stack_max = 64,
|
||||
on_place = minetest.item_eat(4),
|
||||
on_secondary_use = minetest.item_eat(4),
|
||||
groups = { food = 2, eatable = 4, compostability = 65 },
|
||||
_mcl_saturation = 2.4,
|
||||
})
|
||||
|
||||
local gapple_hunger_restore = minetest.item_eat(4)
|
||||
|
||||
local function eat_gapple(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
elseif pointed_thing.type == "object" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local regen_duration, absorbtion_factor = 5, 1
|
||||
if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then
|
||||
regen_duration, absorbtion_factor = 20, 4
|
||||
mcl_potions.fire_resistance_func(placer, 1, 300)
|
||||
mcl_potions.leaping_func(placer, 1, 300)
|
||||
end
|
||||
mcl_potions.swiftness_func(placer, absorbtion_factor, 120) -- TODO: Absorbtion
|
||||
mcl_potions.regeneration_func(placer, 2, regen_duration)
|
||||
return gapple_hunger_restore(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
||||
minetest.register_craftitem("mcl_core:apple_gold", {
|
||||
-- TODO: Add special highlight color
|
||||
description = S("Golden Apple"),
|
||||
_doc_items_longdesc = S("Golden apples are precious food items which can be eaten."),
|
||||
wield_image = "mcl_core_apple_golden.png",
|
||||
inventory_image = "mcl_core_apple_golden.png",
|
||||
stack_max = 64,
|
||||
on_place = eat_gapple,
|
||||
on_secondary_use = eat_gapple,
|
||||
groups = { food = 2, eatable = 4, can_eat_when_full = 1 },
|
||||
_mcl_saturation = 9.6,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_core:apple_gold_enchanted", {
|
||||
description = S("Enchanted Golden Apple"),
|
||||
_doc_items_longdesc = S("Golden apples are precious food items which can be eaten."),
|
||||
wield_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay,
|
||||
inventory_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay,
|
||||
stack_max = 64,
|
||||
on_place = eat_gapple,
|
||||
on_secondary_use = eat_gapple,
|
||||
groups = { food = 2, eatable = 4, can_eat_when_full = 1 },
|
||||
_mcl_saturation = 9.6,
|
||||
})
|
|
@ -16,43 +16,6 @@ local ACACIA_TREE_ID = 4
|
|||
local JUNGLE_TREE_ID = 5
|
||||
local BIRCH_TREE_ID = 6
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"group:lava"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water")
|
||||
|
||||
local lavatype = minetest.registered_nodes[node.name].liquidtype
|
||||
|
||||
for w=1, #water do
|
||||
--local waternode = minetest.get_node(water[w])
|
||||
--local watertype = minetest.registered_nodes[waternode.name].liquidtype
|
||||
-- Lava on top of water: Water turns into stone
|
||||
if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then
|
||||
minetest.set_node(water[w], {name="mcl_core:stone"})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = water[w], gain = 0.25, max_hear_distance = 16}, true)
|
||||
-- Flowing lava vs water on same level: Lava turns into cobblestone
|
||||
elseif lavatype == "flowing" and water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z) then
|
||||
minetest.set_node(pos, {name="mcl_core:cobble"})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||
-- Lava source vs flowing water above or horizontally neighbored: Lava turns into obsidian
|
||||
elseif lavatype == "source" and
|
||||
((water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z) or
|
||||
(water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z))) then
|
||||
minetest.set_node(pos, {name="mcl_core:obsidian"})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||
-- water above flowing lava: Lava turns into cobblestone
|
||||
elseif lavatype == "flowing" and water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z then
|
||||
minetest.set_node(pos, {name="mcl_core:cobble"})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
@ -97,165 +60,10 @@ function mcl_core.grow_reeds(pos, node)
|
|||
end
|
||||
end
|
||||
|
||||
-- ABMs
|
||||
|
||||
|
||||
local function drop_attached_node(p)
|
||||
local nn = minetest.get_node(p).name
|
||||
if nn == "air" or nn == "ignore" then
|
||||
return
|
||||
end
|
||||
minetest.remove_node(p)
|
||||
for _, item in pairs(minetest.get_node_drops(nn, "")) do
|
||||
local pos = {
|
||||
x = p.x + math.random()/2 - 0.25,
|
||||
y = p.y + math.random()/2 - 0.25,
|
||||
z = p.z + math.random()/2 - 0.25,
|
||||
}
|
||||
if item ~= "" then
|
||||
minetest.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Helper function for node actions for liquid flow
|
||||
local function liquid_flow_action(pos, group, action)
|
||||
local function check_detach(pos, xp, yp, zp)
|
||||
local p = {x=pos.x+xp, y=pos.y+yp, z=pos.z+zp}
|
||||
local n = minetest.get_node_or_nil(p)
|
||||
if not n then
|
||||
return false
|
||||
end
|
||||
local d = minetest.registered_nodes[n.name]
|
||||
if not d then
|
||||
return false
|
||||
end
|
||||
--[[ Check if we want to perform the liquid action.
|
||||
* 1: Item must be in liquid group
|
||||
* 2a: If target node is below liquid, always succeed
|
||||
* 2b: If target node is horizontal to liquid: succeed if source, otherwise check param2 for horizontal flow direction ]]
|
||||
local range = d.liquid_range or 8
|
||||
if (minetest.get_item_group(n.name, group) ~= 0) and
|
||||
((yp > 0) or
|
||||
(yp == 0 and ((d.liquidtype == "source") or (n.param2 > (8-range) and n.param2 < 9)))) then
|
||||
action(pos)
|
||||
end
|
||||
end
|
||||
local posses = {
|
||||
{ x=-1, y=0, z=0 },
|
||||
{ x=1, y=0, z=0 },
|
||||
{ x=0, y=0, z=-1 },
|
||||
{ x=0, y=0, z=1 },
|
||||
{ x=0, y=1, z=0 },
|
||||
}
|
||||
for p=1,#posses do
|
||||
check_detach(pos, posses[p].x, posses[p].y, posses[p].z)
|
||||
end
|
||||
end
|
||||
|
||||
-- Drop some nodes next to flowing water, if it would flow into the node
|
||||
minetest.register_abm({
|
||||
label = "Wash away dig_by_water nodes by water flow",
|
||||
nodenames = {"group:dig_by_water"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
liquid_flow_action(pos, "water", function(pos)
|
||||
drop_attached_node(pos)
|
||||
minetest.dig_node(pos)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Destroy some nodes next to flowing lava, if it would flow into the node
|
||||
minetest.register_abm({
|
||||
label = "Destroy destroy_by_lava_flow nodes by lava flow",
|
||||
nodenames = {"group:destroy_by_lava_flow"},
|
||||
neighbors = {"group:lava"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
liquid_flow_action(pos, "lava", function(pos)
|
||||
minetest.remove_node(pos)
|
||||
minetest.sound_play("builtin_item_lava", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||
minetest.check_for_falling(pos)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Cactus mechanisms
|
||||
minetest.register_abm({
|
||||
label = "Cactus growth",
|
||||
nodenames = {"mcl_core:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
mcl_core.grow_cactus(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Cactus mechanisms",
|
||||
nodenames = {"mcl_core:cactus"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
for _, object in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do
|
||||
local entity = object:get_luaentity()
|
||||
if entity and entity.name == "__builtin:item" then
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } }
|
||||
for _, p in pairs(posses) do
|
||||
local ndef = minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name]
|
||||
if ndef and ndef.walkable then
|
||||
local posy = pos.y
|
||||
while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do
|
||||
local pos = vector.new(pos.x, posy, pos.z)
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_item(vector.offset(pos, math.random(-0.5, 0.5), 0, math.random(-0.5, 0.5)), "mcl_core:cactus")
|
||||
posy = posy + 1
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Sugar canes growth",
|
||||
nodenames = {"mcl_core:reeds"},
|
||||
neighbors = {"group:soil_sugarcane"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
mcl_core.grow_reeds(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Sugar canes drop
|
||||
--
|
||||
|
||||
local timber_nodenames={"mcl_core:reeds"}
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while timber_nodenames[i]~=nil do
|
||||
local np={x=pos.x, y=pos.y+1, z=pos.z}
|
||||
while minetest.get_node(np).name==timber_nodenames[i] do
|
||||
minetest.remove_node(np)
|
||||
minetest.add_item(np, timber_nodenames[i])
|
||||
np={x=np.x, y=np.y+1, z=np.z}
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
local function air_leaf(leaftype)
|
||||
if math.random(0, 50) == 3 then
|
||||
return {name = "air"}
|
||||
|
@ -797,8 +605,6 @@ function mcl_core.generate_huge_jungle_tree(pos)
|
|||
end
|
||||
|
||||
|
||||
local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed"))
|
||||
|
||||
function mcl_core.get_grass_palette_index(pos)
|
||||
local biome_data = minetest.get_biome_data(pos)
|
||||
local index = 0
|
||||
|
@ -818,140 +624,6 @@ function mcl_core.get_grass_block_type(pos)
|
|||
return {name = "mcl_core:dirt_with_grass", param2 = mcl_core.get_grass_palette_index(pos)}
|
||||
end
|
||||
|
||||
------------------------------
|
||||
-- Spread grass blocks and mycelium on neighbor dirt
|
||||
------------------------------
|
||||
minetest.register_abm({
|
||||
label = "Grass Block and Mycelium spread",
|
||||
nodenames = {"mcl_core:dirt"},
|
||||
neighbors = {"air", "group:grass_block_no_snow", "mcl_core:mycelium"},
|
||||
interval = 30,
|
||||
chance = 20,
|
||||
catch_up = false,
|
||||
action = function(pos)
|
||||
if pos == nil then
|
||||
return
|
||||
end
|
||||
local above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local abovenode = minetest.get_node(above)
|
||||
if minetest.get_item_group(abovenode.name, "liquid") ~= 0 or minetest.get_item_group(abovenode.name, "opaque") == 1 then
|
||||
-- Never grow directly below liquids or opaque blocks
|
||||
return
|
||||
end
|
||||
local light_self = minetest.get_node_light(above)
|
||||
if not light_self then return end
|
||||
--[[ Try to find a spreading dirt-type block (e.g. grass block or mycelium)
|
||||
within a 3×5×3 area, with the source block being on the 2nd-topmost layer. ]]
|
||||
local nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+3, z=pos.z+1}, "group:spreading_dirt_type")
|
||||
local p2
|
||||
-- Nothing found ? Bail out!
|
||||
if #nodes <= 0 then
|
||||
return
|
||||
else
|
||||
p2 = nodes[grass_spread_randomizer:next(1, #nodes)]
|
||||
end
|
||||
|
||||
-- Found it! Now check light levels!
|
||||
local source_above = {x=p2.x, y=p2.y+1, z=p2.z}
|
||||
local light_source = minetest.get_node_light(source_above)
|
||||
if not light_source then return end
|
||||
|
||||
if light_self >= 4 and light_source >= 9 then
|
||||
-- All checks passed! Let's spread the grass/mycelium!
|
||||
local n2 = minetest.get_node(p2)
|
||||
if minetest.get_item_group(n2.name, "grass_block") ~= 0 then
|
||||
n2 = mcl_core.get_grass_block_type(pos)
|
||||
end
|
||||
minetest.set_node(pos, {name=n2.name})
|
||||
|
||||
-- If this was mycelium, uproot plant above
|
||||
if n2.name == "mcl_core:mycelium" then
|
||||
local tad = minetest.registered_nodes[minetest.get_node(above).name]
|
||||
if tad and tad.groups and tad.groups.non_mycelium_plant then
|
||||
minetest.dig_node(above)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Grass/mycelium death in darkness
|
||||
minetest.register_abm({
|
||||
label = "Grass Block / Mycelium in darkness",
|
||||
nodenames = {"group:spreading_dirt_type"},
|
||||
interval = 8,
|
||||
chance = 50,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
-- Kill grass/mycelium when below opaque block or liquid
|
||||
if name ~= "ignore" and (minetest.get_item_group(name, "opaque") == 1 or minetest.get_item_group(name, "liquid") ~= 0) then
|
||||
minetest.set_node(pos, {name = "mcl_core:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Turn Grass Path and similar nodes to Dirt if a solid node is placed above it
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
if minetest.get_item_group(newnode.name, "solid") ~= 0 or
|
||||
minetest.get_item_group(newnode.name, "dirtifier") ~= 0 then
|
||||
local below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local belownode = minetest.get_node(below)
|
||||
if minetest.get_item_group(belownode.name, "dirtifies_below_solid") == 1 then
|
||||
minetest.set_node(below, {name="mcl_core:dirt"})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Turn Grass Path below solid block into Dirt",
|
||||
nodenames = {"mcl_core:grass_path"},
|
||||
neighbors = {"group:solid"},
|
||||
interval = 8,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if name ~= "ignore" and nodedef and (nodedef.groups and nodedef.groups.solid) then
|
||||
minetest.set_node(pos, {name = "mcl_core:dirt"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local SAVANNA_INDEX = 1
|
||||
minetest.register_lbm({
|
||||
label = "Replace legacy dry grass",
|
||||
name = "mcl_core:replace_legacy_dry_grass_0_65_0",
|
||||
nodenames = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt_with_dry_grass_snow"},
|
||||
action = function(pos, node)
|
||||
local biome_data = minetest.get_biome_data(pos)
|
||||
if biome_data then
|
||||
local biome = biome_data.biome
|
||||
local biome_name = minetest.get_biome_name(biome)
|
||||
local reg_biome = minetest.registered_biomes[biome_name]
|
||||
if reg_biome then
|
||||
if node.name == "mcl_core:dirt_with_dry_grass_snow" then
|
||||
node.name = "mcl_core:dirt_with_grass_snow"
|
||||
else
|
||||
node.name = "mcl_core:dirt_with_grass"
|
||||
end
|
||||
node.param2 = reg_biome._mcl_palette_index
|
||||
-- Fall back to savanna palette index
|
||||
if not node.param2 then
|
||||
node.param2 = SAVANNA_INDEX
|
||||
end
|
||||
minetest.set_node(pos, node)
|
||||
return
|
||||
end
|
||||
end
|
||||
node.param2 = SAVANNA_INDEX
|
||||
minetest.set_node(pos, node)
|
||||
return
|
||||
end,
|
||||
})
|
||||
|
||||
--------------------------
|
||||
-- Try generate tree ---
|
||||
--------------------------
|
||||
|
@ -1109,252 +781,6 @@ function mcl_core.grow_sapling(pos, node)
|
|||
end
|
||||
end
|
||||
|
||||
-- TODO: Use better tree models for everything
|
||||
-- TODO: Support 2×2 saplings
|
||||
|
||||
-- Oak tree
|
||||
minetest.register_abm({
|
||||
label = "Oak tree growth",
|
||||
nodenames = {"mcl_core:sapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 25,
|
||||
chance = 2,
|
||||
action = grow_oak
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded oak tree",
|
||||
name = "mcl_core:lbm_oak",
|
||||
nodenames = {"mcl_core:sapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_oak
|
||||
})
|
||||
|
||||
-- Dark oak tree
|
||||
minetest.register_abm({
|
||||
label = "Dark oak tree growth",
|
||||
nodenames = {"mcl_core:darksapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 25,
|
||||
chance = 2,
|
||||
action = grow_dark_oak
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded dark oak tree",
|
||||
name = "mcl_core:lbm_dark_oak",
|
||||
nodenames = {"mcl_core:darksapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_dark_oak
|
||||
})
|
||||
|
||||
-- Jungle Tree
|
||||
minetest.register_abm({
|
||||
label = "Jungle tree growth",
|
||||
nodenames = {"mcl_core:junglesapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 25,
|
||||
chance = 2,
|
||||
action = grow_jungle_tree
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded jungle tree",
|
||||
name = "mcl_core:lbm_jungle_tree",
|
||||
nodenames = {"mcl_core:junglesapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_jungle_tree
|
||||
})
|
||||
|
||||
-- Spruce tree
|
||||
minetest.register_abm({
|
||||
label = "Spruce tree growth",
|
||||
nodenames = {"mcl_core:sprucesapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 25,
|
||||
chance = 2,
|
||||
action = grow_spruce
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded spruce tree",
|
||||
name = "mcl_core:lbm_spruce",
|
||||
nodenames = {"mcl_core:sprucesapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_spruce
|
||||
})
|
||||
|
||||
-- Birch tree
|
||||
minetest.register_abm({
|
||||
label = "Birch tree growth",
|
||||
nodenames = {"mcl_core:birchsapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 25,
|
||||
chance = 2,
|
||||
action = grow_birch
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded birch tree",
|
||||
name = "mcl_core:lbm_birch",
|
||||
nodenames = {"mcl_core:birchsapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_birch
|
||||
})
|
||||
|
||||
-- Acacia tree
|
||||
minetest.register_abm({
|
||||
label = "Acacia tree growth",
|
||||
nodenames = {"mcl_core:acaciasapling"},
|
||||
neighbors = {"group:soil_sapling"},
|
||||
interval = 20,
|
||||
chance = 2,
|
||||
action = grow_acacia
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "Add growth for unloaded acacia tree",
|
||||
name = "mcl_core:lbm_acacia",
|
||||
nodenames = {"mcl_core:acaciasapling"},
|
||||
run_at_every_load = true,
|
||||
action = grow_acacia
|
||||
})
|
||||
|
||||
local function leafdecay_particles(pos, node)
|
||||
minetest.add_particlespawner({
|
||||
amount = math.random(10, 20),
|
||||
time = 0.1,
|
||||
minpos = vector.add(pos, {x=-0.4, y=-0.4, z=-0.4}),
|
||||
maxpos = vector.add(pos, {x=0.4, y=0.4, z=0.4}),
|
||||
minvel = {x=-0.2, y=-0.2, z=-0.2},
|
||||
maxvel = {x=0.2, y=0.1, z=0.2},
|
||||
minacc = {x=0, y=-9.81, z=0},
|
||||
maxacc = {x=0, y=-9.81, z=0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 1.5,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
node = node,
|
||||
})
|
||||
end
|
||||
|
||||
local function vinedecay_particles(pos, node)
|
||||
local dir = minetest.wallmounted_to_dir(node.param2)
|
||||
local relpos1, relpos2
|
||||
if dir.x < 0 then
|
||||
relpos1 = { x = -0.45, y = -0.4, z = -0.5 }
|
||||
relpos2 = { x = -0.4, y = 0.4, z = 0.5 }
|
||||
elseif dir.x > 0 then
|
||||
relpos1 = { x = 0.4, y = -0.4, z = -0.5 }
|
||||
relpos2 = { x = 0.45, y = 0.4, z = 0.5 }
|
||||
elseif dir.z < 0 then
|
||||
relpos1 = { x = -0.5, y = -0.4, z = -0.45 }
|
||||
relpos2 = { x = 0.5, y = 0.4, z = -0.4 }
|
||||
elseif dir.z > 0 then
|
||||
relpos1 = { x = -0.5, y = -0.4, z = 0.4 }
|
||||
relpos2 = { x = 0.5, y = 0.4, z = 0.45 }
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = math.random(8, 16),
|
||||
time = 0.1,
|
||||
minpos = vector.add(pos, relpos1),
|
||||
maxpos = vector.add(pos, relpos2),
|
||||
minvel = {x=-0.2, y=-0.2, z=-0.2},
|
||||
maxvel = {x=0.2, y=0.1, z=0.2},
|
||||
minacc = {x=0, y=-9.81, z=0},
|
||||
maxacc = {x=0, y=-9.81, z=0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 1.0,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
node = node,
|
||||
})
|
||||
end
|
||||
|
||||
---------------------
|
||||
-- Vine generating --
|
||||
---------------------
|
||||
minetest.register_abm({
|
||||
label = "Vines growth",
|
||||
nodenames = {"mcl_core:vine"},
|
||||
interval = 47,
|
||||
chance = 4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
-- First of all, check if we are even supported, otherwise, let's die!
|
||||
if not mcl_core.check_vines_supported(pos, node) then
|
||||
minetest.remove_node(pos)
|
||||
vinedecay_particles(pos, node)
|
||||
minetest.check_for_falling(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- Add vines below pos (if empty)
|
||||
local function spread_down(origin, target, dir, node)
|
||||
if math.random(1, 2) == 1 then
|
||||
if minetest.get_node(target).name == "air" then
|
||||
minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add vines above pos if it is backed up
|
||||
local function spread_up(origin, target, dir, node)
|
||||
local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine")
|
||||
-- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well)
|
||||
if #vines_in_area < 5 then
|
||||
if math.random(1, 2) == 1 then
|
||||
if minetest.get_node(target).name == "air" then
|
||||
local backup_dir = minetest.wallmounted_to_dir(node.param2)
|
||||
local backup = vector.subtract(target, backup_dir)
|
||||
local backupnodename = minetest.get_node(backup).name
|
||||
|
||||
-- Check if the block above is supported
|
||||
if mcl_core.supports_vines(backupnodename) then
|
||||
minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spread_horizontal(origin, target, dir, node)
|
||||
local vines_in_area = minetest.find_nodes_in_area({x=origin.x-4, y=origin.y-1, z=origin.z-4}, {x=origin.x+4, y=origin.y+1, z=origin.z+4}, "mcl_core:vine")
|
||||
-- Less then 4 vines blocks around the ticked vines block (remember the ticked block is counted by above function as well)
|
||||
if #vines_in_area < 5 then
|
||||
-- Spread horizontally
|
||||
local backup_dir = minetest.wallmounted_to_dir(node.param2)
|
||||
if not vector.equals(backup_dir, dir) then
|
||||
local target_node = minetest.get_node(target)
|
||||
if target_node.name == "air" then
|
||||
local backup = vector.add(target, backup_dir)
|
||||
local backupnodename = minetest.get_node(backup).name
|
||||
if mcl_core.supports_vines(backupnodename) then
|
||||
minetest.add_node(target, {name = "mcl_core:vine", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local directions = {
|
||||
{ { x= 1, y= 0, z= 0 }, spread_horizontal },
|
||||
{ { x=-1, y= 0, z= 0 }, spread_horizontal },
|
||||
{ { x= 0, y= 1, z= 0 }, spread_up },
|
||||
{ { x= 0, y=-1, z= 0 }, spread_down },
|
||||
{ { x= 0, y= 0, z= 1 }, spread_horizontal },
|
||||
{ { x= 0, y= 0, z=-1 }, spread_horizontal },
|
||||
}
|
||||
|
||||
local d = math.random(1, #directions)
|
||||
local dir = directions[d][1]
|
||||
local spread = directions[d][2]
|
||||
|
||||
spread(pos, vector.add(pos, dir), dir, node)
|
||||
end
|
||||
})
|
||||
|
||||
-- Returns true of the node supports vines
|
||||
function mcl_core.supports_vines(nodename)
|
||||
local def = minetest.registered_nodes[nodename]
|
||||
|
@ -1380,137 +806,6 @@ mcl_core.leafdecay_enable_cache = true
|
|||
-- Spread the load of finding trunks
|
||||
mcl_core.leafdecay_trunk_find_allow_accumulator = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
--local finds_per_second = 5000
|
||||
mcl_core.leafdecay_trunk_find_allow_accumulator = math.floor(dtime * 5000)
|
||||
end)
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Leaf decay",
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
interval = 2,
|
||||
chance = 5,
|
||||
|
||||
action = function(p0, node, _, _)
|
||||
local do_preserve = false
|
||||
local d = minetest.registered_nodes[node.name].groups.leafdecay
|
||||
if not d or d == 0 then
|
||||
return
|
||||
end
|
||||
local n0 = minetest.get_node(p0)
|
||||
if n0.param2 ~= 0 then
|
||||
-- Prevent leafdecay for player-placed leaves.
|
||||
-- param2 is set to 1 after it was placed by the player
|
||||
return
|
||||
end
|
||||
local p0_hash = nil
|
||||
if mcl_core.leafdecay_enable_cache then
|
||||
p0_hash = minetest.hash_node_position(p0)
|
||||
local trunkp = mcl_core.leafdecay_trunk_cache[p0_hash]
|
||||
if trunkp then
|
||||
local n = minetest.get_node(trunkp)
|
||||
local reg = minetest.registered_nodes[n.name]
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
|
||||
return
|
||||
end
|
||||
-- Cache is invalid
|
||||
table.remove(mcl_core.leafdecay_trunk_cache, p0_hash)
|
||||
end
|
||||
end
|
||||
if mcl_core.leafdecay_trunk_find_allow_accumulator <= 0 then
|
||||
return
|
||||
end
|
||||
mcl_core.leafdecay_trunk_find_allow_accumulator =
|
||||
mcl_core.leafdecay_trunk_find_allow_accumulator - 1
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
|
||||
if p1 then
|
||||
do_preserve = true
|
||||
if mcl_core.leafdecay_enable_cache then
|
||||
-- Cache the trunk
|
||||
mcl_core.leafdecay_trunk_cache[p0_hash] = p1
|
||||
end
|
||||
end
|
||||
if not do_preserve then
|
||||
-- Drop stuff other than the node itself
|
||||
local itemstacks = minetest.get_node_drops(n0.name)
|
||||
for _, itemname in pairs(itemstacks) do
|
||||
local p_drop = {
|
||||
x = p0.x - 0.5 + math.random(),
|
||||
y = p0.y - 0.5 + math.random(),
|
||||
z = p0.z - 0.5 + math.random(),
|
||||
}
|
||||
minetest.add_item(p_drop, itemname)
|
||||
end
|
||||
-- Remove node
|
||||
minetest.remove_node(p0)
|
||||
leafdecay_particles(p0, n0)
|
||||
minetest.check_for_falling(p0)
|
||||
|
||||
-- Kill depending vines immediately to skip the vines decay delay
|
||||
local surround = {
|
||||
{ x = 0, y = 0, z = -1 },
|
||||
{ x = 0, y = 0, z = 1 },
|
||||
{ x = -1, y = 0, z = 0 },
|
||||
{ x = 1, y = 0, z = 0 },
|
||||
{ x = 0, y = -1, z = -1 },
|
||||
}
|
||||
for s=1, #surround do
|
||||
local spos = vector.add(p0, surround[s])
|
||||
local maybe_vine = minetest.get_node(spos)
|
||||
--local surround_inverse = vector.multiply(surround[s], -1)
|
||||
if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then
|
||||
minetest.remove_node(spos)
|
||||
vinedecay_particles(spos, maybe_vine)
|
||||
minetest.check_for_falling(spos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Remove vines which are not supported by anything, similar to leaf decay.
|
||||
--[[ TODO: Vines are supposed to die immediately when they supporting block is destroyed.
|
||||
But doing this in Minetest would be too complicated / hacky. This vines decay is a simple
|
||||
way to make sure that all floating vines are destroyed eventually. ]]
|
||||
minetest.register_abm({
|
||||
label = "Vines decay",
|
||||
nodenames = {"mcl_core:vine"},
|
||||
neighbors = {"air"},
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
interval = 4,
|
||||
chance = 8,
|
||||
action = function(p0, node, _, _)
|
||||
if not mcl_core.check_vines_supported(p0, node) then
|
||||
-- Vines must die!
|
||||
minetest.remove_node(p0)
|
||||
vinedecay_particles(p0, node)
|
||||
-- Just in case a falling node happens to float above vines
|
||||
minetest.check_for_falling(p0)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Melt snow
|
||||
minetest.register_abm({
|
||||
label = "Top snow and ice melting",
|
||||
nodenames = {"mcl_core:snow", "mcl_core:ice"},
|
||||
interval = 16,
|
||||
chance = 8,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node_light(pos, 0) >= 12 then
|
||||
if node.name == "mcl_core:ice" then
|
||||
mcl_core.melt_ice(pos)
|
||||
else
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--[[ Call this for vines nodes only.
|
||||
Given the pos and node of a vines node, this returns true if the vines are supported
|
||||
and false if the vines are currently floating.
|
||||
|
|
|
@ -20,11 +20,3 @@ mcl_autogroup.register_diggroup("hoey")
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
dofile(modpath.."/functions.lua")
|
||||
dofile(modpath.."/nodes_base.lua") -- Simple solid cubic nodes with simple definitions
|
||||
dofile(modpath.."/nodes_liquid.lua") -- Liquids
|
||||
dofile(modpath.."/nodes_cactuscane.lua") -- Cactus and sugar canes
|
||||
dofile(modpath.."/nodes_trees.lua") -- Tree nodes: Wood, Planks, Sapling, Leaves
|
||||
dofile(modpath.."/nodes_glass.lua") -- Glass
|
||||
dofile(modpath.."/nodes_climb.lua") -- Climbable nodes
|
||||
dofile(modpath.."/nodes_misc.lua") -- Other and special nodes
|
||||
dofile(modpath.."/craftitems.lua")
|
||||
dofile(modpath.."/crafting.lua")
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
-- Cactus and Sugar Cane
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_node("mcl_core:cactus", {
|
||||
description = S("Cactus"),
|
||||
_tt_help = S("Grows on sand").."\n"..minetest.colorize(mcl_colors.YELLOW, S("Contact damage: @1 per half second", 1)),
|
||||
_doc_items_longdesc = S("This is a piece of cactus commonly found in dry areas, especially deserts. Over time, cacti will grow up to 3 blocks high on sand or red sand. A cactus hurts living beings touching it with a damage of 1 HP every half second. When a cactus block is broken, all cactus blocks connected above it will break as well."),
|
||||
_doc_items_usagehelp = S("A cactus can only be placed on top of another cactus or any sand."),
|
||||
drawtype = "nodebox",
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||
tiles = {"mcl_core_cactus_top.png", "mcl_core_cactus_bottom.png", "mcl_core_cactus_side.png"},
|
||||
is_ground_content = true,
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
handy = 1, attached_node = 1, deco_block = 1, dig_by_piston = 1,
|
||||
plant = 1, enderman_takable = 1, compostability = 50
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
node_placement_prediction = "",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main body
|
||||
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
|
||||
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
|
||||
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
|
||||
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
|
||||
},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-7/16, -8/16, -7/16, 7/16, 7/16, 7/16}, -- Main body. slightly lower than node box
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16},
|
||||
},
|
||||
},
|
||||
-- Only allow to place cactus on sand or cactus
|
||||
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
|
||||
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if not node_below then return false end
|
||||
return (node_below.name == "mcl_core:cactus" or minetest.get_item_group(node_below.name, "sand") == 1)
|
||||
end),
|
||||
_mcl_blast_resistance = 0.4,
|
||||
_mcl_hardness = 0.4,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:reeds", {
|
||||
description = S("Sugar Canes"),
|
||||
_tt_help = S("Grows on sand or dirt next to water"),
|
||||
_doc_items_longdesc = S("Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well."),
|
||||
_doc_items_usagehelp = S("Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow."),
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "color",
|
||||
tiles = {"mcl_core_papyrus.png"},
|
||||
palette = "mcl_core_palette_grass.png",
|
||||
palette_index = 0,
|
||||
inventory_image = "mcl_core_reeds.png",
|
||||
wield_image = "mcl_core_reeds.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main Body
|
||||
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
|
||||
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
|
||||
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
|
||||
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
|
||||
},
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
dig_immediate = 3, craftitem = 1, deco_block = 1, dig_by_piston = 1,
|
||||
plant = 1, non_mycelium_plant = 1, compostability = 50
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
node_placement_prediction = "",
|
||||
drop = "mcl_core:reeds", -- to prevent color inheritation
|
||||
on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node)
|
||||
local soil_pos = {x=place_pos.x, y=place_pos.y-1, z=place_pos.z}
|
||||
local soil_node = minetest.get_node_or_nil(soil_pos)
|
||||
if not soil_node then return false end
|
||||
local snn = soil_node.name -- soil node name
|
||||
|
||||
-- Placement rules:
|
||||
-- * On top of group:soil_sugarcane AND next to water or frosted ice. OR
|
||||
-- * On top of sugar canes
|
||||
-- * Not inside liquid
|
||||
if snn == "mcl_core:reeds" then
|
||||
return true
|
||||
elseif minetest.get_item_group(snn, "soil_sugarcane") == 0 then
|
||||
return false
|
||||
end
|
||||
local place_node = minetest.get_node(place_pos)
|
||||
local pdef = minetest.registered_nodes[place_node.name]
|
||||
if pdef and pdef.liquidtype ~= "none" then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Legal water position rules are the same as for decoration spawn_by rules.
|
||||
-- This differs from MC, which does not allow diagonal neighbors
|
||||
-- and neighbors 1 layer above.
|
||||
local np1 = {x=soil_pos.x-1, y=soil_pos.y, z=soil_pos.z-1}
|
||||
local np2 = {x=soil_pos.x+1, y=soil_pos.y+1, z=soil_pos.z+1}
|
||||
if #minetest.find_nodes_in_area(np1, np2, {"group:water", "group:frosted_ice"}) > 0 then
|
||||
-- Water found! Sugar canes are happy! :-)
|
||||
return true
|
||||
end
|
||||
|
||||
-- No water found! Sugar canes are not amuzed and refuses to be placed. :-(
|
||||
return false
|
||||
|
||||
end),
|
||||
on_construct = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.param2 == 0 then
|
||||
node.param2 = mcl_core.get_grass_palette_index(pos)
|
||||
if node.param2 ~= 0 then
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
end
|
||||
end,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
|
@ -1,173 +0,0 @@
|
|||
-- Climbable nodes
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local function rotate_climbable(pos, node, user, mode)
|
||||
if mode == screwdriver.ROTATE_FACE then
|
||||
local r = screwdriver.rotate.wallmounted(pos, node, mode)
|
||||
node.param2 = r
|
||||
minetest.swap_node(pos, node)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_core:ladder", {
|
||||
description = S("Ladder"),
|
||||
_doc_items_longdesc = S("A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns."),
|
||||
drawtype = "signlike",
|
||||
is_ground_content = false,
|
||||
tiles = {"default_ladder.png"},
|
||||
inventory_image = "default_ladder.png",
|
||||
wield_image = "default_ladder.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = true,
|
||||
climbable = true,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1, attached_node=1, deco_block=1, dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of ladders
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then
|
||||
return itemstack
|
||||
end
|
||||
local groups = def.groups
|
||||
|
||||
-- Don't allow to place the ladder at particular nodes
|
||||
if (groups and (groups.glass or groups.leaves or groups.slab)) or
|
||||
node.name == "mcl_core:ladder" or node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Ladders may not be placed on ceiling or floor
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
_mcl_blast_resistance = 0.4,
|
||||
_mcl_hardness = 0.4,
|
||||
on_rotate = rotate_climbable,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:vine", {
|
||||
description = S("Vines"),
|
||||
_doc_items_longdesc = S("Vines are climbable blocks which can be placed on the sides of solid full-cube blocks. Vines slowly grow and spread."),
|
||||
drawtype = "signlike",
|
||||
tiles = {"mcl_core_vine.png"},
|
||||
inventory_image = "mcl_core_vine.png",
|
||||
wield_image = "mcl_core_vine.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
buildable_to = true,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
handy = 1, axey = 1, shearsy = 1, swordy = 1, deco_block = 1,
|
||||
dig_by_piston = 1, destroy_by_lava_flow = 1, compostability = 50,
|
||||
flammable = 2, fire_encouragement = 15, fire_flammability = 100
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
drop = "",
|
||||
_mcl_shears_drop = true,
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of vines
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then return itemstack end
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
|
||||
-- Only place on full cubes
|
||||
if not mcl_core.supports_vines(node.name) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Vines may not be placed on top or below another block
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local itemstack, success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
-- If dug, also dig a “dependant” vine below it.
|
||||
-- A vine is dependant if it hangs from this node and has no supporting block.
|
||||
on_dig = function(pos, node, digger)
|
||||
local below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local belownode = minetest.get_node(below)
|
||||
minetest.node_dig(pos, node, digger)
|
||||
if belownode.name == node.name and (not mcl_core.check_vines_supported(below, belownode)) then
|
||||
minetest.registered_nodes[node.name].on_dig(below, node, digger)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
on_rotate = false,
|
||||
})
|
|
@ -1,91 +0,0 @@
|
|||
-- Glass nodes
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local mod_doc = minetest.get_modpath("doc")
|
||||
|
||||
minetest.register_node("mcl_core:glass", {
|
||||
description = S("Glass"),
|
||||
_doc_items_longdesc = S("A decorative and mostly transparent block."),
|
||||
drawtype = "glasslike_framed_optional",
|
||||
is_ground_content = false,
|
||||
tiles = {"default_glass.png", "default_glass_detail.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "glasslikeliquidlevel",
|
||||
sunlight_propagates = true,
|
||||
stack_max = 64,
|
||||
groups = {handy=1, glass=1, building_block=1, material_glass=1},
|
||||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
drop = "",
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
------------------------
|
||||
-- Create Color Glass --
|
||||
------------------------
|
||||
local canonical_color = "yellow"
|
||||
function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color)
|
||||
|
||||
local longdesc, create_entry, entry_name
|
||||
if mod_doc then
|
||||
if color == canonical_color then
|
||||
longdesc = S("Stained glass is a decorative and mostly transparent block which comes in various different colors.")
|
||||
entry_name = S("Stained Glass")
|
||||
else
|
||||
create_entry = false
|
||||
end
|
||||
end
|
||||
minetest.register_node("mcl_core:glass_"..color, {
|
||||
description = desc,
|
||||
_doc_items_create_entry = create_entry,
|
||||
_doc_items_entry_name = entry_name,
|
||||
_doc_items_longdesc = longdesc,
|
||||
drawtype = "glasslike_framed_optional",
|
||||
is_ground_content = false,
|
||||
tiles = {"mcl_core_glass_"..color..".png", "mcl_core_glass_"..color.."_detail.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "glasslikeliquidlevel",
|
||||
sunlight_propagates = true,
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
|
||||
stack_max = 64,
|
||||
-- TODO: Add color to groups
|
||||
groups = {handy=1, glass=1, building_block=1, material_glass=1},
|
||||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
drop = "",
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:glass_"..color.." 8",
|
||||
recipe = {
|
||||
{"mcl_core:glass","mcl_core:glass","mcl_core:glass"},
|
||||
{"mcl_core:glass",recipeitem,"mcl_core:glass"},
|
||||
{"mcl_core:glass","mcl_core:glass","mcl_core:glass"},
|
||||
}
|
||||
})
|
||||
|
||||
if mod_doc and color ~= canonical_color then
|
||||
doc.add_entry_alias("nodes", "mcl_core:glass_"..canonical_color, "nodes", "mcl_core:glass_"..color)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---- colored glass
|
||||
mcl_core.add_stained_glass( S("Red Stained Glass"), "mcl_dye:red", "basecolor_red", "red")
|
||||
mcl_core.add_stained_glass( S("Green Stained Glass"), "mcl_dye:dark_green", "unicolor_dark_green", "green")
|
||||
mcl_core.add_stained_glass( S("Blue Stained Glass"), "mcl_dye:blue", "basecolor_blue", "blue")
|
||||
mcl_core.add_stained_glass( S("Light Blue Stained Glass"), "mcl_dye:lightblue", "unicolor_light_blue", "light_blue")
|
||||
mcl_core.add_stained_glass( S("Black Stained Glass"), "mcl_dye:black", "basecolor_black", "black")
|
||||
mcl_core.add_stained_glass( S("White Stained Glass"), "mcl_dye:white", "basecolor_white", "white")
|
||||
mcl_core.add_stained_glass( S("Yellow Stained Glass"), "mcl_dye:yellow", "basecolor_yellow", "yellow")
|
||||
mcl_core.add_stained_glass( S("Brown Stained Glass"), "mcl_dye:brown", "unicolor_dark_orange", "brown")
|
||||
mcl_core.add_stained_glass( S("Orange Stained Glass"), "mcl_dye:orange", "excolor_orange", "orange")
|
||||
mcl_core.add_stained_glass( S("Pink Stained Glass"), "mcl_dye:pink", "unicolor_light_red", "pink")
|
||||
mcl_core.add_stained_glass( S("Grey Stained Glass"), "mcl_dye:dark_grey", "unicolor_darkgrey", "gray")
|
||||
mcl_core.add_stained_glass( S("Lime Stained Glass"), "mcl_dye:green", "basecolor_green", "lime")
|
||||
mcl_core.add_stained_glass( S("Light Grey Stained Glass"), "mcl_dye:grey", "basecolor_grey", "silver")
|
||||
mcl_core.add_stained_glass( S("Magenta Stained Glass"), "mcl_dye:magenta", "basecolor_magenta", "magenta")
|
||||
mcl_core.add_stained_glass( S("Purple Stained Glass"), "mcl_dye:violet", "excolor_violet", "purple")
|
||||
mcl_core.add_stained_glass( S("Cyan Stained Glass"), "mcl_dye:cyan", "basecolor_cyan", "cyan")
|
|
@ -1,245 +0,0 @@
|
|||
-- Liquids: Water and lava
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local vector = vector
|
||||
local math = math
|
||||
|
||||
--local WATER_ALPHA = 179
|
||||
local WATER_VISC = 1
|
||||
local LAVA_VISC = 7
|
||||
local LIGHT_LAVA = minetest.LIGHT_MAX
|
||||
local USE_TEXTURE_ALPHA = true
|
||||
|
||||
if minetest.features.use_texture_alpha_string_modes then
|
||||
USE_TEXTURE_ALPHA = "blend"
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_core:water_flowing", {
|
||||
description = S("Flowing Water"),
|
||||
_doc_items_create_entry = false,
|
||||
wield_image = "default_water_flowing_animated.png^[verticalframe:64:0",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_water_flowing_animated.png^[verticalframe:64:0"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
||||
},
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
||||
},
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:water_source", {
|
||||
description = S("Water Source"),
|
||||
_doc_items_entry_name = S("Water"),
|
||||
_doc_items_longdesc =
|
||||
S("Water is abundant in oceans and also appears in a few springs in the ground. You can swim easily in water, but you need to catch your breath from time to time.").."\n\n"..
|
||||
S("Water interacts with lava in various ways:").."\n"..
|
||||
S("• When water is directly above or horizontally next to a lava source, the lava turns into obsidian.").."\n"..
|
||||
S("• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.").."\n"..
|
||||
S("• When water is directly below lava, the water turns into stone."),
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name="default_water_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
||||
stack_max = 64,
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_flowing", {
|
||||
description = S("Flowing Lava"),
|
||||
_doc_items_create_entry = false,
|
||||
wield_image = "default_lava_flowing_animated.png^[verticalframe:64:0",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_lava_flowing_animated.png^[verticalframe:64:0"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=6.6}
|
||||
},
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=6.6}
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
light_source = LIGHT_LAVA,
|
||||
is_ground_content = false,
|
||||
sounds = mcl_sounds.node_sound_lava_defaults(),
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
--[[ Drowning in Minecraft deals 2 damage per second.
|
||||
In Minetest, drowning damage is dealt every 2 seconds so this
|
||||
translates to 4 drowning damage ]]
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=245, r=208, g=73, b=10},
|
||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1, set_on_fire=15},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
local fire_text
|
||||
local fire_enabled = minetest.settings:get_bool("enable_fire", true)
|
||||
if fire_enabled then
|
||||
fire_text = S("A lava source sets fire to a couple of air blocks above when they're next to a flammable block.")
|
||||
else
|
||||
fire_text = ""
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_core:lava_source", {
|
||||
description = S("Lava Source"),
|
||||
_doc_items_entry_name = "Lava",
|
||||
_doc_items_longdesc =
|
||||
S("Lava is hot and rather dangerous. Don't touch it, it will hurt you a lot and it is hard to get out.").."\n"..
|
||||
fire_text.."\n\n"..
|
||||
S("Lava interacts with water various ways:").."\n"..
|
||||
S("• When a lava source is directly below or horizontally next to water, the lava turns into obsidian.").."\n"..
|
||||
S("• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.").."\n"..
|
||||
S("• When lava is directly above water, the water turns into stone."),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style lava source material (mostly unused)
|
||||
{
|
||||
name="default_lava_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = LIGHT_LAVA,
|
||||
is_ground_content = false,
|
||||
sounds = mcl_sounds.node_sound_lava_defaults(),
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=245, r=208, g=73, b=10},
|
||||
stack_max = 64,
|
||||
groups = { lava=3, lava_source=1, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1, set_on_fire=15, fire_damage=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
local function emit_lava_particle(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "lava_source") == 0 then
|
||||
return
|
||||
end
|
||||
local ppos = vector.add(pos, { x = math.random(-7, 7)/16, y = 0.45, z = math.random(-7, 7)/16})
|
||||
--local spos = vector.add(ppos, { x = 0, y = -0.2, z = 0 })
|
||||
local vel = { x = math.random(-3, 3)/10, y = math.random(4, 7), z = math.random(-3, 3)/10 }
|
||||
local acc = { x = 0, y = -9.81, z = 0 }
|
||||
-- Lava droplet
|
||||
minetest.add_particle({
|
||||
pos = ppos,
|
||||
velocity = vel,
|
||||
acceleration = acc,
|
||||
expirationtime = 2.5,
|
||||
collisiondetection = true,
|
||||
collision_removal = true,
|
||||
size = math.random(20, 30)/10,
|
||||
texture = "mcl_particles_lava.png",
|
||||
glow = LIGHT_LAVA,
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.settings:get("mcl_node_particles") == "full" then
|
||||
minetest.register_abm({
|
||||
label = "Lava particles",
|
||||
nodenames = {"group:lava_source"},
|
||||
interval = 8.0,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
local apos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local anode = minetest.get_node(apos)
|
||||
-- Only emit partiles when directly below lava
|
||||
if anode.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.after(math.random(0, 800)*0.01, emit_lava_particle, pos)
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -1,277 +0,0 @@
|
|||
-- Other nodes
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local mod_screwdriver = minetest.get_modpath("screwdriver")
|
||||
|
||||
local on_rotate
|
||||
if mod_screwdriver then
|
||||
on_rotate = screwdriver.rotate_3way
|
||||
end
|
||||
|
||||
local alldirs = {{x=0,y=0,z=1}, {x=1,y=0,z=0}, {x=0,y=0,z=-1}, {x=-1,y=0,z=0}, {x=0,y=-1,z=0}, {x=0,y=1,z=0}}
|
||||
|
||||
minetest.register_node("mcl_core:bone_block", {
|
||||
description = S("Bone Block"),
|
||||
_doc_items_longdesc = S("Bone blocks are decorative blocks and a compact storage of bone meal."),
|
||||
tiles = {"mcl_core_bone_block_top.png", "mcl_core_bone_block_top.png", "mcl_core_bone_block_side.png"},
|
||||
is_ground_content = false,
|
||||
paramtype2 = "facedir",
|
||||
on_place = mcl_util.rotate_axis,
|
||||
groups = {pickaxey=1, building_block=1, material_stone=1},
|
||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:slimeblock", {
|
||||
description = S("Slime Block"),
|
||||
_doc_items_longdesc = S("Slime blocks are very bouncy and prevent fall damage."),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "regular",
|
||||
},
|
||||
tiles = {"mcl_core_slime.png"},
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
|
||||
stack_max = 64,
|
||||
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks
|
||||
-- bouncy=44 makes the player bounce up to 49.6. This value was chosen by experiment.
|
||||
-- bouncy=80 was chosen because it is higher than 66 (bounciness of bed)
|
||||
groups = {dig_immediate=3, bouncy=80,fall_damage_add_percent=-100,deco_block=1},
|
||||
sounds = {
|
||||
dug = {name="slimenodes_dug", gain=0.6},
|
||||
place = {name="slimenodes_place", gain=0.6},
|
||||
footstep = {name="slimenodes_step", gain=0.3},
|
||||
},
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
mvps_sticky = function(pos, node, piston_pos)
|
||||
local connected = {}
|
||||
for n, v in ipairs(alldirs) do
|
||||
local neighbor_pos = vector.add(pos, v)
|
||||
local neighbor_node = minetest.get_node(neighbor_pos)
|
||||
if neighbor_node then
|
||||
if neighbor_node.name == "ignore" then
|
||||
minetest.get_voxel_manip():read_from_map(neighbor_pos, neighbor_pos)
|
||||
neighbor_node = minetest.get_node(neighbor_pos)
|
||||
end
|
||||
local name = neighbor_node.name
|
||||
if name ~= "air" and name ~= "ignore" and not mesecon.mvps_unsticky[name] then
|
||||
local piston, piston_side, piston_up, piston_down = false, false, false, false
|
||||
if name == "mesecons_pistons:piston_sticky_off" or name == "mesecons_pistons:piston_normal_off" then
|
||||
piston, piston_side = true, true
|
||||
elseif name == "mesecons_pistons:piston_up_sticky_off" or name == "mesecons_pistons:piston_up_normal_off" then
|
||||
piston, piston_up = true, true
|
||||
elseif name == "mesecons_pistons:piston_down_sticky_off" or name == "mesecons_pistons:piston_down_normal_off" then
|
||||
piston, piston_down = true, true
|
||||
end
|
||||
if not( (piston_side and (n-1==neighbor_node.param2)) or (piston_up and (n==5)) or (piston_down and (n==6)) ) then
|
||||
if piston and piston_pos then
|
||||
if piston_pos.x == neighbor_pos.x and piston_pos.y == neighbor_pos.y and piston_pos.z == neighbor_pos.z then
|
||||
-- Loopback to the same piston! Preventing unwanted behavior:
|
||||
return {}, true
|
||||
end
|
||||
end
|
||||
table.insert(connected, neighbor_pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return connected, false
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:cobweb", {
|
||||
description = S("Cobweb"),
|
||||
_tt_help = S("Slows down movement"),
|
||||
_doc_items_longdesc = S("Cobwebs can be walked through, but significantly slow you down."),
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "degrotate",
|
||||
visual_scale = 1.1,
|
||||
stack_max = 64,
|
||||
tiles = {"mcl_core_web.png"},
|
||||
inventory_image = "mcl_core_web.png",
|
||||
paramtype = "light",
|
||||
liquid_viscosity = 14,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:cobweb",
|
||||
liquid_alternative_source = "mcl_core:cobweb",
|
||||
liquid_renewable = false,
|
||||
liquid_range = 0,
|
||||
walkable = false,
|
||||
groups = {swordy_cobweb=1, shearsy_cobweb=1, fake_liquid=1, disable_jump=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
||||
drop = "mcl_mobitems:string",
|
||||
_mcl_shears_drop = true,
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 4,
|
||||
_mcl_hardness = 4,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:deadbush", {
|
||||
description = S("Dead Bush"),
|
||||
_doc_items_longdesc = S("Dead bushes are unremarkable plants often found in dry areas. They can be harvested for sticks."),
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_dry_shrub.png"},
|
||||
inventory_image = "default_dry_shrub.png",
|
||||
wield_image = "default_dry_shrub.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
stack_max = 64,
|
||||
buildable_to = true,
|
||||
groups = {handy=1,shearsy=1, flammable=3,attached_node=1,plant=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1, fire_encouragement=60, fire_flammability=100},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"mcl_core:stick 2"},
|
||||
rarity = 2,
|
||||
},
|
||||
{
|
||||
items = {"mcl_core:stick 1"},
|
||||
rarity = 2,
|
||||
},
|
||||
}
|
||||
},
|
||||
_mcl_shears_drop = true,
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-5/16, -8/16, -5/16, 5/16, 1/16, 5/16},
|
||||
},
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:barrier", {
|
||||
description = S("Barrier"),
|
||||
_doc_items_longdesc = S("Barriers are invisble walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block."),
|
||||
_doc_items_usagehelp = S("When you hold a barrier in hand, you reveal all placed barriers in a short distance around you."),
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
inventory_image = "mcl_core_barrier.png",
|
||||
wield_image = "mcl_core_barrier.png",
|
||||
tiles = { "blank.png" },
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {creative_breakable=1, not_in_creative_inventory = 1, not_solid = 1 },
|
||||
on_blast = function() end,
|
||||
drop = "",
|
||||
_mcl_blast_resistance = 36000008,
|
||||
_mcl_hardness = -1,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
if placer == nil then
|
||||
return
|
||||
end
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
expirationtime = 1,
|
||||
size = 8,
|
||||
texture = "mcl_core_barrier.png",
|
||||
glow = 14,
|
||||
playername = placer:get_player_name()
|
||||
})
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
if not privs.maphack then
|
||||
minetest.chat_send_player(name, "Placement denied. You need the “maphack” privilege to place barriers.")
|
||||
return itemstack
|
||||
end
|
||||
local new_itemstack = minetest.item_place(itemstack, placer, pointed_thing)
|
||||
return new_itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
-- Same as barrier, but non-pointable. This node is only to be used internally to separate realms.
|
||||
-- It must NOT be used for anything else.
|
||||
-- This node only exists because Minetest does not have support for “dimensions” yet and needs to
|
||||
-- be removed when support for this is implemented.
|
||||
minetest.register_node("mcl_core:realm_barrier", {
|
||||
description = S("Realm Barrier"),
|
||||
_doc_items_create_entry = false,
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
inventory_image = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX",
|
||||
wield_image = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX",
|
||||
tiles = { "blank.png" },
|
||||
stack_max = 64,
|
||||
-- To avoid players getting stuck forever between realms
|
||||
damage_per_second = 8,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
pointable = false,
|
||||
groups = {not_in_creative_inventory = 1, not_solid = 1 },
|
||||
on_blast = function() end,
|
||||
drop = "",
|
||||
_mcl_blast_resistance = 36000008,
|
||||
_mcl_hardness = -1,
|
||||
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
|
||||
node_placement_prediction = "",
|
||||
on_place = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.chat_send_player(placer:get_player_name(), minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!"))
|
||||
return
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
-- The void below the bedrock. Void damage is handled in mcl_playerplus.
|
||||
-- The void does not exist as a block in Minecraft but we register it as a
|
||||
-- block here to make things easier for us.
|
||||
minetest.register_node("mcl_core:void", {
|
||||
description = S("Void"),
|
||||
_doc_items_create_entry = false,
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
pointable = false,
|
||||
walkable = false,
|
||||
floodable = false,
|
||||
buildable_to = false,
|
||||
inventory_image = "mcl_core_void.png",
|
||||
wield_image = "mcl_core_void.png",
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = { not_in_creative_inventory = 1 },
|
||||
on_blast = function() end,
|
||||
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
|
||||
node_placement_prediction = "",
|
||||
on_place = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.chat_send_player(placer:get_player_name(), minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!"))
|
||||
return
|
||||
end,
|
||||
drop = "",
|
||||
-- Infinite blast resistance; it should never be destroyed by explosions
|
||||
_mcl_blast_resistance = -1,
|
||||
_mcl_hardness = -1,
|
||||
})
|
|
@ -1,275 +0,0 @@
|
|||
-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves, Stripped Wood
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local mod_screwdriver = minetest.get_modpath("screwdriver")
|
||||
|
||||
local on_rotate
|
||||
if mod_screwdriver then
|
||||
on_rotate = screwdriver.rotate_3way
|
||||
end
|
||||
|
||||
-- Register tree trunk (wood) and bark
|
||||
local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
|
||||
minetest.register_node("mcl_core:"..subname, {
|
||||
description = description_trunk,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
tiles = {tile_inner, tile_inner, tile_bark},
|
||||
paramtype2 = "facedir",
|
||||
on_place = mcl_util.rotate_axis,
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
_mcl_stripped_variant = stripped_variant,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:"..subname.."_bark", {
|
||||
description = description_bark,
|
||||
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
|
||||
tiles = {tile_bark},
|
||||
paramtype2 = "facedir",
|
||||
on_place = mcl_util.rotate_axis,
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
is_ground_content = false,
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
_mcl_stripped_variant = stripped_variant.."_bark",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:"..subname.."_bark 3",
|
||||
recipe = {
|
||||
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Register stripped trunk and stripped wood
|
||||
local function register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark)
|
||||
minetest.register_node("mcl_core:"..subname, {
|
||||
description = description_stripped_trunk,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
tiles = {tile_stripped_inner, tile_stripped_inner, tile_stripped_bark},
|
||||
paramtype2 = "facedir",
|
||||
on_place = mcl_util.rotate_axis,
|
||||
stack_max = 64,
|
||||
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:"..subname.."_bark", {
|
||||
description = description_stripped_bark,
|
||||
_doc_items_longdesc = longdesc_wood,
|
||||
tiles = {tile_stripped_bark},
|
||||
paramtype2 = "facedir",
|
||||
on_place = mcl_util.rotate_axis,
|
||||
stack_max = 64,
|
||||
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
is_ground_content = false,
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_core:"..subname.."_bark 3",
|
||||
recipe = {
|
||||
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function register_wooden_planks(subname, description, tiles)
|
||||
minetest.register_node("mcl_core:"..subname, {
|
||||
description = description,
|
||||
_doc_items_longdesc = doc.sub.items.temp.build,
|
||||
_doc_items_hidden = false,
|
||||
tiles = tiles,
|
||||
stack_max = 64,
|
||||
is_ground_content = false,
|
||||
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 2,
|
||||
})
|
||||
end
|
||||
|
||||
local function register_leaves(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance)
|
||||
if leafdecay_distance == nil then
|
||||
leafdecay_distance = 4
|
||||
end
|
||||
local apple_chances = {200, 180, 160, 120, 40}
|
||||
local stick_chances = {50, 45, 30, 35, 10}
|
||||
|
||||
local function get_drops(fortune_level)
|
||||
local drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {sapling},
|
||||
rarity = sapling_chances[fortune_level + 1] or sapling_chances[fortune_level]
|
||||
},
|
||||
{
|
||||
items = {"mcl_core:stick 1"},
|
||||
rarity = stick_chances[fortune_level + 1]
|
||||
},
|
||||
{
|
||||
items = {"mcl_core:stick 2"},
|
||||
rarity = stick_chances[fortune_level + 1]
|
||||
},
|
||||
}
|
||||
}
|
||||
if drop_apples then
|
||||
table.insert(drop.items, {
|
||||
items = {"mcl_core:apple"},
|
||||
rarity = apple_chances[fortune_level + 1]
|
||||
})
|
||||
end
|
||||
return drop
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_core:"..subname, {
|
||||
description = description,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 2,
|
||||
place_param2 = 1, -- Prevent leafdecay for placed nodes
|
||||
tiles = tiles,
|
||||
paramtype = "light",
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
|
||||
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
|
||||
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
|
||||
compostability = 30
|
||||
},
|
||||
drop = get_drops(0),
|
||||
_mcl_shears_drop = true,
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
|
||||
})
|
||||
end
|
||||
|
||||
local function register_sapling(subname, description, longdesc, tt_help, texture, selbox)
|
||||
minetest.register_node("mcl_core:"..subname, {
|
||||
description = description,
|
||||
_tt_help = tt_help,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.0,
|
||||
tiles = {texture},
|
||||
inventory_image = texture,
|
||||
wield_image = texture,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = selbox
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
plant = 1, sapling = 1, non_mycelium_plant = 1, attached_node = 1,
|
||||
deco_block = 1, dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
|
||||
destroy_by_lava_flow = 1, compostability = 30
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("stage", 0)
|
||||
end,
|
||||
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
|
||||
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if not node_below then return false end
|
||||
local nn = node_below.name
|
||||
return minetest.get_item_group(nn, "grass_block") == 1 or
|
||||
nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or
|
||||
nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt"
|
||||
end),
|
||||
node_placement_prediction = "",
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
||||
end
|
||||
|
||||
---------------------
|
||||
|
||||
register_tree_trunk("tree", S("Oak Wood"), S("Oak Bark"), S("The trunk of an oak tree."), "default_tree_top.png", "default_tree.png", "mcl_core:stripped_oak")
|
||||
register_tree_trunk("darktree", S("Dark Oak Wood"), S("Dark Oak Bark"), S("The trunk of a dark oak tree."), "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png", "mcl_core:stripped_dark_oak")
|
||||
register_tree_trunk("acaciatree", S("Acacia Wood"), S("Acacia Bark"), S("The trunk of an acacia."), "default_acacia_tree_top.png", "default_acacia_tree.png", "mcl_core:stripped_acacia")
|
||||
register_tree_trunk("sprucetree", S("Spruce Wood"), S("Spruce Bark"), S("The trunk of a spruce tree."), "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png", "mcl_core:stripped_spruce")
|
||||
register_tree_trunk("birchtree", S("Birch Wood"), S("Birch Bark"), S("The trunk of a birch tree."), "mcl_core_log_birch_top.png", "mcl_core_log_birch.png", "mcl_core:stripped_birch")
|
||||
register_tree_trunk("jungletree", S("Jungle Wood"), S("Jungle Bark"), S("The trunk of a jungle tree."), "default_jungletree_top.png", "default_jungletree.png", "mcl_core:stripped_jungle")
|
||||
|
||||
register_stripped_trunk("stripped_oak", S("Stripped Oak Log"), S("Stripped Oak Wood"), S("The stripped trunk of an oak tree."), S("The stripped wood of an oak tree."), "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png")
|
||||
register_stripped_trunk("stripped_acacia", S("Stripped Acacia Log"), S("Stripped Acacia Wood"), S("The stripped trunk of an acacia tree."), S("The stripped wood of an acacia tree."), "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png")
|
||||
register_stripped_trunk("stripped_dark_oak", S("Stripped Dark Oak Log"), S("Stripped Dark Oak Wood"), S("The stripped trunk of a dark oak tree."), S("The stripped wood of a dark oak tree."), "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png")
|
||||
register_stripped_trunk("stripped_birch", S("Stripped Birch Log"), S("Stripped Birch Wood"), S("The stripped trunk of a birch tree."), S("The stripped wood of a birch tree."), "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png")
|
||||
register_stripped_trunk("stripped_spruce", S("Stripped Spruce Log"), S("Stripped Spruce Wood"), S("The stripped trunk of a spruce tree."), S("The stripped wood of a spruce tree."), "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png")
|
||||
register_stripped_trunk("stripped_jungle", S("Stripped Jungle Log"), S("Stripped Jungle Wood"), S("The stripped trunk of a jungle tree."), S("The stripped wood of a jungle tree."),"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png")
|
||||
register_wooden_planks("wood", S("Oak Wood Planks"), {"default_wood.png"})
|
||||
register_wooden_planks("darkwood", S("Dark Oak Wood Planks"), {"mcl_core_planks_big_oak.png"})
|
||||
register_wooden_planks("junglewood", S("Jungle Wood Planks"), {"default_junglewood.png"})
|
||||
register_wooden_planks("sprucewood", S("Spruce Wood Planks"), {"mcl_core_planks_spruce.png"})
|
||||
register_wooden_planks("acaciawood", S("Acacia Wood Planks"), {"default_acacia_wood.png"})
|
||||
register_wooden_planks("birchwood", S("Birch Wood Planks"), {"mcl_core_planks_birch.png"})
|
||||
|
||||
|
||||
register_sapling("sapling", S("Oak Sapling"),
|
||||
S("When placed on soil (such as dirt) and exposed to light, an oak sapling will grow into an oak after some time."),
|
||||
S("Needs soil and light to grow"),
|
||||
"default_sapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16})
|
||||
register_sapling("darksapling", S("Dark Oak Sapling"),
|
||||
S("Dark oak saplings can grow into dark oaks, but only in groups. A lonely dark oak sapling won't grow. A group of four dark oak saplings grows into a dark oak after some time when they are placed on soil (such as dirt) in a 2×2 square and exposed to light."),
|
||||
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings required"),
|
||||
"mcl_core_sapling_big_oak.png", {-5/16, -0.5, -5/16, 5/16, 7/16, 5/16})
|
||||
register_sapling("junglesapling", S("Jungle Sapling"),
|
||||
S("When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. When there are 4 jungle saplings in a 2×2 square, they will grow to a huge jungle tree."),
|
||||
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"),
|
||||
"default_junglesapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16})
|
||||
register_sapling("acaciasapling", S("Acacia Sapling"),
|
||||
S("When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia after some time."),
|
||||
S("Needs soil and light to grow"),
|
||||
"default_acacia_sapling.png", {-5/16, -0.5, -5/16, 5/16, 4/16, 5/16})
|
||||
register_sapling("sprucesapling", S("Spruce Sapling"),
|
||||
S("When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce after some time. When there are 4 spruce saplings in a 2×2 square, they will grow to a huge spruce."),
|
||||
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"),
|
||||
"mcl_core_sapling_spruce.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
|
||||
register_sapling("birchsapling", S("Birch Sapling"),
|
||||
S("When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch after some time."),
|
||||
S("Needs soil and light to grow"),
|
||||
"mcl_core_sapling_birch.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
|
||||
|
||||
|
||||
register_leaves("leaves", S("Oak Leaves"), S("Oak leaves are grown from oak trees."), {"default_leaves.png"}, "mcl_core:sapling", true, {20, 16, 12, 10})
|
||||
register_leaves("darkleaves", S("Dark Oak Leaves"), S("Dark oak leaves are grown from dark oak trees."), {"mcl_core_leaves_big_oak.png"}, "mcl_core:darksapling", true, {20, 16, 12, 10})
|
||||
register_leaves("jungleleaves", S("Jungle Leaves"), S("Jungle leaves are grown from jungle trees."), {"default_jungleleaves.png"}, "mcl_core:junglesapling", false, {40, 26, 32, 24, 10})
|
||||
register_leaves("acacialeaves", S("Acacia Leaves"), S("Acacia leaves are grown from acacia trees."), {"default_acacia_leaves.png"}, "mcl_core:acaciasapling", false, {20, 16, 12, 10})
|
||||
register_leaves("spruceleaves", S("Spruce Leaves"), S("Spruce leaves are grown from spruce trees."), {"mcl_core_leaves_spruce.png"}, "mcl_core:sprucesapling", false, {20, 16, 12, 10})
|
||||
register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from birch trees."), {"mcl_core_leaves_birch.png"}, "mcl_core:birchsapling", false, {20, 16, 12, 10})
|
||||
|
||||
|
||||
|
||||
-- Node aliases
|
||||
|
||||
minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree")
|
||||
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")
|
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 990 B |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 710 B |
Before Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 191 B |