Is it possible to tell if a pawn is being carried by another pawn?

Started by svend, October 07, 2021, 04:25:44 PM

Previous topic - Next topic

svend

I know that you can use the pawn.carryTracker to check what a pawn is carrying, but is it possible to check if a pawn itself is being carried by another pawn?

I guess I could ask for all other pawns and check all of them to see if they're carrying the pawn in question, but that would be rather inefficient...

RawCode

carry some pawn
save game
not carry same pawn
save game
open both saves in text editor
navigate to record related to specific pawn
compare records

post result here

svend

Thank you for your reply! :)

I found a different solution to what I was trying to do at the time, but since this is still an interesting question I tried your save game comparison idea to see what I'd find :)

I found this in the reservationManager's reservations list, which would be one approach:


<li>
<claimant>Thing_BabyDragonThing198133</claimant>
<job>Job_330492</job>
<target>Thing_Human43465</target>
<maxPawns>1</maxPawns>
<stackCount>-1</stackCount>
</li>


However, by doing lots of saves just up until the pawn is (downed and) picked up, it seems this gets set slightly before the pickup, so might not be usable for this... so as far as I can tell from trawling the save games, the best and most reliable option would be to track through the carry trackers of all (relevant) pawns. This wouldn't be infeasible in my case, as only certain types of pawns are relevant... but as mentioned, I found a different solution, using the AddFinishAction on the carrying toil of the carrier (to remove a paralysis hediff I'm using to allow the carry of an unharmed pawn).

Cheers,
Svend

RawCode

search better
as state of pawn itself changes when it is carried

JT

If you're stuck, what you want is the pawn's holdingOwner.

Digging around with ILSpy is probably a better bet than relying on the save data, since not all runtime data is saved in a format that is identical to the guts of the script engine, the same way that a photograph doesn't tell you anything about the camera that made it.

Reservations are for jobs, not carrying, and definitely can't be relied on (at least, not all the time -- some jobs, like tending patients, do reserve the carried medicine all the way through).