Пример #1
0
        // Function from file: supply.dm
        public void buy(  )
        {
            ByTable empty_turfs    = null;
            Tile_Simulated_Floor T = null;
            double      value      = 0;
            int         purchases  = 0;
            SupplyOrder SO         = null;


            if (!(GlobalVars.SSshuttle.shoppinglist.len != 0))
            {
                return;
            }
            empty_turfs = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(this.areaInstance, typeof(Tile_Simulated_Floor)))
            {
                T = _a;


                if (T.density || T.contents.len != 0)
                {
                    continue;
                }
                empty_turfs.Add(T);
            }
            value     = 0;
            purchases = 0;

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSshuttle.shoppinglist, typeof(SupplyOrder)))
            {
                SO = _b;


                if (!(empty_turfs.len != 0))
                {
                    break;
                }

                if (SO.pack.cost > GlobalVars.SSshuttle.points)
                {
                    continue;
                }
                GlobalVars.SSshuttle.points -= SO.pack.cost;
                value += SO.pack.cost;
                GlobalVars.SSshuttle.shoppinglist.Remove(SO);
                GlobalVars.SSshuttle.orderhistory.Add(SO);
                SO.generate(GlobalFuncs.pick_n_take(empty_turfs));
                this.investigate_log("Order #" + SO.id + " (" + SO.pack.name + ", placed by " + GlobalFuncs.key_name(SO.orderer_ckey) + ") has shipped.", "cargo");

                if (SO.pack.dangerous)
                {
                    GlobalFuncs.message_admins(new Txt().A(SO.pack.name).item().str(" ordered by ").item(GlobalFuncs.key_name_admin(SO.orderer_ckey)).str(" has shipped.").ToString());
                }
                purchases++;
            }
            this.investigate_log("" + purchases + " orders in this shipment, worth " + value + " points. " + GlobalVars.SSshuttle.points + " points left.", "cargo");
            return;
        }
Пример #2
0
        // Function from file: chem_dispenser.dm
        public override ByTable ui_data(dynamic user = null)
        {
            ByTable data                = null;
            ByTable beakerContents      = null;
            double  beakerCurrentVolume = 0;
            Reagent R         = null;
            ByTable chemicals = null;
            dynamic re        = null;
            dynamic temp      = null;

            data                   = new ByTable();
            data["amount"]         = this.amount;
            data["energy"]         = this.energy;
            data["maxEnergy"]      = this.max_energy;
            data["isBeakerLoaded"] = (Lang13.Bool(this.beaker) ? true : false);
            beakerContents         = new ByTable(0);
            beakerCurrentVolume    = 0;

            if (Lang13.Bool(this.beaker) && Lang13.Bool(this.beaker.reagents) && this.beaker.reagents.reagent_list.len != 0)
            {
                foreach (dynamic _a in Lang13.Enumerate(this.beaker.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    beakerContents.Add(new ByTable(new object [] { new ByTable().Set("name", R.name).Set("volume", R.volume) }));
                    beakerCurrentVolume += R.volume;
                }
            }
            data["beakerContents"] = beakerContents;

            if (Lang13.Bool(this.beaker))
            {
                data["beakerCurrentVolume"]   = beakerCurrentVolume;
                data["beakerMaxVolume"]       = this.beaker.volume;
                data["beakerTransferAmounts"] = this.beaker.possible_transfer_amounts;
            }
            else
            {
                data["beakerCurrentVolume"]   = null;
                data["beakerMaxVolume"]       = null;
                data["beakerTransferAmounts"] = null;
            }
            chemicals = null;
            chemicals = new ByTable(0);

            foreach (dynamic _b in Lang13.Enumerate(this.dispensable_reagents))
            {
                re = _b;

                temp = GlobalVars.chemical_reagents_list[re];

                if (Lang13.Bool(temp))
                {
                    chemicals.Add(new ByTable(new object [] { new ByTable().Set("title", temp.name).Set("id", temp.id) }));
                }
            }
            data["chemicals"] = chemicals;
            return(data);
        }
Пример #3
0
        // Function from file: SDQL_2_parser.dm
        public int call_query(int i = 0, ByTable node = null)
        {
            ByTable func      = null;
            ByTable arguments = null;
            ByTable select    = null;
            ByTable from      = null;

            ByTable where = null;

            func      = new ByTable();
            arguments = new ByTable();
            i         = this.call_function(i + 1, func, arguments);
            node.Add("call");
            node["call"] = func;
            node["args"] = arguments;

            if (this.tokenl(i) != "on")
            {
                return(i);
            }
            select = new ByTable();
            i      = this.select_list(i + 1, select);
            node.Add("on");
            node["on"] = select;
            from       = new ByTable();

            if (new ByTable(new object [] { "from", "in" }).Contains(this.tokenl(i)))
            {
                i = this.from_list(i + 1, from);
            }
            else
            {
                from.Add("world");
            }
            node.Add("from");
            node["from"] = from;

            if (this.tokenl(i) == "where")
            {
                where = new ByTable();
                i     = this.bool_expression(i + 1, where);
                node.Add("where");
                node["where"] = where;
            }
            return(i);
        }
Пример #4
0
        public void togglev(  )
        {
            Ent_Static U              = null;
            string     vchange        = null;
            int        chance         = 0;
            ByTable    names          = null;
            Mob_Living_Carbon_Human M = null;

            U       = this.loc;
            vchange = Interface13.Alert("Would you like to synthesize a new name or turn off the voice synthesizer?", null, "New Name", "Turn Off");

            if (vchange == "New Name")
            {
                chance = Rand13.Int(1, 100);

                dynamic _b = chance;                 // Was a switch-case, sorry for the mess.
                if (1 <= _b && _b <= 50)
                {
                    this.voice = "" + (Rand13.Int(0, 1) == 1 ? Rand13.PickFromTable(GlobalVars.first_names_female) : Rand13.PickFromTable(GlobalVars.first_names_male)) + " " + Rand13.PickFromTable(GlobalVars.last_names);
                }
                else if (51 <= _b && _b <= 70)
                {
                    this.voice = "" + Rand13.Pick(new object [] { GlobalFuncs.lizard_name(GlobalVars.MALE), GlobalFuncs.lizard_name(GlobalVars.FEMALE) });
                }
                else if (71 <= _b && _b <= 80)
                {
                    this.voice = "" + Rand13.PickFromTable(GlobalVars.clown_names);
                }
                else if (81 <= _b && _b <= 90)
                {
                    this.voice = "" + Rand13.PickFromTable(GlobalVars.wizard_first) + " " + Rand13.PickFromTable(GlobalVars.wizard_second);
                }
                else if (91 <= _b && _b <= 100)
                {
                    names = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_Living_Carbon_Human)))
                    {
                        M = _a;


                        if (M == U || !(M.client != null) || !Lang13.Bool(M.real_name))
                        {
                            continue;
                        }
                        names.Add(M.real_name);
                    }
                    this.voice = (!(names.len != 0) ? ((dynamic)("Cuban Pete")) : Rand13.PickFromTable(names));
                }
                ((dynamic)U).WriteMsg("You are now mimicking <B>" + this.voice + "</B>.");
            }
            else
            {
                ((dynamic)U).WriteMsg("The voice synthesizer is " + (this.voice != "Unknown" ? "now" : "already") + " deactivated.");
                this.voice = "Unknown";
            }
            return;
        }
