Exemple #1
0
        // Function from file: robot_parts.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic M = null;
            Obj_Item_Weapon_Ed209Assembly B = null;
            dynamic M2 = null;
            dynamic BM = null;
            Mob_Living_Silicon_Robot O = null;

            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);

            if (A is Obj_Item_Stack_Sheet_Metal && !Lang13.Bool(this.l_arm) && !Lang13.Bool(this.r_arm) && !Lang13.Bool(this.l_leg) && !Lang13.Bool(this.r_leg) && !Lang13.Bool(this.chest) && !Lang13.Bool(this.head))
            {
                M = A;

                if (Lang13.Bool(M.use(1)))
                {
                    B     = new Obj_Item_Weapon_Ed209Assembly();
                    B.loc = GlobalFuncs.get_turf(this);
                    user.WriteMsg("<span class='notice'>You arm the robot frame.</span>");

                    if (((Mob)user).get_inactive_hand() == this)
                    {
                        ((Mob)user).unEquip(this);
                        ((Mob)user).put_in_inactive_hand(B);
                    }
                    GlobalFuncs.qdel(this);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need one sheet of metal to start building ED-209!</span>");
                    return(null);
                }
            }

            if (A is Obj_Item_RobotParts_LLeg)
            {
                if (Lang13.Bool(this.l_leg))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.l_leg = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_RLeg)
            {
                if (Lang13.Bool(this.r_leg))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.r_leg = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_LArm)
            {
                if (Lang13.Bool(this.l_arm))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.l_arm = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_RArm)
            {
                if (Lang13.Bool(this.r_arm))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.r_arm = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_Chest)
            {
                if (Lang13.Bool(this.chest))
                {
                    return(null);
                }

                if (Lang13.Bool(A.wired) && Lang13.Bool(A.cell))
                {
                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }
                    A.loc      = this;
                    this.chest = A;
                    this.updateicon();
                }
                else if (!Lang13.Bool(A.wired))
                {
                    user.WriteMsg("<span class='warning'>You need to attach wires to it first!</span>");
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need to attach a cell to it first!</span>");
                }
            }

            if (A is Obj_Item_RobotParts_Head)
            {
                if (Lang13.Bool(this.head))
                {
                    return(null);
                }

                if (Lang13.Bool(A.flash2) && Lang13.Bool(A.flash1))
                {
                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }
                    A.loc     = this;
                    this.head = A;
                    this.updateicon();
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need to attach a flash to it first!</span>");
                }
            }

            if (A is Obj_Item_Device_Multitool)
            {
                if (this.check_completion())
                {
                    this.Interact(user);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>The endoskeleton must be assembled before debugging can begin!</span>");
                }
            }

            if (A is Obj_Item_Device_Mmi)
            {
                M2 = A;

                if (this.check_completion())
                {
                    if (!(this.loc is Tile))
                    {
                        user.WriteMsg("<span class='warning'>You can't put the MMI in, the frame has to be standing on the ground to be perfectly precise!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(M2.brainmob))
                    {
                        user.WriteMsg("<span class='warning'>Sticking an empty MMI into the frame would sort of defeat the purpose!</span>");
                        return(null);
                    }
                    BM = M2.brainmob;

                    if (!Lang13.Bool(BM.key) || !Lang13.Bool(BM.mind))
                    {
                        user.WriteMsg("<span class='warning'>The mmi indicates that their mind is completely unresponsive; there's no point!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(BM.client))
                    {
                        user.WriteMsg("<span class='warning'>The mmi indicates that their mind is currently inactive; it might change!</span>");
                        return(null);
                    }

                    if (Convert.ToInt32(BM.stat) == 2 || Lang13.Bool(M2.brain) && M2.brain.damaged_brain)
                    {
                        user.WriteMsg("<span class='warning'>Sticking a dead brain into the frame would sort of defeat the purpose!</span>");
                        return(null);
                    }

                    if (GlobalFuncs.jobban_isbanned(BM, "Cyborg"))
                    {
                        user.WriteMsg("<span class='warning'>This MMI does not seem to fit!</span>");
                        return(null);
                    }
                    O = new Mob_Living_Silicon_Robot(GlobalFuncs.get_turf(this.loc));

                    if (!(O != null))
                    {
                        return(null);
                    }

                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }

                    if (M2.syndiemmi)
                    {
                        this.aisync  = false;
                        this.lawsync = false;
                        O.laws       = new AiLaws_SyndicateOverride();
                    }
                    O.invisibility = 0;
                    O.custom_name  = this.created_name;
                    O.locked       = this.panel_locked;

                    if (!this.aisync)
                    {
                        this.lawsync   = false;
                        O.connected_ai = null;
                    }
                    else
                    {
                        O.notify_ai(1);

                        if (Lang13.Bool(this.forced_ai))
                        {
                            O.connected_ai = this.forced_ai;
                        }
                    }

                    if (!this.lawsync && !M2.syndiemmi)
                    {
                        O.lawupdate = false;
                        O.make_laws();
                    }
                    ((GameMode)GlobalVars.ticker.mode).remove_antag_for_borging(BM.mind);
                    ((Mind)BM.mind).transfer_to(O);

                    if (O.mind != null && Lang13.Bool(O.mind.special_role))
                    {
                        O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.");
                        O.WriteMsg("<span class='userdanger'>You have been robotized!</span>");
                        O.WriteMsg("<span class='danger'>You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.</span>");
                    }
                    O.job  = "Cyborg";
                    O.cell = this.chest.cell;
                    this.chest.cell.loc = O;
                    this.chest.cell     = null;
                    A.loc = O;

                    if (Lang13.Bool(O.mmi))
                    {
                        GlobalFuncs.qdel(O.mmi);
                    }
                    O.mmi = A;
                    O.updatename();
                    GlobalFuncs.feedback_inc("cyborg_birth", 1);
                    this.loc     = O;
                    O.robot_suit = this;

                    if (!this.locomotion)
                    {
                        O.lockcharge = true;
                        O.update_canmove();
                        O.WriteMsg("<span class='warning'>Error: Servo motors unresponsive.</span>");
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>The MMI must go in after everything else!</span>");
                }
            }

            if (A is Obj_Item_Weapon_Pen)
            {
                user.WriteMsg("<span class='warning'>You need to use a multitool to name " + this + "!</span>");
            }
            return(null);
        }
        // Function from file: ed209bot.dm
        public override void explode(  )
        {
            dynamic Tsec = null;
            Obj_Item_Weapon_Ed209Assembly            Sa = null;
            Obj_Item_Weapon_Gun_Energy_Gun_Advtaser  G  = null;
            Obj_Item_Weapon_Gun_Energy_Laser_Bluetag G2 = null;
            Obj_Item_Weapon_Gun_Energy_Laser_Redtag  G3 = null;
            EffectSystem_SparkSpread s = null;

            Map13.WalkTowards(this, 0, 0, 0);
            this.visible_message("<span class='boldannounce'>" + this + " blows apart!</span>");
            Tsec          = GlobalFuncs.get_turf(this);
            Sa            = new Obj_Item_Weapon_Ed209Assembly(Tsec);
            Sa.build_step = 1;
            Sa.overlays.Add(new Image("icons/obj/aibots.dmi", "hs_hole"));
            Sa.created_name = this.name;
            new Obj_Item_Device_Assembly_ProxSensor(Tsec);

            if (!Lang13.Bool(this.lasercolor))
            {
                G = new Obj_Item_Weapon_Gun_Energy_Gun_Advtaser(Tsec);
                G.power_supply.charge = 0;
                G.update_icon();
            }
            else if (this.lasercolor == "b")
            {
                G2 = new Obj_Item_Weapon_Gun_Energy_Laser_Bluetag(Tsec);
                G2.power_supply.charge = 0;
                G2.update_icon();
            }
            else if (this.lasercolor == "r")
            {
                G3 = new Obj_Item_Weapon_Gun_Energy_Laser_Redtag(Tsec);
                G3.power_supply.charge = 0;
                G3.update_icon();
            }

            if (Rand13.PercentChance(50))
            {
                new Obj_Item_RobotParts_LLeg(Tsec);

                if (Rand13.PercentChance(25))
                {
                    new Obj_Item_RobotParts_RLeg(Tsec);
                }
            }

            if (Rand13.PercentChance(25))
            {
                if (Rand13.PercentChance(50))
                {
                    new Obj_Item_Clothing_Head_Helmet(Tsec);
                }
                else
                {
                    if (!Lang13.Bool(this.lasercolor))
                    {
                        new Obj_Item_Clothing_Suit_Armor_Vest(Tsec);
                    }

                    if (this.lasercolor == "b")
                    {
                        new Obj_Item_Clothing_Suit_Bluetag(Tsec);
                    }

                    if (this.lasercolor == "r")
                    {
                        new Obj_Item_Clothing_Suit_Redtag(Tsec);
                    }
                }
            }
            s = new EffectSystem_SparkSpread();
            s.set_up(3, 1, this);
            s.start();
            new Obj_Effect_Decal_Cleanable_Oil(this.loc);
            base.explode();
            return;
        }