mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?
Topywo wrote:mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?
Search for tree in your minetest/doc/lua_api.txt fot the use of L-system trees.
Edit: Typo.
I'm not sure about the tree, but you can look at the grass spawning code for use in the pumpkins: https://github.com/minetest/minetest_game/blob/master/mods/default/mapgen.luaGambit wrote:What's a good way to generate cocoa in jungle trees? I've thought of generating them using the ore structure I'm not to sure that's the best option to choose. I need the cocoa to generate even if the tree was grown through sapling.
Also, what would be the best method for generating pumpkins at well?
local function place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") <= 1 then
return
end
minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
minetest.register_craftitem("ethereal:mushroom_craftingitem", {
description = "Mushroom",
groups = {not_in_creative_inventory=1},
inventory_image = "mushroom.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "ethereal:mushroom_garden_1")
end,
})
for i=1,4 do
local drop = {
items = {
{items = {'ethereal:mushroom'},rarity=9-i},
{items = {'ethereal:mushroom 9'},rarity=18-i*2},
}
}
minetest.register_node("ethereal:mushroom_garden_"..i, {
drawtype = "plantlike",
tiles = {"ethereal_mushroom_garden_"..i..".png"},
paramtype = "light",
walkable = false,
drop = drop,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = {snappy=3,flammable=2,plant=1,mushroom=i,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
end
minetest.register_abm({
nodenames = {"group:mushroom"},
neighbors = {"group:soil"},
interval = 1,
chance = 10000,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "mushroom") == 4 then
return
end
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y+1
-- check light
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
-- grow
local height = minetest.get_item_group(node.name, "mushroom") + 1
minetest.set_node(pos, {name="ethereal:mushroom_garden_"..height})
end
})Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.
chance = 10000,
Topywo wrote:Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.
chance = 10000,
Did you try it with a chance = 1 or 2?
minetest.register_node("troll:troll", {
tiles = {"troll:troll.png"},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
})
minetest.register_node("troll:derp", {
tiles = {"troll:derp.png"},
groups = {snappy=1,choppy=3,oddly_breakable_by_han=2,flmmable=1},
})22:03:08: ERROR[main]: generateImage(): Could not load image "troll:troll.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:troll.png"
22:03:08: ERROR[main]: generateImage(): Could not load image "troll:derp.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:derp.png"paramat wrote:tiles should be "troll_troll.png" not "troll:troll.png" etc :)
chance = 10,minetest.register_craftitem("inlaid:inlaytool", {
description = "Inlay tool",
inventory_image = "inlaid_inlaytool.png",
})
minetest.register_craftitem("inlaid:chisel", {
description = "Chisel",
inventory_image = "inlaid_chisel.png",
})21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'Enke wrote:[...] and I get this error when I run it:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'
Can someone explain?
Enke wrote:This is all the code I have, and I have no clue why the error message says that the line is unfinished.
minetest.register_node("luna:oxygen", {
drawtype = "glasslike",
tiles = {"atmos.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
post_effect_color = {a=24, r=255, g=255, b=255},
groups = {not_in_creative_inventory=1, air_like=1}
})modsBr wrote:how can I make my own mod?
Users browsing this forum: No registered users and 17 guests