Пример #5
0
        // Function from file: projectile.dm
        public override dynamic Bump(Ent_Static Obstacle = null, dynamic yes = null)
        {
            int        distance    = 0;
            dynamic    target_turf = null;
            dynamic    permutation = null;
            ByTable    mobs_list   = null;
            Mob_Living L           = null;
            dynamic    picked_mob  = null;


            if (!Lang13.Bool(yes))
            {
                return(null);
            }

            if (Lang13.Bool(this.firer))
            {
                if (Obstacle == this.firer || Obstacle == this.firer.loc && Obstacle is Obj_Mecha)
                {
                    this.loc = Obstacle.loc;
                    return(0);
                }
            }
            distance      = Map13.GetDistance(GlobalFuncs.get_turf(Obstacle), this.starting);
            this.def_zone = GlobalFuncs.ran_zone(this.def_zone, Num13.MaxInt(100 - distance * 7, 5));
            target_turf   = GlobalFuncs.get_turf(Obstacle);
            permutation   = Obstacle.bullet_act(this, this.def_zone);

            if (permutation == -1 || this.forcedodge)
            {
                this.loc = target_turf;

                if (Obstacle != null)
                {
                    this.permutated.Add(Obstacle);
                }
                return(0);
            }
            else if (Obstacle != null && Obstacle.density && !(Obstacle is Mob) && !Lang13.Bool(Obstacle.flags & 512))
            {
                mobs_list = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(target_turf, typeof(Mob_Living)))
                {
                    L = _a;

                    mobs_list.Add(L);
                }

                if (mobs_list.len != 0)
                {
                    picked_mob = Rand13.PickFromTable(mobs_list);
                    ((Ent_Static)picked_mob).bullet_act(this, this.def_zone);
                }
            }
            GlobalFuncs.qdel(this);
            return(null);
        }
Пример #6
0
        // Function from file: electrical_storm.dm
        public override bool start(  )
        {
            ByTable                 epicentreList      = null;
            int?                    i                  = null;
            ByTable                 possibleEpicentres = null;
            Obj_Effect_Landmark     newEpicentre       = null;
            Obj_Effect_Landmark     epicentre          = null;
            Obj_Machinery_Power_Apc apc                = null;

            epicentreList = new ByTable();
            i             = null;
            i             = 1;

            while ((i ?? 0) <= (this.lightsoutAmount ?? 0))
            {
                possibleEpicentres = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark)))
                {
                    newEpicentre = _a;


                    if (newEpicentre.name == "lightsout" && !epicentreList.Contains(newEpicentre))
                    {
                        possibleEpicentres.Add(newEpicentre);
                    }
                }

                if (possibleEpicentres.len != 0)
                {
                    epicentreList.Add(Rand13.PickFromTable(possibleEpicentres));
                }
                else
                {
                    break;
                }
                i++;
            }

            if (!(epicentreList.len != 0))
            {
                return(false);
            }

            foreach (dynamic _c in Lang13.Enumerate(epicentreList, typeof(Obj_Effect_Landmark)))
            {
                epicentre = _c;


                foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.ultra_range(this.lightsoutRange, epicentre), typeof(Obj_Machinery_Power_Apc)))
                {
                    apc = _b;

                    apc.overload_lighting();
                }
            }
            return(false);
        }
Пример #7
0
        // Function from file: transit_tube.dm
        public void init_dirs_automatic(  )
        {
            ByTable connected              = null;
            ByTable connected_auto         = null;
            dynamic direction              = null;
            Tile    location               = null;
            Obj_Structure_TransitTube tube = null;

            connected      = new ByTable();
            connected_auto = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.tube_dir_list))
            {
                direction = _b;

                location = Map13.GetStep(this.loc, Convert.ToInt32(direction));

                foreach (dynamic _a in Lang13.Enumerate(location, typeof(Obj_Structure_TransitTube)))
                {
                    tube = _a;


                    if (tube.directions() == null && tube.icon_state == "auto")
                    {
                        connected_auto.Add(direction);
                        break;
                    }
                    else if (tube.directions().Contains(Num13.Rotate(direction, 180)))
                    {
                        connected.Add(direction);
                        break;
                    }
                }
            }
            connected.Add(connected_auto);
            this.tube_dirs = this.select_automatic_dirs(connected);

            if (Lang13.Length(this.tube_dirs) == 2 && GlobalVars.tube_dir_list.Find(this.tube_dirs[1]) > GlobalVars.tube_dir_list.Find(this.tube_dirs[2]))
            {
                this.tube_dirs.Swap(1, 2);
            }
            this.generate_automatic_corners(this.tube_dirs);
            this.select_automatic_icon_state(this.tube_dirs);
            return;
        }
Пример #8
0
        // Function from file: LINDA_system.dm
        public ByTable GetAtmosAdjacentTurfs(int?alldir = null)
        {
            alldir = alldir ?? 0;

            ByTable adjacent_turfs     = null;
            Tile    curloc             = null;
            dynamic direction          = null;
            int     matchingDirections = 0;
            Tile    S = null;
            dynamic checkDirection = null;
            Tile    checkTurf      = null;


            if (!(this is Tile_Simulated))
            {
                return(new ByTable());
            }
            adjacent_turfs = this.atmos_adjacent_turfs.Copy();

            if (!Lang13.Bool(alldir))
            {
                return(adjacent_turfs);
            }
            curloc = this;

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.diagonals))
            {
                direction = _b;

                matchingDirections = 0;
                S = Map13.GetStep(curloc, Convert.ToInt32(direction));

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    checkDirection = _a;

                    checkTurf = Map13.GetStep(S, Convert.ToInt32(checkDirection));

                    if (!S.atmos_adjacent_turfs.Contains(checkTurf))
                    {
                        continue;
                    }

                    if (adjacent_turfs.Contains(checkTurf))
                    {
                        matchingDirections++;
                    }

                    if (matchingDirections >= 2)
                    {
                        adjacent_turfs.Add(S);
                        break;
                    }
                }
            }
            return(adjacent_turfs);
        }
Пример #9
0
        // Function from file: camera.dm
        public ByTable get_available_cameras(  )
        {
            ByTable L = null;
            Obj_Machinery_Camera C = null;
            ByTable D = null;
            Obj_Machinery_Camera C2 = null;
            ByTable tempnetwork     = null;

            L = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cameranet.cameras, typeof(Obj_Machinery_Camera)))
            {
                C = _a;


                if ((this.z > 7 || C.z > 7) && C.z != this.z)
                {
                    continue;
                }
                L.Add(C);
            }
            GlobalFuncs.camera_sort(L);
            D           = new ByTable();
            D["Cancel"] = "Cancel";

            foreach (dynamic _b in Lang13.Enumerate(L, typeof(Obj_Machinery_Camera)))
            {
                C2 = _b;


                if (!(C2.network != null))
                {
                    Task13.Schedule(0, (Task13.Closure)(() => {
                        throw new Exception("Camera in a cameranet has no camera network");
                        return;
                    }));
                    continue;
                }

                if (!(C2.network is ByTable))
                {
                    Task13.Schedule(0, (Task13.Closure)(() => {
                        throw new Exception("Camera in a cameranet has a non-list camera network");
                        return;
                    }));
                    continue;
                }
                tempnetwork = C2.network & this.network;

                if (tempnetwork.len != 0)
                {
                    D["" + C2.c_tag + (C2.status ? null : " (Deactivated)")] = C2;
                }
            }
            return(D);
        }
