// 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;
        }
        // Function from file: buildmode.dm
        public override bool Click(dynamic loc = null, string control = null, string _params = null)
        {
            ByTable pa = null;

            pa = String13.ParseUrlParams(_params);

            if (pa.Find("left") != 0)
            {
                ((Buildmode)this.bd).toggle_modes();
            }
            else if (pa.Find("right") != 0)
            {
                ((Buildmode)this.bd).change_settings(Task13.User);
            }
            this.update_icon();
            return(true);
        }
Exemple #3
0
        // Function from file: computer.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            ByTable options          = null;
            Obj_DockingPort_Mobile M = null;
            string dat = null;
            bool   destination_found     = false;
            Obj_DockingPort_Stationary S = null;
            Browser popup = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            this.add_fingerprint(Task13.User);
            options = String13.ParseUrlParams(this.possible_destinations);
            M       = GlobalVars.SSshuttle.getShuttle(this.shuttleId);
            dat     = "Status: " + (M != null ? M.getStatusText() : "*Missing*") + "<br><br>";

            if (M != null)
            {
                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSshuttle.stationary, typeof(Obj_DockingPort_Stationary)))
                {
                    S = _a;


                    if (!(options.Find(S.id) != 0))
                    {
                        continue;
                    }

                    if (M.canDock(S) != 0)
                    {
                        continue;
                    }
                    destination_found = true;
                    dat += new Txt("<A href='?src=").Ref(this).str(";move=").item(S.id).str("'>Send to ").item(S.name).str("</A><br>").ToString();
                }

                if (!destination_found)
                {
                    dat += "<B>Shuttle Locked</B><br>";

                    if (this.admin_controlled)
                    {
                        dat += "Authorized personnel only<br>";
                        dat += new Txt("<A href='?src=").Ref(this).str(";request=1]'>Request Authorization</A><br>").ToString();
                    }
                }
            }
            dat  += new Txt("<a href='?src=").Ref(a).str(";mach_close=computer'>Close</a>").ToString();
            popup = new Browser(a, "computer", (M != null ? M.name : "shuttle"), 300, 200);
            popup.set_content("<center>" + dat + "</center>");
            popup.set_title_image(Task13.User.browse_rsc_icon(this.icon, this.icon_state));
            popup.open();
            return(null);
        }
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static bool above_neck( dynamic zone = null ) {
			ByTable zones = null;
			zones = new ByTable(new object [] { "head", "mouth", "eyes" });
			if ( zones.Find( zone ) != 0 ) {
				return true;
			} else {
				return false;
			}
		}
Exemple #5
0
        // Function from file: camera.dm
        public override dynamic check_eye(Mob user = null)
        {
            Obj_Machinery_Camera C = null;
            ByTable viewing        = null;


            if ((this.stat & 3) != 0 || user.incapacitated() || user.eye_blind != 0)
            {
                user.unset_machine();
                return(null);
            }

            if (!this.watchers.Contains(user))
            {
                user.unset_machine();
                return(null);
            }

            if (!Lang13.Bool(this.watchers[user]))
            {
                user.unset_machine();
                return(null);
            }
            C = this.watchers[user];

            if (!C.can_use())
            {
                user.unset_machine();
                return(null);
            }

            if (!(user is Mob_Living_Silicon))
            {
                if (!this.Adjacent(user))
                {
                    user.unset_machine();
                    return(null);
                }
            }
            else if (user is Mob_Living_Silicon_Robot)
            {
                viewing = Map13.FetchViewers(null, this);

                if (!(viewing.Find(user) != 0))
                {
                    user.unset_machine();
                }
            }
            return(null);
        }
        // Function from file: buildandrepair.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            ByTable dept_list = null;
            dynamic choice    = null;


            if (A is Obj_Item_Device_Multitool)
            {
                dept_list = new ByTable(new object [] { "general", "security", "medical", "science", "engineering" });
                choice    = Interface13.Input("Currently set to " + dept_list[this.target_dept] + " personnel database. Changing to:", "Multitool-Circuitboard interface", null, null, dept_list, InputType.Null | InputType.Any);

                if (Lang13.Bool(choice))
                {
                    this.target_dept = dept_list.Find(choice);
                }
            }
            return(null);
        }
