dfcaverns/plants.lua

102 lines
2.6 KiB
Lua
Raw Normal View History

2017-03-08 07:50:58 +01:00
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-----------------------------------------------------------------------
-- Plants
2017-03-11 21:29:06 +01:00
minetest.register_node("dfcaverns:dead_fungus", {
description = S("Dead Fungus"),
drawtype = "plantlike",
tiles = {"dfcaverns_dead_fungus.png"},
inventory_image = "dfcaverns_dead_fungus.png",
paramtype = "light",
walkable = false,
buildable_to = true,
2017-03-16 09:18:32 +01:00
groups = {flammable=4, oddly_breakable_by_hand=1, plant = 1},
2017-03-11 21:29:06 +01:00
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
},
})
2017-03-16 09:18:32 +01:00
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:dead_fungus",
burntime = 2
})
2017-03-11 21:29:06 +01:00
-- not DF canon
minetest.register_node("dfcaverns:cavern_fungi", {
description = S("Cavern Fungi"),
drawtype = "plantlike",
tiles = {"dfcaverns_fungi.png"},
inventory_image = "dfcaverns_fungi.png",
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {flammable=4, oddly_breakable_by_hand=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
},
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:cavern_fungi",
burntime = 2
})
-----------------------------------------------------------------------------------------
2017-03-16 19:40:49 +01:00
dfcaverns.register_seed = function(name, description, image, stage_one)
2017-03-16 09:18:32 +01:00
local def = {
2017-03-12 04:22:03 +01:00
description = description,
tiles = {image},
inventory_image = image,
drawtype = "signlike",
2017-03-16 09:18:32 +01:00
paramtype2 = "wallmounted",
2017-03-12 04:22:03 +01:00
groups = {flammable=4, oddly_breakable_by_hand=1},
2017-03-16 09:18:32 +01:00
_dfcaverns_next_stage = stage_one,
2017-03-12 04:22:03 +01:00
paramtype = "light",
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
2017-03-16 09:18:32 +01:00
}
minetest.register_node("dfcaverns:"..name, def)
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:"..name,
burntime = 1
2017-03-12 04:22:03 +01:00
})
end
2017-03-16 19:40:49 +01:00
dfcaverns.register_grow_abm = function(names, interval, chance)
2017-03-16 09:18:32 +01:00
minetest.register_abm({
nodenames = names,
interval = interval,
chance = chance,
action = function(pos, node)
pos.y = pos.y-1
if minetest.get_node(pos).name ~= "farming:soil_wet" then
return
end
local node_def = minetest.registered_nodes[node.name]
local next_stage = node_def._dfcaverns_next_stage
if next_stage then
local next_def = minetest.registered_nodes[next_stage]
pos.y = pos.y+1
minetest.swap_node(pos, {name=next_stage, param2 = next_def.place_param2 or node.param2})
end
end
})
end