Пример #10
0
        // Function from file: runes.dm
        public override void invoke(dynamic user = null)
        {
            ByTable cultists          = null;
            Mind    M                 = null;
            dynamic cultist_to_summon = null;

            cultists = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.cult, typeof(Mind)))
            {
                M = _a;

                cultists.Add(M.current);
            }
            cultist_to_summon = Interface13.Input("Who do you wish to call to " + this + "?", "Followers of the Geometer", null, null, cultists - user, InputType.Null | InputType.Any);

            if (!this.Adjacent(user) || !(this != null) || Lang13.Bool(GlobalFuncs.qdeleted(this)) || ((Mob)user).incapacitated())
            {
                return;
            }

            if (!Lang13.Bool(cultist_to_summon))
            {
                user.WriteMsg("<span class='cultitalic'>You require a summoning target!</span>");
                this.fail_invoke();
                GlobalFuncs.log_game("Summon Cultist rune failed - no target");
                return;
            }

            if (!GlobalFuncs.iscultist(cultist_to_summon))
            {
                user.WriteMsg("<span class='cultitalic'>" + cultist_to_summon + " is not a follower of the Geometer!</span>");
                this.fail_invoke();
                GlobalFuncs.log_game("Summon Cultist rune failed - no target");
                return;
            }

            if (Convert.ToDouble(cultist_to_summon.z) > 7)
            {
                user.WriteMsg("<span class='cultitalic'>" + cultist_to_summon + " is not in our dimension!</span>");
                this.fail_invoke();
                GlobalFuncs.log_game("Summon Cultist rune failed - target in away mission");
                return;
            }

            if (cultist_to_summon.buckled != null)
            {
                cultist_to_summon.buckled.unbuckle_mob();
            }
            ((Ent_Static)cultist_to_summon).visible_message("<span class='warning'>" + cultist_to_summon + " suddenly disappears in a flash of red light!</span>", "<span class='cultitalic'><b>Overwhelming vertigo consumes you as you are hurled through the air!</b></span>");
            this.visible_message("<span class='warning'>A foggy shape materializes atop " + this + " and solidifes into " + cultist_to_summon + "!</span>");
            user.apply_damage(10, "brute", "head");
            cultist_to_summon.loc = GlobalFuncs.get_turf(this);
            GlobalFuncs.qdel(this);
            return;
        }
Пример #11
0
        // Function from file: gang.dm
        public override int?process(dynamic seconds = null)
        {
            ByTable winners = null;
            Gang    G       = null;
            Gang    G2      = null;

            winners = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
            {
                G = _a;


                if (Game13.time > this.next_point_time)
                {
                    G.income();
                }

                if (Lang13.Bool(Lang13.IsNumber(G.dom_timer)))
                {
                    G.dom_timer -= seconds / 10;

                    if (Convert.ToDouble(G.dom_timer) < 0)
                    {
                        winners.Add(G);
                    }
                }
            }

            if (Game13.time > this.next_point_time)
            {
                this.next_point_time = Game13.time + this.next_point_interval;
            }

            if (winners.len != 0)
            {
                if (winners.len > 1)
                {
                    foreach (dynamic _b in Lang13.Enumerate(winners, typeof(Gang)))
                    {
                        G2 = _b;

                        G2.domination(0.5);
                    }
                    GlobalFuncs.priority_announce("Multiple station takeover attempts have made simultaneously. Conflicting takeover attempts appears to have restarted.", "Network Alert");
                }
                else
                {
                    GlobalVars.ticker.mode.explosion_in_progress = true;
                    GlobalVars.ticker.station_explosion_cinematic(1);
                    GlobalVars.ticker.mode.explosion_in_progress = false;
                    GlobalVars.ticker.force_ending = Rand13.PickFromTable(winners);
                }
            }
            return(null);
        }
Пример #12
0
        // Function from file: SDQL_2_parser.dm
        public int update_query(int i = 0, ByTable node = null)
        {
            ByTable select          = null;
            ByTable from            = null;
            ByTable set_assignments = null;

            ByTable where = null;

            select = new ByTable();
            i      = this.select_list(i + 1, select);
            node.Add("update");
            node["update"] = select;
            from           = new ByTable();

            if (new ByTable(new object [] { "from", "in" }).Contains(this.tokenl(i)))
            {
                i = this.from_list(i + 1, from);
            }
            else
            {
                from.Add("world");
            }
            node.Add("from");
            node["from"] = from;

            if (this.tokenl(i) != "set")
            {
                i = this.parse_error("UPDATE has misplaced SET");
            }
            set_assignments = new ByTable();
            i = this.assignments(i + 1, set_assignments);
            node.Add("set");
            node["set"] = set_assignments;

            if (this.tokenl(i) == "where")
            {
                where = new ByTable();
                i     = this.bool_expression(i + 1, where);
                node.Add("where");
                node["where"] = where;
            }
            return(i);
        }
Пример #13
0
        // Function from file: server.dm
        public override void initialize(  )
        {
            ByTable no_id_servers       = null;
            ByTable server_ids          = null;
            Obj_Machinery_RND_Server S  = null;
            Obj_Machinery_RND_Server S2 = null;
            int num = 0;

            base.initialize();
            no_id_servers = new ByTable();
            server_ids    = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server)))
            {
                S = _b;


                switch ((int?)(S.server_id))
                {
                case -1:
                    continue;
                    break;

                case 0:
                    no_id_servers.Add(S);
                    break;

                default:
                    server_ids.Add(S.server_id);
                    break;
                }
            }

            foreach (dynamic _c in Lang13.Enumerate(no_id_servers, typeof(Obj_Machinery_RND_Server)))
            {
                S2 = _c;

                num = 1;

                while (!Lang13.Bool(S2.server_id))
                {
                    if (server_ids.Contains(num))
                    {
                        num++;
                    }
                    else
                    {
                        S2.server_id = num;
                        server_ids.Add(num);
                    }
                }
                no_id_servers.Remove(S2);
            }
            return;
        }
Пример #14
0
        // Function from file: matrices.dm
        public ByTable togrid(  )
        {
            ByTable _default = null;

            _default = new ByTable();
            _default.Add(this.a);
            _default.Add(this.d);
            _default.Add(0);
            _default.Add(this.b);
            _default.Add(this.e);
            _default.Add(0);
            _default.Add(this.c);
            _default.Add(this.f);
            _default.Add(1);
            return(_default);
        }
Пример #15
0
        // Function from file: shuffle.dm
        public override bool start(  )
        {
            ByTable moblocs                = null;
            ByTable mobs                   = null;
            Mob_Living_Carbon_Human  H     = null;
            Mob_Living_Carbon_Human  H2    = null;
            Mob_Living_Carbon_Human  H3    = null;
            EffectSystem_SmokeSpread smoke = null;

            moblocs = new ByTable();
            mobs    = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon_Human)))
            {
                H = _a;


                if (H.z != 1)
                {
                    continue;
                }
                moblocs.Add(H.loc);
                mobs.Add(H);
            }

            if (!(mobs != null))
            {
                return(false);
            }
            GlobalFuncs.shuffle(moblocs);
            GlobalFuncs.shuffle(mobs);

            foreach (dynamic _b in Lang13.Enumerate(mobs, typeof(Mob_Living_Carbon_Human)))
            {
                H2 = _b;


                if (!(moblocs != null))
                {
                    break;
                }
                GlobalFuncs.do_teleport(H2, moblocs[moblocs.len]);
                moblocs.len -= 1;
            }

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon_Human)))
            {
                H3 = _c;

                smoke = new EffectSystem_SmokeSpread();
                smoke.set_up(0, H3.loc);
                smoke.start();
            }
            return(false);
        }
