Add cocoa

master
Wuzzy 2020-11-05 15:45:30 +01:00
parent 4b76db3536
commit 6d5fed8753
10 changed files with 85 additions and 2 deletions

View File

@ -118,6 +118,12 @@ minetest.register_craft({
output = "dye:green 4",
recipe = {"hades_core:cactus"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:brown",
recipe = {"hades_trees:cocoa_bean"},
})
-- Mix recipes
-- Just mix everything to everything somehow sanely

View File

@ -85,6 +85,12 @@ hades_trees.register_leaves = function(id, def)
end
hades_trees.register_fruit = function(id, def)
local sat = def.satiation
local on_use, food
if def.satiation then
food = 2
on_use = minetest.item_eat(sat)
end
minetest.register_node("hades_trees:"..id, {
description = def.description,
drawtype = def.drawtype,
@ -98,8 +104,8 @@ hades_trees.register_fruit = function(id, def)
type = "fixed",
fixed = def.selbox,
},
groups = {dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1,food=2,eatable=def.satiation},
on_use = minetest.item_eat(def.satiation),
groups = {dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1,food=food,eatable=sat},
on_use = on_use,
sounds = hades_sounds.node_sound_leaves_defaults(),
place_param2 = 1,
})

View File

@ -0,0 +1,34 @@
local S = minetest.get_translator("hades_trees")
hades_trees.register_sapling("cocoa_sapling", {
description = S("Cocoa Tree Sapling"),
image = "hades_trees_cocoa_sapling.png",
selbox = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3},
})
hades_trees.register_fruit("cocoa_pod", {
description = S("Cocoa Pod"),
drawtype = "plantlike",
-- TODO: Better image needed!
image = "hades_trees_cocoa_pod.png",
selbox = {-0.25, -7/16, -0.25, 0.25, 0.5, 0.25},
})
minetest.register_craftitem("hades_trees:cocoa_bean", {
description = S("Cocoa Bean"),
inventory_image = "hades_trees_cocoa_bean.png",
wield_image = "hades_trees_cocoa_bean.png",
})
minetest.register_craft({
output = "hades_trees:cocoa_bean 4",
recipe = {{"hades_trees:cocoa_pod"}},
})
minetest.register_abm({
nodenames = {"hades_trees:cocoa_sapling"},
interval = 60,
chance = 20,
action = function(pos, node)
hades_trees.generate_cocoatree(pos)
end
})

View File

@ -294,6 +294,8 @@ minetest.register_craft({
}
})
-- TODO: Cocoa sapling
-- Fuel
minetest.register_craft({
type = "fuel",

View File

@ -18,6 +18,8 @@ function hades_trees.grow_sapling(pos, check_light)
hades_trees.generate_bananatree(pos, check_light)
elseif node.name == "hades_trees:orange_sapling" then
hades_trees.generate_orangetree(pos, check_light)
elseif node.name == "hades_trees:cocoa_sapling" then
hades_trees.generate_cocoatree(pos, check_light)
end
end
@ -174,6 +176,24 @@ function hades_trees.generate_orangetree(pos, check_light, trunk, leaves, underg
hades_trees.generate_tree(pos, check_light, trunk, leaves, underground, replacements)
end
-- Cocoa Tree
-- TODO: Customize cocoa tree
function hades_trees.generate_cocoatree(pos, check_light, trunk, leaves, underground, replacements)
if not trunk then
trunk = "hades_trees:jungle_tree"
end
if not leaves then
leaves = "hades_trees:jungle_leaves"
end
if not underground then
underground = {"hades_core:dirt", "hades_core:dirt_with_grass"}
end
if not replacements then
replacements = {["hades_trees:cocoa"]=12}
end
hades_trees.generate_tree(pos, check_light, trunk, leaves, underground, replacements)
end
-- Pale Tree
function hades_trees.generate_paletree(pos, check_light, trunk, leaves, underground)
if not trunk then

View File

@ -11,6 +11,7 @@ dofile(minetest.get_modpath("hades_trees").."/jungle.lua")
dofile(minetest.get_modpath("hades_trees").."/cjtree.lua")
dofile(minetest.get_modpath("hades_trees").."/banana.lua")
dofile(minetest.get_modpath("hades_trees").."/orange.lua")
dofile(minetest.get_modpath("hades_trees").."/cocoa.lua")
dofile(minetest.get_modpath("hades_trees").."/wood.lua")
dofile(minetest.get_modpath("hades_trees").."/crafting.lua")

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

View File

@ -179,3 +179,17 @@ refruit.add_refruit("banana", {
flower_selbox = {-0.1875, -0.4375, -0.1875, 0.1875, 0.25, 0.1875},
})
refruit.add_refruit("cocoa", {
fruit_itemstring = "hades_trees:cocoa_pod",
bud_description = S("Cocoa Bud"),
bud_tt = S("Grows to a Cocoa Flower").."\n"..surv.."\n"..S("Needs Common Jungle Leaves to grow"),
flower_description = S("Cocoa Flower"),
flower_tt = S("Grows to Cocoa").."\n"..surv.."\n"..S("Needs Common Jungle Leaves to grow"),
bud_interval = 35,
bud_chance = 10,
flower_interval = 34,
flower_chance = 60,
neighbors = {"hades_trees:jungle_leaves"},
bud_selbox = {-0.1875, -0.25, -0.1875, 0.1875, 0.375, 0.1875},
flower_selbox = {-0.1875, -0.1875, -0.1875, 0.1875, 0.5, 0.1875},
})