local function capitalize(s) return s:sub(1,1):upper()..s:sub(2) end local function makebeetexture(body1,body2,outline,color1,color2) return body1.."^("..body1.."^[makealpha:0,0,0^[colorize:"..color1..":255)^"..body2.."^("..outline.."^[colorize:"..color2..":255)" end local function printbeestats(itemstack, user, pointed_thing) local meta = itemstack:get_meta() local name = itemstack:get_name() minetest.chat_send_player(user:get_player_name(), "Name: "..string.sub(string.match(name, ":.*"),2).."\nGenes:"..string.gsub(meta:get_string("genes"), "return", "") ) --minetest.chat_send_player(user:get_player_name(), "Name:"..string.sub(string.match(name, ":.*"),2)..", Active:"..minetest.deserialize(meta:get_string("genes"))["type_gene"][1]..", Inactive:"..minetest.deserialize(meta:get_string("genes"))["type_gene"][2]) end local function register_bee(name, color1, color2) minetest.register_craftitem("forestry_bees:"..name.."_princess", { description = capitalize(name).." Princess", inventory_image = makebeetexture("body1.png", "princess.body2.png", "princess.outline.png",color1,color2), on_use = printbeestats, groups = {bee_princess=1, bee_monarch=1}, }) minetest.register_craftitem("forestry_bees:"..name.."_drone", { description = capitalize(name).." Drone", inventory_image = makebeetexture("body1.png", "drone.body2.png", "drone.outline.png",color1,color2), on_use = printbeestats, groups = {bee_drone=1}, }) minetest.register_craftitem("forestry_bees:"..name.."_queen", { description = capitalize(name).." Queen", inventory_image = makebeetexture("body1.png", "queen.body2.png", "queen.outline.png",color1,color2), on_use = printbeestats, groups = {bee_queen=1, bee_monarch=1}, }) end --Here we register nodes minetest.register_node("forestry_bees:forest_beehive", { description = "Forest Beehive", tiles = { "forestry_bees_forest_beehive_top.png", "forestry_bees_forest_beehive_top.png", "forestry_bees_forest_beehive_side.png", "forestry_bees_forest_beehive_side.png", "forestry_bees_forest_beehive_side.png", "forestry_bees_forest_beehive_side.png", }, groups = {scoopy = 1}, diggable = true, drop = { max_items = 3, items = { {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("princess", forestry_bees.return_all_genes_double("forest"))}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", forestry_bees.return_all_genes_double("forest"))}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {"forestry_bees:honey_comb"}} } } }) minetest.register_node("forestry_bees:meadow_beehive", { description = "Meadow Beehive", tiles = { "forestry_bees_meadow_beehive_top.png", "forestry_bees_meadow_beehive_top.png", "forestry_bees_meadow_beehive_side.png", "forestry_bees_meadow_beehive_side.png", "forestry_bees_meadow_beehive_side.png", "forestry_bees_meadow_beehive_side.png", }, groups = {scoopy = 1}, diggable = true, drop = { max_items = 3, items = { {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("princess", forestry_bees.return_all_genes_double("meadow"))}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", forestry_bees.return_all_genes_double("meadow"))}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {"forestry_bees:honey_comb"}} } } }) minetest.register_tool("forestry_bees:scoop", { description = "Scoop", inventory_image = "forestry_bees_scoop.png", groups = {scoop_tool = 1}, tool_capabilities = { full_punch_interval = 1.5, max_drop_level = 1, groupcaps = { scoopy = { maxlevel = 1, uses = 10, times = { [1]=1, [2]=1, [3]=1 } }, }, }, }) register_bee("forest","#ffdc16","#19d0ec") register_bee("meadow","#ffdc16","#ef131e") register_bee("common","#ffdc16","#b2b2b2") register_bee("cultivated","#ffdc16","#5734ec") register_bee("noble","#ffdc16","#ec9a19") register_bee("diligent","#ffdc16","#c219ec") minetest.register_craftitem("forestry_bees:honey_comb", { description = "Honey Comb", groups = {comb = 1}, inventory_image = "(bee_combs.0.png^[colorize:#ffa12b:155)^(bee_combs.1.png^[colorize:#e8d56a:255)" }) minetest.register_craftitem("forestry_bees:dripping_comb", { description = "Dripping Comb", groups = {comb = 1}, inventory_image = "(bee_combs.0.png^[colorize:#ffff00:155)^(bee_combs.1.png^[colorize:#dc7613:255)" }) minetest.register_craftitem("forestry_bees:stringy_comb", { description = "Stringy Comb", groups = {comb = 1}, inventory_image = "(bee_combs.0.png^[colorize:#bda93e:155)^(bee_combs.1.png^[colorize:#c8be67:255)" })