public override void DrawGhost(ThingDef def, IntVec3 loc, Rot4 rot, Color ghostCol)
        {
            GenDraw.DrawFieldEdges(CompPowerPlantWater.GroundCells(loc, rot).ToList <IntVec3>(), Color.white);
            Color color = (!this.WaterCellsPresent(loc, rot, Find.CurrentMap)) ? Designator_Place.CannotPlaceColor.ToOpaque() : Designator_Place.CanPlaceColor.ToOpaque();

            GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterCells(loc, rot).ToList <IntVec3>(), color);
            bool     flag     = false;
            CellRect cellRect = CompPowerPlantWater.WaterUseRect(loc, rot);

            PlaceWorker_WatermillGenerator.waterMills.AddRange(Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDefOf.WatermillGenerator).Cast <Thing>());
            PlaceWorker_WatermillGenerator.waterMills.AddRange(from t in Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.Blueprint)
                                                               where t.def.entityDefToBuild == ThingDefOf.WatermillGenerator
                                                               select t);
            PlaceWorker_WatermillGenerator.waterMills.AddRange(from t in Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.BuildingFrame)
                                                               where t.def.entityDefToBuild == ThingDefOf.WatermillGenerator
                                                               select t);
            foreach (Thing thing in PlaceWorker_WatermillGenerator.waterMills)
            {
                GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterUseCells(thing.Position, thing.Rotation).ToList <IntVec3>(), new Color(0.2f, 0.2f, 1f));
                if (cellRect.Overlaps(CompPowerPlantWater.WaterUseRect(thing.Position, thing.Rotation)))
                {
                    flag = true;
                }
            }
            PlaceWorker_WatermillGenerator.waterMills.Clear();
            Color color2 = (!flag) ? Designator_Place.CanPlaceColor.ToOpaque() : new Color(1f, 0.6f, 0f);

            if (!flag || Time.realtimeSinceStartup % 0.4f < 0.2f)
            {
                GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterUseCells(loc, rot).ToList <IntVec3>(), color2);
            }
        }
 public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null)
 {
     foreach (IntVec3 c in CompPowerPlantWater.GroundCells(loc, rot))
     {
         if (!map.terrainGrid.TerrainAt(c).affordances.Contains(TerrainAffordanceDefOf.Heavy))
         {
             return(new AcceptanceReport("TerrainCannotSupport".Translate()));
         }
     }
     if (!this.WaterCellsPresent(loc, rot, map))
     {
         return(new AcceptanceReport("MustBeOnMovingWater".Translate()));
     }
     return(true);
 }
Esempio n. 3
0
 public IEnumerable <IntVec3> GroundCells()
 {
     return(CompPowerPlantWater.GroundCells(this.parent.Position, this.parent.Rotation));
 }