DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.86k stars 468 forks source link

`rejuvenate --force` needs to break mother/infant rider relationship #4894

Closed ab9rf closed 1 week ago

ab9rf commented 2 weeks ago

when rejuvenate --force is used, the script changes the occupation of infants that are aged up but does not break the mother/infant "rider" relationship causing mothers to perpetually attempt to pick up their abandoned "baby" (who is now an adult)

related discord discussion

ab9rf commented 2 weeks ago

further update: on research, the problem may be that the aged-up babies are not being removed from the ANY_BABY categorized unit subvector when they're forcibly aged up. the game periodically checks to see if, for any given unit M, there is a unit B on this vector for whom M is the unit's Mother but not RiderMount (in M's relationship_ids table), then if M can path to B, M will cancel whatever she is doing and initiate a SeekInfant job for B, regardless as to whether B is still a baby or not

thus, when aging up a baby to not-baby, it's necessary to:

it's probably also a good idea to set the former baby's mount_type to STANDARD

p.s. code ref for this is unitst::evaluate_orders_high_priority, which in 50.13 steam (win64) is at 0x140743160, specifically starting at or about 0x140743683

ahlove3 commented 2 weeks ago

Commenting to say I'm taking a look at this

ahlove3 commented 2 weeks ago

Submitted a PR

ab9rf commented 2 weeks ago

we should consider centralizing age transition emulation in either a lua library or in the core