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

◆ MoveInWorld()

void Terraria.Item.MoveInWorld ( float gravity,
float maxFallSpeed,
ref Vector2 wetVelocity,
int i )
inlineprivate

Definition at line 50360 of file Item.cs.

50361 {
50362 //IL_03f3: Unknown result type (might be due to invalid IL or missing references)
50363 //IL_0415: Unknown result type (might be due to invalid IL or missing references)
50364 //IL_014a: Unknown result type (might be due to invalid IL or missing references)
50365 //IL_015c: Unknown result type (might be due to invalid IL or missing references)
50366 //IL_0174: Unknown result type (might be due to invalid IL or missing references)
50367 //IL_0186: Unknown result type (might be due to invalid IL or missing references)
50368 //IL_01a0: Unknown result type (might be due to invalid IL or missing references)
50369 //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
50370 //IL_01d1: Unknown result type (might be due to invalid IL or missing references)
50371 //IL_01e3: Unknown result type (might be due to invalid IL or missing references)
50372 //IL_0f3d: Unknown result type (might be due to invalid IL or missing references)
50373 //IL_0f43: Unknown result type (might be due to invalid IL or missing references)
50374 //IL_0f57: Unknown result type (might be due to invalid IL or missing references)
50375 //IL_0f5c: Unknown result type (might be due to invalid IL or missing references)
50376 //IL_025b: Unknown result type (might be due to invalid IL or missing references)
50377 //IL_026d: Unknown result type (might be due to invalid IL or missing references)
50378 //IL_0f62: Unknown result type (might be due to invalid IL or missing references)
50379 //IL_0f68: Unknown result type (might be due to invalid IL or missing references)
50380 //IL_0f7b: Unknown result type (might be due to invalid IL or missing references)
50381 //IL_0f80: Unknown result type (might be due to invalid IL or missing references)
50382 //IL_0f87: Unknown result type (might be due to invalid IL or missing references)
50383 //IL_0f98: Unknown result type (might be due to invalid IL or missing references)
50384 //IL_0fa9: Unknown result type (might be due to invalid IL or missing references)
50385 //IL_0fba: Unknown result type (might be due to invalid IL or missing references)
50386 //IL_0ec2: Unknown result type (might be due to invalid IL or missing references)
50387 //IL_0ec7: Unknown result type (might be due to invalid IL or missing references)
50388 //IL_0ecb: Unknown result type (might be due to invalid IL or missing references)
50389 //IL_0ed1: Unknown result type (might be due to invalid IL or missing references)
50390 //IL_0ee5: Unknown result type (might be due to invalid IL or missing references)
50391 //IL_0eea: Unknown result type (might be due to invalid IL or missing references)
50392 //IL_0efa: Unknown result type (might be due to invalid IL or missing references)
50393 //IL_0da5: Unknown result type (might be due to invalid IL or missing references)
50394 //IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
50395 //IL_0dca: Unknown result type (might be due to invalid IL or missing references)
50396 //IL_0887: Unknown result type (might be due to invalid IL or missing references)
50397 //IL_08a6: Unknown result type (might be due to invalid IL or missing references)
50398 //IL_08ac: Unknown result type (might be due to invalid IL or missing references)
50399 //IL_0f1f: Unknown result type (might be due to invalid IL or missing references)
50400 //IL_09d3: Unknown result type (might be due to invalid IL or missing references)
50401 //IL_09f5: Unknown result type (might be due to invalid IL or missing references)
50402 //IL_09fb: Unknown result type (might be due to invalid IL or missing references)
50403 //IL_04af: Unknown result type (might be due to invalid IL or missing references)
50404 //IL_04d1: Unknown result type (might be due to invalid IL or missing references)
50405 //IL_04d7: Unknown result type (might be due to invalid IL or missing references)
50406 //IL_0c90: Unknown result type (might be due to invalid IL or missing references)
50407 //IL_0cb2: Unknown result type (might be due to invalid IL or missing references)
50408 //IL_0cb8: Unknown result type (might be due to invalid IL or missing references)
50409 //IL_0b89: Unknown result type (might be due to invalid IL or missing references)
50410 //IL_0bab: Unknown result type (might be due to invalid IL or missing references)
50411 //IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
50412 //IL_0a98: Unknown result type (might be due to invalid IL or missing references)
50413 //IL_0a9d: Unknown result type (might be due to invalid IL or missing references)
50414 //IL_0abb: Unknown result type (might be due to invalid IL or missing references)
50415 //IL_0ac0: Unknown result type (might be due to invalid IL or missing references)
50416 //IL_0ade: Unknown result type (might be due to invalid IL or missing references)
50417 //IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
50418 //IL_0772: Unknown result type (might be due to invalid IL or missing references)
50419 //IL_0794: Unknown result type (might be due to invalid IL or missing references)
50420 //IL_079a: Unknown result type (might be due to invalid IL or missing references)
50421 //IL_0665: Unknown result type (might be due to invalid IL or missing references)
50422 //IL_0687: Unknown result type (might be due to invalid IL or missing references)
50423 //IL_068d: Unknown result type (might be due to invalid IL or missing references)
50424 //IL_0574: Unknown result type (might be due to invalid IL or missing references)
50425 //IL_0579: Unknown result type (might be due to invalid IL or missing references)
50426 //IL_0597: Unknown result type (might be due to invalid IL or missing references)
50427 //IL_059c: Unknown result type (might be due to invalid IL or missing references)
50428 //IL_05ba: Unknown result type (might be due to invalid IL or missing references)
50429 //IL_05bf: Unknown result type (might be due to invalid IL or missing references)
50430 //IL_0b01: Unknown result type (might be due to invalid IL or missing references)
50431 //IL_0b06: Unknown result type (might be due to invalid IL or missing references)
50432 //IL_05dd: Unknown result type (might be due to invalid IL or missing references)
50433 //IL_05e2: Unknown result type (might be due to invalid IL or missing references)
50434 ItemLoader.Update(this, ref gravity, ref maxFallSpeed);
50436 {
50437 velocity.X *= 0.95f;
50438 if ((double)velocity.X < 0.1 && (double)velocity.X > -0.1)
50439 {
50440 velocity.X = 0f;
50441 }
50442 velocity.Y *= 0.95f;
50443 if ((double)velocity.Y < 0.1 && (double)velocity.Y > -0.1)
50444 {
50445 velocity.Y = 0f;
50446 }
50447 }
50448 else
50449 {
50450 bool flag = false;
50451 if (shimmered && active)
50452 {
50453 int num = 50;
50454 for (int j = 0; j < 400; j++)
50455 {
50456 if (i == j || !Main.item[j].active || !Main.item[j].shimmered)
50457 {
50458 continue;
50459 }
50460 if (num-- <= 0)
50461 {
50462 break;
50463 }
50464 float num9 = (width + Main.item[j].width) / 2;
50465 if (!(Math.Abs(base.Center.X - Main.item[j].Center.X) <= num9) || !(Math.Abs(base.Center.Y - Main.item[j].Center.Y) <= num9))
50466 {
50467 continue;
50468 }
50469 flag = true;
50470 float num10 = Vector2.Distance(base.Center, Main.item[j].Center);
50471 num9 /= num10;
50472 if (num9 > 10f)
50473 {
50474 num9 = 10f;
50475 }
50476 if (base.Center.X < Main.item[j].Center.X)
50477 {
50478 if (velocity.X > -3f * num9)
50479 {
50480 velocity.X -= 0.1f * num9;
50481 }
50482 if (Main.item[j].velocity.X < 3f)
50483 {
50484 Main.item[j].velocity.X += 0.1f * num9;
50485 }
50486 }
50487 else if (base.Center.X > Main.item[j].Center.X)
50488 {
50489 if (velocity.X < 3f * num9)
50490 {
50491 velocity.X += 0.1f * num9;
50492 }
50493 if (Main.item[j].velocity.X > -3f)
50494 {
50495 Main.item[j].velocity.X -= 0.1f * num9;
50496 }
50497 }
50498 else if (i < j)
50499 {
50500 if (velocity.X > -3f * num9)
50501 {
50502 velocity.X -= 0.1f * num9;
50503 }
50504 if (Main.item[j].velocity.X < 3f * num9)
50505 {
50506 Main.item[j].velocity.X += 0.1f * num9;
50507 }
50508 }
50509 }
50510 }
50511 velocity.Y += gravity;
50512 if (velocity.Y > maxFallSpeed)
50513 {
50514 velocity.Y = maxFallSpeed;
50515 }
50516 velocity.X *= 0.95f;
50517 if ((double)velocity.X < 0.1 && (double)velocity.X > -0.1)
50518 {
50519 velocity.X = 0f;
50520 }
50521 if (flag)
50522 {
50523 velocity.X *= 0.8f;
50524 }
50525 }
50526 bool flag2 = Collision.LavaCollision(position, width, height);
50527 if (flag2)
50528 {
50529 lavaWet = true;
50530 }
50531 bool num16 = Collision.WetCollision(position, width, height);
50532 if (Collision.honey)
50533 {
50534 honeyWet = true;
50535 }
50536 if (Collision.shimmer)
50537 {
50538 shimmerWet = true;
50539 }
50540 if (num16)
50541 {
50542 if (!wet)
50543 {
50544 if (wetCount == 0)
50545 {
50546 wetCount = 20;
50547 if (!flag2)
50548 {
50549 if (shimmerWet)
50550 {
50551 for (int k = 0; k < 10; k++)
50552 {
50553 int num11 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
50554 Main.dust[num11].velocity.Y -= 4f;
50555 Main.dust[num11].velocity.X *= 2.5f;
50556 Main.dust[num11].scale = 0.8f;
50557 Main.dust[num11].noGravity = true;
50558 switch (Main.rand.Next(6))
50559 {
50560 case 0:
50561 Main.dust[num11].color = new Color(255, 255, 210);
50562 break;
50563 case 1:
50564 Main.dust[num11].color = new Color(190, 245, 255);
50565 break;
50566 case 2:
50567 Main.dust[num11].color = new Color(255, 150, 255);
50568 break;
50569 default:
50570 Main.dust[num11].color = new Color(190, 175, 255);
50571 break;
50572 }
50573 }
50574 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
50575 }
50576 else if (honeyWet)
50577 {
50578 for (int l = 0; l < 5; l++)
50579 {
50580 int num12 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
50581 Main.dust[num12].velocity.Y -= 1f;
50582 Main.dust[num12].velocity.X *= 2.5f;
50583 Main.dust[num12].scale = 1.3f;
50584 Main.dust[num12].alpha = 100;
50585 Main.dust[num12].noGravity = true;
50586 }
50587 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50588 }
50589 else
50590 {
50591 for (int m = 0; m < 10; m++)
50592 {
50593 int num13 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
50594 Main.dust[num13].velocity.Y -= 4f;
50595 Main.dust[num13].velocity.X *= 2.5f;
50596 Main.dust[num13].scale *= 0.8f;
50597 Main.dust[num13].alpha = 100;
50598 Main.dust[num13].noGravity = true;
50599 }
50600 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50601 }
50602 }
50603 else
50604 {
50605 for (int n = 0; n < 5; n++)
50606 {
50607 int num14 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
50608 Main.dust[num14].velocity.Y -= 1.5f;
50609 Main.dust[num14].velocity.X *= 2.5f;
50610 Main.dust[num14].scale = 1.3f;
50611 Main.dust[num14].alpha = 100;
50612 Main.dust[num14].noGravity = true;
50613 }
50614 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50615 }
50616 }
50617 wet = true;
50618 }
50619 }
50620 else if (wet)
50621 {
50622 wet = false;
50623 if (wetCount == 0)
50624 {
50625 wetCount = 20;
50626 if (!lavaWet)
50627 {
50628 if (shimmerWet)
50629 {
50630 for (int num15 = 0; num15 < 10; num15++)
50631 {
50632 int num2 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
50633 Main.dust[num2].velocity.Y -= 4f;
50634 Main.dust[num2].velocity.X *= 2.5f;
50635 Main.dust[num2].scale = 0.8f;
50636 Main.dust[num2].noGravity = true;
50637 switch (Main.rand.Next(6))
50638 {
50639 case 0:
50640 Main.dust[num2].color = new Color(255, 255, 210);
50641 break;
50642 case 1:
50643 Main.dust[num2].color = new Color(190, 245, 255);
50644 break;
50645 case 2:
50646 Main.dust[num2].color = new Color(255, 150, 255);
50647 break;
50648 default:
50649 Main.dust[num2].color = new Color(190, 175, 255);
50650 break;
50651 }
50652 }
50653 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
50654 }
50655 else if (honeyWet)
50656 {
50657 for (int num3 = 0; num3 < 5; num3++)
50658 {
50659 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
50660 Main.dust[num4].velocity.Y -= 1f;
50661 Main.dust[num4].velocity.X *= 2.5f;
50662 Main.dust[num4].scale = 1.3f;
50663 Main.dust[num4].alpha = 100;
50664 Main.dust[num4].noGravity = true;
50665 }
50666 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50667 }
50668 else
50669 {
50670 for (int num5 = 0; num5 < 10; num5++)
50671 {
50672 int num6 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, Dust.dustWater());
50673 Main.dust[num6].velocity.Y -= 4f;
50674 Main.dust[num6].velocity.X *= 2.5f;
50675 Main.dust[num6].scale *= 0.8f;
50676 Main.dust[num6].alpha = 100;
50677 Main.dust[num6].noGravity = true;
50678 }
50679 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50680 }
50681 }
50682 else
50683 {
50684 for (int num7 = 0; num7 < 5; num7++)
50685 {
50686 int num8 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
50687 Main.dust[num8].velocity.Y -= 1.5f;
50688 Main.dust[num8].velocity.X *= 2.5f;
50689 Main.dust[num8].scale = 1.3f;
50690 Main.dust[num8].alpha = 100;
50691 Main.dust[num8].noGravity = true;
50692 }
50693 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
50694 }
50695 }
50696 }
50697 if (!wet)
50698 {
50699 lavaWet = false;
50700 honeyWet = false;
50701 shimmerWet = false;
50702 }
50703 if (wetCount > 0)
50704 {
50705 wetCount--;
50706 }
50707 if (wet)
50708 {
50709 if (wet)
50710 {
50711 Vector2 vector = velocity;
50712 velocity = Collision.TileCollision(position, velocity, width, height);
50713 if (velocity.X != vector.X)
50714 {
50715 wetVelocity.X = velocity.X;
50716 }
50717 if (velocity.Y != vector.Y)
50718 {
50719 wetVelocity.Y = velocity.Y;
50720 }
50721 }
50722 }
50723 else
50724 {
50725 velocity = Collision.TileCollision(position, velocity, width, height);
50726 }
50727 Vector4 vector2 = Collision.SlopeCollision(position, velocity, width, height, gravity);
50728 position.X = vector2.X;
50729 position.Y = vector2.Y;
50730 velocity.X = vector2.Z;
50731 velocity.Y = vector2.W;
50732 Collision.StepConveyorBelt(this, 1f);
50733 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool honeyWet
Definition Entity.cs:61
bool shimmerWet
Definition Entity.cs:59
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
byte wetCount
Definition Entity.cs:63
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static bool[] ItemNoGravity
If true for a given item type (F:Terraria.Item.type), then that item will float in place instead of f...
Definition ItemID.cs:1347
bool shimmered
Definition Item.cs:779
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static void Update(Item item, ref float gravity, ref float maxFallSpeed)
Calls ModItem.Update, then all GlobalItem.Update hooks.
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26

References Terraria.Entity.active, Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Entity.height, Terraria.Collision.honey, Terraria.Entity.honeyWet, Terraria.Main.item, Terraria.ID.ItemID.Sets.ItemNoGravity, Terraria.Collision.LavaCollision(), Terraria.Entity.lavaWet, Terraria.Dust.NewDust(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Collision.shimmer, Terraria.Item.shimmered, Terraria.Entity.shimmerWet, Terraria.Collision.SlopeCollision(), Terraria.Collision.StepConveyorBelt(), Terraria.Collision.TileCollision(), Terraria.Item.type, Terraria.ModLoader.ItemLoader.Update(), Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Collision.WetCollision(), Terraria.Entity.wetCount, and Terraria.Entity.width.

Referenced by Terraria.Item.UpdateItem().

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