Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PlaceOasisPlant()

static void Terraria.WorldGen.PlaceOasisPlant ( int X,
int Y,
ushort type = 530 )
inlinestatic

Definition at line 38823 of file WorldGen.cs.

38824 {
38825 int num = genRand.Next(9);
38826 int num2 = 0;
38827 if (X < beachDistance || X > Main.maxTilesX - beachDistance || Y < 5 || Y > Main.maxTilesY - 5)
38828 {
38829 return;
38830 }
38831 bool flag = true;
38832 for (int i = X - 1; i < X + 2; i++)
38833 {
38834 for (int j = Y - 1; j < Y + 1; j++)
38835 {
38836 if (Main.tile[i, j] == null)
38837 {
38838 Main.tile[i, j] = new Tile();
38839 }
38840 if (Main.tile[i, j].active() && Main.tile[i, j].type != 529)
38841 {
38842 flag = false;
38843 }
38844 if (Main.tile[i, j].liquid > 0)
38845 {
38846 flag = false;
38847 }
38848 }
38849 if (Main.tile[i, Y + 1] == null)
38850 {
38851 Main.tile[i, Y + 1] = new Tile();
38852 }
38853 if (!SolidTile(i, Y + 1) || !TileID.Sets.Conversion.Sand[Main.tile[i, Y + 1].type])
38854 {
38855 flag = false;
38856 }
38857 }
38858 if (flag && OasisPlantWaterCheck(X, Y))
38859 {
38860 short num3 = (short)(54 * num);
38861 short num4 = (short)(36 * num2);
38862 Main.tile[X - 1, Y - 1].active(active: true);
38863 Main.tile[X - 1, Y - 1].frameY = num4;
38864 Main.tile[X - 1, Y - 1].frameX = num3;
38865 Main.tile[X - 1, Y - 1].type = type;
38866 Main.tile[X, Y - 1].active(active: true);
38867 Main.tile[X, Y - 1].frameY = num4;
38868 Main.tile[X, Y - 1].frameX = (short)(num3 + 18);
38869 Main.tile[X, Y - 1].type = type;
38870 Main.tile[X + 1, Y - 1].active(active: true);
38871 Main.tile[X + 1, Y - 1].frameY = num4;
38872 Main.tile[X + 1, Y - 1].frameX = (short)(num3 + 36);
38873 Main.tile[X + 1, Y - 1].type = type;
38874 Main.tile[X - 1, Y].active(active: true);
38875 Main.tile[X - 1, Y].frameY = (short)(num4 + 18);
38876 Main.tile[X - 1, Y].frameX = num3;
38877 Main.tile[X - 1, Y].type = type;
38878 Main.tile[X, Y].active(active: true);
38879 Main.tile[X, Y].frameY = (short)(num4 + 18);
38880 Main.tile[X, Y].frameX = (short)(num3 + 18);
38881 Main.tile[X, Y].type = type;
38882 Main.tile[X + 1, Y].active(active: true);
38883 Main.tile[X + 1, Y].frameY = (short)(num4 + 18);
38884 Main.tile[X + 1, Y].frameX = (short)(num3 + 36);
38885 Main.tile[X + 1, Y].type = type;
38886 }
38887 }
static bool OasisPlantWaterCheck(int x, int y, bool boost=false)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static readonly int beachDistance
Definition WorldGen.cs:928

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.Enums.SolidTile, Terraria.DataStructures.Tile, Terraria.Main.tile, System.type, System.X, and System.Y.