diff --git a/forestry_bees/apiary.lua b/forestry_bees/apiary.lua index ea63930..0eb6e97 100644 --- a/forestry_bees/apiary.lua +++ b/forestry_bees/apiary.lua @@ -105,9 +105,8 @@ local function apiary_node_timer(pos,elapsed) local can_breed, can_live local actionable - local breedtime = 1 --hardcoded for now - local lifetime = 10 - local needed_time = 200 --just so that the formspecs doesnt make an error + local breedtime = 1 + local needed_time = 1 --just so that the formspecs doesnt make an error while elapsed > 0 and update do update = false @@ -125,7 +124,7 @@ local function apiary_node_timer(pos,elapsed) --if actionable check if things are ready if actionable then --ternary expression if can_breed it evals to breedtime else lifetime - needed_time = (can_breed and {breedtime} or {lifetime})[1] + needed_time = (can_breed and {breedtime} or { tonumber(forestry_bees.settings:get("lifespan_multiplier")) * minetest.deserialize(monarchlist[1]:get_meta():get_string("genes"))["lifespan"][1]})[1] el = math.min(el, needed_time - src_time) src_time = src_time + el diff --git a/forestry_bees/forestry_bees.conf b/forestry_bees/forestry_bees.conf new file mode 100644 index 0000000..052b2b6 --- /dev/null +++ b/forestry_bees/forestry_bees.conf @@ -0,0 +1,2 @@ +--base multiplier for bee lifespan, default value is 27.5 to have parity with MC-forestry +lifespan_multiplier = 1.0 diff --git a/forestry_bees/init.lua b/forestry_bees/init.lua index 2a74b11..f1921e3 100644 --- a/forestry_bees/init.lua +++ b/forestry_bees/init.lua @@ -1,5 +1,6 @@ --definitions that can be used around 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") .. "/register.lua") diff --git a/forestry_bees/register.lua b/forestry_bees/register.lua index 1cefd4d..b849dc2 100644 --- a/forestry_bees/register.lua +++ b/forestry_bees/register.lua @@ -55,8 +55,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}})}}, - {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", {type_gene = {"forest","forest"}, fertility = {2,2}})}}, + {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:honey_comb"}} } } @@ -77,8 +77,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}})}}, - {tool_groups = {"scoop_tool"}, rarity = 2, items = {forestry_bees.Bee("drone", {type_gene = {"meadow","meadow"}, fertility = {3,3}})}}, + {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:honey_comb"}} } }