Allow age to override during initialization.

This commit is contained in:
iliekprogrammar 2021-03-31 17:38:38 +08:00
parent ccea673dcc
commit bfff643ff4

View file

@ -277,9 +277,10 @@ function kelp.init_age(pos, age, pos_hash, meta)
local meta = meta or mt_get_meta(pos) local meta = meta or mt_get_meta(pos)
local age = age local age = age
if not meta:contains("mcl_ocean:kelp_age") then if age then
-- NOTE: age param can only replace initial age roll. kelp.store_age(age, pos, pos_hash)
age = age or kelp.roll_init_age() elseif not meta:contains("mcl_ocean:kelp_age") then
age = kelp.roll_init_age()
kelp.store_age(age, pos, pos_hash) kelp.store_age(age, pos, pos_hash)
else else
age = meta:get_int("mcl_ocean:kelp_age") age = meta:get_int("mcl_ocean:kelp_age")