From 45870760ed0e86eb0a3dbf15b1f2d12e749f951d Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 6 Nov 2023 17:07:31 -0800 Subject: [PATCH] reconcile histfig pregnancy stats --- catsplosion.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/catsplosion.lua b/catsplosion.lua index ccb9c5ec00..d1b301447d 100644 --- a/catsplosion.lua +++ b/catsplosion.lua @@ -1,3 +1,5 @@ +local datetime = require('datetime') + local world = df.global.world if not dfhack.isWorldLoaded() then @@ -68,6 +70,19 @@ for id in pairs(creatures) do female.pregnancy_caste = female.caste -- To handle female only species total_created = total_created + 1 end + local hf = df.historical_figure.find(female.histfig_id) + if not hf then goto continue end + if not hf.info then + hf.info = df.historical_figure_info:new() + end + if not hf.info.wounds then + hf.info.wounds = df.historical_figure_info.T_wounds:new() + end + local dt = datetime.DateTime.now() + dt:addTicks(female.pregnancy_timer) + local wounds = hf.info.wounds + wounds.childbirth_year, wounds.childbirth_ticks = dt:getYears() + ::continue:: end end