Guest User

Untitled

a guest
Jun 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. public void ModifyWorld() {
  2.         Main.statusText = "Adding Greenium Ore...";
  3.         for(int i=0;i<100+(int)(Main.maxTilesY/5);i++) AddOres(); //We want it to be rare...
  4.         //Count ores, for comparison purposes...
  5.         //Gold ore=8
  6.         //Silver ore=9
  7.         //Copper ore=7
  8.         Main.statusText = "Counting ores...";
  9.         string data="";
  10.         DictionaryHandler<int, int> countType = new DictionaryHandler<int,int>();
  11.         for(int x=0;x<Main.maxTilesX;x++) {
  12.                 for(int y=0;y<Main.maxTilesY;y++) {
  13.                         Main.statusText = "Counting ores... ("+((x*(y+1))/(Main.maxTilesX*Main.maxTilesY))+"%)";
  14.                         try {
  15.                                 int type=Main.tile[x,y].type;
  16.                                 if(type==7 || type==8 || type==9 || type==Config.tileDefs.ID["Placeable"]) countType[type]++;
  17.                         } catch {
  18.                         }
  19.  
  20.                 }
  21.         }
  22.         data+="Copper: "+countType[7]+"\n";
  23.         data+="Silver: "+countType[9]+"\n";
  24.         data+="Gold: "+countType[8]+"\n";
  25.         data+="Greenium: "+countType[Config.tileDefs.ID["Placeable"]]+"\n";
  26.         data+="Greenium added for world size: "+(int)(Main.maxTilesY/5)+"\n";
  27.         File.WriteAllText(Main.SavePath+@"\"+"Ores.txt", data);
  28. }
  29. public void AddOres() {
  30.     int add = 0;
  31.     //float num3 = (float)(Main.maxTilesX / 4200);
  32.     int i2 = WorldGen.genRand.Next(100, Main.maxTilesX - 100);
  33.     double num6 = Main.worldSurface;
  34.     int j2 = WorldGen.genRand.Next((int)num6, Main.maxTilesY - 150);
  35.     WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(5, 9 + add), WorldGen.genRand.Next(5, 9 + add), Config.tileDefs.ID["Placeable"]);
  36. }
Add Comment
Please, Sign In to add comment