コード例 #1
0
ファイル: GenPlace.cs プロジェクト: sachdevs/RW-Decompile
 private static bool TryFindPlaceSpotNear(IntVec3 center, Map map, Thing thing, bool allowStacking, out IntVec3 bestSpot)
 {
     GenPlace.PlaceSpotQuality placeSpotQuality = GenPlace.PlaceSpotQuality.Unusable;
     bestSpot = center;
     for (int i = 0; i < 9; i++)
     {
         IntVec3 intVec = center + GenRadial.RadialPattern[i];
         GenPlace.PlaceSpotQuality placeSpotQuality2 = GenPlace.PlaceSpotQualityAt(intVec, map, thing, center, allowStacking);
         if (placeSpotQuality2 > placeSpotQuality)
         {
             bestSpot         = intVec;
             placeSpotQuality = placeSpotQuality2;
         }
         if (placeSpotQuality == GenPlace.PlaceSpotQuality.Perfect)
         {
             break;
         }
     }
     if (placeSpotQuality >= GenPlace.PlaceSpotQuality.Okay)
     {
         return(true);
     }
     for (int j = 0; j < GenPlace.PlaceNearMiddleRadialCells; j++)
     {
         IntVec3 intVec = center + GenRadial.RadialPattern[j];
         GenPlace.PlaceSpotQuality placeSpotQuality2 = GenPlace.PlaceSpotQualityAt(intVec, map, thing, center, allowStacking);
         if (placeSpotQuality2 > placeSpotQuality)
         {
             bestSpot         = intVec;
             placeSpotQuality = placeSpotQuality2;
         }
         if (placeSpotQuality == GenPlace.PlaceSpotQuality.Perfect)
         {
             break;
         }
     }
     if (placeSpotQuality >= GenPlace.PlaceSpotQuality.Okay)
     {
         return(true);
     }
     for (int k = 0; k < GenPlace.PlaceNearMaxRadialCells; k++)
     {
         IntVec3 intVec = center + GenRadial.RadialPattern[k];
         GenPlace.PlaceSpotQuality placeSpotQuality2 = GenPlace.PlaceSpotQualityAt(intVec, map, thing, center, allowStacking);
         if (placeSpotQuality2 > placeSpotQuality)
         {
             bestSpot         = intVec;
             placeSpotQuality = placeSpotQuality2;
         }
         if (placeSpotQuality == GenPlace.PlaceSpotQuality.Perfect)
         {
             break;
         }
     }
     if (placeSpotQuality > GenPlace.PlaceSpotQuality.Unusable)
     {
         return(true);
     }
     bestSpot = center;
     return(false);
 }
コード例 #2
0
ファイル: GenPlace.cs プロジェクト: sachdevs/RW-Decompile
        public static bool TryPlaceThing(Thing thing, IntVec3 center, Map map, ThingPlaceMode mode, Action <Thing, int> placedAction = null)
        {
            Thing thing2;

            return(GenPlace.TryPlaceThing(thing, center, map, mode, out thing2, placedAction));
        }