How can I bypass holder.owner's error checking?

Started by BBream, April 20, 2015, 11:45:09 PM

Previous topic - Next topic

BBream

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?

Tynan

Only thing I can think of now is to not call PositionHeld. Sorry. I'll rework this to be more extensible.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

BBream

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.

BBream

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.