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

◆ TryPlacingAGolfBallNearANearbyTee()

bool Terraria.Player.TryPlacingAGolfBallNearANearbyTee ( Vector2 placePosition)
inline

Definition at line 50261 of file Player.cs.

50262 {
50263 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
50264 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
50265 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
50266 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
50267 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
50268 //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
50269 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
50270 //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
50271 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
50272 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
50273 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
50274 //IL_010d: Unknown result type (might be due to invalid IL or missing references)
50275 //IL_0119: Unknown result type (might be due to invalid IL or missing references)
50276 //IL_01c0: Unknown result type (might be due to invalid IL or missing references)
50277 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
50278 //IL_01cf: Unknown result type (might be due to invalid IL or missing references)
50279 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
50280 //IL_01de: Unknown result type (might be due to invalid IL or missing references)
50281 //IL_01e3: Unknown result type (might be due to invalid IL or missing references)
50282 int num = 0;
50283 int value = (int)(placePosition.X / 16f) - tileRangeX - num + 1;
50284 int value2 = (int)(placePosition.X / 16f) + tileRangeX + num - 1;
50285 int value3 = (int)(placePosition.Y / 16f) - tileRangeY - num + 1;
50286 int value4 = (int)(placePosition.Y / 16f) + tileRangeY + num - 2;
50287 value = Utils.Clamp(value, 10, Main.maxTilesX - 10);
50288 value2 = Utils.Clamp(value2, 10, Main.maxTilesX - 10);
50289 value3 = Utils.Clamp(value3, 10, Main.maxTilesY - 10);
50290 value4 = Utils.Clamp(value4, 10, Main.maxTilesY - 10);
50291 Vector2 value5 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
50292 if (gravDir == -1f)
50293 {
50294 value5.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
50295 }
50296 Point point = placePosition.ToTileCoordinates();
50298 for (int i = -2; i <= 2; i++)
50299 {
50300 for (int j = -2; j <= 2; j++)
50301 {
50302 int num2 = point.X + i;
50303 int num3 = point.Y + j;
50304 if (WorldGen.InWorld(num2, num3, 1))
50305 {
50306 Tile tileSafely = Framing.GetTileSafely(num2, num3);
50307 if (tileSafely.active() && tileSafely.type == 494)
50308 {
50309 list.Add(new Tuple<int, int>(num2, num3));
50310 break;
50311 }
50312 }
50313 }
50314 }
50315 bool result = false;
50316 if (list.Count > 0)
50317 {
50318 float num4 = -1f;
50319 Tuple<int, int> tuple = list[0];
50320 for (int k = 0; k < list.Count; k++)
50321 {
50322 float num5 = Vector2.Distance(new Vector2((float)list[k].Item1, (float)list[k].Item2) * 16f + Vector2.One * 8f, value5);
50323 if (num4 == -1f || num5 < num4)
50324 {
50325 num4 = num5;
50326 tuple = list[k];
50327 }
50328 }
50329 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, value, value3, value2, value4))
50330 {
50331 result = true;
50332 for (int l = 0; l < 1000; l++)
50333 {
50334 if (ProjectileID.Sets.IsAGolfBall[Main.projectile[l].type] && Main.projectile[l].owner == whoAmI)
50335 {
50336 Main.projectile[l].Kill();
50337 }
50338 }
50340 Projectile.NewProjectile(GetProjectileSource_TileInteraction(tuple.Item1, tuple.Item2), (float)(tuple.Item1 * 16) + 8.5f, tuple.Item2 * 16 + 6, 0f, 0f, projType, 0, 0f, whoAmI, 0f, -1f);
50341 }
50342 }
50343 return result;
50344 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
static bool[] IsAGolfBall
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile is a kind of g...
void GetPreferredGolfBallToUse(out int projType)
Definition Player.cs:50346
static int tileRangeX
Definition Player.cs:2642
static int tileRangeY
Definition Player.cs:2644
IEntitySource GetProjectileSource_TileInteraction(int tileCoordsX, int tileCoordsY)
Definition Player.cs:7876

References Terraria.Player.GetPreferredGolfBallToUse(), Terraria.Player.GetProjectileSource_TileInteraction(), Terraria.Framing.GetTileSafely(), Terraria.Player.gravDir, Terraria.Collision.InTileBounds(), Terraria.WorldGen.InWorld(), Terraria.ID.ProjectileID.Sets.IsAGolfBall, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Projectile.NewProjectile(), Terraria.Main.projectile, Terraria.Main.screenHeight, Terraria.Player.tileRangeX, Terraria.Player.tileRangeY, and Terraria.Entity.whoAmI.

Referenced by Terraria.Projectile.AI_150_GolfClubHelper(), and Terraria.Player.ItemCheck_Shoot().

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