Ejemplo n.º 1
0
        // Function from file: camera.dm
        public override dynamic Destroy(  )
        {
            this.toggle_cam(null, false);

            if (this.assembly != null)
            {
                GlobalFuncs.qdel(this.assembly);
                this.assembly = null;
            }

            if (this.bug is Obj_Item_Device_CameraBug)
            {
                this.bug.bugged_cameras.Remove(this.c_tag);

                if (this.bug.current == this)
                {
                    this.bug.current = null;
                }
                this.bug = null;
            }
            GlobalVars.cameranet.removeCamera(this);
            GlobalVars.cameranet.cameras.Remove(this);
            GlobalVars.cameranet.removeCamera(this);
            return(base.Destroy());
        }
Ejemplo n.º 2
0
 // Function from file: camera.dm
 public Obj_Machinery_Camera(dynamic loc = null) : base((object)(loc))
 {
     // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
     this.assembly       = new Obj_Machinery_CameraAssembly(this);
     this.assembly.state = 4;
     GlobalVars.cameranet.cameras.Add(this);
     GlobalVars.cameranet.addCamera(this);
     GlobalFuncs.add_to_proximity_list(this, 1);
     return;
 }
Ejemplo n.º 3
0
        // Function from file: camera.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            string  msg      = null;
            string  msg2     = null;
            dynamic U        = null;
            dynamic X        = null;
            dynamic P        = null;
            string  itemname = null;
            dynamic info     = null;
            dynamic O        = null;
            dynamic AI       = null;
            dynamic L        = null;

            msg  = "<span class='notice'>You attach " + A + " into the assembly's inner circuits.</span>";
            msg2 = "<span class='notice'>" + this + " already has that upgrade!</span>";

            if (A is Obj_Item_Weapon_Screwdriver)
            {
                this.panel_open = !Lang13.Bool(this.panel_open) ?1:0;
                user.WriteMsg("<span class='notice'>You screw the camera's panel " + (Lang13.Bool(this.panel_open) ? "open" : "closed") + ".</span>");
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                return(null);
            }

            if (Lang13.Bool(this.panel_open))
            {
                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    this.toggle_cam(user, true);
                    this.health = Lang13.Initial(this, "health");
                }
                else if (A is Obj_Item_Device_Multitool)
                {
                    this.setViewRange((this.view_range == Lang13.Initial(this, "view_range") ? ((dynamic)(this.short_range)) : Lang13.Initial(this, "view_range")));
                    user.WriteMsg("<span class='notice'>You " + (this.view_range == Lang13.Initial(this, "view_range") ? "restore" : "mess up") + " the camera's focus.</span>");
                }
                else if (A is Obj_Item_Weapon_Weldingtool)
                {
                    if (this.weld(A, user))
                    {
                        this.visible_message("<span class='warning'>" + user + " unwelds " + this + ", leaving it as just a frame screwed to the wall.</span>", "<span class='warning'>You unweld " + this + ", leaving it as just a frame screwed to the wall</span>");

                        if (!(this.assembly != null))
                        {
                            this.assembly = new Obj_Machinery_CameraAssembly();
                        }
                        this.assembly.loc   = this.loc;
                        this.assembly.state = 1;
                        this.assembly.dir   = this.dir;
                        this.assembly       = null;
                        GlobalFuncs.qdel(this);
                        return(null);
                    }
                }
                else if (A is Obj_Item_Device_Analyzer)
                {
                    if (!(this.isXRay() != 0))
                    {
                        this.upgradeXRay();
                        GlobalFuncs.qdel(A);
                        user.WriteMsg("" + msg);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
                else if (A is Obj_Item_Stack_Sheet_Mineral_Plasma)
                {
                    if (!(this.isEmpProof() != 0))
                    {
                        this.upgradeEmpProof();
                        user.WriteMsg("" + msg);
                        GlobalFuncs.qdel(A);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
                else if (A is Obj_Item_Device_Assembly_ProxSensor)
                {
                    if (!(this.isMotion() != 0))
                    {
                        this.upgradeMotion();
                        user.WriteMsg("" + msg);
                        GlobalFuncs.qdel(A);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
            }

            if ((A is Obj_Item_Weapon_Paper || A is Obj_Item_Device_Pda) && user is Mob_Living)
            {
                U        = user;
                X        = null;
                P        = null;
                itemname = "";
                info     = "";

                if (A is Obj_Item_Weapon_Paper)
                {
                    X        = A;
                    itemname = X.name;
                    info     = X.info;
                }
                else
                {
                    P        = A;
                    itemname = P.name;
                    info     = P.notehtml;
                }
                U.WriteMsg(new Txt("<span class='notice'>You hold ").the(itemname).item().str(" up to the camera...</span>").ToString());
                ((Mob)U).changeNext_move(8);

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
                {
                    O = _a;


                    if (O is Mob_Living_Silicon_Ai)
                    {
                        AI = O;

                        if (AI.control_disabled || Convert.ToInt32(AI.stat) == 2)
                        {
                            return(null);
                        }

                        if (U.name == "Unknown")
                        {
                            AI.WriteMsg(new Txt("<b>").item(U).str("</b> holds <a href='?_src_=usr;show_paper=1;'>").a(itemname).item().str("</a> up to one of your cameras ...").ToString());
                        }
                        else
                        {
                            AI.WriteMsg(new Txt("<b><a href='?src=").Ref(AI).str(";track=").item(String13.HtmlEncode(U.name)).str("'>").item(U).str("</a></b> holds <a href='?_src_=usr;show_paper=1;'>").a(itemname).item().str("</a> up to one of your cameras ...").ToString());
                        }
                        AI.last_paper_seen = "<HTML><HEAD><TITLE>" + itemname + "</TITLE></HEAD><BODY><TT>" + info + "</TT></BODY></HTML>";
                    }
                    else if (Lang13.Bool(O.client) && O.client.eye == this)
                    {
                        O.WriteMsg(new Txt().item(U).str(" holds ").a(itemname).item().str(" up to one of the cameras ...").ToString());
                        Interface13.Browse(O, "<HTML><HEAD><TITLE>" + itemname + "</TITLE></HEAD><BODY><TT>" + info + "</TT></BODY></HTML>", "window=" + itemname);
                    }
                }
            }
            else if (A is Obj_Item_Device_CameraBug)
            {
                if (!this.can_use())
                {
                    user.WriteMsg("<span class='notice'>Camera non-functional.</span>");
                    return(null);
                }

                if (this.bug is Obj_Item_Device_CameraBug)
                {
                    user.WriteMsg("<span class='notice'>Camera bug removed.</span>");
                    this.bug.bugged_cameras.Remove(this.c_tag);
                    this.bug = null;
                }
                else
                {
                    user.WriteMsg("<span class='notice'>Camera bugged.</span>");
                    this.bug = A;
                    this.bug.bugged_cameras[this.c_tag] = this;
                }
            }
            else if (A is Obj_Item_Device_LaserPointer)
            {
                L = A;
                ((Obj_Item_Device_LaserPointer)L).laser_act(this, user);
            }
            else if (Convert.ToDouble(A.force) >= 10)
            {
                ((Mob)user).changeNext_move(8);
                this.visible_message("<span class='warning'>" + user + " hits " + this + " with " + A + "!</span>", "<span class='warning'>You hit " + this + " with " + A + "!</span>");
                this.health = Num13.MaxInt(0, Convert.ToInt32(this.health - A.force));
                ((Ent_Dynamic)user).do_attack_animation(this);

                if (!Lang13.Bool(this.health) && this.status)
                {
                    this.triggerCameraAlarm();
                    this.toggle_cam(user, true);
                }
            }
            return(null);
        }