Пример #16
0
        // Function from file: mutations.dm
        public override dynamic say_mod(dynamic message = null)
        {
            string  prefix     = null;
            ByTable words      = null;
            ByTable rearranged = null;
            int?    i          = null;
            dynamic cword      = null;
            string  suffix     = null;


            if (Lang13.Bool(message))
            {
                prefix = String13.SubStr(message, 1, 2);

                if (prefix == ";")
                {
                    message = String13.SubStr(message, 2, 0);
                }
                else if (new ByTable(new object [] { ":", "#" }).Contains(prefix))
                {
                    prefix += String13.SubStr(message, 2, 3);
                    message = String13.SubStr(message, 3, 0);
                }
                else
                {
                    prefix = "";
                }
                words      = GlobalFuncs.splittext(message, " ");
                rearranged = new ByTable();
                i          = null;
                i          = 1;

                while ((i ?? 0) <= words.len)
                {
                    cword = Rand13.PickFromTable(words);
                    words.Remove(cword);
                    suffix = String13.SubStr(cword, Lang13.Length(cword) - 1, Lang13.Length(cword));

                    while (new ByTable(new object [] { ".", ",", ";", "!", ":", "?" }).Contains(Lang13.Length(cword) > 0 && Lang13.Bool(suffix)))
                    {
                        cword  = String13.SubStr(cword, 1, Lang13.Length(cword) - 1);
                        suffix = String13.SubStr(cword, Lang13.Length(cword) - 1, Lang13.Length(cword));
                    }

                    if (Lang13.Length(cword) != 0)
                    {
                        rearranged.Add(cword);
                    }
                    i++;
                }
                message = "" + prefix + String13.ToUpper(GlobalFuncs.jointext(rearranged, " ")) + "!!";
            }
            return(message);
        }
Пример #17
0
        // Function from file: advance.dm
        public ByTable GenerateSymptoms(int level_min = 0, int level_max = 0, bool?amount_get = null)
        {
            amount_get = amount_get ?? false;

            ByTable generated         = null;
            ByTable possible_symptoms = null;
            dynamic symp      = null;
            dynamic S         = null;
            int?    number_of = null;
            int?    i         = null;

            generated         = new ByTable();
            possible_symptoms = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.list_symptoms))
            {
                symp = _a;

                S = Lang13.Call(symp);

                if (Convert.ToDouble(S.level) >= level_min && Convert.ToDouble(S.level) <= level_max)
                {
                    if (!this.HasSymptom(S))
                    {
                        possible_symptoms.Add(S);
                    }
                }
            }

            if (!(possible_symptoms.len != 0))
            {
                return(generated);
            }
            number_of = Lang13.IntNullable(amount_get);

            if (!(amount_get == true))
            {
                number_of = 1;

                while (Rand13.PercentChance(20))
                {
                    number_of += 1;
                }
            }
            i = null;
            i = 1;

            while ((number_of ?? 0) >= (i ?? 0) && possible_symptoms.len != 0)
            {
                generated.Add(GlobalFuncs.pick_n_take(possible_symptoms));
                i++;
            }
            return(generated);
        }
Пример #18
0
        // Function from file: other_reagents.dm
        public override bool on_mob_life(dynamic M = null)
        {
            ByTable possible_morphs = null;
            dynamic type            = null;
            dynamic S        = null;
            dynamic mutation = null;

            base.on_mob_life((object)(M));
            M.WriteMsg("<span class='warning'><b>You crumple in agony as your flesh wildly morphs into new forms!</b></span>");
            ((Ent_Static)M).visible_message("<b>" + M + "</b> falls to the ground and screams as their skin bubbles and froths!");
            ((Mob)M).Weaken(3);
            Task13.Schedule(30, (Task13.Closure)(() => {
                if (!Lang13.Bool(M) || Lang13.Bool(GlobalFuncs.qdeleted(M)))
                {
                    return;
                }
                possible_morphs = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(Lang13.GetTypes(typeof(Species)) - typeof(Species)))
                {
                    type = _a;

                    S = type;

                    if (Lang13.Bool(Lang13.Initial(S, "blacklisted")))
                    {
                        continue;
                    }
                    possible_morphs.Add(S);
                }
                mutation = Rand13.PickFromTable(possible_morphs);

                if (Rand13.PercentChance(90) && Lang13.Bool(mutation) && M.dna.species != typeof(Species_Golem) && M.dna.species != typeof(Species_Golem_Adamantine))
                {
                    M.WriteMsg("<span class='danger'>The pain subsides. You feel... different.</span>");
                    ((Mob)M).set_species(mutation);

                    if (mutation.id == "slime")
                    {
                        M.faction |= "slime";
                    }
                    else
                    {
                        M.faction -= "slime";
                    }
                }
                else
                {
                    M.WriteMsg("<span class='danger'>The pain vanishes suddenly. You feel no different.</span>");
                }
                return;
            }));
            return(true);
        }
Пример #19
0
 // Function from file: SDQL_2_parser.dm
 public int bool_operator(int i = 0, ByTable node = null)
 {
     if (new ByTable(new object [] { "and", "or", "&&", "||" }).Contains(this.tokenl(i)))
     {
         node.Add(this.token(i));
     }
     else
     {
         this.parse_error("Unknown comparitor " + this.token(i));
     }
     return(i + 1);
 }
Пример #20
0
        // Function from file: storage.dm
        public virtual void orient2hud(dynamic user = null)
        {
            int             adjusted_contents = 0;
            ByTable         numbered_contents = null;
            Obj_Item        I         = null;
            bool            found     = false;
            NumberedDisplay ND        = null;
            int             row_num   = 0;
            int             col_count = 0;

            adjusted_contents = this.contents.len;

            if (this.display_contents_with_number)
            {
                numbered_contents = new ByTable();
                adjusted_contents = 0;

                foreach (dynamic _b in Lang13.Enumerate(this.contents, typeof(Obj_Item)))
                {
                    I = _b;

                    found = false;

                    foreach (dynamic _a in Lang13.Enumerate(numbered_contents, typeof(NumberedDisplay)))
                    {
                        ND = _a;


                        if (ND.sample_object.type == I.type)
                        {
                            ND.number++;
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        adjusted_contents++;
                        numbered_contents.Add(new NumberedDisplay(I));
                    }
                }
            }
            row_num   = 0;
            col_count = Num13.MinInt(7, ((int)(this.storage_slots ?? 0))) - 1;

            if (adjusted_contents > 7)
            {
                row_num = Num13.Floor((adjusted_contents - 1) / 7);
            }
            this.standard_orient_objs(row_num, col_count, numbered_contents);
            return;
        }
Пример #21
0
 public int f_string(int i = 0, ByTable node = null)
 {
     if (new ByTable(new object [] { "'", "\"" }).Contains(String13.SubStr(this.token(i), 1, 2)))
     {
         node.Add(String13.SubStr(this.token(i), 2, -1));
     }
     else
     {
         this.parse_error("Expected string but found '" + this.token(i) + "'");
     }
     return(i + 1);
 }
Пример #22
0
 // Function from file: SDQL_2_parser.dm
 public int object_type(int i = 0, ByTable node = null)
 {
     if (String13.SubStr(this.token(i), 1, 2) == "/")
     {
         node.Add(this.token(i));
     }
     else
     {
         i = this.f_string(i, node);
     }
     return(i + 1);
 }
Пример #23
0
 // Function from file: SDQL_2_parser.dm
 public int binary_operator(int i = 0, ByTable node = null)
 {
     if ((this.binary_operators + this.comparitors).Contains(this.token(i)))
     {
         node.Add(this.token(i));
     }
     else
     {
         this.parse_error("Unknown binary operator " + this.token(i));
     }
     return(i + 1);
 }
Пример #24
0
        // Function from file: holy_weapons.dm
        public override ByTable worn_overlays(int?isinhands = null)
        {
            ByTable _default = null;

            _default = new ByTable();

            if (Lang13.Bool(isinhands))
            {
                _default.Add(new Image("icons/effects/effects.dmi", null, "" + this.shield_icon));
            }
            return(_default);
        }
Пример #25
0
        // Function from file: camera_advanced.dm
        public override void Activate(int?forced_state = null)
        {
            dynamic C                   = null;
            Obj     remote_eye          = null;
            dynamic origin              = null;
            ByTable L                   = null;
            Obj_Machinery_Camera cam    = null;
            ByTable T                   = null;
            Obj_Machinery_Camera netcam = null;
            ByTable tempnetwork         = null;
            dynamic camera              = null;
            dynamic final               = null;


            if (!Lang13.Bool(this.target) || !(this.target is Mob_Living_Carbon))
            {
                return;
            }
            C          = this.target;
            remote_eye = C.remote_control;
            origin     = ((dynamic)remote_eye).origin;
            L          = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cameranet.cameras, typeof(Obj_Machinery_Camera)))
            {
                cam = _a;

                L.Add(cam);
            }
            GlobalFuncs.camera_sort(L);
            T = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(L, typeof(Obj_Machinery_Camera)))
            {
                netcam = _b;

                tempnetwork = netcam.network & origin.networks;

                if (tempnetwork.len != 0)
                {
                    T["" + netcam.c_tag + (netcam.can_use() ? null : " (Deactivated)")] = netcam;
                }
            }
            camera = Interface13.Input("Choose which camera you want to view", "Cameras", null, null, T, InputType.Null | InputType.Any);
            final  = T[camera];

            if (Lang13.Bool(final))
            {
                ((Mob_Camera_AiEye)remote_eye).setLoc(GlobalFuncs.get_turf(final));
            }
            return;
        }
