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

◆ GetGrapplingForces()

void Terraria.Player.GetGrapplingForces ( Vector2 fromPosition,
out int? preferredPlayerDirectionToSet,
out float preferedPlayerVelocityX,
out float preferedPlayerVelocityY )
inlineprivate

Definition at line 20611 of file Player.cs.

20612 {
20613 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
20614 //IL_0363: Unknown result type (might be due to invalid IL or missing references)
20615 //IL_0364: Unknown result type (might be due to invalid IL or missing references)
20616 //IL_0368: Unknown result type (might be due to invalid IL or missing references)
20617 //IL_0375: Unknown result type (might be due to invalid IL or missing references)
20618 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
20619 //IL_0115: Unknown result type (might be due to invalid IL or missing references)
20620 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
20621 //IL_01de: Unknown result type (might be due to invalid IL or missing references)
20622 //IL_01e3: Unknown result type (might be due to invalid IL or missing references)
20623 //IL_01e8: Unknown result type (might be due to invalid IL or missing references)
20624 //IL_01ec: Unknown result type (might be due to invalid IL or missing references)
20625 //IL_01f2: Unknown result type (might be due to invalid IL or missing references)
20626 //IL_01f7: Unknown result type (might be due to invalid IL or missing references)
20627 //IL_01fc: Unknown result type (might be due to invalid IL or missing references)
20628 //IL_01fe: Unknown result type (might be due to invalid IL or missing references)
20629 //IL_0200: Unknown result type (might be due to invalid IL or missing references)
20630 //IL_0205: Unknown result type (might be due to invalid IL or missing references)
20631 //IL_020a: Unknown result type (might be due to invalid IL or missing references)
20632 //IL_020c: Unknown result type (might be due to invalid IL or missing references)
20633 //IL_0211: Unknown result type (might be due to invalid IL or missing references)
20634 //IL_0213: Unknown result type (might be due to invalid IL or missing references)
20635 //IL_0215: Unknown result type (might be due to invalid IL or missing references)
20636 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
20637 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
20638 //IL_0134: Unknown result type (might be due to invalid IL or missing references)
20639 //IL_0137: Unknown result type (might be due to invalid IL or missing references)
20640 //IL_013e: Unknown result type (might be due to invalid IL or missing references)
20641 //IL_0143: Unknown result type (might be due to invalid IL or missing references)
20642 //IL_0148: Unknown result type (might be due to invalid IL or missing references)
20643 //IL_014a: Unknown result type (might be due to invalid IL or missing references)
20644 //IL_014f: Unknown result type (might be due to invalid IL or missing references)
20645 //IL_0154: Unknown result type (might be due to invalid IL or missing references)
20646 //IL_0156: Unknown result type (might be due to invalid IL or missing references)
20647 //IL_02b2: Unknown result type (might be due to invalid IL or missing references)
20648 //IL_02b7: Unknown result type (might be due to invalid IL or missing references)
20649 //IL_02bc: Unknown result type (might be due to invalid IL or missing references)
20650 //IL_02c1: Unknown result type (might be due to invalid IL or missing references)
20651 //IL_02c3: Unknown result type (might be due to invalid IL or missing references)
20652 //IL_02c5: Unknown result type (might be due to invalid IL or missing references)
20653 //IL_02cf: Unknown result type (might be due to invalid IL or missing references)
20654 //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
20655 //IL_02d7: Unknown result type (might be due to invalid IL or missing references)
20656 //IL_02e1: Unknown result type (might be due to invalid IL or missing references)
20657 //IL_02ea: Unknown result type (might be due to invalid IL or missing references)
20658 //IL_023a: Unknown result type (might be due to invalid IL or missing references)
20659 //IL_023c: Unknown result type (might be due to invalid IL or missing references)
20660 //IL_0221: Unknown result type (might be due to invalid IL or missing references)
20661 //IL_0223: Unknown result type (might be due to invalid IL or missing references)
20662 //IL_0225: Unknown result type (might be due to invalid IL or missing references)
20663 //IL_022c: Unknown result type (might be due to invalid IL or missing references)
20664 //IL_0231: Unknown result type (might be due to invalid IL or missing references)
20665 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
20666 //IL_0180: Unknown result type (might be due to invalid IL or missing references)
20667 //IL_015f: Unknown result type (might be due to invalid IL or missing references)
20668 //IL_0164: Unknown result type (might be due to invalid IL or missing references)
20669 //IL_0169: Unknown result type (might be due to invalid IL or missing references)
20670 //IL_02f9: Unknown result type (might be due to invalid IL or missing references)
20671 //IL_0265: Unknown result type (might be due to invalid IL or missing references)
20672 //IL_026d: Unknown result type (might be due to invalid IL or missing references)
20673 //IL_0280: Unknown result type (might be due to invalid IL or missing references)
20674 //IL_0288: Unknown result type (might be due to invalid IL or missing references)
20675 float num = 0f;
20676 float num3 = 0f;
20678 int num4 = 0;
20679 Vector2 vector = default(Vector2);
20680 for (int i = 0; i < grapCount; i++)
20681 {
20682 Projectile projectile = Main.projectile[grappling[i]];
20683 if (projectile.ai[0] != 2f || projectile.position.HasNaNs())
20684 {
20685 continue;
20686 }
20687 int type = projectile.type;
20688 int num11;
20689 if (projectile.ModProjectile != null)
20690 {
20691 num11 = ((projectile.ModProjectile.AIType > 0) ? 1 : 0);
20692 if (num11 != 0)
20693 {
20694 projectile.type = projectile.ModProjectile.AIType;
20695 }
20696 }
20697 else
20698 {
20699 num11 = 0;
20700 }
20701 num += projectile.position.X + (float)(projectile.width / 2);
20702 num3 += projectile.position.Y + (float)(projectile.height / 2);
20703 num4++;
20704 if (projectile.type == 446)
20705 {
20706 ((Vector2)(ref vector))._002Ector((float)(controlRight.ToInt() - controlLeft.ToInt()), (float)(controlDown.ToInt() - controlUp.ToInt()) * gravDir);
20707 if (vector != Vector2.Zero)
20708 {
20709 ((Vector2)(ref vector)).Normalize();
20710 }
20711 vector *= 100f;
20712 Vector2 vec = Vector2.Normalize(base.Center - projectile.Center + vector);
20713 if (vec.HasNaNs())
20714 {
20715 vec = -Vector2.UnitY;
20716 }
20717 float num5 = 200f;
20718 num += vec.X * num5;
20719 num3 += vec.Y * num5;
20720 }
20721 else if (projectile.type == 652)
20722 {
20723 Vector2 vector2 = Utils.SafeNormalize(new Vector2((float)(controlRight.ToInt() - controlLeft.ToInt()), (float)(controlDown.ToInt() - controlUp.ToInt()) * gravDir), Vector2.Zero);
20724 Vector2 vector3 = projectile.Center - base.Center;
20725 Vector2 vector4 = vector3.SafeNormalize(Vector2.Zero);
20726 Vector2 value = Vector2.Zero;
20727 if (vector2 != Vector2.Zero)
20728 {
20729 value = vector4 * Vector2.Dot(vector4, vector2);
20730 }
20731 float num6 = 6f;
20732 if (Vector2.Dot(value, vector3) < 0f && ((Vector2)(ref vector3)).Length() >= 600f)
20733 {
20734 num6 = 0f;
20735 }
20736 num += 0f - vector3.X + value.X * num6;
20737 num3 += 0f - vector3.Y + value.Y * num6;
20738 }
20739 else if (projectile.type == 865)
20740 {
20741 Vector2 vector5 = (projectile.rotation - (float)Math.PI / 2f).ToRotationVector2().SafeNormalize(Vector2.UnitY);
20742 Vector2 vector6 = -vector5 * 28f;
20743 num += vector6.X;
20744 num3 += vector6.Y;
20745 if (vector5.X != 0f)
20746 {
20748 }
20749 }
20750 if (num11 != 0)
20751 {
20752 projectile.type = type;
20753 }
20754 ProjectileLoader.GrappleTargetPoint(projectile, this, ref num, ref num3);
20755 }
20756 if (num4 == 0)
20757 {
20760 return;
20761 }
20762 float num7 = num / (float)num4;
20763 float num8 = num3 / (float)num4;
20767 float num10 = 11f;
20768 if (Main.projectile[grappling[0]].type == 315)
20769 {
20770 num10 = 14f;
20771 }
20772 if (Main.projectile[grappling[0]].type == 487)
20773 {
20774 num10 = 12f;
20775 }
20776 if (Main.projectile[grappling[0]].type >= 646 && Main.projectile[grappling[0]].type <= 649)
20777 {
20778 num10 = 16f;
20779 }
20780 ProjectileLoader.GrapplePullSpeed(Main.projectile[grappling[0]], this, ref num10);
20781 float num2 = num9;
20782 num2 = ((!(num9 > num10)) ? 1f : (num10 / num9));
20785 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
static void GrappleTargetPoint(Projectile projectile, Player player, ref float grappleX, ref float grappleY)
static void GrapplePullSpeed(Projectile projectile, Player player, ref float speed)
This serves as the central class from which projectile-related functions are carried out....
bool controlRight
Definition Player.cs:1896
int[] grappling
Definition Player.cs:2840

References Terraria.Projectile.ai, Terraria.ModLoader.ModProjectile.AIType, Terraria.Entity.Center, Terraria.Player.controlDown, Terraria.Player.controlLeft, Terraria.Player.controlRight, Terraria.Player.controlUp, Terraria.Player.grapCount, Terraria.ModLoader.ProjectileLoader.GrapplePullSpeed(), Terraria.ModLoader.ProjectileLoader.GrappleTargetPoint(), Terraria.Player.grappling, Terraria.Player.gravDir, Terraria.Entity.height, Terraria.Projectile.ModProjectile, Terraria.Entity.position, Terraria.Main.projectile, Terraria.Utils.SafeNormalize(), Terraria.Projectile.type, Terraria.Entity.velocity, and Terraria.Entity.width.

Referenced by Terraria.Player.GrappleMovement().

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