added bee lifespan and config file

This commit is contained in:
StochasticMouse 2024-10-09 14:26:31 +02:00
parent eeddae8e5d
commit b48704226b
4 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -0,0 +1,2 @@
--base multiplier for bee lifespan, default value is 27.5 to have parity with MC-forestry
lifespan_multiplier = 1.0

View File

@ -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")

View File

@ -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"}}
}
}