Пример #26
0
 // Function from file: SDQL_2_parser.dm
 public int value(int i = 0, ByTable node = null)
 {
     if (this.token(i) == "null")
     {
         node.Add("null");
         i++;
     }
     else if (Lang13.Bool(Lang13.IsNumber(String13.ParseNumber(this.token(i)))))
     {
         node.Add(String13.ParseNumber(this.token(i)));
         i++;
     }
     else if (new ByTable(new object [] { "'", "\"" }).Contains(String13.SubStr(this.token(i), 1, 2)))
     {
         i = this.f_string(i, node);
     }
     else
     {
         i = this.variable(i, node);
     }
     return(i);
 }
Пример #27
0
 // Function from file: SDQL_2_parser.dm
 public int from_item(int i = 0, ByTable node = null)
 {
     if (this.token(i) == "world")
     {
         node.Add("world");
         i++;
     }
     else
     {
         i = this.object_type(i, node);
     }
     return(i);
 }
Пример #28
0
        // Function from file: jobs.dm
        public ByTable FindOccupationCandidates(Job job = null, double level = 0, dynamic flag = null)
        {
            ByTable       candidates = null;
            Mob_NewPlayer player     = null;

            this.Debug("Running FOC, Job: " + job + ", Level: " + level + ", Flag: " + flag);
            candidates = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(this.unassigned, typeof(Mob_NewPlayer)))
            {
                player = _a;


                if (GlobalFuncs.jobban_isbanned(player, job.title))
                {
                    this.Debug("FOC isbanned failed, Player: " + player);
                    continue;
                }

                if (!job.player_old_enough(player.client))
                {
                    this.Debug("FOC player not old enough, Player: " + player);
                    continue;
                }

                if (Lang13.Bool(flag) && !player.client.prefs.be_special.Contains(flag))
                {
                    this.Debug("FOC flag failed, Player: " + player + ", Flag: " + flag + ", ");
                    continue;
                }

                if (player.mind.restricted_roles.Contains(player.mind != null && Lang13.Bool(job.title)))
                {
                    this.Debug("FOC incompatible with antagonist role, Player: " + player);
                    continue;
                }

                if (GlobalVars.config.enforce_human_authority && !((Species)player.client.prefs.pref_species).qualifies_for_rank(job.title, player.client.prefs.features))
                {
                    this.Debug("FOC non-human failed, Player: " + player);
                    continue;
                }

                if (Lang13.Bool(player.client.prefs.GetJobDepartment(job, level) & job.flag))
                {
                    this.Debug("FOC pass, Player: " + player + ", Level:" + level);
                    candidates.Add(player);
                }
            }
            return(candidates);
        }
Пример #29
0
        // Function from file: teleport.dm
        public bool doTeleport(  )
        {
            dynamic destturf = null;
            dynamic curturf  = null;
            ByTable posturfs = null;
            dynamic center   = null;
            dynamic T        = null;

            curturf = GlobalFuncs.get_turf(this.teleatom);

            if (this.precision != 0)
            {
                posturfs = new ByTable();
                center   = GlobalFuncs.get_turf(this.destination);

                if (!Lang13.Bool(center))
                {
                    center = this.destination;
                }

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(center, this.precision)))
                {
                    T = _a;

                    posturfs.Add(T);
                }
                destturf = GlobalFuncs.safepick(posturfs);
            }
            else
            {
                destturf = GlobalFuncs.get_turf(this.destination);
            }

            if (!Lang13.Bool(destturf) || !Lang13.Bool(curturf))
            {
                return(false);
            }
            this.playSpecials(curturf, this.effectin, this.soundin);

            if (this.force_teleport)
            {
                this.teleatom.forceMove(destturf);
                this.playSpecials(destturf, this.effectout, this.soundout);
            }
            else if (this.teleatom.Move(destturf))
            {
                this.playSpecials(destturf, this.effectout, this.soundout);
            }
            return(true);
        }
Пример #30
0
        // Function from file: robot_modules.dm
        public ByTable get_usable_modules(  )
        {
            ByTable _default = null;

            Ent_Static R = null;

            _default = this.modules.Copy();
            R        = this.loc;

            if (Lang13.Bool(((dynamic)R).emagged))
            {
                _default.Add(this.emag);
            }
            return(_default);
        }
Пример #31
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable sortmobs(  ) {
			ByTable moblist = null;
			ByTable sortmob = null;
			Mob_Living_Silicon_Ai M = null;
			Mob_Camera M2 = null;
			Mob_Living_Silicon_Pai M3 = null;
			Mob_Living_Silicon_Robot M4 = null;
			Mob_Living_Carbon_Human M5 = null;
			Mob_Living_Carbon_Brain M6 = null;
			Mob_Living_Carbon_Alien M7 = null;
			Mob_Dead_Observer M8 = null;
			Mob_NewPlayer M9 = null;
			Mob_Living_Carbon_Monkey M10 = null;
			Mob_Living_SimpleAnimal_Slime M11 = null;
			Mob_Living_SimpleAnimal M12 = null;
			moblist = new ByTable();
			sortmob = GlobalFuncs.sortNames( GlobalVars.mob_list );
			M = null;
			foreach (dynamic _a in sortmob ) {
				if ( !( _a is Mob_Living_Silicon_Ai ) ) {
					continue;
				}
				M = _a;
				moblist.Add( M );
			};
			M2 = null;
			foreach (dynamic _b in sortmob ) {
				if ( !( _b is Mob_Camera ) ) {
					continue;
				}
				M2 = _b;
				moblist.Add( M2 );
			};
			M3 = null;
			foreach (dynamic _c in sortmob ) {
				if ( !( _c is Mob_Living_Silicon_Pai ) ) {
					continue;
				}
				M3 = _c;
				moblist.Add( M3 );
			};
			M4 = null;
			foreach (dynamic _d in sortmob ) {
				if ( !( _d is Mob_Living_Silicon_Robot ) ) {
					continue;
				}
				M4 = _d;
				moblist.Add( M4 );
			};
			M5 = null;
			foreach (dynamic _e in sortmob ) {
				if ( !( _e is Mob_Living_Carbon_Human ) ) {
					continue;
				}
				M5 = _e;
				moblist.Add( M5 );
			};
			M6 = null;
			foreach (dynamic _f in sortmob ) {
				if ( !( _f is Mob_Living_Carbon_Brain ) ) {
					continue;
				}
				M6 = _f;
				moblist.Add( M6 );
			};
			M7 = null;
			foreach (dynamic _g in sortmob ) {
				if ( !( _g is Mob_Living_Carbon_Alien ) ) {
					continue;
				}
				M7 = _g;
				moblist.Add( M7 );
			};
			M8 = null;
			foreach (dynamic _h in sortmob ) {
				if ( !( _h is Mob_Dead_Observer ) ) {
					continue;
				}
				M8 = _h;
				moblist.Add( M8 );
			};
			M9 = null;
			foreach (dynamic _i in sortmob ) {
				if ( !( _i is Mob_NewPlayer ) ) {
					continue;
				}
				M9 = _i;
				moblist.Add( M9 );
			};
			M10 = null;
			foreach (dynamic _j in sortmob ) {
				if ( !( _j is Mob_Living_Carbon_Monkey ) ) {
					continue;
				}
				M10 = _j;
				moblist.Add( M10 );
			};
			M11 = null;
			foreach (dynamic _k in sortmob ) {
				if ( !( _k is Mob_Living_SimpleAnimal_Slime ) ) {
					continue;
				}
				M11 = _k;
				moblist.Add( M11 );
			};
			M12 = null;
			foreach (dynamic _l in sortmob ) {
				if ( !( _l is Mob_Living_SimpleAnimal ) ) {
					continue;
				}
				M12 = _l;
				moblist.Add( M12 );
			};
			return moblist;
		}
