time data inserted
parent
f7a892a9f0
commit
bae3631b40
7
init.lua
7
init.lua
|
@ -38,6 +38,8 @@ minetest.register_abm({
|
|||
})
|
||||
]]
|
||||
|
||||
-- 1h in minetest == 72s reale Zeit
|
||||
|
||||
-- replacement LBM for pre-nodetimer plants
|
||||
minetest.register_lbm({
|
||||
name = ":farming:start_nodetimer_",
|
||||
|
@ -50,9 +52,10 @@ minetest.register_lbm({
|
|||
minetest.register_abm({
|
||||
nodenames="air",
|
||||
intervall=1,
|
||||
change=1000,
|
||||
change=100000,
|
||||
action = function(pos)
|
||||
print(dump(farming.calc_light(pos,{light_min=15})))
|
||||
-- print(dump(farming.calc_light(pos,{light_min=15})))
|
||||
print(os.clock(),minetest.get_timeofday())
|
||||
end
|
||||
})
|
||||
]]
|
||||
|
|
12
register.lua
12
register.lua
|
@ -596,8 +596,18 @@ farming.step_on_timer = function(pos, elapsed)
|
|||
end
|
||||
-- new timer needed?
|
||||
if def.next_step then
|
||||
-- using light at midday to increase or decrease growing time
|
||||
local wait_factor = math.max(0.75,def.light_min/minetest.get_node_light(pos,0.5))
|
||||
-- check for config values
|
||||
if meta:get_int("farming:lightamount") ~= nil then
|
||||
if farming.light_stat[def.light_min] ~= nil then
|
||||
local ls = farming.light_stat[def.light_min]
|
||||
if ls.amount ~= nil and meta:get_int("farming:lightamount") > 0 then
|
||||
-- time till next step is stretched. Less light means longer growing time
|
||||
wait_factor = ls.amount / meta:get_int("farming:lightamount")
|
||||
end
|
||||
end
|
||||
end
|
||||
-- using light at midday to increase or decrease growing time
|
||||
local wait_min = math.ceil(def.grow_time_min * wait_factor)
|
||||
local wait_max = math.ceil(def.grow_time_max * wait_factor)
|
||||
if wait_max <= wait_min then wait_max = 2*wait_min end
|
||||
|
|
Loading…
Reference in New Issue