Exemplo n.º 1
0
        // Function from file: airlock.dm
        public override void on_pulse(string wire = null)
        {
            Ent_Static A = null;

            A = this.holder;

            switch ((string)(wire))
            {
            case "power1":
            case "power2":
                ((dynamic)A).loseMainPower();
                break;

            case "backup1":
            case "backup2":
                ((dynamic)A).loseBackupPower();
                break;

            case "open":

                if (Lang13.Bool(((dynamic)A).emagged))
                {
                    return;
                }

                if (!Lang13.Bool(((dynamic)A).requiresID()) || Lang13.Bool(((dynamic)A).check_access(null)))
                {
                    if (A.density)
                    {
                        ((dynamic)A).open();
                    }
                    else
                    {
                        ((dynamic)A).close();
                    }
                }
                break;

            case "bolts":

                if (!Lang13.Bool(((dynamic)A).locked))
                {
                    ((dynamic)A).bolt();
                    A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1);
                }
                else if (Lang13.Bool(((dynamic)A).hasPower()))
                {
                    ((dynamic)A).unbolt();
                    A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1);
                }
                ((dynamic)A).update_icon();
                break;

            case "idscan":

                if (Lang13.Bool(((dynamic)A).hasPower()) && A.density)
                {
                    ((dynamic)A).do_animate("deny");

                    if (Lang13.Bool(((dynamic)A).emergency))
                    {
                        ((dynamic)A).emergency = GlobalVars.FALSE;
                        ((dynamic)A).update_icon();
                    }
                }
                break;

            case "ai":

                if (Lang13.Bool(((dynamic)A).aiControlDisabled) == false)
                {
                    ((dynamic)A).aiControlDisabled = 1;
                }
                else if (Convert.ToInt32(((dynamic)A).aiControlDisabled) == -1)
                {
                    ((dynamic)A).aiControlDisabled = 2;
                }
                Task13.Schedule(10, (Task13.Closure)(() => {
                    if (A != null)
                    {
                        if (Lang13.Bool(((dynamic)A).aiControlDisabled) == true)
                        {
                            ((dynamic)A).aiControlDisabled = 0;
                        }
                        else if (Convert.ToInt32(((dynamic)A).aiControlDisabled) == 2)
                        {
                            ((dynamic)A).aiControlDisabled = -1;
                        }
                    }
                    return;
                }));
                break;

            case "shock":

                if (!Lang13.Bool(((dynamic)A).secondsElectrified))
                {
                    ((dynamic)A).secondsElectrified = 30;
                    ((dynamic)A).shockedby         += "[" + GlobalFuncs.time_stamp() + "]" + Task13.User + "(ckey:" + Task13.User.ckey + ")";
                    GlobalFuncs.add_logs(Task13.User, A, "electrified", null, "at " + A.x + "," + A.y + "," + A.z);
                    Task13.Schedule(10, (Task13.Closure)(() => {
                        if (A != null)
                        {
                            while (Convert.ToDouble(((dynamic)A).secondsElectrified) > 0)
                            {
                                ((dynamic)A).secondsElectrified -= 1;

                                if (Convert.ToDouble(((dynamic)A).secondsElectrified) < 0)
                                {
                                    ((dynamic)A).secondsElectrified = 0;
                                }
                                Task13.Sleep(10);
                            }
                        }
                        return;
                    }));
                }
                break;

            case "safety":
                ((dynamic)A).safe = !Lang13.Bool(((dynamic)A).safe);

                if (!A.density)
                {
                    ((dynamic)A).close();
                }
                break;

            case "timing":
                ((dynamic)A).normalspeed = !Lang13.Bool(((dynamic)A).normalspeed);
                break;

            case "light":
                ((dynamic)A).lights = !Lang13.Bool(((dynamic)A).lights);
                ((dynamic)A).update_icon();
                break;
            }
            return;
        }