private static bool Prefix(TradeShip __instance, Thing toGive, int countToGive, Pawn playerNegotiator, List <Pawn> ___soldPrisoners) { if (__instance.Map != null) { MapParent_PocketDimension mapParent = __instance.Map.info.parent as MapParent_PocketDimension; if (mapParent != null) { Map containingMap = PocketDimensionUtility.GetHighestContainingMap(__instance.Map); // If there was no containing map found (should mean box is in a caravan; could mean the box was nested inside itself, it which case, oh well, give them their goods anyway :P) if (containingMap == __instance.Map) { Building_PocketDimensionExit exit = PocketDimensionUtility.GetExit(mapParent.dimensionSeed); if (exit != null && exit.SpawnedOrAnyParentSpawned) { Thing thing = toGive.SplitOff(countToGive); thing.PreTraded(TradeAction.PlayerBuys, playerNegotiator, __instance); Pawn pawn = thing as Pawn; if (pawn != null) { ___soldPrisoners.Remove(pawn); } IntVec3 positionHeld = exit.PositionHeld; Map mapHeld = exit.MapHeld; GenPlace.TryPlaceThing(thing, positionHeld, mapHeld, ThingPlaceMode.Near); return(false); } } } } return(true); }
private static void Prefix(ref Map map) { if (map != null) { //Logger.MessageFormat(map, "Checking for alternate map target."); Map containingMap = PocketDimensionUtility.GetHighestContainingMap(map); if (containingMap != null) { map = containingMap; Logger.MessageFormat(map, "Redirecting drop pod to: {0}", containingMap.GetUniqueLoadID()); } } }