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

◆ CarpetMovement()

void Terraria.Player.CarpetMovement ( )
inline

Definition at line 19851 of file Player.cs.

19852 {
19853 bool flag = false;
19854 if (grappling[0] == -1 && carpet && !AnyExtraJumpUsable() && jump == 0 && velocity.Y != 0f && rocketTime == 0 && wingTime == 0f && !mount.Active)
19855 {
19856 if (controlJump && canCarpet)
19857 {
19858 canCarpet = false;
19859 carpetTime = 300;
19860 }
19861 if (carpetTime > 0 && controlJump)
19862 {
19863 fallStart = (int)(position.Y / 16f);
19864 flag = true;
19865 carpetTime--;
19866 float num = gravity;
19867 if (gravDir == 1f && velocity.Y > 0f - num)
19868 {
19869 velocity.Y = 0f - (num + 1E-06f);
19870 }
19871 else if (gravDir == -1f && velocity.Y < num)
19872 {
19873 velocity.Y = num + 1E-06f;
19874 }
19875 carpetFrameCounter += 1f + Math.Abs(velocity.X * 0.5f);
19876 if (carpetFrameCounter > 8f)
19877 {
19879 carpetFrame++;
19880 }
19881 if (carpetFrame < 0)
19882 {
19883 carpetFrame = 0;
19884 }
19885 if (carpetFrame > 5)
19886 {
19887 carpetFrame = 0;
19888 }
19889 }
19890 }
19891 if (!flag)
19892 {
19893 carpetFrame = -1;
19894 }
19895 else
19896 {
19897 slowFall = false;
19898 }
19899 }
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
bool Active
Definition Mount.cs:348
bool AnyExtraJumpUsable()
Returns true if any extra jump is P:Terraria.DataStructures.ExtraJumpState.Available and M:Terraria....
Definition Player.cs:58714
float carpetFrameCounter
Definition Player.cs:1313
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
Definition Player.cs:2323
int[] grappling
Definition Player.cs:2840

References Terraria.Mount.Active, Terraria.Player.AnyExtraJumpUsable(), Terraria.Player.canCarpet, Terraria.Player.carpet, Terraria.Player.carpetFrame, Terraria.Player.carpetFrameCounter, Terraria.Player.carpetTime, Terraria.Player.controlJump, Terraria.Player.fallStart, Terraria.Player.grappling, Terraria.Player.gravDir, Terraria.Player.gravity, Terraria.Player.jump, Terraria.Player.mount, Terraria.Entity.position, Terraria.Player.rocketTime, Terraria.Player.slowFall, Terraria.Entity.velocity, and Terraria.Player.wingTime.

Referenced by Terraria.Player.Update().

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