Пример #32
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic AverageColour( Icon I = null ) {
			ByTable colours = null;
			double? x_pixel = null;
			double? y_pixel = null;
			string this_colour = null;
			dynamic final_average = null;
			dynamic colour = null;
			colours = new ByTable();
			x_pixel = null;
			foreach (dynamic _b in Lang13.iter_range( 1, I.Width() ) ) {
				x_pixel = _b;
				y_pixel = null;
				foreach (dynamic _a in Lang13.iter_range( 1, I.Height() ) ) {
					y_pixel = _a;
					this_colour = I.GetPixel( x_pixel, y_pixel );
					if ( Lang13.Bool( this_colour ) ) {
						colours.Add( this_colour );
					}
				};
			};
			if ( !( colours.len != 0 ) ) {
				return null;
			}
			final_average = colours[1];
			colour = null;
			foreach (dynamic _c in colours - colours[1] ) {
				colour = _c;
				final_average = GlobalFuncs.BlendRGB( final_average, colour, 1 );
			};
			return final_average;
		}
Пример #33
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void setup_map_transitions(  ) {
			ByTable SLS = null;
			dynamic D = null;
			int conf_set_len = 0;
			int k = 0;
			dynamic A = null;
			ByTable point_grid = null;
			ByTable grid = null;
			dynamic P = null;
			int? i = null;
			int? j = null;
			Point pnt = null;
			ByTable possible_points = null;
			ByTable used_points = null;
			dynamic A2 = null;
			ByTable x_pos_beginning = null;
			ByTable y_pos_beginning = null;
			ByTable x_pos_ending = null;
			ByTable y_pos_ending = null;
			ByTable x_pos_transition = null;
			ByTable y_pos_transition = null;
			int? zlevelnumber = null;
			int? side = null;
			Tile beginning = null;
			Tile ending = null;
			ByTable turfblock = null;
			double dirside = 0;
			int? zdestination = null;
			Tile_Space S = null;
			dynamic A3 = null;
			SLS = new ByTable();
			conf_set_len = GlobalVars.map_transition_config.len;
			k = 1;
			A = null;
			foreach (dynamic _a in GlobalVars.map_transition_config ) {
				A = _a;
				D = new SpaceLevel( GlobalVars.map_transition_config[A] );
				D.name = A;
				D.z_value = k;
				if ( Lang13.Double( D.linked ) < 2 ) {
					GlobalVars.z_levels_list["" + D.z_value] = D;
				} else {
					SLS.Add( D );
				}
				k++;
			};
			point_grid = null;
			point_grid = new ByTable( conf_set_len * 2 + 1, conf_set_len * 2 + 1 );
			grid = new ByTable();
			P = null;
			i = null;
			i = 1;
			while (( i ??0) <= conf_set_len * 2 + 1) {
				j = null;
				j = 1;
				while (( j ??0) <= conf_set_len * 2 + 1) {
					P = new Point( i, j, point_grid );
					point_grid[i][j] = P;
					grid.Add( P );
					j++;
				}
				i++;
			}
			pnt = null;
			foreach (dynamic _b in grid ) {
				if ( !( _b is Point ) ) {
					continue;
				}
				pnt = _b;
				pnt.set_neigbours( point_grid );
			};
			P = point_grid[conf_set_len + 1][conf_set_len + 1];
			possible_points = new ByTable();
			used_points = new ByTable();
			grid.Cut();
			while (SLS.len != 0) {
				D = Rand13.pick( SLS );
				SLS.Remove( D );
				D.xi = P.x;
				D.yi = P.y;
				P.spl = D;
				possible_points |= P.neigbours;
				used_points |= P;
				possible_points.Remove( used_points );
				((SpaceLevel)D).set_neigbours( used_points );
				P = Rand13.pick( possible_points );
				grid["" + D.z_value] = D;
			}
			A2 = null;
			foreach (dynamic _c in GlobalVars.z_levels_list ) {
				A2 = _c;
				grid[A2] = GlobalVars.z_levels_list[A2];
			};
			x_pos_beginning = new ByTable(new object [] { 1, 1, Game13.map_size_x - 7, 1 });
			y_pos_beginning = new ByTable(new object [] { Game13.map_size_y - 7, 1, 7, 7 });
			x_pos_ending = new ByTable(new object [] { Game13.map_size_x, Game13.map_size_x, Game13.map_size_x, 7 });
			y_pos_ending = new ByTable(new object [] { Game13.map_size_y, 7, Game13.map_size_y - 7, Game13.map_size_y - 7 });
			x_pos_transition = new ByTable(new object [] { 1, 1, 9, Game13.map_size_x - 7 - 2 });
			y_pos_transition = new ByTable(new object [] { 9, Game13.map_size_y - 7 - 2, 1, 1 });
			zlevelnumber = null;
			zlevelnumber = 1;
			while (( zlevelnumber ??0) <= grid.len) {
				D = grid["" + zlevelnumber];
				if ( !Lang13.Bool( D ) ) {
					Task13.crash( "" + zlevelnumber + " position has no space level datum." );
				}
				if ( !Lang13.Bool( D.neigbours.len ) ) {
					
				} else {
					side = null;
					side = 1;
					while (( side ??0) < 5) {
						beginning = Map13.get_tile_at( Lang13.Int( x_pos_beginning[side] ), Lang13.Int( y_pos_beginning[side] ), zlevelnumber ??0 );
						ending = Map13.get_tile_at( Lang13.Int( x_pos_ending[side] ), Lang13.Int( y_pos_ending[side] ), zlevelnumber ??0 );
						turfblock = Map13.fetch_in_block( beginning, ending );
						dirside = Math.Pow( 2, ( side ??0) - 1 );
						zdestination = zlevelnumber;
						if ( Lang13.Bool( D.neigbours["" + dirside] ) && D.neigbours["" + dirside] != D ) {
							D = D.neigbours["" + dirside];
							zdestination = Lang13.IntNullable( D.z_value );
						} else {
							dirside = Num13.rotate_dir( dirside, 180 );
							while (Lang13.Bool( D.neigbours["" + dirside] ) && D.neigbours["" + dirside] != D) {
								D = D.neigbours["" + dirside];
							}
							zdestination = Lang13.IntNullable( D.z_value );
						}
						D = grid["" + zlevelnumber];
						S = null;
						foreach (dynamic _d in turfblock ) {
							if ( !( _d is Tile_Space ) ) {
								continue;
							}
							S = _d;
							S.destination_x = ( x_pos_transition[side] == 1 ? ((dynamic)S).x : x_pos_transition[side] );
							S.destination_y = ( y_pos_transition[side] == 1 ? ((dynamic)S).y : y_pos_transition[side] );
							S.destination_z = zdestination;
						};
						side++;
					}
				}
				zlevelnumber++;
			}
			A3 = null;
			foreach (dynamic _e in grid ) {
				A3 = _e;
				GlobalVars.z_levels_list[A3] = grid[A3];
			};
			return;
		}
