diff --git a/forestry_bees/apiary.lua b/forestry_bees/apiary.lua index 0eb6e97..25a5997 100644 --- a/forestry_bees/apiary.lua +++ b/forestry_bees/apiary.lua @@ -129,7 +129,7 @@ local function apiary_node_timer(pos,elapsed) src_time = src_time + el if can_live then --chance to drop honeycomb - local drops = forestry_bees.calculate_drop(minetest.deserialize(monarchlist[1]:get_meta():get_string("genes"))["type_gene"][1]) + local drops = forestry_bees.calculate_drop(monarchlist[1]) if (not (next(drops) == nil)) and inv:get_size("dst") - forestry_bees.stacks_in_inv(inv,"dst") >= #drops then for _,drop in pairs(drops) do inv:add_item("dst",drop) diff --git a/forestry_bees/bee_genes.lua b/forestry_bees/bee_genes.lua index 177457d..728b775 100644 --- a/forestry_bees/bee_genes.lua +++ b/forestry_bees/bee_genes.lua @@ -23,9 +23,9 @@ 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}) \ No newline at end of file +register_base_gene("forest",{production = 0.3, fertility = 3, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) +register_base_gene("meadow",{production = 0.3, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) +register_base_gene("common",{production = 0.6, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) +register_base_gene("cultivated",{production = 1.2, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) +register_base_gene("noble",{production = 0.6, fertility = 2, lifespan = 30, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) +register_base_gene("diligent",{production = 0.6, fertility = 2, lifespan = 30, nocturnal = false, cave = false, flyer = false, flower = "flowers"}) \ No newline at end of file diff --git a/forestry_bees/helper.lua b/forestry_bees/helper.lua index dcb1717..4eb40f4 100644 --- a/forestry_bees/helper.lua +++ b/forestry_bees/helper.lua @@ -16,11 +16,12 @@ function forestry_bees.Bee(bee_type,genes) return itemstack end -function forestry_bees.calculate_drop(bee_type) --later we will take as input also the bee_prod_speed and the item_modifier (for frames) - local possible_drops = forestry_bees.bee_drops[bee_type] --this gets us a table +function forestry_bees.calculate_drop(bee) + local genes = minetest.deserialize(bee:get_meta():get_string("genes")) + local possible_drops = forestry_bees.bee_drops[genes["type_gene"][1]] --this gets us a table local out_table = {} for drop,chance in pairs(possible_drops) do - if math.random() < chance then + if math.random() < chance * genes["production"][1] then --the prob of getting something is P = (base chance from bee_drops) * (item modifier (frames and stuff)) * (bee production gene) table.insert(out_table,ItemStack(drop)) end end