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

◆ StickyMovement()

void Terraria.Player.StickyMovement ( )
inline

Definition at line 20822 of file Player.cs.

20823 {
20824 //IL_008b: Unknown result type (might be due to invalid IL or missing references)
20825 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
20826 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
20827 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
20828 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
20829 //IL_00af: Unknown result type (might be due to invalid IL or missing references)
20830 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
20831 //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
20832 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
20833 //IL_04b1: Unknown result type (might be due to invalid IL or missing references)
20834 //IL_04cc: Unknown result type (might be due to invalid IL or missing references)
20835 //IL_04d2: Unknown result type (might be due to invalid IL or missing references)
20836 //IL_0510: Unknown result type (might be due to invalid IL or missing references)
20837 //IL_051a: Unknown result type (might be due to invalid IL or missing references)
20838 //IL_051f: Unknown result type (might be due to invalid IL or missing references)
20839 //IL_040c: Unknown result type (might be due to invalid IL or missing references)
20840 //IL_0427: Unknown result type (might be due to invalid IL or missing references)
20841 //IL_042d: Unknown result type (might be due to invalid IL or missing references)
20842 //IL_046b: Unknown result type (might be due to invalid IL or missing references)
20843 //IL_0475: Unknown result type (might be due to invalid IL or missing references)
20844 //IL_047a: Unknown result type (might be due to invalid IL or missing references)
20845 //IL_0673: Unknown result type (might be due to invalid IL or missing references)
20846 //IL_068e: Unknown result type (might be due to invalid IL or missing references)
20847 //IL_0694: Unknown result type (might be due to invalid IL or missing references)
20848 //IL_06d2: Unknown result type (might be due to invalid IL or missing references)
20849 //IL_06dc: Unknown result type (might be due to invalid IL or missing references)
20850 //IL_06e1: Unknown result type (might be due to invalid IL or missing references)
20851 //IL_05cb: Unknown result type (might be due to invalid IL or missing references)
20852 //IL_05e6: Unknown result type (might be due to invalid IL or missing references)
20853 //IL_05ec: Unknown result type (might be due to invalid IL or missing references)
20854 //IL_062a: Unknown result type (might be due to invalid IL or missing references)
20855 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
20856 //IL_0639: Unknown result type (might be due to invalid IL or missing references)
20857 //IL_0831: Unknown result type (might be due to invalid IL or missing references)
20858 //IL_084c: Unknown result type (might be due to invalid IL or missing references)
20859 //IL_0852: Unknown result type (might be due to invalid IL or missing references)
20860 //IL_0890: Unknown result type (might be due to invalid IL or missing references)
20861 //IL_089a: Unknown result type (might be due to invalid IL or missing references)
20862 //IL_089f: Unknown result type (might be due to invalid IL or missing references)
20863 //IL_078d: Unknown result type (might be due to invalid IL or missing references)
20864 //IL_07a8: Unknown result type (might be due to invalid IL or missing references)
20865 //IL_07ae: Unknown result type (might be due to invalid IL or missing references)
20866 //IL_07ec: Unknown result type (might be due to invalid IL or missing references)
20867 //IL_07f6: Unknown result type (might be due to invalid IL or missing references)
20868 //IL_07fb: Unknown result type (might be due to invalid IL or missing references)
20869 if (shimmering)
20870 {
20871 return;
20872 }
20873 bool flag = false;
20874 if (mount.Type > 0 && MountID.Sets.Cart[mount.Type] && Math.Abs(velocity.X) > 5f)
20875 {
20876 flag = true;
20877 }
20878 int num = width / 2;
20879 int num3 = height / 2;
20880 new Vector2(position.X + (float)(width / 2) - (float)(num / 2), position.Y + (float)(height / 2) - (float)(num3 / 2));
20881 Vector2 vector = Collision.StickyTiles(position, velocity, width, height);
20882 if (vector.Y != -1f && vector.X != -1f)
20883 {
20884 int num4 = (int)vector.X;
20885 int num5 = (int)vector.Y;
20886 int type = Main.tile[num4, num5].type;
20887 if (whoAmI == Main.myPlayer && type == 51 && (velocity.X != 0f || velocity.Y != 0f))
20888 {
20889 stickyBreak++;
20890 if (stickyBreak > Main.rand.Next(20, 100) || flag)
20891 {
20892 stickyBreak = 0;
20893 WorldGen.KillTile(num4, num5);
20894 if (Main.netMode == 1 && !Main.tile[num4, num5].active() && Main.netMode == 1)
20895 {
20896 NetMessage.SendData(17, -1, -1, null, 0, num4, num5);
20897 }
20898 }
20899 }
20900 if (flag)
20901 {
20902 return;
20903 }
20904 fallStart = (int)(position.Y / 16f);
20905 if (type != 229)
20906 {
20907 jump = 0;
20908 }
20909 if (velocity.X > 1f)
20910 {
20911 velocity.X = 1f;
20912 }
20913 if (velocity.X < -1f)
20914 {
20915 velocity.X = -1f;
20916 }
20917 if ((double)velocity.X > 0.75 || (double)velocity.X < -0.75)
20918 {
20919 velocity.X *= 0.85f;
20920 }
20921 else
20922 {
20923 velocity.X *= 0.6f;
20924 }
20925 if (gravDir == -1f)
20926 {
20927 if (velocity.Y < -1f)
20928 {
20929 velocity.Y = -1f;
20930 }
20931 if (velocity.Y > 5f)
20932 {
20933 velocity.Y = 5f;
20934 }
20935 if (velocity.Y > 0f)
20936 {
20937 velocity.Y *= 0.96f;
20938 }
20939 else
20940 {
20941 velocity.Y *= 0.3f;
20942 }
20943 }
20944 else
20945 {
20946 if (velocity.Y > 1f)
20947 {
20948 velocity.Y = 1f;
20949 }
20950 if (velocity.Y < -5f)
20951 {
20952 velocity.Y = -5f;
20953 }
20954 if (velocity.Y < 0f)
20955 {
20956 velocity.Y *= 0.96f;
20957 }
20958 else
20959 {
20960 velocity.Y *= 0.3f;
20961 }
20962 }
20963 if (type != 229 || Main.rand.Next(5) != 0 || (!((double)velocity.Y > 0.15) && !(velocity.Y < 0f)))
20964 {
20965 return;
20966 }
20967 if ((float)(num4 * 16) < position.X + (float)(width / 2))
20968 {
20969 int num6 = Dust.NewDust(new Vector2(position.X - 4f, (float)(num5 * 16)), 4, 16, 153, 0f, 0f, 50);
20970 Main.dust[num6].scale += (float)Main.rand.Next(0, 6) * 0.1f;
20971 Dust obj = Main.dust[num6];
20972 obj.velocity *= 0.1f;
20973 Main.dust[num6].noGravity = true;
20974 }
20975 else
20976 {
20977 int num7 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, (float)(num5 * 16)), 4, 16, 153, 0f, 0f, 50);
20978 Main.dust[num7].scale += (float)Main.rand.Next(0, 6) * 0.1f;
20979 Dust obj2 = Main.dust[num7];
20980 obj2.velocity *= 0.1f;
20981 Main.dust[num7].noGravity = true;
20982 }
20983 if (Main.tile[num4, num5 + 1] != null && Main.tile[num4, num5 + 1].type == 229 && position.Y + (float)height > (float)((num5 + 1) * 16))
20984 {
20985 if ((float)(num4 * 16) < position.X + (float)(width / 2))
20986 {
20987 int num8 = Dust.NewDust(new Vector2(position.X - 4f, (float)(num5 * 16 + 16)), 4, 16, 153, 0f, 0f, 50);
20988 Main.dust[num8].scale += (float)Main.rand.Next(0, 6) * 0.1f;
20989 Dust obj3 = Main.dust[num8];
20990 obj3.velocity *= 0.1f;
20991 Main.dust[num8].noGravity = true;
20992 }
20993 else
20994 {
20995 int num9 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, (float)(num5 * 16 + 16)), 4, 16, 153, 0f, 0f, 50);
20996 Main.dust[num9].scale += (float)Main.rand.Next(0, 6) * 0.1f;
20997 Dust obj4 = Main.dust[num9];
20998 obj4.velocity *= 0.1f;
20999 Main.dust[num9].noGravity = true;
21000 }
21001 }
21002 if (Main.tile[num4, num5 + 2] != null && Main.tile[num4, num5 + 2].type == 229 && position.Y + (float)height > (float)((num5 + 2) * 16))
21003 {
21004 if ((float)(num4 * 16) < position.X + (float)(width / 2))
21005 {
21006 int num10 = Dust.NewDust(new Vector2(position.X - 4f, (float)(num5 * 16 + 32)), 4, 16, 153, 0f, 0f, 50);
21007 Main.dust[num10].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21008 Dust obj5 = Main.dust[num10];
21009 obj5.velocity *= 0.1f;
21010 Main.dust[num10].noGravity = true;
21011 }
21012 else
21013 {
21014 int num2 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, (float)(num5 * 16 + 32)), 4, 16, 153, 0f, 0f, 50);
21015 Main.dust[num2].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21016 Dust obj6 = Main.dust[num2];
21017 obj6.velocity *= 0.1f;
21018 Main.dust[num2].noGravity = true;
21019 }
21020 }
21021 }
21022 else
21023 {
21024 stickyBreak = 0;
21025 }
21026 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static bool[] Cart
If true for a given T:Terraria.ID.MountID, then that mount is categorized as a minecart....
Definition MountID.cs:16
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
Definition Player.cs:2323

References Terraria.ID.MountID.Sets.Cart, Terraria.Main.dust, Terraria.Player.fallStart, Terraria.Player.gravDir, Terraria.Entity.height, Terraria.Player.jump, Terraria.WorldGen.KillTile(), Terraria.Player.mount, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Entity.position, Terraria.Main.rand, Terraria.NetMessage.SendData(), Terraria.Player.shimmering, Terraria.Player.stickyBreak, Terraria.Collision.StickyTiles(), Terraria.Main.tile, Terraria.Mount.Type, Terraria.Entity.velocity, Terraria.Entity.whoAmI, and Terraria.Entity.width.

Referenced by Terraria.Player.Update().

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