From 0471d9ed59d407f188cb8d55b01853402164629d Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 8 Sep 2024 14:11:27 -0700 Subject: [PATCH] use library function for getting the caste raw --- rejuvenate.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rejuvenate.lua b/rejuvenate.lua index 9952be746..04c79cdf5 100644 --- a/rejuvenate.lua +++ b/rejuvenate.lua @@ -7,12 +7,9 @@ local DEFAULT_OLD_AGE = 160 local ANY_BABY = df.global.world.units.other.ANY_BABY local function get_caste_misc(unit) - local cre = df.creature_raw.find(unit.race) - if not cre then return end - if unit.caste < 0 or unit.caste >= #cre.caste then - return - end - return cre.caste[unit.caste].misc + local craw = dfhack.units.getCasteRaw(unit) + if not craw then return end + return craw.misc end local function get_adult_age(misc)