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

◆ WingMovement()

void Terraria.Player.WingMovement ( )
inline

Definition at line 19906 of file Player.cs.

19907 {
19908 if (wingsLogic == 4 && TryingToHoverUp)
19909 {
19910 velocity.Y -= 0.2f * gravDir;
19911 if (gravDir == 1f)
19912 {
19913 if (velocity.Y > 0f)
19914 {
19915 velocity.Y -= 1f;
19916 }
19917 else if (velocity.Y > 0f - jumpSpeed)
19918 {
19919 velocity.Y -= 0.2f;
19920 }
19921 if (velocity.Y < (0f - jumpSpeed) * 3f)
19922 {
19923 velocity.Y = (0f - jumpSpeed) * 3f;
19924 }
19925 }
19926 else
19927 {
19928 if (velocity.Y < 0f)
19929 {
19930 velocity.Y += 1f;
19931 }
19932 else if (velocity.Y < jumpSpeed)
19933 {
19934 velocity.Y += 0.2f;
19935 }
19936 if (velocity.Y > jumpSpeed * 3f)
19937 {
19938 velocity.Y = jumpSpeed * 3f;
19939 }
19940 }
19941 wingTime -= 2f;
19942 }
19943 else
19944 {
19945 float num = 0.1f;
19946 float num2 = 0.5f;
19947 float num3 = 1.5f;
19948 float num4 = 0.5f;
19949 float num5 = 0.1f;
19950 if (wingsLogic == 26)
19951 {
19952 num2 = 0.75f;
19953 num5 = 0.15f;
19954 num4 = 1f;
19955 num3 = 2.5f;
19956 num = 0.125f;
19957 }
19958 if (wingsLogic == 8 || wingsLogic == 11 || wingsLogic == 24 || wingsLogic == 27 || wingsLogic == 22)
19959 {
19960 num3 = 1.66f;
19961 }
19962 if (wingsLogic == 21 || wingsLogic == 12 || wingsLogic == 20 || wingsLogic == 23)
19963 {
19964 num3 = 1.805f;
19965 }
19966 if (wingsLogic == 37)
19967 {
19968 num2 = 0.75f;
19969 num5 = 0.15f;
19970 num4 = 1f;
19971 num3 = 2.5f;
19972 num = 0.125f;
19973 }
19974 if (wingsLogic == 44)
19975 {
19976 num2 = 0.85f;
19977 num5 = 0.15f;
19978 num4 = 1f;
19979 num3 = 2.75f;
19980 num = 0.125f;
19981 if (TryingToHoverUp)
19982 {
19983 velocity.Y -= 0.4f * gravDir;
19984 if (gravDir == 1f)
19985 {
19986 if (velocity.Y > 0f)
19987 {
19988 velocity.Y -= 1f;
19989 }
19990 else if (velocity.Y > 0f - jumpSpeed)
19991 {
19992 velocity.Y -= 0.2f;
19993 }
19994 if (velocity.Y < (0f - jumpSpeed) * 3f)
19995 {
19996 velocity.Y = (0f - jumpSpeed) * 3f;
19997 }
19998 }
19999 else
20000 {
20001 if (velocity.Y < 0f)
20002 {
20003 velocity.Y += 1f;
20004 }
20005 else if (velocity.Y < jumpSpeed)
20006 {
20007 velocity.Y += 0.2f;
20008 }
20009 if (velocity.Y > jumpSpeed * 3f)
20010 {
20011 velocity.Y = jumpSpeed * 3f;
20012 }
20013 }
20014 }
20015 if (TryingToHoverDown && !controlJump && velocity.Y != 0f)
20016 {
20017 velocity.Y += 0.4f;
20018 }
20019 }
20020 if (wingsLogic == 45)
20021 {
20022 num2 = 0.95f;
20023 num5 = 0.15f;
20024 num4 = 1f;
20025 num3 = 4.5f;
20026 if (TryingToHoverUp)
20027 {
20028 velocity.Y -= 0.4f * gravDir;
20029 if (gravDir == 1f)
20030 {
20031 if (velocity.Y > 0f)
20032 {
20033 velocity.Y -= 1f;
20034 }
20035 else if (velocity.Y > 0f - jumpSpeed)
20036 {
20037 velocity.Y -= 0.2f;
20038 }
20039 if (velocity.Y < (0f - jumpSpeed) * 3f)
20040 {
20041 velocity.Y = (0f - jumpSpeed) * 3f;
20042 }
20043 }
20044 else
20045 {
20046 if (velocity.Y < 0f)
20047 {
20048 velocity.Y += 1f;
20049 }
20050 else if (velocity.Y < jumpSpeed)
20051 {
20052 velocity.Y += 0.2f;
20053 }
20054 if (velocity.Y > jumpSpeed * 3f)
20055 {
20056 velocity.Y = jumpSpeed * 3f;
20057 }
20058 }
20059 }
20060 if (TryingToHoverDown && !controlJump && velocity.Y != 0f)
20061 {
20062 velocity.Y += 0.4f;
20063 }
20064 }
20065 if (wingsLogic == 29 || wingsLogic == 32)
20066 {
20067 num2 = 0.85f;
20068 num5 = 0.15f;
20069 num4 = 1f;
20070 num3 = 3f;
20071 num = 0.135f;
20072 }
20073 if (wingsLogic == 30 || wingsLogic == 31)
20074 {
20075 num4 = 1f;
20076 num3 = 2.45f;
20077 if (!TryingToHoverDown)
20078 {
20079 num = 0.15f;
20080 }
20081 }
20083 velocity.Y -= num * gravDir;
20084 if (gravDir == 1f)
20085 {
20086 if (velocity.Y > 0f)
20087 {
20088 velocity.Y -= num2;
20089 }
20090 else if (velocity.Y > (0f - jumpSpeed) * num4)
20091 {
20092 velocity.Y -= num5;
20093 }
20094 if (velocity.Y < (0f - jumpSpeed) * num3)
20095 {
20096 velocity.Y = (0f - jumpSpeed) * num3;
20097 }
20098 }
20099 else
20100 {
20101 if (velocity.Y < 0f)
20102 {
20103 velocity.Y += num2;
20104 }
20105 else if (velocity.Y < jumpSpeed * num4)
20106 {
20107 velocity.Y += num5;
20108 }
20109 if (velocity.Y > jumpSpeed * num3)
20110 {
20111 velocity.Y = jumpSpeed * num3;
20112 }
20113 }
20114 if ((wingsLogic == 22 || wingsLogic == 28 || wingsLogic == 30 || wingsLogic == 31 || wingsLogic == 37 || wingsLogic == 45) && TryingToHoverDown && !controlLeft && !controlRight)
20115 {
20116 wingTime -= 0.5f;
20117 }
20118 else
20119 {
20120 wingTime -= 1f;
20121 }
20122 }
20123 if (empressBrooch && wingTime != 0f)
20124 {
20126 }
20127 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
static void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
If the player is using wings, this uses the result of GetWing, and calls ModItem.VerticalWingSpeeds t...
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
bool controlRight
Definition Player.cs:1896
bool empressBrooch
Definition Player.cs:2199
static float jumpSpeed
The speed, in pixels/tick, that this players jumps at.
Definition Player.cs:2661
bool TryingToHoverDown
Definition Player.cs:4275
bool TryingToHoverUp
Definition Player.cs:4263

References Terraria.Player.controlJump, Terraria.Player.controlLeft, Terraria.Player.controlRight, Terraria.Player.empressBrooch, Terraria.Player.gravDir, Terraria.Player.jumpSpeed, Terraria.Player.TryingToHoverDown, Terraria.Player.TryingToHoverUp, Terraria.Entity.velocity, Terraria.ModLoader.ItemLoader.VerticalWingSpeeds(), Terraria.Player.wingsLogic, Terraria.Player.wingTime, and Terraria.Player.wingTimeMax.

Referenced by Terraria.Player.Update().

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