// Function from file: transit_tube_construction.dm
        public virtual void tube_flip(  )
        {
            ByTable split_text = null;

            split_text = GlobalFuncs.splittext(this.icon_state, "-");

            if (Lang13.Length(split_text[2]) < 2)
            {
                return;
            }

            if (split_text.len == 3 && split_text[3] != "Pass")
            {
                split_text.Swap(2, 3);
            }
            else if (Lang13.Length(split_text[1]) == 2 && Lang13.Length(split_text[2]) == 2)
            {
                split_text[1] = String13.SubStr(split_text[1], 1, 2) + String13.SubStr(split_text[2], 2, 3);
                split_text[2] = String13.SubStr(split_text[2], 1, 2) + (String13.SubStr(split_text[2], 2, 3) == "E" ? "W" : "E");
            }
            else if (split_text[1] == "N" || split_text[1] == "S")
            {
                split_text[2] = String13.SubStr(split_text[2], 1, 2) + (String13.SubStr(split_text[2], 2, 3) == "E" ? "W" : "E");
            }
            else
            {
                split_text[2] = (String13.SubStr(split_text[2], 1, 2) == "N" ? "S" : "N") + String13.SubStr(split_text[2], 2, 3);
            }
            this.icon_state = GlobalFuncs.jointext(split_text, "-");
            return;
        }
        // Function from file: transit_tube_construction.dm
        public virtual void tube_turn(double angle = 0)
        {
            ByTable badtubes   = null;
            ByTable split_text = null;
            int?    i          = null;
            int     curdir     = 0;
            string  newdir     = null;

            badtubes   = new ByTable(new object [] { "W-E", "W-E-Pass", "S-N", "S-N-Pass", "SW-NE", "SE-NW" });
            split_text = GlobalFuncs.splittext(this.icon_state, "-");
            i          = null;
            i          = 1;

            while ((i ?? 0) <= split_text.len)
            {
                curdir = GlobalFuncs.text2dir_extended(split_text[i]);

                if (curdir != 0)
                {
                    split_text[i] = GlobalFuncs.dir2text_short(Num13.Rotate(curdir, angle));
                }
                i++;
            }
            newdir = GlobalFuncs.jointext(split_text, "-");

            if (badtubes.Find(newdir) != 0)
            {
                split_text.Swap(1, 2);
                newdir = GlobalFuncs.jointext(split_text, "-");
            }
            this.icon_state = newdir;
            return;
        }
Example #3
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void moveRange( ByTable L = null, dynamic fromIndex = null, dynamic toIndex = null, dynamic len = null ) {
			dynamic distance = null;
			dynamic i = null;
			dynamic i2 = null;
			if ( len == null ) {
				len = 1;
			}
			distance = Math.Abs( Lang13.Double( toIndex - fromIndex ) );
			if ( Lang13.Double( len ) >= Lang13.Double( distance ) ) {
				if ( Lang13.Double( fromIndex ) <= Lang13.Double( toIndex ) ) {
					return;
				}
				fromIndex += len;
				i = null;
				i = 0;
				while (Lang13.Double( i ) < Lang13.Double( distance )) {
					L.Insert( Lang13.Int( fromIndex ), null );
					L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) );
					L.Cut( Lang13.IntNullable( toIndex ), Lang13.Int( toIndex + 1 ) );
					i++;
				}
			} else {
				if ( Lang13.Double( fromIndex ) > Lang13.Double( toIndex ) ) {
					fromIndex += len;
				}
				i2 = null;
				i2 = 0;
				while (Lang13.Double( i2 ) < Lang13.Double( len )) {
					L.Insert( Lang13.Int( toIndex ), null );
					L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) );
					L.Cut( Lang13.IntNullable( fromIndex ), Lang13.Int( fromIndex + 1 ) );
					i2++;
				}
			}
			return;
		}
Example #4
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void moveElement( ByTable L = null, dynamic fromIndex = null, dynamic toIndex = null ) {
			if ( fromIndex == toIndex || fromIndex + 1 == toIndex ) {
				return;
			}
			if ( Lang13.Double( fromIndex ) > Lang13.Double( toIndex ) ) {
				fromIndex++;
			}
			L.Insert( Lang13.Int( toIndex ), null );
			L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) );
			L.Cut( Lang13.IntNullable( fromIndex ), Lang13.Int( fromIndex + 1 ) );
			return;
		}
Example #5
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable camera_sort( ByTable L = null ) {
			dynamic a = null;
			dynamic b = null;
			int? i = null;
			double? j = null;
			i = null;
			i = L.len;
			while (( i ??0) > 0) {
				j = null;
				foreach (dynamic _a in Lang13.iter_range( 1, ( i ??0) - 1 ) ) {
					j = _a;
					a = L[j];
					b = L[( j ??0) + 1];
					if ( a.c_tag_order != b.c_tag_order ) {
						if ( Lang13.Double( a.c_tag_order ) > Lang13.Double( b.c_tag_order ) ) {
							L.Swap( ((int)( j )), ((int)( ( j ??0) + 1 )) );
						}
					} else if ( String13.order( a.c_tag, b.c_tag ) < 0 ) {
						L.Swap( ((int)( j )), ((int)( ( j ??0) + 1 )) );
					}
				};
				i--;
			}
			return L;
		}
Example #6
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable shuffle( ByTable L = null ) {
			int? i = null;
			if ( !( L != null ) ) {
				return null;
			}
			L = L.Copy();
			i = null;
			i = 1;
			while (( i ??0) < L.len) {
				L.Swap( i ??0, Rand13.Int( i ??0, L.len ) );
				i++;
			}
			return L;
		}
Example #7
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable reverseRange( ByTable L = null, double? start = null, double? end = null ) {
			if ( start == null ) {
				start = 1;
			}
			if ( end == null ) {
				end = 0;
			}
			if ( L.len != 0 ) {
				start = ( start ??0) % L.len;
				end = ( end ??0) % ( L.len + 1 );
				if ( ( start ??0) <= 0 ) {
					start += L.len;
				}
				if ( ( end ??0) <= 0 ) {
					end += L.len + 1;
				}
				end--;
				while (( start ??0) < ( end ??0)) {
					L.Swap( ((int)( start++ )), ((int)( end-- )) );
				}
			}
			return L;
		}