Exemple #1
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            var conveyor = thing as IBeltConveyorLinkable;

            if (!(thing is Building_BeltConveyorUGConnector) &&
                conveyor != null && conveyor.IsUnderground &&
                !(layer is SectionLayer_UGConveyor))
            {
                // Original Logic (notation by LWM)
                // if it IS NOT an underground connector
                // and it IS an IBeltLinkable
                // and it IS underground
                // and the layer IS NOT Sectionlayer for UGConveyor
                // then return
                // so.....
                // if it IS a connector
                // or it's NOT an IBletLinkable
                // or it's above ground
                // or it's UG's SectionLayer
                // then print this
                // So....don't print underground belts?
                return;
            }
            base.Print(layer, thing);
            // Print the tiny yellow arrow showing direction:
            Printer_Plane.PrintPlane(layer, thing.TrueCenter()
                                     + arrowOffsetsByRot4[thing.Rotation.AsInt], this.drawSize, arrow,
                                     thing.Rotation.AsAngle);
        }
Exemple #2
0
        /// <summary>
        /// Main method to Print a Atlas Pipe Graphic
        /// </summary>
        /// <param name="layer">Section Layer calling this Print command</param>
        /// <param name="parent">Parent Object</param>
        public override void Print(SectionLayer layer, Thing parent)
        {
            //var iterator = parent.OccupiedRect().GetIterator();
            //while (!iterator.Done())
            foreach (var item in parent.OccupiedRect())
            {
                var vector = item.ToVector3ShiftedWithAltitude(AltitudeLayer.MapDataOverlay);

                var building = parent as Building;

                var compAirFlow = building?.GetComps <CompAirFlow>().FirstOrDefault();
                if (compAirFlow == null)
                {
                    return;
                }

                if (compAirFlow.FlowType != FlowType && compAirFlow.FlowType != AirFlowType.Any)
                {
                    return;
                }

                subGraphic = compAirFlow.FlowType == AirFlowType.Any ? _anyGraphic : _flowGraphic;

                Printer_Plane.PrintPlane(layer, vector, Vector2.one, LinkedDrawMatFrom(parent, item), 0f);
            }
        }
Exemple #3
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            Vector2 size;
            bool    flipUv;

            if (this.ShouldDrawRotated)
            {
                size   = this.drawSize;
                flipUv = false;
            }
            else
            {
                size   = thing.Rotation.IsHorizontal ? this.drawSize.Rotated() : this.drawSize;
                flipUv = thing.Rotation == Rot4.West && this.WestFlipped || thing.Rotation == Rot4.East && this.EastFlipped;
            }
            float rot = this.AngleFromRot(thing.Rotation);

            if (flipUv && this.data != null)
            {
                rot += this.data.flipExtraRotation;
            }
            Vector3 center = thing.TrueCenter() + this.DrawOffset(thing.Rotation);

            Printer_Plane.PrintPlane(layer, center, size, this.MatAt(thing.Rotation, thing), rot, flipUv, (Vector2[])null, (Color32[])null, 0.01f, 0.0f);
            if (this.ShadowGraphic == null || thing == null)
            {
                return;
            }
            this.ShadowGraphic.Print(layer, thing);
        }