Пример #34
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable kick_clients_in_lobby( string message = null, double? kick_only_afk = null ) {
			ByTable kicked_client_names = null;
			dynamic C = null;
			if ( kick_only_afk == null ) {
				kick_only_afk = 0;
			}
			kicked_client_names = new ByTable();
			C = null;
			foreach (dynamic _a in GlobalVars.clients ) {
				C = _a;
				if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( C ) ) ) {
					continue;
				}
				if ( C.mob is Mob_NewPlayer ) {
					if ( Lang13.Bool( kick_only_afk ) && !Lang13.Bool( ((dynamic)C).is_afk() ) ) {
						continue;
					}
					if ( Lang13.Bool( message ) ) {
						C.write( message );
					}
					kicked_client_names.Add( "" + C.ckey );
					Lang13.delete( C );
					C = null;
				}
			};
			return kicked_client_names;
		}
Пример #35
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic AStar( dynamic start = null, dynamic end = null, Mob_Living_SimpleAnimal atom = null, System.Reflection.MethodInfo dist = null, dynamic maxnodes = null, dynamic maxnodedepth = null, dynamic mintargetdist = null, System.Reflection.MethodInfo adjacent = null, Ent_Item_Weapon_Card_Id id = null, dynamic exclude = null, bool? simulated_only = null ) {
			Heap open = null;
			ByTable closed = null;
			ByTable path = null;
			dynamic cur = null;
			bool? closeenough = null;
			dynamic L = null;
			dynamic T = null;
			dynamic newg = null;
			PathNode PN = null;
			dynamic T2 = null;
			double? i = null;
			if ( maxnodedepth == null ) {
				maxnodedepth = 30;
			}
			if ( adjacent == null ) {
				adjacent = typeof(Tile).GetMethod( "reachableAdjacentTurfs" );
			}
			if ( id == null ) {
				id = null;
			}
			if ( exclude == null ) {
				exclude = null;
			}
			if ( simulated_only == null ) {
				simulated_only = true;
			}
			if ( Lang13.Bool( maxnodes ) ) {
				if ( Lang13.Double( Lang13.call( Lang13.bindf( start, dist ), end ) ) > Lang13.Double( maxnodes ) ) {
					return 0;
				}
				maxnodedepth = maxnodes;
			}
			open = new Heap( typeof(GlobalFuncs).GetMethod( "HeapPathWeightCompare" ) );
			closed = new ByTable();
			path = null;
			start = GlobalFuncs.get_turf( start );
			if ( !Lang13.Bool( start ) ) {
				return 0;
			}
			open.Insert( new PathNode( start, null, false, Lang13.call( Lang13.bindf( start, dist ), end ), false ) );
			while (!open.IsEmpty() && !( path != null )) {
				cur = open.Pop();
				closed.Add( cur.source );
				closeenough = null;
				if ( Lang13.Bool( mintargetdist ) ) {
					closeenough = Lang13.Double( Lang13.call( Lang13.bindf( cur.source, dist ), end ) ) <= Lang13.Double( mintargetdist );
				}
				if ( Lang13.Bool( maxnodedepth ) && Lang13.Double( cur.nt ) > Lang13.Double( maxnodedepth ) ) {
					continue;
				}
				if ( cur.source == end || closeenough == true ) {
					path = new ByTable();
					path.Add( cur.source );
					while (Lang13.Bool( cur.prevNode )) {
						cur = cur.prevNode;
						path.Add( cur.source );
					}
					break;
				}
				L = Lang13.call( Lang13.bindf( cur.source, adjacent ), atom, id, simulated_only );
				T = null;
				foreach (dynamic _a in L ) {
					T = _a;
					if ( T == exclude || closed.contains( T ) ) {
						continue;
					}
					newg = cur.g + Lang13.call( Lang13.bindf( cur.source, dist ), T );
					if ( !Lang13.Bool( T.PNode ) ) {
						open.Insert( new PathNode( T, cur, Lang13.Bool( newg ), Lang13.call( Lang13.bindf( T, dist ), end ), Lang13.Bool( cur.nt + 1 ) ) );
					} else if ( Lang13.Double( newg ) < Lang13.Double( T.PNode.g ) ) {
						T.PNode.prevNode = cur;
						T.PNode.g = newg;
						((dynamic)T.PNode).calc_f();
						T.PNode.nt = cur.nt + 1;
						open.ReSort( T.PNode );
					}
				};
			}
			PN = null;
			foreach (dynamic _b in open.L ) {
				if ( !( _b is PathNode ) ) {
					continue;
				}
				PN = _b;
				PN.source.PNode = null;
			};
			T2 = null;
			foreach (dynamic _c in closed ) {
				T2 = _c;
				T2.PNode = null;
			};
			if ( path != null ) {
				i = null;
				i = 1;
				while (( i ??0) <= path.len / 2) {
					path.Swap( ((int)( i )), ((int)( path.len - ( i ??0) + 1 )) );
					i++;
				}
			}
			return path;
		}
Пример #36
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable getpois( bool? mobs_only = null, bool? skip_mindless = null ) {
			ByTable mobs = null;
			ByTable names = null;
			ByTable pois = null;
			ByTable namecounts = null;
			dynamic M = null;
			string name = null;
			BaseStatic A = null;
			string name2 = null;
			if ( mobs_only == null ) {
				mobs_only = false;
			}
			if ( skip_mindless == null ) {
				skip_mindless = false;
			}
			mobs = GlobalFuncs.sortmobs();
			names = new ByTable();
			pois = new ByTable();
			namecounts = new ByTable();
			M = null;
			foreach (dynamic _a in mobs ) {
				M = _a;
				if ( skip_mindless == true && !Lang13.Bool( M.mind ) && !Lang13.Bool( M.ckey ) ) {
					if ( !( M is Mob_Living_SimpleAnimal_Bot ) && !( M is Mob_Camera ) ) {
						continue;
					}
				}
				if ( Lang13.Bool( M.client ) && Lang13.Bool( M.client.holder ) && Lang13.Bool( M.client.holder.fakekey ) ) {
					continue;
				}
				name = M.name;
				if ( names.contains( name ) ) {
					namecounts[name]++;
					name = "" + name + " (" + namecounts[name] + ")";
				} else {
					names.Add( name );
					namecounts[name] = 1;
				}
				if ( Lang13.Bool( M.real_name ) && M.real_name != M.name ) {
					name += " [" + M.real_name + "]";
				}
				if ( Lang13.Int( M.stat ) == 2 ) {
					if ( M is Mob_Dead_Observer ) {
						name += " [ghost]";
					} else {
						name += " [dead]";
					}
				}
				pois[name] = M;
			};
			if ( !( mobs_only == true ) ) {
				A = null;
				foreach (dynamic _b in GlobalVars.poi_list ) {
					if ( !( _b is BaseStatic ) ) {
						continue;
					}
					A = _b;
					if ( !( A != null ) || !Lang13.Bool( ((dynamic)A).loc ) ) {
						continue;
					}
					name2 = ((dynamic)A).name;
					if ( names.Find( name2 ) != 0 ) {
						namecounts[name2]++;
						name2 = "" + name2 + " (" + namecounts[name2] + ")";
					} else {
						names.Add( name2 );
						namecounts[name2] = 1;
					}
					pois[name2] = A;
				};
			}
			return pois;
		}
