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

◆ PlaceLilyPad()

static bool Terraria.WorldGen.PlaceLilyPad ( int x,
int j )
inlinestatic

Definition at line 50017 of file WorldGen.cs.

50018 {
50019 int num = j;
50020 if (x < 50 || x > Main.maxTilesX - 50 || num < 50 || num > Main.maxTilesY - 50)
50021 {
50022 return false;
50023 }
50024 if (Main.tile[x, num].active() || Main.tile[x, num].liquid == 0 || Main.tile[x, num].liquidType() != 0)
50025 {
50026 return false;
50027 }
50028 while (Main.tile[x, num].liquid > 0 && num > 50)
50029 {
50030 num--;
50031 }
50032 num++;
50033 if (Main.tile[x, num].active() || Main.tile[x, num - 1].active() || Main.tile[x, num].liquid == 0 || Main.tile[x, num].liquidType() != 0)
50034 {
50035 return false;
50036 }
50037 if (Main.tile[x, num].wall != 0 && Main.tile[x, num].wall != 15 && Main.tile[x, num].wall != 70 && (Main.tile[x, num].wall < 63 || Main.tile[x, num].wall > 68))
50038 {
50039 return false;
50040 }
50041 int num2 = 5;
50042 int num3 = 0;
50043 for (int i = x - num2; i <= x + num2; i++)
50044 {
50045 for (int k = num - num2; k <= num + num2; k++)
50046 {
50047 if (Main.tile[i, k].active() && Main.tile[i, k].type == 518)
50048 {
50049 num3++;
50050 }
50051 }
50052 }
50053 if (num3 > 3)
50054 {
50055 return false;
50056 }
50057 int l;
50058 for (l = num; (!Main.tile[x, l].active() || !Main.tileSolid[Main.tile[x, l].type] || Main.tileSolidTop[Main.tile[x, l].type]) && l < Main.maxTilesY - 50; l++)
50059 {
50060 if (Main.tile[x, l].active() && Main.tile[x, l].type == 519)
50061 {
50062 return false;
50063 }
50064 }
50065 int num4 = 12;
50066 if (l - num > num4)
50067 {
50068 return false;
50069 }
50070 if (l - num < 3)
50071 {
50072 return false;
50073 }
50074 int type = Main.tile[x, l].type;
50075 int num5 = -1;
50076 if (type == 2 || type == 477)
50077 {
50078 num5 = 0;
50079 }
50080 if (type == 109 || type == 109 || type == 116)
50081 {
50082 num5 = 18;
50083 }
50084 if (type == 60)
50085 {
50086 num5 = 36;
50087 }
50088 if (num5 < 0)
50089 {
50090 return false;
50091 }
50092 Main.tile[x, num].active(active: true);
50093 Main.tile[x, num].type = 518;
50094 if (genRand.Next(2) == 0)
50095 {
50096 Main.tile[x, num].frameX = (short)(18 * genRand.Next(3));
50097 }
50098 else if (genRand.Next(15) == 0)
50099 {
50100 Main.tile[x, num].frameX = (short)(18 * genRand.Next(18));
50101 }
50102 else
50103 {
50104 int num6 = Main.maxTilesX / 5;
50105 if (x < num6)
50106 {
50107 Main.tile[x, num].frameX = (short)(18 * genRand.Next(6, 9));
50108 }
50109 else if (x < num6 * 2)
50110 {
50111 Main.tile[x, num].frameX = (short)(18 * genRand.Next(9, 12));
50112 }
50113 else if (x < num6 * 3)
50114 {
50115 Main.tile[x, num].frameX = (short)(18 * genRand.Next(3, 6));
50116 }
50117 else if (x < num6 * 4)
50118 {
50119 Main.tile[x, num].frameX = (short)(18 * genRand.Next(15, 18));
50120 }
50121 else
50122 {
50123 Main.tile[x, num].frameX = (short)(18 * genRand.Next(12, 15));
50124 }
50125 }
50126 Main.tile[x, num].frameY = (short)num5;
50127 Main.tile[x, num].halfBrick(halfBrick: false);
50128 Main.tile[x, num].slope(0);
50129 SquareTileFrame(x, num);
50130 return true;
50131 }
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and System.type.