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

◆ StepDown()

static void Terraria.Collision.StepDown ( ref Vector2 position,
ref Vector2 velocity,
int width,
int height,
ref float stepSpeed,
ref float gfxOffY,
int gravDir = 1,
bool waterWalk = false )
inlinestatic

Definition at line 4142 of file Collision.cs.

4143 {
4144 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
4145 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
4146 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
4147 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
4148 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
4149 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
4150 //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
4151 //IL_01a6: Unknown result type (might be due to invalid IL or missing references)
4152 //IL_01ba: Unknown result type (might be due to invalid IL or missing references)
4153 Vector2 vector = position;
4154 vector.X += velocity.X;
4155 vector.Y = (float)Math.Floor((vector.Y + (float)height) / 16f) * 16f - (float)height;
4156 bool flag = false;
4157 int num19 = (int)(vector.X / 16f);
4158 int num11 = (int)((vector.X + (float)width) / 16f);
4159 int num12 = (int)((vector.Y + (float)height + 4f) / 16f);
4160 int num13 = height / 16 + ((height % 16 != 0) ? 1 : 0);
4161 float num14 = (num12 + num13) * 16;
4162 float num15 = Main.bottomWorld / 16f - 42f;
4163 for (int i = num19; i <= num11; i++)
4164 {
4165 for (int j = num12; j <= num12 + 1; j++)
4166 {
4167 if (!WorldGen.InWorld(i, j, 1))
4168 {
4169 continue;
4170 }
4171 if (Main.tile[i, j] == null)
4172 {
4173 Main.tile[i, j] = default(Tile);
4174 }
4175 if (Main.tile[i, j - 1] == null)
4176 {
4177 Main.tile[i, j - 1] = default(Tile);
4178 }
4179 if (waterWalk && Main.tile[i, j].liquid > 0 && Main.tile[i, j - 1].liquid == 0)
4180 {
4181 int num16 = Main.tile[i, j].liquid / 32 * 2 + 2;
4182 int num17 = j * 16 + 16 - num16;
4183 Rectangle val = new Rectangle(i * 16, j * 16 - 17, 16, 16);
4184 if (((Rectangle)(ref val)).Intersects(new Rectangle((int)position.X, (int)position.Y, width, height)) && (float)num17 < num14)
4185 {
4186 num14 = num17;
4187 }
4188 }
4189 if ((float)j >= num15 || (Main.tile[i, j].nactive() && (Main.tileSolid[Main.tile[i, j].type] || Main.tileSolidTop[Main.tile[i, j].type])))
4190 {
4191 int num18 = j * 16;
4192 if (Main.tile[i, j].halfBrick())
4193 {
4194 num18 += 8;
4195 }
4196 if (Utils.FloatIntersect(i * 16, j * 16 - 17, 16f, 16f, position.X, position.Y, width, height) && (float)num18 < num14)
4197 {
4198 num14 = num18;
4199 }
4200 }
4201 }
4202 }
4203 float num10 = num14 - (position.Y + (float)height);
4204 if (num10 > 7f && num10 < 17f && !flag)
4205 {
4206 stepSpeed = 1.5f;
4207 if (num10 > 9f)
4208 {
4209 stepSpeed = 2.5f;
4210 }
4211 gfxOffY += position.Y + (float)height - num14;
4212 position.Y = num14 - (float)height;
4213 }
4214 }

References Terraria.Utils.FloatIntersect(), Terraria.WorldGen.InWorld(), Terraria.Main.tile, Terraria.Main.tileSolid, and Terraria.Main.tileSolidTop.

Referenced by Terraria.NPC.AI_007_TownEntities(), Terraria.Player.DryCollision(), and Terraria.Player.Update().

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