Exemple #7
0
        // Function from file: holy_weapons.dm
        public void reskin_holy_weapon(dynamic M = null)
        {
            dynamic holy_weapons_list = null;
            ByTable display_names     = null;
            dynamic V           = null;
            dynamic A           = null;
            dynamic choice      = null;
            int     index       = 0;
            dynamic A2          = null;
            dynamic holy_weapon = null;

            holy_weapons_list = Lang13.GetTypes(typeof(Obj_Item_Weapon_Nullrod));
            display_names     = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(holy_weapons_list))
            {
                V = _a;

                A = V;
                display_names.Add(Lang13.Initial(A, "name"));
            }
            choice = Interface13.Input(M, "What theme would you like for your holy weapon?", "Holy Weapon Theme", null, display_names, InputType.Null | InputType.Any);

            if (!(this != null) || !Lang13.Bool(choice) || Lang13.Bool(M.stat) || !(Map13.GetDistance(M, this) <= 1) || ((Mob)M).restrained() || !Lang13.Bool(M.canmove) || this.reskinned)
            {
                return;
            }
            index       = display_names.Find(choice);
            A2          = holy_weapons_list[index];
            holy_weapon = Lang13.Call(A2);
            GlobalFuncs.feedback_set_details("chaplain_weapon", "" + choice);

            if (Lang13.Bool(holy_weapon))
            {
                holy_weapon.reskinned = GlobalVars.TRUE;
                ((Mob)M).unEquip(this);
                ((Mob)M).put_in_active_hand(holy_weapon);
                GlobalFuncs.qdel(this);
            }
            return;
        }
        // Function from file: constructable_frame.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic fridges  = null;
            dynamic position = null;


            if (A is Obj_Item_Weapon_Screwdriver)
            {
                fridges = new ByTable()
                          .Set(typeof(Obj_Machinery_Smartfridge), "default")
                          .Set(typeof(Obj_Machinery_Smartfridge_Drinks), "drinks")
                          .Set(typeof(Obj_Machinery_Smartfridge_Extract), "slimes")
                          .Set(typeof(Obj_Machinery_Smartfridge_Chemistry), "chems")
                          .Set(typeof(Obj_Machinery_Smartfridge_Chemistry_Virology), "viruses")
                ;
                position        = fridges.Find(this.build_path, fridges);
                position        = (position == fridges.len ? ((dynamic)(1)) : position + 1);
                this.build_path = fridges[position];
                user.WriteMsg("<span class='notice'>You set the board to " + fridges[this.build_path] + ".</span>");
            }
            return(null);
        }
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic next_list_item( dynamic item = null, ByTable L = null ) {
			int i = 0;
			i = L.Find( item );
			if ( i == L.len ) {
				i = 1;
			} else {
				i++;
			}
			return L[i];
		}
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable getpois( bool? mobs_only = null, bool? skip_mindless = null ) {
			ByTable mobs = null;
			ByTable names = null;
			ByTable pois = null;
			ByTable namecounts = null;
			dynamic M = null;
			string name = null;
			BaseStatic A = null;
			string name2 = null;
			if ( mobs_only == null ) {
				mobs_only = false;
			}
			if ( skip_mindless == null ) {
				skip_mindless = false;
			}
			mobs = GlobalFuncs.sortmobs();
			names = new ByTable();
			pois = new ByTable();
			namecounts = new ByTable();
			M = null;
			foreach (dynamic _a in mobs ) {
				M = _a;
				if ( skip_mindless == true && !Lang13.Bool( M.mind ) && !Lang13.Bool( M.ckey ) ) {
					if ( !( M is Mob_Living_SimpleAnimal_Bot ) && !( M is Mob_Camera ) ) {
						continue;
					}
				}
				if ( Lang13.Bool( M.client ) && Lang13.Bool( M.client.holder ) && Lang13.Bool( M.client.holder.fakekey ) ) {
					continue;
				}
				name = M.name;
				if ( names.contains( name ) ) {
					namecounts[name]++;
					name = "" + name + " (" + namecounts[name] + ")";
				} else {
					names.Add( name );
					namecounts[name] = 1;
				}
				if ( Lang13.Bool( M.real_name ) && M.real_name != M.name ) {
					name += " [" + M.real_name + "]";
				}
				if ( Lang13.Int( M.stat ) == 2 ) {
					if ( M is Mob_Dead_Observer ) {
						name += " [ghost]";
					} else {
						name += " [dead]";
					}
				}
				pois[name] = M;
			};
			if ( !( mobs_only == true ) ) {
				A = null;
				foreach (dynamic _b in GlobalVars.poi_list ) {
					if ( !( _b is BaseStatic ) ) {
						continue;
					}
					A = _b;
					if ( !( A != null ) || !Lang13.Bool( ((dynamic)A).loc ) ) {
						continue;
					}
					name2 = ((dynamic)A).name;
					if ( names.Find( name2 ) != 0 ) {
						namecounts[name2]++;
						name2 = "" + name2 + " (" + namecounts[name2] + ")";
					} else {
						names.Add( name2 );
						namecounts[name2] = 1;
					}
					pois[name2] = A;
				};
			}
			return pois;
		}
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic previous_list_item( dynamic item = null, ByTable L = null ) {
			int i = 0;
			i = L.Find( item );
			if ( i == 1 ) {
				i = L.len;
			} else {
				i--;
			}
			return L[i];
		}
