예제 #1
0
 // Function from file: nuclearbomb.dm
 public Obj_Machinery_Nuclearbomb(dynamic loc = null) : base((object)(loc))
 {
     // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
     GlobalVars.nuke_list.Add(this);
     this.core = new Obj_Item_NukeCore(this);
     GlobalVars.SSobj.processing.Remove(this.core);
     this.update_icon();
     this.previous_level = GlobalFuncs.get_security_level();
     return;
 }
예제 #2
0
        // Function from file: nuclearbomb.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic welder   = null;
            dynamic core_box = null;
            dynamic M        = null;


            if (A is Obj_Item_Weapon_Disk_Nuclear)
            {
                if (!Lang13.Bool(user.drop_item()))
                {
                    return(null);
                }
                A.loc     = this;
                this.auth = A;
                this.add_fingerprint(user);
                return(null);
            }

            switch ((int)(this.deconstruction_state))
            {
            case 5:

                if (A is Obj_Item_Weapon_Screwdriver_Nuke)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    user.WriteMsg("<span class='notice'>You start removing " + this + "'s front panel's screws...</span>");

                    if (GlobalFuncs.do_after(user, 60 / A.toolspeed, null, this))
                    {
                        this.deconstruction_state = 4;
                        user.WriteMsg("<span class='notice'>You remove the screws from " + this + "'s front panel.</span>");
                        this.update_icon();
                    }
                    return(null);
                }
                break;

            case 4:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    user.WriteMsg("<span class='notice'>You start removing " + this + "'s front panel...</span>");
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);

                    if (GlobalFuncs.do_after(user, 30 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You remove " + this + "'s front panel.</span>");
                        this.deconstruction_state = 3;
                        this.update_icon();
                    }
                    return(null);
                }
                break;

            case 3:

                if (A is Obj_Item_Weapon_Weldingtool)
                {
                    welder = A;
                    GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 100, 1);
                    user.WriteMsg("<span class='notice'>You start cutting " + this + "'s inner plate...</span>");

                    if (((Obj_Item_Weapon_Weldingtool)welder).remove_fuel(1, user))
                    {
                        if (GlobalFuncs.do_after(user, 80 / A.toolspeed, null, this))
                        {
                            user.WriteMsg("<span class='notice'>You cut " + this + "'s inner plate.</span>");
                            this.deconstruction_state = 2;
                            this.update_icon();
                        }
                    }
                    return(null);
                }
                break;

            case 2:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    user.WriteMsg("<span class='notice'>You start prying off " + this + "'s inner plate...</span>");
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);

                    if (GlobalFuncs.do_after(user, 50 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You pry off " + this + "'s inner plate. You can see the core's green glow!</span>");
                        this.deconstruction_state = 1;
                        this.update_icon();
                        GlobalVars.SSobj.processing.Add(this.core);
                    }
                }
                break;

            case 1:

                if (A is Obj_Item_NukeCoreContainer)
                {
                    core_box = A;
                    user.WriteMsg("<span class='notice'>You start loading the plutonium core into " + core_box + "...</span>");

                    if (GlobalFuncs.do_after(user, 50, null, this))
                    {
                        if (Lang13.Bool(core_box.load(this.core, user)))
                        {
                            user.WriteMsg("<span class='notice'>You load the plutonium core into " + core_box + ".</span>");
                            this.deconstruction_state = 0;
                            this.update_icon();
                            this.core = null;
                        }
                        else
                        {
                            user.WriteMsg("<span class='warning'>You fail to load the plutonium core into " + core_box + ". " + core_box + " has already been used!</span>");
                        }
                    }
                    return(null);
                }

                if (A is Obj_Item_Stack_Sheet_Metal)
                {
                    M = A;

                    if (Convert.ToDouble(M.amount) >= 20)
                    {
                        user.WriteMsg("<span class='notice'>You begin repairing " + this + "'s inner metal plate...</span>");

                        if (GlobalFuncs.do_after(user, 100, null, this))
                        {
                            if (Lang13.Bool(M.use(20)))
                            {
                                user.WriteMsg("<span class='notice'>You repair " + this + "'s inner metal plate. The radiation is contained.</span>");
                                this.deconstruction_state = 3;
                                GlobalVars.SSobj.processing.Remove(this.core);
                                this.update_icon();
                            }
                            else
                            {
                                user.WriteMsg("<span class='warning'>You need more metal to do that!</span>");
                            }
                        }
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>You need more metal to do that!</span>");
                    }
                    return(null);
                }
                break;

            default:
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
                break;
            }
            return(null);
        }