Skip to content

Commit

Permalink
use library function for getting the caste raw
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Sep 8, 2024
1 parent a6cdf8c commit 0471d9e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions rejuvenate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0471d9e

Please sign in to comment.