added all base genes, also now production is tied to a bee production gene
This commit is contained in:
parent
1d3e8470b6
commit
30cf5b1c4f
@ -129,7 +129,7 @@ local function apiary_node_timer(pos,elapsed)
|
|||||||
src_time = src_time + el
|
src_time = src_time + el
|
||||||
|
|
||||||
if can_live then --chance to drop honeycomb
|
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
|
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
|
for _,drop in pairs(drops) do
|
||||||
inv:add_item("dst",drop)
|
inv:add_item("dst",drop)
|
||||||
|
@ -23,9 +23,9 @@ end
|
|||||||
function forestry_bees.return_genes(bee_type)
|
function forestry_bees.return_genes(bee_type)
|
||||||
return forestry_bees.bee_base_genes[bee_type]
|
return forestry_bees.bee_base_genes[bee_type]
|
||||||
end
|
end
|
||||||
register_base_gene("forest",{fertility = 3, lifespan = 10})
|
register_base_gene("forest",{production = 0.3, fertility = 3, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
||||||
register_base_gene("meadow",{fertility = 2, lifespan = 10})
|
register_base_gene("meadow",{production = 0.3, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
||||||
register_base_gene("common",{fertility = 2, lifespan = 10})
|
register_base_gene("common",{production = 0.6, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
||||||
register_base_gene("cultivated",{fertility = 2, lifespan = 10})
|
register_base_gene("cultivated",{production = 1.2, fertility = 2, lifespan = 10, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
||||||
register_base_gene("noble",{fertility = 2, lifespan = 30})
|
register_base_gene("noble",{production = 0.6, fertility = 2, lifespan = 30, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
||||||
register_base_gene("diligent",{fertility = 2, lifespan = 30})
|
register_base_gene("diligent",{production = 0.6, fertility = 2, lifespan = 30, nocturnal = false, cave = false, flyer = false, flower = "flowers"})
|
@ -16,11 +16,12 @@ function forestry_bees.Bee(bee_type,genes)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
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)
|
function forestry_bees.calculate_drop(bee)
|
||||||
local possible_drops = forestry_bees.bee_drops[bee_type] --this gets us a table
|
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 = {}
|
local out_table = {}
|
||||||
for drop,chance in pairs(possible_drops) do
|
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))
|
table.insert(out_table,ItemStack(drop))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user