mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Init age on plant so not all kelp grow to top of ocean
This commit is contained in:
parent
6f7505b6c6
commit
a1f10205f6
@ -467,7 +467,10 @@ function kelp.surface_on_timer(pos)
|
|||||||
|
|
||||||
local age = retrieve_age(pos)
|
local age = retrieve_age(pos)
|
||||||
if kelp.is_age_growable(age) then
|
if kelp.is_age_growable(age) then
|
||||||
|
minetest.log("age growable: ".. tostring(age) .. ", pos: ".. mt_pos_to_string(pos))
|
||||||
kelp.next_grow(age+1, pos, node, pos_hash)
|
kelp.next_grow(age+1, pos, node, pos_hash)
|
||||||
|
else
|
||||||
|
minetest.log("age not: ".. tostring(age) .. ", pos: ".. mt_pos_to_string(pos))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -599,12 +602,14 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing)
|
|||||||
|
|
||||||
-- Initialize age and timer when it's planted on a new surface.
|
-- Initialize age and timer when it's planted on a new surface.
|
||||||
--local pos_hash = mt_hash_node_position(pos_under)
|
--local pos_hash = mt_hash_node_position(pos_under)
|
||||||
|
local init_age = kelp.roll_init_age()
|
||||||
|
|
||||||
if new_surface then
|
if new_surface then
|
||||||
kelp.init_age(pos_under, nil)
|
kelp.init_age(pos_under, init_age)
|
||||||
--kelp.init_timer(pos_under, pos_hash)
|
--kelp.init_timer(pos_under, pos_hash)
|
||||||
else
|
else
|
||||||
-- TODO needed?
|
-- TODO needed?
|
||||||
store_age(pos_under, kelp.roll_init_age())
|
store_age(pos_under, init_age)
|
||||||
--kelp.store_age(kelp.roll_init_age(), pos_under, pos_hash)
|
--kelp.store_age(kelp.roll_init_age(), pos_under, pos_hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -871,8 +876,8 @@ minetest.register_abm({
|
|||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Kelp growth",
|
label = "Kelp growth",
|
||||||
nodenames = { "group:kelp" },
|
nodenames = { "group:kelp" },
|
||||||
interval = 17, --17 target was 45
|
interval = 17, --17
|
||||||
chance = 28, -- 3 target was 12
|
chance = 28,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = kelp.surface_on_timer,
|
action = kelp.surface_on_timer,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user