added base_genes to bee_types and now genes get printed on bee usage
This commit is contained in:
parent
b48704226b
commit
2769aa978e
31
forestry_bees/bee_genes.lua
Normal file
31
forestry_bees/bee_genes.lua
Normal file
@ -0,0 +1,31 @@
|
||||
forestry_bees.bee_base_genes = {}
|
||||
|
||||
local function register_base_gene(bee_type, base_genes)
|
||||
forestry_bees.bee_base_genes[bee_type] = base_genes
|
||||
end
|
||||
|
||||
function forestry_bees.return_all_genes_double(bee_type)
|
||||
local output = {type_gene = {bee_type, bee_type}}
|
||||
for key,value in pairs(forestry_bees.bee_base_genes[bee_type]) do
|
||||
output[key] = {value, value}
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
function forestry_bees.return_all_genes(bee_type)
|
||||
local output = {type_gene = bee_type}
|
||||
for key,value in pairs(forestry_bees.bee_base_genes[bee_type]) do
|
||||
output[key] = value
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
function forestry_bees.return_genes(bee_type)
|
||||
return forestry_bees.bee_base_genes[bee_type]
|
||||
end
|
||||
register_base_gene("forest",{fertility = 3, lifespan = 10})
|
||||
register_base_gene("meadow",{fertility = 2, lifespan = 10})
|
||||
register_base_gene("common",{fertility = 2, lifespan = 10})
|
||||
register_base_gene("cultivated",{fertility = 2, lifespan = 10})
|
||||
register_base_gene("noble",{fertility = 2, lifespan = 30})
|
||||
register_base_gene("diligent",{fertility = 2, lifespan = 30})
|
@ -3,6 +3,7 @@ forestry_bees = {}
|
||||
forestry_bees.settings = Settings(minetest.get_modpath("forestry_bees") .. "/forestry_bees.conf")
|
||||
|
||||
dofile(minetest.get_modpath("forestry_bees") .. "/helper.lua")
|
||||
dofile(minetest.get_modpath("forestry_bees") .. "/bee_genes.lua")
|
||||
dofile(minetest.get_modpath("forestry_bees") .. "/register.lua")
|
||||
dofile(minetest.get_modpath("forestry_bees") .. "/bee_drops.lua")
|
||||
dofile(minetest.get_modpath("forestry_bees") .. "/mutations.lua")
|
||||
|
@ -9,7 +9,8 @@ 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:"..minetest.deserialize(meta:get_string("genes"))["type_gene"][1]..", Inactive:"..minetest.deserialize(meta:get_string("genes"))["type_gene"][2])
|
||||
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)
|
||||
@ -55,8 +56,8 @@ minetest.register_node("forestry_bees:forest_beehive", {
|
||||
drop = {
|
||||
max_items = 3,
|
||||
items = {
|
||||
{tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("princess", {type_gene = {"forest","forest"}, fertility = {2,2}, lifespan = {10,10}})}},
|
||||
{tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", {type_gene = {"forest","forest"}, fertility = {2,2}, lifespan = {10,10}})}},
|
||||
{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"}}
|
||||
}
|
||||
}
|
||||
@ -77,8 +78,8 @@ minetest.register_node("forestry_bees:meadow_beehive", {
|
||||
drop = {
|
||||
max_items = 3,
|
||||
items = {
|
||||
{tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("princess", {type_gene = {"meadow","meadow"}, fertility = {3,3}, lifespan = {10,10} })}},
|
||||
{tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", {type_gene = {"meadow","meadow"}, fertility = {3,3}, lifespan = {10,10}})}},
|
||||
{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"}}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user