Ludeon Forums

RimWorld => Mods => Help => Topic started by: BBream on April 20, 2015, 11:45:09 PM

Title: How can I bypass holder.owner's error checking?
Post by: BBream on April 20, 2015, 11:45:09 PM
Hi.

I'm looking for way to fix my mod's bug. Thing has the holder for knowing position if it is in container.
But holder.owner restricted for Pawn's container, Building_CryptosleepCasket.

In Thing.PositionHeld()

...
Pawn_CarryHands pawnCarryHands = this.holder.owner as Pawn_CarryHands;
if (pawnCarryHands != null)
    return pawnCarryHands.pawn.Position;
Pawn_InventoryTracker inventoryTracker = this.holder.owner as Pawn_InventoryTracker;
if (inventoryTracker != null)
    return inventoryTracker.pawn.Position;
Building_CryptosleepCasket cryptosleepCasket = this.holder.owner as Building_CryptosleepCasket;
if (cryptosleepCasket != null)
    return cryptosleepCasket.PositionHeld;
//print error message
...


So, I cannot avoid this error message even if it is intended.
Someone know how to bypass it?
Title: Re: How can I bypass holder.owner's error checking?
Post by: Tynan on April 21, 2015, 12:51:35 AM
Only thing I can think of now is to not call PositionHeld. Sorry. I'll rework this to be more extensible.
Title: Re: How can I bypass holder.owner's error checking?
Post by: BBream on April 21, 2015, 01:12:48 AM
Quote from: Tynan on April 21, 2015, 12:51:35 AM
Only thing I can think of now is to not call PositionHeld. Sorry. I'll rework this to be more extensible.

Thanks for replying.
I hope so but ChunkRock has called somethings and debug inspector always call it.
Anyway, I understood.
Title: Re: How can I bypass holder.owner's error checking?
Post by: BBream on April 26, 2015, 03:46:03 AM
This is what I found.
1) Don't use StoreUtility.TryFindBestBetterStoreCellFor() method
2) Items in container should not be included in GenClosest.ClosestThing_Global_Reachable() method searchset
3) Don't use TargetInfo in GotoThing(TargetIndex ind, PathMode mode). It should bring source code and write code by myself.