示例#1
0
        // Function from file: portable_turret.dm
        public Obj_Machinery_PortaTurret(dynamic loc = null) : base((object)(loc))
        {
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            if (!(this.v_base != null))
            {
                this.v_base = this;
            }
            this.icon_state   = "" + this.base_icon_state + this.off_state;
            this.spark_system = new EffectSystem_SparkSpread();
            this.spark_system.set_up(5, 0, this);
            this.spark_system.attach(this);

            if (this.has_cover)
            {
                this.cover = new Obj_Machinery_PortaTurretCover(this.loc);
                this.cover.Parent_Turret = this;
            }
            this.setup();

            if (!this.has_cover)
            {
                this.popUp();
            }
            return;
        }
示例#2
0
        // Function from file: portable_turret.dm
        public override int?process(dynamic seconds = null)
        {
            ByTable targets = null;


            if (this.cover == null && Lang13.Bool(this.anchored))
            {
                if ((this.stat & 1) != 0)
                {
                    GlobalFuncs.qdel(this.cover);
                }
                else if (this.has_cover)
                {
                    this.cover = new Obj_Machinery_PortaTurretCover(this.loc);
                    this.cover.Parent_Turret = this;
                }
            }

            if ((this.stat & 3) != 0)
            {
                if (!this.always_up)
                {
                    this.popDown();
                }
                return(null);
            }

            if (!this.on)
            {
                if (!this.always_up)
                {
                    this.popDown();
                }
                return(null);
            }
            targets = this.calculate_targets();

            if (!this.tryToShootAt(targets))
            {
                if (!this.always_up)
                {
                    this.popDown();
                }
            }
            return(null);
        }
示例#3
0
 // Function from file: portable_turret.dm
 public override dynamic Destroy(  )
 {
     GlobalFuncs.qdel(this.cover);
     this.cover = null;
     return(base.Destroy());
 }
示例#4
0
        // Function from file: portable_turret.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic Gun = null;
            dynamic M   = null;


            if ((this.stat & 1) != 0)
            {
                if (A is Obj_Item_Weapon_Crowbar)
                {
                    user.WriteMsg("<span class='notice'>You begin prying the metal coverings off...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        if (Rand13.PercentChance(70))
                        {
                            user.WriteMsg("<span class='notice'>You remove the turret and salvage some components.</span>");

                            if (Lang13.Bool(this.installation))
                            {
                                Gun = Lang13.Call(this.installation, this.loc);
                                Gun.power_supply.charge = this.gun_charge;
                                Gun.update_icon();
                                this.lasercolor = null;
                            }

                            if (Rand13.PercentChance(50))
                            {
                                new Obj_Item_Stack_Sheet_Metal(this.loc, Rand13.Int(1, 4));
                            }

                            if (Rand13.PercentChance(50))
                            {
                                new Obj_Item_Device_Assembly_ProxSensor(this.loc);
                            }
                        }
                        else
                        {
                            user.WriteMsg("<span class='notice'>You remove the turret but did not manage to salvage anything.</span>");
                        }
                        GlobalFuncs.qdel(this);
                    }
                }
            }
            else if (A is Obj_Item_Weapon_Wrench && !this.on)
            {
                if (this.raised)
                {
                    return(null);
                }

                if (!Lang13.Bool(this.anchored) && !this.isinspace())
                {
                    this.anchored     = 1;
                    this.invisibility = 60;
                    this.icon_state   = "" + this.base_icon_state + this.off_state;
                    user.WriteMsg("<span class='notice'>You secure the exterior bolts on the turret.</span>");

                    if (this.has_cover)
                    {
                        this.cover = new Obj_Machinery_PortaTurretCover(this.loc);
                        this.cover.Parent_Turret = this;
                    }
                }
                else if (Lang13.Bool(this.anchored))
                {
                    this.anchored = 0;
                    user.WriteMsg("<span class='notice'>You unsecure the exterior bolts on the turret.</span>");
                    this.icon_state   = "turretCover";
                    this.invisibility = 0;
                    GlobalFuncs.qdel(this.cover);
                }
            }
            else if (A is Obj_Item_Weapon_Card_Id || A is Obj_Item_Device_Pda)
            {
                if (this.allowed(user))
                {
                    this.locked = !this.locked;
                    user.WriteMsg("<span class='notice'>Controls are now " + (this.locked ? "locked" : "unlocked") + ".</span>");
                }
                else
                {
                    user.WriteMsg("<span class='notice'>Access denied.</span>");
                }
            }
            else if (A is Obj_Item_Device_Multitool && !this.locked)
            {
                M        = A;
                M.buffer = this;
                user.WriteMsg("<span class='notice'>You add " + this + " to multitool buffer.</span>");
            }
            else
            {
                ((Mob)user).changeNext_move(8);
                this.take_damage(A.force * 0.5);

                if (Convert.ToDouble(A.force * 0.5) > 1)
                {
                    if (!this.attacked && !Lang13.Bool(this.emagged))
                    {
                        this.attacked = true;
                        Task13.Schedule(0, (Task13.Closure)(() => {
                            Task13.Sleep(60);
                            this.attacked = false;
                            return;
                        }));
                    }
                }
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            return(null);
        }