Exemple #12
0
        // Function from file: buildmode.dm
        public bool ClickOn(Ent_Static user = null, string _params = null, Base_Data _object = null)
        {
            bool _default = false;

            ByTable   pa          = null;
            int       right_click = 0;
            int       left_click  = 0;
            int       alt_click   = 0;
            int       ctrl_click  = 0;
            Base_Data T           = null;
            Base_Data T2          = null;
            Base_Data T3          = null;
            Base_Data T4          = null;
            Obj_Structure_Window_Reinforced WIN  = null;
            Obj_Structure_Window_Reinforced WIN2 = null;
            Obj_Structure_Window_Reinforced WIN3 = null;
            Obj_Structure_Window_Reinforced WIN4 = null;
            Obj_Structure_Window_Reinforced WIN5 = null;
            dynamic T5 = null;
            dynamic A  = null;
            dynamic G  = null;
            dynamic T6 = null;

            pa          = String13.ParseUrlParams(_params);
            right_click = pa.Find("right");
            left_click  = pa.Find("left");
            alt_click   = pa.Find("alt");
            ctrl_click  = pa.Find("ctrl");
            _default    = true;

            switch ((int)(this.mode))
            {
            case 1:

                if (_object is Tile && left_click != 0 && !(alt_click != 0) && !(ctrl_click != 0))
                {
                    T = _object;

                    if (_object is Tile_Space)
                    {
                        ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Floor_Plasteel));
                    }
                    else if (_object is Tile_Simulated_Floor)
                    {
                        ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Wall));
                    }
                    else if (_object is Tile_Simulated_Wall)
                    {
                        ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Wall_RWall));
                    }
                    GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " built " + T + " at (" + ((dynamic)T).x + "," + ((dynamic)T).y + "," + ((dynamic)T).z + ")");
                    return(_default);
                }
                else if (right_click != 0)
                {
                    GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " deleted " + _object + " at (" + ((dynamic)_object).x + "," + ((dynamic)_object).y + "," + ((dynamic)_object).z + ")");

                    if (_object is Tile_Simulated_Wall)
                    {
                        T2 = _object;
                        ((Tile)T2).ChangeTurf(typeof(Tile_Simulated_Floor_Plasteel));
                    }
                    else if (_object is Tile_Simulated_Floor)
                    {
                        T3 = _object;
                        ((Tile)T3).ChangeTurf(typeof(Tile_Space));
                    }
                    else if (_object is Tile_Simulated_Wall_RWall)
                    {
                        T4 = _object;
                        ((Tile)T4).ChangeTurf(typeof(Tile_Simulated_Wall));
                    }
                    else if (_object is Obj)
                    {
                        GlobalFuncs.qdel(_object);
                    }
                    return(_default);
                }
                else if (_object is Tile && alt_click != 0 && left_click != 0)
                {
                    GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " built an airlock at (" + ((dynamic)_object).x + "," + ((dynamic)_object).y + "," + ((dynamic)_object).z + ")");
                    new Obj_Machinery_Door_Airlock(GlobalFuncs.get_turf(_object));
                }
                else if (_object is Tile && ctrl_click != 0 && left_click != 0)
                {
                    switch ((int?)(this.build_dir))
                    {
                    case 1:
                        WIN     = new Obj_Structure_Window_Reinforced(GlobalFuncs.get_turf(_object));
                        WIN.dir = ((int)(GlobalVars.NORTH));
                        break;

                    case 2:
                        WIN2     = new Obj_Structure_Window_Reinforced(GlobalFuncs.get_turf(_object));
                        WIN2.dir = ((int)(GlobalVars.SOUTH));
                        break;

                    case 4:
                        WIN3     = new Obj_Structure_Window_Reinforced(GlobalFuncs.get_turf(_object));
                        WIN3.dir = ((int)(GlobalVars.EAST));
                        break;

                    case 8:
                        WIN4     = new Obj_Structure_Window_Reinforced(GlobalFuncs.get_turf(_object));
                        WIN4.dir = ((int)(GlobalVars.WEST));
                        break;

                    case 9:
                        WIN5     = new Obj_Structure_Window_Reinforced(GlobalFuncs.get_turf(_object));
                        WIN5.dir = ((int)(GlobalVars.NORTHWEST));
                        break;
                    }
                    GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " built a window at (" + ((dynamic)_object).x + "," + ((dynamic)_object).y + "," + ((dynamic)_object).z + ")");
                }
                break;

            case 2:

                if (left_click != 0)
                {
                    if (Lang13.Bool(this.objholder.IsSubclassOf(typeof(Tile))))
                    {
                        T5 = GlobalFuncs.get_turf(_object);
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " modified " + T5 + " (" + T5.x + "," + T5.y + "," + T5.z + ") to " + this.objholder);
                        ((Tile)T5).ChangeTurf(this.objholder);
                    }
                    else
                    {
                        A     = Lang13.Call(this.objholder, GlobalFuncs.get_turf(_object));
                        A.dir = this.build_dir;
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " modified " + A + "'s (" + A.x + "," + A.y + "," + A.z + ") dir to " + this.build_dir);
                    }
                }
                else if (right_click != 0)
                {
                    if (_object is Obj)
                    {
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " deleted " + _object + " at (" + ((dynamic)_object).x + "," + ((dynamic)_object).y + "," + ((dynamic)_object).z + ")");
                        GlobalFuncs.qdel(_object);
                    }
                }
                break;

            case 3:

                if (left_click != 0)
                {
                    if (_object.vars.Find(this.varholder) != 0)
                    {
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " modified " + ((dynamic)_object).name + "'s " + this.varholder + " to " + this.valueholder);
                        _object.vars[this.varholder] = this.valueholder;
                    }
                    else
                    {
                        ((dynamic)user).WriteMsg("<span class='warning'>" + Lang13.Initial(_object, "name") + " does not have a var called '" + this.varholder + "'</span>");
                    }
                }

                if (right_click != 0)
                {
                    if (_object.vars.Find(this.varholder) != 0)
                    {
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " modified " + ((dynamic)_object).name + "'s " + this.varholder + " to " + this.valueholder);
                        _object.vars[this.varholder] = Lang13.Initial(_object, this.varholder);
                    }
                    else
                    {
                        ((dynamic)user).WriteMsg("<span class='warning'>" + Lang13.Initial(_object, "name") + " does not have a var called '" + this.varholder + "'</span>");
                    }
                }
                break;

            case 4:

                if (left_click != 0)
                {
                    if (_object is Tile)
                    {
                        return(_default);
                    }
                    this.throw_atom = _object;
                }

                if (right_click != 0)
                {
                    if (this.throw_atom != null)
                    {
                        ((Ent_Dynamic)this.throw_atom).throw_at(_object, 10, 1, user);
                        GlobalFuncs.log_admin("Build Mode: " + GlobalFuncs.key_name(user) + " threw " + this.throw_atom + " at " + _object + " (" + ((dynamic)_object).x + "," + ((dynamic)_object).y + "," + ((dynamic)_object).z + ")");
                    }
                }
                break;

            case 5:

                if (!Lang13.Bool(this.cornerA))
                {
                    this.cornerA = GlobalFuncs.get_turf(_object);
                    return(_default);
                }

                if (Lang13.Bool(this.cornerA) && !Lang13.Bool(this.cornerB))
                {
                    this.cornerB = GlobalFuncs.get_turf(_object);
                }

                if (left_click != 0)
                {
                    if (Lang13.Bool(this.cornerA) && Lang13.Bool(this.cornerB))
                    {
                        if (!Lang13.Bool(this.generator_path))
                        {
                            ((dynamic)user).WriteMsg("<span class='warning'>Select generator type first.</span>");
                        }
                        G = Lang13.Call(this.generator_path);
                        ((MapGenerator)G).defineRegion(this.cornerA, this.cornerB, true);
                        ((MapGenerator)G).generate();
                        this.cornerA = null;
                        this.cornerB = null;
                        return(_default);
                    }
                }
                this.cornerA = null;
                this.cornerB = null;
                break;

            case 6:

                if (left_click != 0)
                {
                    T6 = GlobalFuncs.get_turf(_object);

                    if (this.stored != null)
                    {
                        GlobalFuncs.DuplicateObject(this.stored, true, null, T6);
                    }
                }
                else if (right_click != 0)
                {
                    if (_object is Ent_Dynamic)
                    {
                        this.stored = _object;
                    }
                }
                break;
            }
            return(_default);
        }
        public bool toggle(  )
        {
            Mob        M          = null;
            ByTable    modes      = null;
            dynamic    switchMode = null;
            Ent_Static H          = null;

            M = Task13.User;

            if (M is Mob_Dead)
            {
                return(false);
            }

            if (!this.can_use(M))
            {
                return(false);
            }

            if (this.has_sensor >= 2)
            {
                Task13.User.WriteMsg("The controls are locked.");
                return(false);
            }

            if (this.has_sensor <= 0)
            {
                Task13.User.WriteMsg("This suit does not have any sensors.");
                return(false);
            }
            modes      = new ByTable(new object [] { "Off", "Binary vitals", "Exact vitals", "Tracking beacon" });
            switchMode = Interface13.Input("Select a sensor mode:", "Suit Sensor Mode", modes[this.sensor_mode + 1], null, modes, InputType.Any);

            if (Map13.GetDistance(Task13.User, this) > 1)
            {
                Task13.User.WriteMsg("<span class='warning'>You have moved too far away!</span>");
                return(false);
            }
            this.sensor_mode = modes.Find(switchMode) - 1;

            if (this.loc == Task13.User)
            {
                switch ((int)(this.sensor_mode))
                {
                case 0:
                    Task13.User.WriteMsg("<span class='notice'>You disable your suit's remote sensing equipment.</span>");
                    break;

                case 1:
                    Task13.User.WriteMsg("<span class='notice'>Your suit will now only report whether you are alive or dead.</span>");
                    break;

                case 2:
                    Task13.User.WriteMsg("<span class='notice'>Your suit will now only report your exact vital lifesigns.</span>");
                    break;

                case 3:
                    Task13.User.WriteMsg("<span class='notice'>Your suit will now report your exact vital lifesigns as well as your coordinate position.</span>");
                    break;
                }
            }

            if (this.loc is Mob_Living_Carbon_Human)
            {
                H = this.loc;

                if (((dynamic)H).w_uniform == this)
                {
                    ((dynamic)H).update_suit_sensors();
                }
            }
            Lang13.SuperCall();
            return(false);
        }
