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

◆ FindSharpTearsSpot()

Point Terraria.Player.FindSharpTearsSpot ( Vector2 targetSpot)
inlineprivate

Definition at line 50137 of file Player.cs.

50138 {
50139 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
50140 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
50141 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
50142 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
50143 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
50144 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
50145 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
50146 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
50147 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
50148 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
50149 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
50150 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
50151 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
50152 //IL_0060: Unknown result type (might be due to invalid IL or missing references)
50153 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
50154 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
50155 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
50156 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
50157 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
50158 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
50159 //IL_007b: Unknown result type (might be due to invalid IL or missing references)
50160 //IL_00b0: Unknown result type (might be due to invalid IL or missing references)
50161 //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
50162 //IL_00b4: Unknown result type (might be due to invalid IL or missing references)
50163 //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
50164 //IL_0203: Unknown result type (might be due to invalid IL or missing references)
50165 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
50166 //IL_01ae: Unknown result type (might be due to invalid IL or missing references)
50167 //IL_01b3: Unknown result type (might be due to invalid IL or missing references)
50168 //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
50169 //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
50170 //IL_01d1: Unknown result type (might be due to invalid IL or missing references)
50171 //IL_0107: Unknown result type (might be due to invalid IL or missing references)
50172 //IL_0108: Unknown result type (might be due to invalid IL or missing references)
50173 //IL_011d: Unknown result type (might be due to invalid IL or missing references)
50174 //IL_0127: Unknown result type (might be due to invalid IL or missing references)
50175 //IL_0131: Unknown result type (might be due to invalid IL or missing references)
50176 //IL_013b: Unknown result type (might be due to invalid IL or missing references)
50177 //IL_0162: Unknown result type (might be due to invalid IL or missing references)
50178 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
50179 Point point = targetSpot.ToTileCoordinates();
50180 Vector2 center = base.Center;
50181 Vector2 endPoint = targetSpot;
50182 int samplesToTake = 3;
50183 float samplingWidth = 4f;
50185 float num = float.PositiveInfinity;
50186 for (int i = 0; i < samples.Length; i++)
50187 {
50188 if (samples[i] < num)
50189 {
50190 num = samples[i];
50191 }
50192 }
50193 targetSpot = center + vectorTowardsTarget.SafeNormalize(Vector2.Zero) * num;
50194 point = targetSpot.ToTileCoordinates();
50195 Rectangle value = default(Rectangle);
50196 ((Rectangle)(ref value))._002Ector(point.X, point.Y, 1, 1);
50197 ((Rectangle)(ref value)).Inflate(6, 16);
50198 Rectangle value2 = default(Rectangle);
50199 ((Rectangle)(ref value2))._002Ector(0, 0, Main.maxTilesX, Main.maxTilesY);
50200 ((Rectangle)(ref value2)).Inflate(-40, -40);
50201 value = Rectangle.Intersect(value, value2);
50202 List<Point> list = new List<Point>();
50204 Vector2 value3 = default(Vector2);
50205 for (int j = ((Rectangle)(ref value)).Left; j <= ((Rectangle)(ref value)).Right; j++)
50206 {
50207 for (int k = ((Rectangle)(ref value)).Top; k <= ((Rectangle)(ref value)).Bottom; k++)
50208 {
50209 if (!WorldGen.SolidTile2(j, k))
50210 {
50211 continue;
50212 }
50213 ((Vector2)(ref value3))._002Ector((float)(j * 16 + 8), (float)(k * 16 + 8));
50214 if (!(Vector2.Distance(targetSpot, value3) > 200f))
50215 {
50216 if (FindSharpTearsOpening(j, k, j > point.X, j < point.X, k > point.Y, k < point.Y))
50217 {
50218 list.Add(new Point(j, k));
50219 }
50220 else
50221 {
50222 list2.Add(new Point(j, k));
50223 }
50224 }
50225 }
50226 }
50227 if (list.Count == 0 && list2.Count == 0)
50228 {
50229 list.Add((base.Center.ToTileCoordinates().ToVector2() + Main.rand.NextVector2Square(-2f, 2f)).ToPoint());
50230 }
50231 List<Point> list3 = list;
50232 if (list3.Count == 0)
50233 {
50234 list3 = list2;
50235 }
50236 int index = Main.rand.Next(list3.Count);
50237 return list3[index];
50238 }
Vector2 Bottom
Definition Entity.cs:170
Vector2 Left
Definition Entity.cs:87
Vector2 Right
Definition Entity.cs:104
bool FindSharpTearsOpening(int x, int y, bool acceptLeft, bool acceptRight, bool acceptUp, bool acceptDown)
Definition Player.cs:50240

References Terraria.Collision.AimingLaserScan(), Terraria.Entity.Bottom, Terraria.Player.FindSharpTearsOpening(), Terraria.Entity.Left, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.rand, Terraria.Entity.Right, and Terraria.WorldGen.SolidTile2().

Referenced by Terraria.Player.ItemCheck_Shoot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: