warning untested code ahead:
function getSlaugthered()
local ret={}
for _, d in ipairs(df.glboal.world.deaths.all) do
if d.death_cause==df.death_type.SLAUGHTER then
table.insert(ret,d)
end
end
return ret
end
for other one use: "df.misc_trait_type.RevertWildTimer" not sure on details though...
Um, so how would I go about using this? I'm asking in more of a general sense, I'm looking for the death type in general, slaughter was just an example.
Basically I'm trying to make a system that goes over your fort's history and judges how nice you are to your pets, and make it easier or harder to attract and train animals based on that. So (for example) if an animal is killed by invaders that's bad, if it dies of starvation that's worse, and if you slaughter it that's the worst. I know how to iterate over all the animals in the fort's history and check if they're dead, but how would I check the cause of their death?
EDIT: Oh, I found the problem - slaughtered animals don't show up in the death list, probably because they don't run the usual process of go missing - found dead. Well, then I could just check and see if they were marked for slaughter at the time of death instead.