public void StringToLines(CompTargetable_Tent t, Rot4 rot)
        {
            CompProperties_Tent props = this.Props;

            if (line_n == null || line_e == null || line_s == null || line_w == null)
            {
                BuildRots(t);
            }

            if (rot == Rot4.South)
            {
                lines = line_s;
            }
            else if (rot == Rot4.West)
            {
                lines = line_w;
            }
            else if (rot == Rot4.North)
            {
                lines = line_n;
            }
            else if (rot == Rot4.East)
            {
                lines = line_e;
            }

            this.lastRot = rot;
        }
        public void StringToLines(CompTargetable_Tent t, Rot4 rot)
        {
            CompProperties_Tent props = this.Props;

            string[] sline1;
            string[] sline2;
            string[] sline3;
            string[] sline4;
            string[] sline5;
            string[] sline6;
            string[] sline7;
            if (rot == Rot4.South)
            {
                sline1 = t.Props.line1_s.Split(',');
                sline2 = t.Props.line2_s.Split(',');
                sline3 = t.Props.line3_s.Split(',');
                sline4 = t.Props.line4_s.Split(',');
                sline5 = t.Props.line5_s.Split(',');
                sline6 = t.Props.line6_s.Split(',');
                sline7 = t.Props.line7_s.Split(',');
            }
            else if (rot == Rot4.West)
            {
                sline1 = t.Props.line1_w.Split(',');
                sline2 = t.Props.line2_w.Split(',');
                sline3 = t.Props.line3_w.Split(',');
                sline4 = t.Props.line4_w.Split(',');
                sline5 = t.Props.line5_w.Split(',');
                sline6 = t.Props.line6_w.Split(',');
                sline7 = t.Props.line7_w.Split(',');
            }
            else if (rot == Rot4.North)
            {
                sline1 = t.Props.line1_n.Split(',');
                sline2 = t.Props.line2_n.Split(',');
                sline3 = t.Props.line3_n.Split(',');
                sline4 = t.Props.line4_n.Split(',');
                sline5 = t.Props.line5_n.Split(',');
                sline6 = t.Props.line6_n.Split(',');
                sline7 = t.Props.line7_n.Split(',');
            }
            else
            {
                sline1 = t.Props.line1_e.Split(',');
                sline2 = t.Props.line2_e.Split(',');
                sline3 = t.Props.line3_e.Split(',');
                sline4 = t.Props.line4_e.Split(',');
                sline5 = t.Props.line5_e.Split(',');
                sline6 = t.Props.line6_e.Split(',');
                sline7 = t.Props.line7_e.Split(',');
            }
            t.line1.Clear();
            t.line2.Clear();
            t.line3.Clear();
            t.line4.Clear();
            t.line5.Clear();
            t.line6.Clear();
            t.line7.Clear();
            foreach (String l in sline1)
            {
                t.line1.Add(Int32.Parse(l));
            }
            foreach (String l in sline2)
            {
                t.line2.Add(Int32.Parse(l));
            }
            foreach (String l in sline3)
            {
                t.line3.Add(Int32.Parse(l));
            }
            foreach (String l in sline4)
            {
                t.line4.Add(Int32.Parse(l));
            }
            foreach (String l in sline5)
            {
                t.line5.Add(Int32.Parse(l));
            }
            foreach (String l in sline6)
            {
                t.line6.Add(Int32.Parse(l));
            }
            foreach (String l in sline7)
            {
                t.line7.Add(Int32.Parse(l));
            }
            this.lastRot = rot;
        }
        private static bool TargetValidator(IntVec3 c, Map map, CompTargetable_Tent t)
        {
            if (!c.InBounds(map) || !c.Standable(map))
            {
                return(false);
            }
            if (!c.Walkable(map))
            {
                return(false);
            }

            t.HandleRotation();
            t.GetPlacements(c);
            CellRect       cellRect   = new CellRect(c.x - 2, c.z - 2, 5, 4);
            List <IntVec3> clist      = new List <IntVec3>();
            Color          color      = new Color(1f, 1f, 1f, 0.4f);
            List <IntVec3> everything = new List <IntVec3>();

            everything.AddRange(t.wallCells);
            everything.AddRange(t.doorCells);


            foreach (IntVec3 current in everything)
            {
                if (!current.InBounds(map))
                {
                    return(false);
                }
                if (!GenConstruct.CanPlaceBlueprintAt(ThingDefOf.Wall, current, Rot4.North, map, false, null).Accepted)
                {
                    color = new Color(1f, 0f, 0f, 0.4f);
                }

                if (current.GetFirstItem(map) != null || current.GetFirstPawn(map) != null || current.GetFirstHaulable(map) != null)
                {
                    color = new Color(1f, 0f, 0f, 0.4f);
                }
                Building building = current.GetFirstBuilding(map);
                if (building != null)
                {
                    if (building.def.IsEdifice())
                    {
                        color = new Color(1f, 0f, 0f, 0.4f);
                    }
                }
                Plant plant = current.GetPlant(map);
                if (plant != null)
                {
                    if (plant.def.plant.IsTree)
                    {
                        color = new Color(1f, 0f, 0f, 0.4f);
                    }
                }
            }
            foreach (IntVec3 doorCell in t.doorCells)
            {
                GhostDrawer.DrawGhostThing(doorCell, t.placingRot, ThingDef.Named("TentDoor"), null, color, AltitudeLayer.Blueprint);
            }


            GenDraw.DrawFieldEdges(t.wallCells, color);

            return(true);
        }
        public void BuildRots(CompTargetable_Tent t)
        {
            List <List <int> > tmpSouth = new List <List <int> >();

            if (line_s == null)
            {
                //Parse tent shape loaded from xml
                for (int i = 0; i < t.Props.tentLayoutSouth.Count(); i++)
                {
                    List <String> splitRow = t.Props.tentLayoutSouth[i].Split(',').ToList();

                    List <int> intRow = splitRow.ConvertAll(int.Parse);
                    tmpSouth.Add(intRow);
                }
            }

            //Find tent size
            numRows = tmpSouth.Count();
            numCols = 0;

            for (int i = 0; i < numRows; i++)
            {
                int rowLen = tmpSouth[i].Count();
                if (numCols < rowLen)
                {
                    numCols = rowLen;
                }
            }

            //Build South orientation
            if (tmpSouth != null && line_s == null)
            {
                line_s = new int[numRows, numCols];

                for (int r = 0; r < numRows; r++)
                {
                    for (int c = 0; c < numCols; c++)
                    {
                        line_s[r, c] = tmpSouth[r].ElementAt(c);

                        if (line_s[r, c] == 3)
                        {
                            supportPosSX = c;
                            supportPosSY = r;
                        }
                    }
                }
            }

            // Variables for reverse traversing arrays
            int numRowIndex = numRows - 1;
            int numColIndex = numCols - 1;

            //Build West orientation
            if (line_w == null)
            {
                line_w = new int[numCols, numRows];
                for (int c = 0; c < numCols; c++)
                {
                    for (int r = numRowIndex; r >= 0; r--)
                    {
                        line_w[c, numRowIndex - r] = line_s[r, c];
                    }
                }
            }

            //Build North orientation
            if (line_n == null)
            {
                //North
                line_n = new int[numRows, numCols];
                //either count down on both
                for (int r = numRowIndex; r >= 0; r--)
                {
                    for (int c = numCols - 1; c >= 0; c--)
                    {
                        line_n[numRowIndex - r, numColIndex - c] = line_s[r, c];
                    }
                }
            }

            //Build East orientation
            if (line_e == null)             // top to bottom is flipped
            {
                //East
                line_e = new int[numCols, numRows];
                //outer column for- count down
                //inner row for
                for (int c = numColIndex; c >= 0; c--)
                {
                    for (int r = 0; r < numRows; r++)
                    {
                        line_e[numColIndex - c, r] = line_s[r, c];
                    }
                }
            }
        }