Пример #1
0
        /*
         * public void UpdateNPCSpawns()
         * {
         *  //All of this is from stack overflow I have no idea how it works
         *  //Well like I get pretty much what it's doing but, yeah...
         *  List<Type> subclassTypes = Assembly
         *      .GetAssembly(typeof(Character))
         *      .GetTypes()
         *      .Where(t => t.IsSubclassOf(typeof(Character)))
         *      .ToList();
         *  foreach (Type t in subclassTypes)
         *  {
         *      // God this is so jank it's actually crazy
         *      MethodInfo method = typeof(ModContent).GetMethod("GetInstance",
         *                                      BindingFlags.Public | BindingFlags.Static);
         *      method = method.MakeGenericMethod(t);
         *      Character v = (Character)method.Invoke(null, null);
         *      MethodInfo method2 = typeof(ModContent).GetMethod("NPCType",
         *          BindingFlags.Public | BindingFlags.Static);
         *      method2 = method2.MakeGenericMethod(t);
         *      int type = (int)method2.Invoke(null, null);
         *      if (Character.NeedToSpawn(v.Name, type))
         *      {
         *          v.SpawnCharacter(CharacterLocationMapping.npcLocations[v.InternalName], type);
         *      }
         *
         *  }
         * }
         */
        public override void Initialize()
        {
            SequenceBuilder.InitialiseSequences(Main.LocalPlayer);
            base.Initialize();
            return;

            tsk.Clear();
            if (Main.worldName != "TEO")
            {
                throw new InvalidOperationException("Wrong map dingus");
            }
            int spawnX = Main.spawnTileX;
            int spawnY = Main.spawnTileY;
            int r      = 0;

            for (int i = 0; i < 21; i++)
            {
                for (int j = 0; j < 21; j++)
                {
                    int  x    = i + spawnX - 25;
                    int  y    = j + spawnY - 25;
                    Tile tile = Framing.GetTileSafely(x, y);


                    int tileID = StarSailorMod.QRCode[j, i] == 1 ? TileID.ObsidianBrick : TileID.Glass;

                    if (tile.type != tileID && preInit == false)
                    {
                        throw new InvalidOperationException("Wrong map dingus");
                    }
                }
            }
            preInit = !preInit;
        }
Пример #2
0
 public override void Action(CommandCaller caller, string input, string[] args)
 {
     SequenceBuilder.InitialiseSequences(Main.LocalPlayer);
 }