local function Bee(beename,active_gene,inactive_gene) local itemstack = ItemStack({name = beename}) itemstack:get_meta():set_string("active_gene",active_gene) itemstack:get_meta():set_string("inactive_gene",inactive_gene) return itemstack end local function makebeetexture(body1,body2,outline,color,ratio) return body1.."^("..body1.."^[makealpha:0,0,0^[colorize:"..color..":"..ratio..")^"..body2.."^("..outline.."^[colorize:"..color..":"..ratio..")" 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)..", Active:"..meta:get_string("active_gene")..", Inactive:"..meta:get_string("inactive_gene")) end local function capitalize(s) return s:sub(1,1):upper()..s:sub(2) end local function register_bee(name, color, color_ratio) minetest.register_craftitem("forestry_bees:"..name.."_princess", { description = capitalize(name).." Princess", inventory_image = makebeetexture("body1.png", "princess.body2.png", "princess.outline.png",color,color_ratio), 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",color,color_ratio), 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",color,color_ratio), 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 = {Bee("forestry_bees:forest_princess","forest","forest")}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {Bee("forestry_bees:forest_drone","forest","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 = {Bee("forestry_bees:meadow_princess","meadow","meadow")}}, {tool_groups = {"scoop_tool"}, rarity = 2, items = {Bee("forestry_bees:meadow_drone","meadow","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","#19d0ec","255") register_bee("meadow","#ef131e","255") register_bee("common","#b2b2b2","255") minetest.register_craftitem("forestry_bees:honey_comb", { description = "Honey Comb", inventory_image = "(bee_combs.0.png^[colorize:Yellow:100)^(bee_combs.1.png^[colorize:Yellow:120)" })