Exemple #14
0
        public string write_map(dynamic t1 = null, dynamic t2 = null, dynamic flags = null)
        {
            Tile    nw              = null;
            Tile    se              = null;
            ByTable templates       = null;
            string  template_buffer = null;
            string  dmm_text        = null;
            double  pos_z           = 0;
            double  pos_y           = 0;
            double  pos_x           = 0;
            Tile    test_turf       = null;
            string  test_template   = null;
            int     template_number = 0;
            int     key_length      = 0;
            ByTable keys            = null;
            double  key_pos         = 0;
            int     z_level         = 0;
            int?    z_pos           = null;
            string  z_block         = null;
            int?    y_pos           = null;
            string  y_block         = null;
            int?    x_pos           = null;
            string  x_block         = null;
            double? key_number      = null;
            dynamic temp_key        = null;


            if (!(t1 is Tile) || !(t2 is Tile))
            {
                Task13.Crash("Invalid arguments supplied to proc write_map, arguments were not turfs.");
            }
            nw              = Map13.GetTile(Num13.MinInt(Convert.ToInt32(t1.x), Convert.ToInt32(t2.x)), Num13.MaxInt(Convert.ToInt32(t1.y), Convert.ToInt32(t2.y)), Num13.MinInt(Convert.ToInt32(t1.z), Convert.ToInt32(t2.z)));
            se              = Map13.GetTile(Num13.MaxInt(Convert.ToInt32(t1.x), Convert.ToInt32(t2.x)), Num13.MinInt(Convert.ToInt32(t1.y), Convert.ToInt32(t2.y)), Num13.MaxInt(Convert.ToInt32(t1.z), Convert.ToInt32(t2.z)));
            templates       = new ByTable(0);
            template_buffer = "";
            dmm_text        = "";

            foreach (dynamic _c in Lang13.IterateRange(nw.z, se.z))
            {
                pos_z = _c;


                foreach (dynamic _b in Lang13.IterateRange(nw.y, se.y))
                {
                    pos_y = _b;


                    foreach (dynamic _a in Lang13.IterateRange(nw.x, se.x))
                    {
                        pos_x = _a;

                        test_turf       = Map13.GetTile(((int)(pos_x)), ((int)(pos_y)), ((int)(pos_z)));
                        test_template   = this.make_template(test_turf, flags);
                        template_number = templates.Find(test_template);

                        if (!(template_number != 0))
                        {
                            templates.Add(test_template);
                            template_number = templates.len;
                        }
                        template_buffer += "" + template_number + ",";
                    }
                    template_buffer += ";";
                }
                template_buffer += ".";
            }
            key_length = Num13.Floor(Math.Log(this.letter_digits.len, templates.len - 1) + 1);
            keys       = null;
            keys       = new ByTable(templates.len);

            foreach (dynamic _d in Lang13.IterateRange(1, templates.len))
            {
                key_pos = _d;

                keys[key_pos] = this.get_model_key(key_pos, key_length);
                dmm_text     += "\"" + keys[key_pos] + "\" = (" + templates[key_pos] + ")\n";
            }
            z_level = 0;
            z_pos   = null;
            z_pos   = 1;

            while (GlobalVars.TRUE != 0)
            {
                if ((z_pos ?? 0) >= Lang13.Length(template_buffer))
                {
                    break;
                }

                if (z_level != 0)
                {
                    dmm_text += "\n";
                }
                dmm_text += "\n(1,1," + ++z_level + ") = {\"\n";
                z_block   = String13.SubStr(template_buffer, z_pos ?? 0, String13.FindIgnoreCase(template_buffer, ".", z_pos ?? 0, 0));
                y_pos     = null;
                y_pos     = 1;

                while (GlobalVars.TRUE != 0)
                {
                    if ((y_pos ?? 0) >= Lang13.Length(z_block))
                    {
                        break;
                    }
                    y_block = String13.SubStr(z_block, y_pos ?? 0, String13.FindIgnoreCase(z_block, ";", y_pos ?? 0, 0));
                    x_pos   = null;
                    x_pos   = 1;

                    while (GlobalVars.TRUE != 0)
                    {
                        if ((x_pos ?? 0) >= Lang13.Length(y_block))
                        {
                            break;
                        }
                        x_block    = String13.SubStr(y_block, x_pos ?? 0, String13.FindIgnoreCase(y_block, ",", x_pos ?? 0, 0));
                        key_number = String13.ParseNumber(x_block);
                        temp_key   = keys[key_number];
                        dmm_text  += temp_key;
                        Task13.Sleep(-1);
                        x_pos = String13.FindIgnoreCase(y_block, ",", x_pos ?? 0, 0) + 1;
                    }
                    dmm_text += "\n";
                    Task13.Sleep(-1);
                    y_pos = String13.FindIgnoreCase(z_block, ";", y_pos ?? 0, 0) + 1;
                }
                dmm_text += "\"}";
                Task13.Sleep(-1);
                z_pos = String13.FindIgnoreCase(template_buffer, ".", z_pos ?? 0, 0) + 1;
            }
            return(dmm_text);
        }
