Ludeon Forums

Ludeon Forums

  • August 11, 2022, 02:21:28 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Is it possible to tell if a pawn is being carried by another pawn?  (Read 730 times)

svend

  • Muffalo
  • *
  • Posts: 13
  • Refugee
    • View Profile

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...
Logged

RawCode

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1987
  • Refugee
    • View Profile
Re: Is it possible to tell if a pawn is being carried by another pawn?
« Reply #1 on: October 08, 2021, 06:04:48 AM »

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
Logged

svend

  • Muffalo
  • *
  • Posts: 13
  • Refugee
    • View Profile
Re: Is it possible to tell if a pawn is being carried by another pawn?
« Reply #2 on: October 12, 2021, 04:26:02 PM »

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:

Code: [Select]
<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
Logged

RawCode

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1987
  • Refugee
    • View Profile
Re: Is it possible to tell if a pawn is being carried by another pawn?
« Reply #3 on: October 20, 2021, 05:08:45 PM »

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

JT

  • Colonist
  • ***
  • Posts: 136
  • Big Whoop
    • View Profile
Re: Is it possible to tell if a pawn is being carried by another pawn?
« Reply #4 on: October 24, 2021, 09:21:03 AM »

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).
Logged