Пример #37
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable generateMapList( string filename = null ) {
			ByTable potentialMaps = null;
			ByTable Lines = null;
			dynamic t = null;
			int pos = 0;
			string name = null;
			potentialMaps = new ByTable();
			Lines = GlobalFuncs.file2list( filename );
			if ( !( Lines.len != 0 ) ) {
				return null;
			}
			t = null;
			foreach (dynamic _a in Lines ) {
				t = _a;
				if ( !Lang13.Bool( t ) ) {
					continue;
				}
				t = GlobalFuncs.trim( t );
				if ( Lang13.Bool( t.Length ) == false ) {
					continue;
				} else if ( String13.substr( t, 1, 2 ) == "#" ) {
					continue;
				}
				pos = String13.find( t, " ", 1, 0 );
				name = null;
				if ( pos != 0 ) {
					name = String13.toLower( String13.substr( t, 1, pos ) );
				} else {
					name = String13.toLower( t );
				}
				if ( !Lang13.Bool( name ) ) {
					continue;
				}
				potentialMaps.Add( t );
			};
			return potentialMaps;
		}
Пример #38
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void tesla_zap( dynamic source = null, int? zap_range = null, double power = 0 ) {
			ByTable tesla_coils = null;
			ByTable grounding_rods = null;
			ByTable potential_machine_zaps = null;
			ByTable potential_mob_zaps = null;
			ByTable potential_structure_zaps = null;
			dynamic closest_atom = null;
			BaseStatic A = null;
			BaseStatic C = null;
			BaseStatic R = null;
			BaseStatic M = null;
			BaseStatic M2 = null;
			BaseStatic L = null;
			dynamic C2 = null;
			dynamic R2 = null;
			dynamic L2 = null;
			int shock_damage = 0;
			dynamic S = null;
			dynamic M3 = null;
			dynamic S2 = null;
			if ( zap_range == null ) {
				zap_range = 3;
			}
			if ( power < 500 ) {
				return;
			}
			tesla_coils = new ByTable();
			grounding_rods = new ByTable();
			potential_machine_zaps = new ByTable();
			potential_mob_zaps = new ByTable();
			potential_structure_zaps = new ByTable();
			A = null;
			foreach (dynamic _a in Map13.fetch_in_view_nocenter( zap_range, source ) ) {
				if ( !( _a is BaseStatic ) ) {
					continue;
				}
				A = _a;
				if ( A is Ent_Machinery_Power_TeslaCoil ) {
					C = A;
					if ( Lang13.Bool( ((dynamic)C).being_shocked ) ) {
						continue;
					}
					tesla_coils.Add( C );
					continue;
				}
				if ( A is Ent_Machinery_Power_GroundingRod ) {
					R = A;
					grounding_rods.Add( R );
					continue;
				}
				if ( A is Ent_Machinery ) {
					M = A;
					if ( GlobalFuncs.is_type_in_list( M, GlobalVars.blacklisted_tesla_types ) ) {
						continue;
					}
					if ( Lang13.Bool( ((dynamic)M).being_shocked ) ) {
						continue;
					}
					potential_machine_zaps.Add( M );
					continue;
				}
				if ( A is Ent_Structure ) {
					M2 = A;
					if ( GlobalFuncs.is_type_in_list( M2, GlobalVars.blacklisted_tesla_types ) ) {
						continue;
					}
					if ( Lang13.Bool( ((dynamic)M2).being_shocked ) ) {
						continue;
					}
					potential_structure_zaps.Add( M2 );
					continue;
				}
				if ( A is Mob_Living ) {
					L = A;
					if ( Lang13.Int( ((dynamic)L).stat ) == 2 ) {
						continue;
					}
					if ( GlobalFuncs.is_type_in_list( L, GlobalVars.blacklisted_tesla_types ) ) {
						continue;
					}
					potential_mob_zaps.Add( L );
					continue;
				}
			};
			closest_atom = GlobalFuncs.get_closest_atom( typeof(Ent_Machinery_Power_TeslaCoil), tesla_coils, source );
			if ( Lang13.Bool( closest_atom ) && closest_atom is Ent_Machinery_Power_TeslaCoil ) {
				C2 = closest_atom;
				new ByTable().set( 1, C2 ).set( "icon_state", "lightning" + Rand13.Int( 1, 12 ) ).set( "icon", "icons/effects/effects.dmi" ).set( "time", 5 ).apply( source.GetType().GetMethod( "Beam" ) );
				((Entity)C2).tesla_act( power );
				return;
			}
			if ( !Lang13.Bool( closest_atom ) ) {
				closest_atom = GlobalFuncs.get_closest_atom( typeof(Ent_Machinery_Power_GroundingRod), grounding_rods, source );
				if ( Lang13.Bool( closest_atom ) && closest_atom is Ent_Machinery_Power_GroundingRod ) {
					R2 = closest_atom;
					new ByTable().set( 1, R2 ).set( "icon_state", "lightning" + Rand13.Int( 1, 12 ) ).set( "icon", "icons/effects/effects.dmi" ).set( "time", 5 ).apply( source.GetType().GetMethod( "Beam" ) );
					((Entity)R2).tesla_act( power );
					return;
				}
			}
			if ( !Lang13.Bool( closest_atom ) ) {
				closest_atom = GlobalFuncs.get_closest_atom( typeof(Mob_Living), potential_mob_zaps, source );
				if ( Lang13.Bool( closest_atom ) && closest_atom is Mob_Living ) {
					L2 = closest_atom;
					shock_damage = Num13.maxInt( 10, Num13.minInt( Num13.floor( power / 400 ), 90 ) ) + Rand13.Int( -5, 5 );
					new ByTable().set( 1, L2 ).set( "icon_state", "lightning" + Rand13.Int( 1, 12 ) ).set( "icon", "icons/effects/effects.dmi" ).set( "time", 5 ).apply( source.GetType().GetMethod( "Beam" ) );
					new ByTable().set( 1, shock_damage ).set( 2, source ).set( 3, 1 ).set( "tesla_shock", 1 ).apply( L2.GetType().GetMethod( "electrocute_act" ) );
					if ( L2 is Mob_Living_Silicon ) {
						S = L2;
						((dynamic)S).emp_act( 2 );
						GlobalFuncs.tesla_zap( S, 7, power / 1.5 );
					} else {
						GlobalFuncs.tesla_zap( L2, 5, power / 1.5 );
					}
					return;
				}
			}
			if ( !Lang13.Bool( closest_atom ) ) {
				closest_atom = GlobalFuncs.get_closest_atom( typeof(Ent_Machinery), potential_machine_zaps, source );
				if ( Lang13.Bool( closest_atom ) ) {
					M3 = closest_atom;
					new ByTable().set( 1, M3 ).set( "icon_state", "lightning" + Rand13.Int( 1, 12 ) ).set( "icon", "icons/effects/effects.dmi" ).set( "time", 5 ).apply( source.GetType().GetMethod( "Beam" ) );
					((Entity)M3).tesla_act( power );
					if ( Rand13.percentChance( 85 ) ) {
						((dynamic)M3).emp_act( 2 );
					} else if ( Rand13.percentChance( 50 ) ) {
						((dynamic)M3).ex_act( 3 );
					} else if ( Rand13.percentChance( 90 ) ) {
						((dynamic)M3).ex_act( 2 );
					} else {
						((dynamic)M3).ex_act( 1 );
					}
					return;
				}
			}
			if ( !Lang13.Bool( closest_atom ) ) {
				closest_atom = GlobalFuncs.get_closest_atom( typeof(Ent_Structure), potential_structure_zaps, source );
				if ( Lang13.Bool( closest_atom ) ) {
					S2 = closest_atom;
					new ByTable().set( 1, S2 ).set( "icon_state", "lightning" + Rand13.Int( 1, 12 ) ).set( "icon", "icons/effects/effects.dmi" ).set( "time", 5 ).apply( source.GetType().GetMethod( "Beam" ) );
					((Entity)S2).tesla_act( power );
					return;
				}
			}
			return;
		}