Exemple #4
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            showW = false; showS = false; showE = false;
            // This may set some of those flags:
            base.Print(layer, thing);
            Debug.Message(Debug.Flag.ConveyorGraphics, "Printing transitions for " + thing + " S:" + showS + " W:" + showW + "E:" + showE);
            Material mat;

            if (showW)
            {
                mat = transitionGData.Graphic.MatWest;
//                mat = transitionWest.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
            if (showS)
            {
                mat = transitionGData.Graphic.MatSouth;
//                mat = transitionSouth.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
            if (showE)
            {
                mat = transitionGData.Graphic.MatEast;
//                mat = transitionEast.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
        }
Exemple #5
0
        public static void PrintOverlayConnectorBaseFor(SectionLayer layer, Thing t)
        {
            Vector3 center = t.TrueCenter();

            center.y = AltitudeLayer.MapDataOverlay.AltitudeFor();
            Printer_Plane.PrintPlane(layer, center, new Vector2(1f, 1f), PowerOverlayMats.MatConnectorBase, 0f, false, null, null, 0.01f, 0f);
        }
        public override void Print(SectionLayer layer, Thing thing)
        {
            if (!(thing is DiningSpot diningSpot))
            {
                return;
            }

            var spots = diningSpot.GetReservationSpots();
            //Log.Message($"Printing diningSpot at {diningSpot.Position}: {spots[0]}, {spots[1]}, {spots[2]}, {spots[3]}");

            var center = thing.TrueCenter();

            // Draw center piece
            Printer_Plane.PrintPlane(layer, center, data.drawSize, subGraphics[diningSpot.DecoVariation].MatSingle);

            // Draw spots rotated
            for (int i = 0; i < 4; i++)
            {
                if (spots[i] < SpotState.Ready)
                {
                    continue;                             // Can be -1 if blocked
                }
                Printer_Plane.PrintPlane(layer, center, data.drawSize, GetGraphic(spots[i]), i * 90 + 180);
            }
        }
        /// <summary>
        /// Main method to Print a Atlas Pipe Graphic
        /// </summary>
        /// <param name="layer">Section Layer calling this Print command</param>
        /// <param name="parent">Parent Object</param>
        public override void Print(SectionLayer layer, Thing parent)
        {
            var material = LinkedDrawMatFrom(parent, parent.Position);

            Printer_Plane.PrintPlane(layer, parent.TrueCenter(), Vector2.one, material, 0f);
            for (var i = 0; i < 4; i++)
            {
                var intVec = parent.Position + GenAdj.CardinalDirections[i];

                if (!intVec.InBounds(parent.Map) ||
                    !CentralizedClimateControlUtility.GetNetManager(parent.Map).ZoneAt(intVec, FlowType) || intVec.GetTerrain(parent.Map).layerable)
                {
                    continue;
                }

                var thingList = intVec.GetThingList(parent.Map);

                Predicate <Thing> predicate = CheckPipe;
                if (thingList.Any(predicate))
                {
                    continue;
                }

                var material2 = LinkedDrawMatFrom(parent, intVec);
                Printer_Plane.PrintPlane(layer, intVec.ToVector3ShiftedWithAltitude(parent.def.Altitude), Vector2.one, material2, 0f);
            }
        }
        public override void Print(SectionLayer layer)
        {
            Plant plant = this.Plant;

            if (plant != null)
            {
                PlantUtility.SetWindExposureColors(Blight.workingColors, plant);
            }
            else
            {
                Blight.workingColors[0].a = (Blight.workingColors[1].a = (Blight.workingColors[2].a = (Blight.workingColors[3].a = 0)));
            }
            float num = Blight.SizeRange.LerpThroughRange(this.severity);

            if (plant != null)
            {
                float a = plant.Graphic.drawSize.x * plant.def.plant.visualSizeRange.LerpThroughRange(plant.Growth);
                num *= Mathf.Min(a, 1f);
            }
            num = Mathf.Clamp(num, 0.5f, 0.9f);
            Vector3  center = this.TrueCenter();
            Vector2  size   = this.def.graphic.drawSize * num;
            Material mat    = this.Graphic.MatAt(base.Rotation, this);

            Color32[] colors = Blight.workingColors;
            Printer_Plane.PrintPlane(layer, center, size, mat, 0f, false, null, colors, 0.1f, 0f);
        }
Exemple #9
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            showW = false; showS = false; showE = false;
            // This may set some of those flags:
            base.Print(layer, thing);
            Material mat;

            if (showW)
            {
                mat = transitionWest.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
            if (showS)
            {
                mat = transitionSouth.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
            if (showE)
            {
                mat = transitionEast.Graphic.MatSingleFor(thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0),
                                         Vector2.one, mat);
            }
        }
Exemple #10
0
        private void DrawLinkableCornersAndEdges(Thing b)
        {
            if (b.def.graphicData == null)
            {
                return;
            }
            DamageGraphicData damageData = b.def.graphicData.damageData;

            if (damageData == null)
            {
                return;
            }
            float damageTexturesAltitude  = this.GetDamageTexturesAltitude(b);
            List <DamageOverlay> overlays = ThingsToxicDamageSectionLayerUtility.GetOverlays(b);
            IntVec3 position = b.Position;
            Vector3 vector   = new Vector3((float)position.x + 0.5f, damageTexturesAltitude, (float)position.z + 0.5f);
            float   x        = Rand.Range(0.4f, 0.6f);
            float   z        = Rand.Range(0.4f, 0.6f);
            float   x2       = Rand.Range(0.4f, 0.6f);
            float   z2       = Rand.Range(0.4f, 0.6f);

            for (int i = 0; i < overlays.Count; i++)
            {
                switch (overlays[i])
                {
                case DamageOverlay.TopLeftCorner:
                    Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerTLMat, 0f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.TopRightCorner:
                    Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerTRMat, 90f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.BotLeftCorner:
                    Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerBLMat, 270f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.BotRightCorner:
                    Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerBRMat, 180f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.LeftEdge:
                    Printer_Plane.PrintPlane(this, vector + new Vector3(0f, 0f, z2), Vector2.one, damageData.edgeLeftMat, 270f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.RightEdge:
                    Printer_Plane.PrintPlane(this, vector + new Vector3(0f, 0f, z), Vector2.one, damageData.edgeRightMat, 90f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.TopEdge:
                    Printer_Plane.PrintPlane(this, vector + new Vector3(x, 0f, 0f), Vector2.one, damageData.edgeTopMat, 0f, false, null, null, 0f, 0f);
                    break;

                case DamageOverlay.BotEdge:
                    Printer_Plane.PrintPlane(this, vector + new Vector3(x2, 0f, 0f), Vector2.one, damageData.edgeBotMat, 180f, false, null, null, 0f, 0f);
                    break;
                }
            }
        }
Exemple #11
0
        private void DrawFullThingCorners(Thing b)
        {
            if (b.def.graphicData == null)
            {
                return;
            }
            if (b.def.graphicData.damageData == null)
            {
                return;
            }
            Rect     damageRect             = ThingsToxicDamageSectionLayerUtility.GetDamageRect(b);
            float    damageTexturesAltitude = this.GetDamageTexturesAltitude(b);
            float    num = Mathf.Min(Mathf.Min(damageRect.width, damageRect.height), 1.5f);
            Material mat;
            Material mat2;
            Material mat3;
            Material mat4;

            ThingsToxicDamageSectionLayerUtility.GetCornerMats(out mat, out mat2, out mat3, out mat4, b);
            float num2 = num * Rand.Range(0.9f, 1f);
            float num3 = num * Rand.Range(0.9f, 1f);
            float num4 = num * Rand.Range(0.9f, 1f);
            float num5 = num * Rand.Range(0.9f, 1f);
            List <DamageOverlay> overlays = ThingsToxicDamageSectionLayerUtility.GetOverlays(b);

            for (int i = 0; i < overlays.Count; i++)
            {
                switch (overlays[i])
                {
                case DamageOverlay.TopLeftCorner:
                {
                    Rect rect = new Rect(damageRect.xMin, damageRect.yMax - num2, num2, num2);
                    Printer_Plane.PrintPlane(this, new Vector3(rect.center.x, damageTexturesAltitude, rect.center.y), rect.size, mat, 0f, false, null, null, 0f, 0f);
                    break;
                }

                case DamageOverlay.TopRightCorner:
                {
                    Rect rect2 = new Rect(damageRect.xMax - num3, damageRect.yMax - num3, num3, num3);
                    Printer_Plane.PrintPlane(this, new Vector3(rect2.center.x, damageTexturesAltitude, rect2.center.y), rect2.size, mat2, 90f, false, null, null, 0f, 0f);
                    break;
                }

                case DamageOverlay.BotLeftCorner:
                {
                    Rect rect3 = new Rect(damageRect.xMin, damageRect.yMin, num5, num5);
                    Printer_Plane.PrintPlane(this, new Vector3(rect3.center.x, damageTexturesAltitude, rect3.center.y), rect3.size, mat4, 270f, false, null, null, 0f, 0f);
                    break;
                }

                case DamageOverlay.BotRightCorner:
                {
                    Rect rect4 = new Rect(damageRect.xMax - num4, damageRect.yMin, num4, num4);
                    Printer_Plane.PrintPlane(this, new Vector3(rect4.center.x, damageTexturesAltitude, rect4.center.y), rect4.size, mat3, 180f, false, null, null, 0f, 0f);
                    break;
                }
                }
            }
        }
Exemple #12
0
        // Token: 0x06000038 RID: 56 RVA: 0x0000331C File Offset: 0x0000151C
        public override void Print(SectionLayer layer, Thing thing, float extraRotation)
        {
            base.Print(layer, thing, extraRotation);
            var vector = thing.TrueCenter();

            vector.y -= 0.05f;
            Printer_Plane.PrintPlane(layer, vector, baseGraphic.drawSize, baseGraphic.MatSingle);
        }
 public override void Print(SectionLayer layer, Thing parent)
 {
     foreach (var current in parent.OccupiedRect())
     {
         Vector3 vector = current.ToVector3ShiftedWithAltitude(AltitudeLayer.MapDataOverlay);
         Printer_Plane.PrintPlane(layer, vector, Vector2.one, base.LinkedDrawMatFrom(parent, current), 0f, false, null, null, 0.01f);
     }
 }
Exemple #14
0
 public override void Print(SectionLayer layer, Thing parent)
 {
     foreach (IntVec3 cell in parent.OccupiedRect())
     {
         Vector3 shiftedWithAltitude = cell.ToVector3ShiftedWithAltitude(AltitudeLayer.MapDataOverlay);
         Printer_Plane.PrintPlane(layer, shiftedWithAltitude, new Vector2(1f, 1f), this.LinkedDrawMatFrom(parent, cell), 0.0f, false, (Vector2[])null, (Color32[])null, 0.01f, 0.0f);
     }
 }
Exemple #15
0
 public override void Print(SectionLayer layer, Thing parent)
 {
     Printer_Plane.PrintPlane(
         layer,
         parent.TrueCenter(),
         Vector2.one,
         LinkedDrawMatFrom(parent, parent.Position));
 }
Exemple #16
0
 public override void Print(SectionLayer layer, Thing parent)
 {
     foreach (IntVec3 item in parent.OccupiedRect())
     {
         Vector3 center = item.ToVector3ShiftedWithAltitude(AltitudeLayer.MapDataOverlay);
         Printer_Plane.PrintPlane(layer, center, new Vector2(1f, 1f), LinkedDrawMatFrom(parent, item));
     }
 }
        public override void Print(SectionLayer layer, Thing thing)
        {
            CellRect val = GenAdj.OccupiedRect(thing);

            foreach (var cell in val)
            {
                Vector3 vector = cell.ToVector3ShiftedWithAltitude(29);
                Printer_Plane.PrintPlane(layer, vector, Vector2.one, LinkedDrawMatFrom(thing, cell));
            }
        }
Exemple #18
0
        private void PrintScratches(Thing b)
        {
            int num = 0;
            List <DamageOverlay> overlays = ThingsToxicDamageSectionLayerUtility.GetOverlays(b);

            for (int i = 0; i < overlays.Count; i++)
            {
                if (overlays[i] == DamageOverlay.Scratch)
                {
                    num++;
                }
            }
            if (num == 0)
            {
                return;
            }
            Rect  rect = ThingsToxicDamageSectionLayerUtility.GetDamageRect(b);
            float num2 = Mathf.Min(0.5f * Mathf.Min(rect.width, rect.height), 1f);

            rect = rect.ContractedBy(num2 / 2f);
            if (rect.width <= 0f || rect.height <= 0f)
            {
                return;
            }
            float num3 = Mathf.Max(rect.width, rect.height) * 0.7f;

            SectionLayer_ThingsToxicDamage.scratches.Clear();
            Rand.PushState();
            Rand.Seed = b.thingIDNumber * 3697;
            for (int j = 0; j < num; j++)
            {
                this.AddScratch(b, rect.width, rect.height, ref num3);
            }
            Rand.PopState();
            float            damageTexturesAltitude = this.GetDamageTexturesAltitude(b);
            IList <Material> scratchMats            = ThingsToxicDamageSectionLayerUtility.GetScratchMats(b);

            Rand.PushState();
            Rand.Seed = b.thingIDNumber * 7;
            for (int k = 0; k < SectionLayer_ThingsToxicDamage.scratches.Count; k++)
            {
                float x    = SectionLayer_ThingsToxicDamage.scratches[k].x;
                float y    = SectionLayer_ThingsToxicDamage.scratches[k].y;
                float rot  = Rand.Range(0f, 360f);
                float num4 = num2;
                if (rect.width > 0.95f && rect.height > 0.95f)
                {
                    num4 *= Rand.Range(0.85f, 1f);
                }
                Vector3 center = new Vector3(rect.xMin + x, damageTexturesAltitude, rect.yMin + y);
                Printer_Plane.PrintPlane(this, center, new Vector2(num4, num4), scratchMats.RandomElement <Material>(), rot, false, null, null, 0f, 0f);
            }
            Rand.PopState();
        }
Exemple #19
0
 public override void Print(SectionLayer layer, Thing parent)
 {
     CellRect.CellRectIterator iterator = parent.OccupiedRect().GetIterator();
     while (!iterator.Done())
     {
         IntVec3 current = iterator.Current;
         Vector3 center  = current.ToVector3ShiftedWithAltitude(AltitudeLayer.MapDataOverlay);
         Printer_Plane.PrintPlane(layer, center, new Vector2(1f, 1f), base.LinkedDrawMatFrom(parent, current), 0f, false, null, null, 0.01f);
         iterator.MoveNext();
     }
 }
        public override void Print(SectionLayer layer, Thing parent)
        {
            var occupiedRect = parent.OccupiedRect();

            foreach (var current in occupiedRect)
            {
                var center = current.ToVector3ShiftedWithAltitude(AltitudeLayer.WorldDataOverlay);
                Printer_Plane.PrintPlane(layer, center, new Vector2(1f, 1f), LinkedDrawMatFrom(parent, current),
                                         0f);
            }
        }
 public override void Print(SectionLayer layer, Thing thing)
 {
     base.Print(layer, thing);
     // Similar to Graphic_LinkedConveyor, we need to not print this
     //   if it's underground (unless something is selected, etc etc)
     if (thing is Building_BeltSplitter splitter)
     {
         if (splitter.IsUnderground && !(layer is SectionLayer_UGConveyor))
         {
             return;
         }
         // We want to draw the open door only if something is using the S
         //   facing wall, so either an output link to the S or an incoming link:
         if ((splitter.OutputLinks.TryGetValue(Rot4.South, out var link) &&
              link.Active) ||
             splitter.IncomingLinks.Any(o => splitter.Position + Rot4.South.FacingCell == o.Position))
         {
             // Draw open door
             var mat = splitterBuildingDoorOpen.Graphic.MatSingleFor(thing);
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() + BuildingOffset,
                                      Vector2.one, mat);
         }
         else
         {
             // Draw closed door
             var mat = splitterBuildingDoorClosed.Graphic.MatSingleFor(thing);
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() + BuildingOffset,
                                      Vector2.one, mat);
         }
         // Print the splitter version of the tiny yellow arrow showing input direction:
         //   Note: these arrows texPaths should probably be exposed to XML via IHaveExtraGrahicData or something
         foreach (var i in splitter.IncomingLinks)
         {
             if (i.Position.IsNextTo(splitter.Position))   // otherwise need new logic
             // splitter.Position + offset = i.Position, so
             // offset = i.Position - splitter.Position
             {
                 var r = Rot4.FromIntVec3(i.Position - splitter.Position);
                 Printer_Plane.PrintPlane(layer, thing.TrueCenter()
                                          + ArrowOffset(r), this.drawSize, arrow00b,
                                          r.Opposite.AsAngle);
             }
         }
         // print tiny brown arrows pointing in output directions:
         //   Note: the texPaths for these should probably be exposed to XML too.
         foreach (var d in splitter.ActiveOutputDirections)
         {
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() +
                                      ArrowOffset(d),
                                      this.drawSize, arrow01, d.AsAngle);
         }
     }
        public void Print(Graphic_LinkedCornerFiller graphic, SectionLayer layer, Thing thing, int curLevel, int baseLevel)
        {
            BasePrint(graphic, layer, thing);
            IntVec3 position = thing.Position;

            for (int i = 0; i < 4; i++)
            {
                IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i];
                if (!graphic.ShouldLinkWith(c, thing) || (i == 0 && (!graphic.ShouldLinkWith(position + IntVec3.West, thing) || !graphic.ShouldLinkWith(position + IntVec3.South, thing))) ||
                    (i == 1 && (!graphic.ShouldLinkWith(position + IntVec3.West, thing) || !graphic.ShouldLinkWith(position + IntVec3.North, thing))) || (i == 2 &&
                                                                                                                                                          (!graphic.ShouldLinkWith(position + IntVec3.East, thing) || !graphic.ShouldLinkWith(position + IntVec3.North, thing))) || (i == 3 &&
                                                                                                                                                                                                                                                                                     (!graphic.ShouldLinkWith(position + IntVec3.East, thing) || !graphic.ShouldLinkWith(position + IntVec3.South, thing))))
                {
                    continue;
                }
                DrawPos_Patch.ChangeDrawPos    = false;
                TrueCenter_Patch.ChangeDrawPos = false;
                Vector3 center = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *Graphic_LinkedCornerFiller.CoverOffsetDist + Altitudes.AltIncVect
                                 + new Vector3(0f, 0f, 0.09f);
                center.z -= (curLevel - baseLevel) / 2f;
                center.y -= (curLevel - baseLevel) / 2f;
                DrawPos_Patch.ChangeDrawPos    = true;
                TrueCenter_Patch.ChangeDrawPos = true;
                Vector2 size = new Vector2(0.5f, 0.5f);
                if (!c.InBounds(thing.Map))
                {
                    if (c.x == -1)
                    {
                        center.x -= 1f;
                        size.x   *= 5f;
                    }
                    if (c.z == -1)
                    {
                        center.z -= 1f;
                        size.y   *= 5f;
                    }
                    if (c.x == thing.Map.Size.x)
                    {
                        center.x += 1f;
                        size.x   *= 5f;
                    }
                    if (c.z == thing.Map.Size.z)
                    {
                        center.z += 1f;
                        size.y   *= 5f;
                    }
                }
                Printer_Plane.PrintPlane(layer, center, size, LinkedDrawMatFrom(graphic, thing, thing.Position), 0f, flipUv: false, Graphic_LinkedCornerFiller.CornerFillUVs);
            }
        }
        public override void Regenerate()
        {
            var wateringComp = Map.GetComponent <MapComponent_Watering>();

            ClearSubMeshes(MeshParts.All);
            foreach (var current in section.CellRect)
            {
                if (wateringComp.Get(Map.cellIndices.CellToIndex(current)) > 0)
                {
                    Printer_Plane.PrintPlane(this, current.ToVector3Shifted(), Vector2.one, material);
                }
            }

            FinalizeMesh(MeshParts.All);

            // LayerSubMesh subMesh = base.GetSubMesh(this.material);
            // if (subMesh.mesh.vertexCount == 0)
            // {
            // MakeBaseGeometry(this.section, subMesh, AltitudeLayer.Terrain);
            // }
            // subMesh.Clear(MeshParts.Colors);
            // CellRect cellRect = this.section.CellRect;
            // int num = base.Map.Size.z - 1;
            // int num2 = base.Map.Size.x - 1;
            // bool flag = false;
            // CellIndices cellIndices = base.Map.cellIndices;

            // for (int x = cellRect.minX; x <= cellRect.maxX; x++)
            // {
            // for (int z = cellRect.minZ; z <= cellRect.maxZ; z++)
            // {
            // if (grid[cellIndices.CellToIndex(x, z)] > 0)
            // {
            // subMesh.colors.Add(new Color32(255, 255, 255, 128));
            // flag = true;
            // }
            // }
            // }
            // if (flag)
            // {
            // subMesh.disabled = false;
            // subMesh.FinalizeMesh(MeshParts.Colors);
            // }
            // else
            // {
            // subMesh.disabled = true;
            // }
        }
Exemple #24
0
        public override void PostPrintOnto(SectionLayer layer)
        {
            base.PostPrintOnto(layer);
            if (!ModSettingGetter.renderGraphicIndicator)
            {
                return;
            }
            Vector3  center = parent.TrueCenter() + new Vector3(0, 1, 0.5f * ModSettingGetter.yDrawSize);
            Vector2  size   = new Vector2(ModSettingGetter.xDrawSize, ModSettingGetter.yDrawSize);
            Material mat    = MaterialPool.MatFrom(new MaterialRequest(ContentFinder <Texture2D> .Get(Props.graphicData.texPath, true)));
            Color32  color  = new Color32(1, 1, 1, 1);

            if (parent is ThingWithComps thingWithComps && thingWithComps.TryGetComp <CompQuality>() is CompQuality compQuality)
            {
                switch (compQuality.Quality)
                {
                case QualityCategory.Awful:
                    color = new Color(int.Parse(ModSettingGetter.stringAwful.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringAwful.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringAwful.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Poor:
                    color = new Color(int.Parse(ModSettingGetter.stringPoor.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringPoor.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringPoor.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Normal:
                    color = new Color(int.Parse(ModSettingGetter.stringNormal.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringNormal.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringNormal.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Good:
                    color = new Color(int.Parse(ModSettingGetter.stringGood.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringGood.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringGood.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Excellent:
                    color = new Color(int.Parse(ModSettingGetter.stringExcellent.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringExcellent.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringExcellent.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Masterwork:
                    color = new Color(int.Parse(ModSettingGetter.stringMasterwork.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringMasterwork.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringMasterwork.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;

                case QualityCategory.Legendary:
                    color = new Color(int.Parse(ModSettingGetter.stringLegendary.Substring(8, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringLegendary.Substring(10, 2), NumberStyles.HexNumber) / 255f, int.Parse(ModSettingGetter.stringLegendary.Substring(12, 2), NumberStyles.HexNumber) / 255f, 1f);
                    break;
                }
            }
            Printer_Plane.PrintPlane(layer, center, size, mat, 0, false, null, new Color32[] { color, color, color, color });
        }
Exemple #25
0
 public override void Print(SectionLayer layer, Thing thing)
 {
     base.Print(layer, thing);
     for (int index = 0; index < 4; ++index)
     {
         IntVec3 intVec3 = thing.Position + GenAdj.CardinalDirections[index];
         if (intVec3.InBounds(thing.Map))
         {
             Building transmitter = intVec3.GetTransmitter(thing.Map);
             if (transmitter != null && !transmitter.def.graphicData.Linked)
             {
                 Material mat = this.LinkedDrawMatFrom(thing, intVec3);
                 Printer_Plane.PrintPlane(layer, intVec3.ToVector3ShiftedWithAltitude(thing.def.Altitude), Vector2.one, mat, 0.0f, false, (Vector2[])null, (Color32[])null, 0.01f, 0.0f);
             }
         }
     }
 }
Exemple #26
0
 public override void Print(SectionLayer layer, Thing thing)
 {
     base.Print(layer, thing);
     for (int i = 0; i < 4; i++)
     {
         IntVec3 intVec = thing.Position + GenAdj.CardinalDirections[i];
         if (intVec.InBounds(thing.Map))
         {
             Building transmitter = intVec.GetTransmitter(thing.Map);
             if (transmitter != null && !transmitter.def.graphicData.Linked)
             {
                 Material mat = LinkedDrawMatFrom(thing, intVec);
                 Printer_Plane.PrintPlane(layer, intVec.ToVector3ShiftedWithAltitude(thing.def.Altitude), Vector2.one, mat);
             }
         }
     }
 }
Exemple #27
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            var conveyor = thing as IBeltConveyorLinkable;

            if (!(thing is Building_BeltConveyorUGConnector) &&
                conveyor != null && conveyor.IsUnderground &&
                !(layer is SectionLayer_UGConveyor))
            {
                // Original Logic (notation by LWM)
                // if it IS NOT an underground connector
                // and it IS an IBeltLinkable
                // and it IS underground
                // and the layer IS NOT Sectionlayer for UGConveyor
                // then return
                // so.....
                // if it IS a connector
                // or it's NOT an IBletLinkable
                // or it's above ground
                // or it's UG's SectionLayer
                // then print this
                // So....don't print underground belts?
                return;
            }
            Material mat           = this.LinkedDrawMatFrom(thing, thing.Position);
            float    extraRotation = 0f;

            if (mat == subMats[(int)LinkDirections.None])
            {
                // The graphic for no links is up/down.  But
                //   if the conveyor is oriented East/West,
                //   we should draw the singleton conveyor
                //   rotated to match
                extraRotation = thing.Rotation.AsAngle;
            }
            if (thing is Blueprint)
            {
                mat = FadedMaterialPool.FadedVersionOf(mat, 0.5f);
            }
            // Print the conveyor material:
            Printer_Plane.PrintPlane(layer, thing.TrueCenter(),
                                     this.drawSize, mat, extraRotation);
            // Print the tiny yellow arrow showing direction:
            Printer_Plane.PrintPlane(layer, thing.TrueCenter()
                                     + new Vector3(0, 0.1f, 0), this.drawSize, arrow00,
                                     thing.Rotation.AsAngle);
        }
 public override void Print(SectionLayer layer, Thing thing)
 {
     base.Print(layer, thing);
     // Similar to Graphic_LinkedConveyor, we need to not print this
     //   if it's underground (unless something is selected, etc etc)
     if (thing is Building_BeltSplitter splitter)
     {
         if (splitter.IsUnderground && !(layer is SectionLayer_UGConveyor))
         {
             return;
         }
         if ((splitter.OutputLinks.ContainsKey(Rot4.South) &&
              splitter.OutputLinks[Rot4.South].Active) ||
             splitter.Rotation == Rot4.North)
         {
             // Draw open door
             var mat = splitterBuildingDoorOpen.Graphic.MatSingleFor(thing);
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.3f, 0),
                                      Vector2.one, mat);
         }
         else
         {
             // Draw closed door
             var mat = splitterBuildingDoorClosed.Graphic.MatSingleFor(thing);
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.3f, 0),
                                      Vector2.one, mat);
         }
         // Print the splitter version of the tiny yellow arrow showing direction:
         Printer_Plane.PrintPlane(layer, thing.TrueCenter()
                                  + new Vector3(0, 1f, 0), this.drawSize, arrow00b,
                                  thing.Rotation.AsAngle);
         // print tiny brown arrows pointing in output directions:
         foreach (var d in splitter.ActiveOutputDirections)
         {
             Printer_Plane.PrintPlane(layer, thing.TrueCenter() +
                                      this.arrowOffsetsByRot4[d.AsInt],
                                      this.drawSize, arrow01, d.AsAngle);
         }
     }
     else     // blueprint?
     //var mat = FadedMaterialPool.FadedVersionOf(splitterBuildingDoorClosed.Graphic.MatSingleFor(thing), 0.5f);
     {
         Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.3f, 0),
                                  Vector2.one, splitterBuildingBlueprint.Graphic.MatSingleFor(thing));
     }
 }
Exemple #29
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            Vector3 vector3 = thing.TrueCenter();

            Rand.PushState();
            Rand.Seed = thing.Position.GetHashCode();
            int num = thing is Filth filth ? filth.thickness : 3;

            for (int index = 0; index < num; ++index)
            {
                Material matSingle = this.MatSingle;
                Vector3  center    = vector3 + new Vector3(Rand.Range(-0.45f, 0.45f), 0.0f, Rand.Range(-0.45f, 0.45f));
                Vector2  size      = new Vector2(Rand.Range(this.data.drawSize.x * 0.8f, this.data.drawSize.x * 1.2f), Rand.Range(this.data.drawSize.y * 0.8f, this.data.drawSize.y * 1.2f));
                float    rot       = (float)Rand.RangeInclusive(0, 360);
                bool     flipUv    = (double)Rand.Value < 0.5;
                Printer_Plane.PrintPlane(layer, center, size, matSingle, rot, flipUv, (Vector2[])null, (Color32[])null, 0.01f, 0.0f);
            }
            Rand.PopState();
        }
Exemple #30
0
        public static void PrintWirePieceConnecting(SectionLayer layer, Thing A, Thing B, bool forPowerOverlay)
        {
            Material mat = PowerNetGraphics.WireMat;
            float    y   = AltitudeLayer.SmallWire.AltitudeFor();

            if (forPowerOverlay)
            {
                mat = PowerOverlayMats.MatConnectorLine;
                y   = AltitudeLayer.MapDataOverlay.AltitudeFor();
            }
            Vector3 center = (A.TrueCenter() + B.TrueCenter()) / 2f;

            center.y = y;
            Vector3 v    = B.TrueCenter() - A.TrueCenter();
            Vector2 size = new Vector2(1f, v.MagnitudeHorizontal());
            float   rot  = v.AngleFlat();

            Printer_Plane.PrintPlane(layer, center, size, mat, rot, false, null, null, 0.01f, 0f);
        }