Exemple #15
0
        // Function from file: camera.dm
        public bool use_camera_console(dynamic user = null)
        {
            ByTable camera_list    = null;
            dynamic t              = null;
            Obj_Machinery_Camera C = null;
            bool    camera_fail    = false;
            ByTable viewing        = null;
            dynamic A              = null;

            camera_list = this.get_available_cameras();
            t           = Interface13.Input(user, "Which camera should you change to?", null, null, camera_list, InputType.Null | InputType.Any);

            if (user.machine != this)
            {
                return(false);
            }

            if (!Lang13.Bool(t))
            {
                ((Mob)user).unset_machine();
                return(false);
            }
            C = camera_list[t];

            if (t == "Cancel")
            {
                ((Mob)user).unset_machine();
                return(false);
            }

            if (C != null)
            {
                camera_fail = false;

                if (!C.can_use() || user.machine != this || user.eye_blind != 0 || ((Mob)user).incapacitated())
                {
                    camera_fail = true;
                }
                else if (user is Mob_Living_Silicon_Robot)
                {
                    viewing = Map13.FetchViewers(null, this);

                    if (!(viewing.Find(user) != 0))
                    {
                        camera_fail = true;
                    }
                }
                else if (!(user is Mob_Living_Silicon))
                {
                    if (!this.Adjacent(user))
                    {
                        camera_fail = true;
                    }
                }

                if (camera_fail)
                {
                    ((Mob)user).unset_machine();
                    return(false);
                }

                if (user is Mob_Living_Silicon_Ai)
                {
                    A = user;
                    ((Mob_Camera_AiEye)A.eyeobj).setLoc(GlobalFuncs.get_turf(C));
                    A.client.eye = A.eyeobj;
                }
                else
                {
                    ((Mob)user).reset_perspective(C);
                }
                this.watchers[user] = C;
                this.f_use_power(50);
                Task13.Schedule(5, (Task13.Closure)(() => {
                    this.use_camera_console(user);
                    return;
                }));
            }
            else
            {
                ((Mob)user).unset_machine();
            }
            return(false);
        }