public static bool CheckPond(FarmTileId tile, Border border, PondDefinition definition, List <Pond> ponds, FarmData __instance) { if (__instance.GetFence(tile, border) != null) { return(false); } FarmTile tile2 = __instance.GetTile(tile + border.GetBorderOffset()); if (tile2 == null) { return(false); } PondContents pondContents = tile2.Contents as PondContents; if (pondContents == null) { return(false); } if (ponds.Contains(pondContents.Pond)) { return(false); } if (pondContents.Definition.Race != definition.Race && false) { return(false); } if (pondContents.Pond.Tiles.Count >= settings.maxTileCount) { return(false); } ponds.Add(pondContents.Pond); return(false); }
private static bool CheckMerge(FarmTileId tile1, FarmTileId tile2, FarmData __instance) { if (!settings.isEnable) { return(true); } FarmTile tile3 = __instance.GetTile(tile1); if (tile3 == null || tile3.IsEmpty) { return(false); } FarmTile tile4 = __instance.GetTile(tile2); if (tile4 == null || tile4.IsEmpty) { return(false); } if (tile3.Contents.Category == tile4.Contents.Category) { FarmTileContentsType category = tile3.Contents.Category; if (category != FarmTileContentsType.Animal) { if (category == FarmTileContentsType.Pond) { PondContents pondContents = tile3.Contents as PondContents; PondContents pondContents2 = tile4.Contents as PondContents; if (pondContents.Pond == pondContents2.Pond) { return(false); } if (pondContents.Pond.Tiles.Count + pondContents2.Pond.Tiles.Count > settings.maxTileCount) { return(false); } pondContents2.Pond.Merge(pondContents.Pond); tile3.StateChanged(true); tile4.StateChanged(true); } } else { AnimalFieldContents animalFieldContents = tile3.Contents as AnimalFieldContents; AnimalFieldContents animalFieldContents2 = tile4.Contents as AnimalFieldContents; if (animalFieldContents.Field == animalFieldContents2.Field) { return(false); } if (animalFieldContents.Field.TileCount + animalFieldContents2.Field.TileCount > settings.maxTileCount) { return(false); } animalFieldContents2.Field.Merge(animalFieldContents.Field); tile3.StateChanged(true); tile4.StateChanged(true); } } return(false); }