mirror of
https://github.com/FalloutCollaborationProject/FCP-Tools.git
synced 2026-07-27 16:59:37 -07:00
Fix InvalidCastException in CageTradeDealPatch
Hard cast (Pawn)t failed for non-pawn tradeables in InSellablePosition. Use pattern match instead to safely skip non-pawn things.
This commit is contained in:
Binary file not shown.
@@ -115,8 +115,7 @@ public static class CageTradeDealPatch
|
||||
|
||||
private static void Postfix(ref bool __result, TradeDeal __instance, Thing t, out string reason)
|
||||
{
|
||||
//Log.Message(t.ParentHolder);
|
||||
if (!__result && !t.Spawned && t.holdingOwner != null && ((Pawn)t).health.capacities.CanBeAwake && !((Pawn)t).DeadOrDowned)
|
||||
if (!__result && !t.Spawned && t is Pawn pawn && t.holdingOwner != null && pawn.health.capacities.CanBeAwake && !pawn.DeadOrDowned)
|
||||
{
|
||||
__result = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user