public override AcceptanceReport CanDesignateCell(IntVec3 c) { if (!base.CanDesignateCell(c).Accepted) { return(false); } if (Util_PlaceWorker.IsNearFishingPier(this.Map, c, Util_PlaceWorker.minDistanceBetweenTwoFishingSpots)) { return(false); } if (Util_Zone_Fishing.IsAquaticTerrain(this.Map, c) && c.Walkable(this.Map)) { return(true); } return(false); }
/// <summary> /// Check if a new fishing pier can be built at this location. /// - the fishing pier bank cell must be on a bank. /// - the rest of the fishing pier and the fishing spot must be on water. /// - must not be too near another fishing pier. /// </summary> public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null) { // Remove old fish stock respawn rate text mote. if (lastMotePosition.IsValid && (loc != lastMotePosition)) { RemoveLastRespawnRateMote(map); } // Check this biome contains some fishes. if (Util_FishIndustry.GetFishSpeciesList(map.Biome).NullOrEmpty()) { return(new AcceptanceReport("FishIndustry.FishingPier_InvalidBiome".Translate())); } // Check if another fishing pier is not too close. if (Util_PlaceWorker.IsNearFishingPier(map, loc, Util_PlaceWorker.minDistanceBetweenTwoFishingSpots)) { return(new AcceptanceReport("FishIndustry.TooCloseFishingPier".Translate())); } // Check if a fishing zone is not too close. if (Util_PlaceWorker.IsNearFishingZone(map, loc, Util_PlaceWorker.minDistanceBetweenTwoFishingSpots)) { return(new AcceptanceReport("FishIndustry.TooCloseFishingZone".Translate())); } // Check fishing pier is on water. if ((Util_Zone_Fishing.IsAquaticTerrain(map, loc + new IntVec3(0, 0, -1).RotatedBy(rot)) == false) || (Util_Zone_Fishing.IsAquaticTerrain(map, loc + new IntVec3(0, 0, 0).RotatedBy(rot)) == false) || (Util_Zone_Fishing.IsAquaticTerrain(map, loc + new IntVec3(0, 0, 1).RotatedBy(rot)) == false)) { return(new AcceptanceReport("FishIndustry.FishingPier_PierMustBeOnWater".Translate())); } // Check fishing zone is on water. for (int xOffset = -1; xOffset <= 1; xOffset++) { for (int yOffset = 2; yOffset <= 4; yOffset++) { if (Util_Zone_Fishing.IsAquaticTerrain(map, loc + new IntVec3(xOffset, 0, yOffset).RotatedBy(rot)) == false) { return(new AcceptanceReport("FishIndustry.FishingPier_ZoneMustBeOnWater".Translate())); } } } // Display fish stock respawn rate. if ((lastMotePosition.IsValid == false) || (Find.TickManager.Paused && (DateTime.Now.Second != lastMoteUpdateSecond)) || ((Find.TickManager.Paused == false) && (Find.TickManager.TicksGame >= lastMoteUpdateTick + GenTicks.TicksPerRealSecond))) { lastMoteUpdateSecond = DateTime.Now.Second; lastMoteUpdateTick = Find.TickManager.TicksGame; RemoveLastRespawnRateMote(map); DisplayMaxFishStockMoteAt(map, loc, rot); } return(true); }