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

◆ Ghost()

void Terraria.Player.Ghost ( )
inline

Definition at line 7037 of file Player.cs.

7038 {
7039 //IL_02cb: Unknown result type (might be due to invalid IL or missing references)
7040 //IL_02d1: Unknown result type (might be due to invalid IL or missing references)
7041 //IL_02d6: Unknown result type (might be due to invalid IL or missing references)
7042 //IL_02db: Unknown result type (might be due to invalid IL or missing references)
7043 immune = false;
7044 immuneAlpha = 0;
7045 if (Main.hasFocus && whoAmI == Main.myPlayer)
7046 {
7047 controlUp = false;
7048 controlLeft = false;
7049 controlDown = false;
7050 controlRight = false;
7051 controlJump = false;
7052 if (!Main.drawingPlayerChat && !Main.editSign && !Main.editChest && !Main.blockInput)
7053 {
7054 PlayerInput.Triggers.Current.CopyInto(this);
7057 }
7058 }
7059 float num = 7f;
7060 float num2 = 0.2f;
7061 if (controlUp || controlJump)
7062 {
7063 if (velocity.Y > 0f)
7064 {
7065 velocity.Y *= 0.9f;
7066 }
7067 velocity.Y -= num2;
7068 if (velocity.Y < 0f - num)
7069 {
7070 velocity.Y = 0f - num;
7071 }
7072 }
7073 else if (controlDown)
7074 {
7075 if (velocity.Y < 0f)
7076 {
7077 velocity.Y *= 0.9f;
7078 }
7079 velocity.Y += num2;
7080 if (velocity.Y > num)
7081 {
7082 velocity.Y = num;
7083 }
7084 }
7085 else if ((double)velocity.Y < -0.1 || (double)velocity.Y > 0.1)
7086 {
7087 velocity.Y *= 0.9f;
7088 }
7089 else
7090 {
7091 velocity.Y = 0f;
7092 }
7093 if (controlLeft && !controlRight)
7094 {
7095 if (velocity.X > 0f)
7096 {
7097 velocity.X *= 0.9f;
7098 }
7099 velocity.X -= num2;
7100 if (velocity.X < 0f - num)
7101 {
7102 velocity.X = 0f - num;
7103 }
7104 }
7105 else if (controlRight && !controlLeft)
7106 {
7107 if (velocity.X < 0f)
7108 {
7109 velocity.X *= 0.9f;
7110 }
7111 velocity.X += num2;
7112 if (velocity.X > num)
7113 {
7114 velocity.X = num;
7115 }
7116 }
7117 else if (velocity.X < 0f - num2 || velocity.X > num2)
7118 {
7119 velocity.X *= 0.9f;
7120 }
7121 else
7122 {
7123 velocity.X = 0f;
7124 }
7125 position += velocity;
7127 if (velocity.X < 0f)
7128 {
7129 direction = -1;
7130 }
7131 else if (velocity.X > 0f)
7132 {
7133 direction = 1;
7134 }
7135 if (ghostFrameCounter >= 8)
7136 {
7138 ghostFrame++;
7139 if (ghostFrame >= 4)
7140 {
7141 ghostFrame = 0;
7142 }
7143 }
7144 if (position.X < Main.leftWorld + (float)(Lighting.OffScreenTiles * 16) + 16f)
7145 {
7146 position.X = Main.leftWorld + (float)(Lighting.OffScreenTiles * 16) + 16f;
7147 velocity.X = 0f;
7148 }
7149 if (position.X + (float)width > Main.rightWorld - (float)(Lighting.OffScreenTiles * 16) - 32f)
7150 {
7151 position.X = Main.rightWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)width;
7152 velocity.X = 0f;
7153 }
7154 if (position.Y < Main.topWorld + (float)(Lighting.OffScreenTiles * 16) + 16f)
7155 {
7156 position.Y = Main.topWorld + (float)(Lighting.OffScreenTiles * 16) + 16f;
7157 if ((double)velocity.Y < -0.1)
7158 {
7159 velocity.Y = -0.1f;
7160 }
7161 }
7162 if (position.Y > Main.bottomWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)height)
7163 {
7164 position.Y = Main.bottomWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)height;
7165 velocity.Y = 0f;
7166 }
7167 }
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 TriggersPack Triggers
bool controlRight
Definition Player.cs:1896
void TrySyncingInput()
Definition Player.cs:7169
void TryOpeningInGameOptionsBasedOnInput()
Definition Player.cs:15621
int ghostFrameCounter
Definition Player.cs:1514

References Terraria.Main.blockInput, Terraria.Main.bottomWorld, Terraria.Player.controlDown, Terraria.Player.controlJump, Terraria.Player.controlLeft, Terraria.Player.controlRight, Terraria.Player.controlUp, Terraria.Entity.direction, Terraria.Main.drawingPlayerChat, Terraria.Main.editChest, Terraria.Main.editSign, Terraria.Player.ghostFrame, Terraria.Player.ghostFrameCounter, Terraria.Main.hasFocus, Terraria.Entity.height, Terraria.Player.immune, Terraria.Player.immuneAlpha, Terraria.Main.leftWorld, Terraria.Main.myPlayer, Terraria.Lighting.OffScreenTiles, Terraria.Entity.position, Terraria.Main.topWorld, Terraria.GameInput.PlayerInput.Triggers, Terraria.Player.TryOpeningInGameOptionsBasedOnInput(), Terraria.Player.TrySyncingInput(), 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: