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

◆ Update()

void Terraria.Projectile.Update ( int i)
inline

Definition at line 15676 of file Projectile.cs.

15677 {
15678 //IL_03f5: Unknown result type (might be due to invalid IL or missing references)
15679 //IL_03fa: Unknown result type (might be due to invalid IL or missing references)
15680 //IL_03fd: Unknown result type (might be due to invalid IL or missing references)
15681 //IL_0402: Unknown result type (might be due to invalid IL or missing references)
15682 //IL_04aa: Unknown result type (might be due to invalid IL or missing references)
15683 //IL_04cf: Unknown result type (might be due to invalid IL or missing references)
15684 //IL_04de: Unknown result type (might be due to invalid IL or missing references)
15685 //IL_0502: Unknown result type (might be due to invalid IL or missing references)
15686 //IL_0511: Unknown result type (might be due to invalid IL or missing references)
15687 //IL_0643: Unknown result type (might be due to invalid IL or missing references)
15688 //IL_065c: Unknown result type (might be due to invalid IL or missing references)
15689 //IL_1205: Unknown result type (might be due to invalid IL or missing references)
15690 //IL_120a: Unknown result type (might be due to invalid IL or missing references)
15691 //IL_121c: Unknown result type (might be due to invalid IL or missing references)
15692 //IL_12c3: Unknown result type (might be due to invalid IL or missing references)
15693 //IL_12e3: Unknown result type (might be due to invalid IL or missing references)
15694 //IL_12e9: Unknown result type (might be due to invalid IL or missing references)
15695 //IL_131e: Unknown result type (might be due to invalid IL or missing references)
15696 //IL_1342: Unknown result type (might be due to invalid IL or missing references)
15697 //IL_1348: Unknown result type (might be due to invalid IL or missing references)
15698 //IL_137d: Unknown result type (might be due to invalid IL or missing references)
15699 //IL_139e: Unknown result type (might be due to invalid IL or missing references)
15700 //IL_13a4: Unknown result type (might be due to invalid IL or missing references)
15701 //IL_1625: Unknown result type (might be due to invalid IL or missing references)
15702 //IL_1637: Unknown result type (might be due to invalid IL or missing references)
15703 //IL_15a6: Unknown result type (might be due to invalid IL or missing references)
15704 //IL_15ab: Unknown result type (might be due to invalid IL or missing references)
15705 //IL_1414: Unknown result type (might be due to invalid IL or missing references)
15706 //IL_1438: Unknown result type (might be due to invalid IL or missing references)
15707 //IL_143e: Unknown result type (might be due to invalid IL or missing references)
15708 //IL_16be: Unknown result type (might be due to invalid IL or missing references)
15709 //IL_16c3: Unknown result type (might be due to invalid IL or missing references)
15710 //IL_1671: Unknown result type (might be due to invalid IL or missing references)
15711 //IL_1676: Unknown result type (might be due to invalid IL or missing references)
15712 //IL_168e: Unknown result type (might be due to invalid IL or missing references)
15713 //IL_1693: Unknown result type (might be due to invalid IL or missing references)
15714 //IL_14b7: Unknown result type (might be due to invalid IL or missing references)
15715 //IL_14db: Unknown result type (might be due to invalid IL or missing references)
15716 //IL_14e1: Unknown result type (might be due to invalid IL or missing references)
15717 //IL_1b47: Unknown result type (might be due to invalid IL or missing references)
15718 //IL_1b58: Unknown result type (might be due to invalid IL or missing references)
15719 //IL_1b5d: Unknown result type (might be due to invalid IL or missing references)
15720 //IL_1b62: Unknown result type (might be due to invalid IL or missing references)
15721 //IL_192a: Unknown result type (might be due to invalid IL or missing references)
15722 //IL_192f: Unknown result type (might be due to invalid IL or missing references)
15723 //IL_196f: Unknown result type (might be due to invalid IL or missing references)
15724 //IL_1974: Unknown result type (might be due to invalid IL or missing references)
15725 //IL_16f2: Unknown result type (might be due to invalid IL or missing references)
15726 //IL_16f7: Unknown result type (might be due to invalid IL or missing references)
15727 //IL_170f: Unknown result type (might be due to invalid IL or missing references)
15728 //IL_1714: Unknown result type (might be due to invalid IL or missing references)
15729 //IL_171a: Unknown result type (might be due to invalid IL or missing references)
15730 //IL_171f: Unknown result type (might be due to invalid IL or missing references)
15731 //IL_1525: Unknown result type (might be due to invalid IL or missing references)
15732 //IL_1561: Unknown result type (might be due to invalid IL or missing references)
15733 //IL_1567: Unknown result type (might be due to invalid IL or missing references)
15734 //IL_19cc: Unknown result type (might be due to invalid IL or missing references)
15735 //IL_19d1: Unknown result type (might be due to invalid IL or missing references)
15736 //IL_1a11: Unknown result type (might be due to invalid IL or missing references)
15737 //IL_1a16: Unknown result type (might be due to invalid IL or missing references)
15738 //IL_1807: Unknown result type (might be due to invalid IL or missing references)
15739 //IL_180c: Unknown result type (might be due to invalid IL or missing references)
15740 //IL_10ee: Unknown result type (might be due to invalid IL or missing references)
15741 //IL_110d: Unknown result type (might be due to invalid IL or missing references)
15742 //IL_1113: Unknown result type (might be due to invalid IL or missing references)
15743 //IL_0baf: Unknown result type (might be due to invalid IL or missing references)
15744 //IL_0bce: Unknown result type (might be due to invalid IL or missing references)
15745 //IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
15746 //IL_1b87: Unknown result type (might be due to invalid IL or missing references)
15747 //IL_1b8c: Unknown result type (might be due to invalid IL or missing references)
15748 //IL_1c0f: Unknown result type (might be due to invalid IL or missing references)
15749 //IL_1c14: Unknown result type (might be due to invalid IL or missing references)
15750 //IL_0d22: Unknown result type (might be due to invalid IL or missing references)
15751 //IL_0d44: Unknown result type (might be due to invalid IL or missing references)
15752 //IL_0d4a: Unknown result type (might be due to invalid IL or missing references)
15753 //IL_07dd: Unknown result type (might be due to invalid IL or missing references)
15754 //IL_07ff: Unknown result type (might be due to invalid IL or missing references)
15755 //IL_0805: Unknown result type (might be due to invalid IL or missing references)
15756 //IL_1c6c: Unknown result type (might be due to invalid IL or missing references)
15757 //IL_1c71: Unknown result type (might be due to invalid IL or missing references)
15758 //IL_1cb1: Unknown result type (might be due to invalid IL or missing references)
15759 //IL_1cb6: Unknown result type (might be due to invalid IL or missing references)
15760 //IL_1cc3: Unknown result type (might be due to invalid IL or missing references)
15761 //IL_1bc9: Unknown result type (might be due to invalid IL or missing references)
15762 //IL_1bce: Unknown result type (might be due to invalid IL or missing references)
15763 //IL_0fe0: Unknown result type (might be due to invalid IL or missing references)
15764 //IL_1002: Unknown result type (might be due to invalid IL or missing references)
15765 //IL_1008: Unknown result type (might be due to invalid IL or missing references)
15766 //IL_0ed8: Unknown result type (might be due to invalid IL or missing references)
15767 //IL_0efa: Unknown result type (might be due to invalid IL or missing references)
15768 //IL_0f00: Unknown result type (might be due to invalid IL or missing references)
15769 //IL_0de7: Unknown result type (might be due to invalid IL or missing references)
15770 //IL_0dec: Unknown result type (might be due to invalid IL or missing references)
15771 //IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
15772 //IL_0e0f: Unknown result type (might be due to invalid IL or missing references)
15773 //IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
15774 //IL_0e32: Unknown result type (might be due to invalid IL or missing references)
15775 //IL_0aa1: Unknown result type (might be due to invalid IL or missing references)
15776 //IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
15777 //IL_0ac9: Unknown result type (might be due to invalid IL or missing references)
15778 //IL_0993: Unknown result type (might be due to invalid IL or missing references)
15779 //IL_09b5: Unknown result type (might be due to invalid IL or missing references)
15780 //IL_09bb: Unknown result type (might be due to invalid IL or missing references)
15781 //IL_08a2: Unknown result type (might be due to invalid IL or missing references)
15782 //IL_08a7: Unknown result type (might be due to invalid IL or missing references)
15783 //IL_08c5: Unknown result type (might be due to invalid IL or missing references)
15784 //IL_08ca: Unknown result type (might be due to invalid IL or missing references)
15785 //IL_08e8: Unknown result type (might be due to invalid IL or missing references)
15786 //IL_08ed: Unknown result type (might be due to invalid IL or missing references)
15787 //IL_1be8: Unknown result type (might be due to invalid IL or missing references)
15788 //IL_1bed: Unknown result type (might be due to invalid IL or missing references)
15789 //IL_1bef: Unknown result type (might be due to invalid IL or missing references)
15790 //IL_1bf4: Unknown result type (might be due to invalid IL or missing references)
15791 //IL_17b5: Unknown result type (might be due to invalid IL or missing references)
15792 //IL_17c1: Unknown result type (might be due to invalid IL or missing references)
15793 //IL_17c8: Unknown result type (might be due to invalid IL or missing references)
15794 //IL_17d2: Unknown result type (might be due to invalid IL or missing references)
15795 //IL_17d8: Unknown result type (might be due to invalid IL or missing references)
15796 //IL_0e50: Unknown result type (might be due to invalid IL or missing references)
15797 //IL_0e55: Unknown result type (might be due to invalid IL or missing references)
15798 //IL_090b: Unknown result type (might be due to invalid IL or missing references)
15799 //IL_0910: Unknown result type (might be due to invalid IL or missing references)
15800 //IL_1a62: Unknown result type (might be due to invalid IL or missing references)
15801 //IL_1a67: Unknown result type (might be due to invalid IL or missing references)
15802 //IL_18a2: Unknown result type (might be due to invalid IL or missing references)
15803 //IL_18ae: Unknown result type (might be due to invalid IL or missing references)
15804 //IL_18b5: Unknown result type (might be due to invalid IL or missing references)
15805 //IL_18bf: Unknown result type (might be due to invalid IL or missing references)
15806 //IL_18c5: Unknown result type (might be due to invalid IL or missing references)
15807 //IL_1a7e: Unknown result type (might be due to invalid IL or missing references)
15808 //IL_1a8d: Unknown result type (might be due to invalid IL or missing references)
15809 //IL_1ae0: Unknown result type (might be due to invalid IL or missing references)
15810 //IL_1aed: Unknown result type (might be due to invalid IL or missing references)
15811 //IL_1af2: Unknown result type (might be due to invalid IL or missing references)
15812 //IL_1af7: Unknown result type (might be due to invalid IL or missing references)
15813 //IL_1afc: Unknown result type (might be due to invalid IL or missing references)
15814 //IL_1aae: Unknown result type (might be due to invalid IL or missing references)
15815 //IL_1abd: Unknown result type (might be due to invalid IL or missing references)
15816 //IL_1ac4: Unknown result type (might be due to invalid IL or missing references)
15817 //IL_1ac9: Unknown result type (might be due to invalid IL or missing references)
15818 if (!active)
15819 {
15820 return;
15821 }
15822 if (Main.netMode == 1 && (ProjectileID.Sets.IsAGolfBall[type] || type == 820))
15823 {
15824 int num = (int)(position.X + (float)(width / 2)) / 16;
15825 int num11 = (int)(position.Y + (float)(height / 2)) / 16;
15826 if (!Main.sectionManager.TileLoaded(num, num11))
15827 {
15828 return;
15829 }
15830 }
15832 Vector2 vector = default(Vector2);
15833 Vector2 vector2 = default(Vector2);
15834 while (numUpdates >= 0)
15835 {
15836 numUpdates--;
15837 if (type == 640 && ai[1] > 0f)
15838 {
15839 ai[1] -= 1f;
15840 continue;
15841 }
15842 if (position.X <= Main.leftWorld || position.X + (float)width >= Main.rightWorld || position.Y <= Main.topWorld || position.Y + (float)height >= Main.bottomWorld)
15843 {
15844 active = false;
15845 return;
15846 }
15848 {
15850 }
15852 {
15853 Player player = Main.player[owner];
15854 damage = (int)player.GetTotalDamage(DamageType).ApplyTo(originalDamage);
15855 CritChance = (int)((float)OriginalCritChance + player.GetTotalCritChance(DamageType) + 5E-06f);
15856 ArmorPenetration = (int)((float)OriginalArmorPenetration + player.GetTotalArmorPenetration(DamageType) + 5E-06f);
15857 }
15858 if (minion && numUpdates == -1 && type != 625 && type != 628)
15859 {
15860 minionPos = Main.player[owner].numMinions;
15861 if (Main.player[owner].slotsMinions + minionSlots > (float)Main.player[owner].maxMinions && owner == Main.myPlayer)
15862 {
15863 if ((type == 627 || type == 626) && owner == Main.myPlayer)
15864 {
15865 int byUUID = GetByUUID(owner, ai[0]);
15866 if (byUUID != -1)
15867 {
15868 Projectile projectile = Main.projectile[byUUID];
15869 if (projectile.type != 625)
15870 {
15871 projectile.localAI[1] = localAI[1];
15872 }
15873 projectile = Main.projectile[(int)localAI[1]];
15874 projectile.ai[0] = ai[0];
15875 projectile.ai[1] = 1f;
15876 projectile.netUpdate = true;
15877 }
15878 }
15879 Kill();
15880 }
15881 else
15882 {
15883 Main.player[owner].numMinions++;
15884 Main.player[owner].slotsMinions += minionSlots;
15885 }
15886 }
15887 float num22 = 1f + Math.Abs(velocity.X) / 3f;
15888 if (gfxOffY > 0f)
15889 {
15890 gfxOffY -= num22 * stepSpeed;
15891 if (gfxOffY < 0f)
15892 {
15893 gfxOffY = 0f;
15894 }
15895 }
15896 else if (gfxOffY < 0f)
15897 {
15898 gfxOffY += num22 * stepSpeed;
15899 if (gfxOffY > 0f)
15900 {
15901 gfxOffY = 0f;
15902 }
15903 }
15904 if (gfxOffY > 16f)
15905 {
15906 gfxOffY = 16f;
15907 }
15908 if (gfxOffY < -16f)
15909 {
15910 gfxOffY = -16f;
15911 }
15912 Vector2 wetVelocity = velocity;
15914 whoAmI = i;
15915 if (soundDelay > 0)
15916 {
15917 soundDelay--;
15918 }
15919 netUpdate = false;
15920 for (int j = 0; j < 255; j++)
15921 {
15922 if (playerImmune[j] > 0)
15923 {
15924 playerImmune[j]--;
15925 }
15926 }
15928 {
15929 for (int k = 0; k < 200; k++)
15930 {
15931 if (localNPCImmunity[k] > 0)
15932 {
15934 }
15935 }
15936 }
15937 AI();
15938 if (ShouldUseWindPhysics() && (double)base.Center.Y < Main.worldSurface * 16.0 && Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16] != null && Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16].wall == 0 && ((velocity.X > 0f && Main.windSpeedCurrent < 0f) || (velocity.X < 0f && Main.windSpeedCurrent > 0f) || Math.Abs(velocity.X) < Math.Abs(Main.windSpeedCurrent * Main.windPhysicsStrength) * 180f) && Math.Abs(velocity.X) < 16f)
15939 {
15940 velocity.X += Main.windSpeedCurrent * Main.windPhysicsStrength;
15941 MathHelper.Clamp(velocity.X, -16f, 16f);
15942 }
15943 if (owner < 255 && !Main.player[owner].active)
15944 {
15945 Kill();
15946 }
15947 if (type == 242 || type == 302 || type == 638)
15948 {
15949 wet = false;
15950 }
15951 int overrideWidth;
15952 if (!ignoreWater)
15953 {
15954 bool flag;
15955 bool flag2;
15956 try
15957 {
15958 flag = Collision.LavaCollision(position, width, height);
15959 flag2 = Collision.WetCollision(position, width, height);
15960 if (flag)
15961 {
15962 lavaWet = true;
15963 }
15964 if (Collision.honey)
15965 {
15966 honeyWet = true;
15967 }
15968 if (Collision.shimmer)
15969 {
15970 shimmerWet = true;
15971 }
15972 }
15973 catch
15974 {
15975 active = false;
15976 return;
15977 }
15978 if (wet && !lavaWet)
15979 {
15980 if (type == 85 || type == 15 || type == 188)
15981 {
15982 Kill();
15983 }
15984 if (type == 2)
15985 {
15986 type = 1;
15987 light = 0f;
15988 }
15989 }
15990 if (type == 34)
15991 {
15992 if (wet && !lavaWet)
15993 {
15994 Kill();
15995 }
15996 if (lavaWet)
15997 {
15998 flag2 = (wet = (lavaWet = false));
15999 }
16000 }
16001 if (type == 80)
16002 {
16003 flag2 = false;
16004 wet = false;
16005 if (flag && ai[0] >= 0f)
16006 {
16007 Kill();
16008 }
16009 }
16010 if (flag2)
16011 {
16012 if (type != 155 && wetCount == 0 && !wet)
16013 {
16014 if (!flag)
16015 {
16016 if (shimmerWet)
16017 {
16018 for (int l = 0; l < 10; l++)
16019 {
16020 int num28 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
16021 Main.dust[num28].velocity.Y -= 4f;
16022 Main.dust[num28].velocity.X *= 2.5f;
16023 Main.dust[num28].scale = 1.3f;
16024 Main.dust[num28].noGravity = true;
16025 overrideWidth = Main.rand.Next(6);
16026 switch (overrideWidth)
16027 {
16028 case 0:
16029 Main.dust[num28].color = new Color(255, 255, 210);
16030 break;
16031 case 1:
16032 Main.dust[num28].color = new Color(190, 245, 255);
16033 break;
16034 case 2:
16035 Main.dust[num28].color = new Color(255, 150, 255);
16036 break;
16037 default:
16038 Main.dust[num28].color = new Color(190, 175, 255);
16039 break;
16040 }
16041 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
16042 }
16043 }
16044 else if (honeyWet)
16045 {
16046 for (int m = 0; m < 10; m++)
16047 {
16048 int num29 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
16049 Main.dust[num29].velocity.Y -= 1f;
16050 Main.dust[num29].velocity.X *= 2.5f;
16051 Main.dust[num29].scale = 1.3f;
16052 Main.dust[num29].alpha = 100;
16053 Main.dust[num29].noGravity = true;
16054 }
16055 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16056 }
16057 else
16058 {
16059 for (int n = 0; n < 10; n++)
16060 {
16061 int num30 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
16062 Main.dust[num30].velocity.Y -= 4f;
16063 Main.dust[num30].velocity.X *= 2.5f;
16064 Main.dust[num30].scale = 1.3f;
16065 Main.dust[num30].alpha = 100;
16066 Main.dust[num30].noGravity = true;
16067 }
16068 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16069 }
16070 }
16071 else
16072 {
16073 for (int num31 = 0; num31 < 10; num31++)
16074 {
16075 int num32 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
16076 Main.dust[num32].velocity.Y -= 1.5f;
16077 Main.dust[num32].velocity.X *= 2.5f;
16078 Main.dust[num32].scale = 1.3f;
16079 Main.dust[num32].alpha = 100;
16080 Main.dust[num32].noGravity = true;
16081 }
16082 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16083 }
16084 }
16085 wet = true;
16086 }
16087 else if (wet)
16088 {
16089 wet = false;
16090 if (type == 155)
16091 {
16092 velocity.Y *= 0.5f;
16093 }
16094 else if (wetCount == 0)
16095 {
16096 wetCount = 10;
16097 if (!lavaWet)
16098 {
16099 if (shimmerWet)
16100 {
16101 for (int num33 = 0; num33 < 10; num33++)
16102 {
16103 int num2 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
16104 Main.dust[num2].velocity.Y -= 4f;
16105 Main.dust[num2].velocity.X *= 2.5f;
16106 Main.dust[num2].scale = 1.3f;
16107 Main.dust[num2].noGravity = true;
16108 overrideWidth = Main.rand.Next(6);
16109 switch (overrideWidth)
16110 {
16111 case 0:
16112 Main.dust[num2].color = new Color(255, 255, 210);
16113 break;
16114 case 1:
16115 Main.dust[num2].color = new Color(190, 245, 255);
16116 break;
16117 case 2:
16118 Main.dust[num2].color = new Color(255, 150, 255);
16119 break;
16120 default:
16121 Main.dust[num2].color = new Color(190, 175, 255);
16122 break;
16123 }
16124 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
16125 }
16126 }
16127 else if (honeyWet)
16128 {
16129 for (int num3 = 0; num3 < 10; num3++)
16130 {
16131 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
16132 Main.dust[num4].velocity.Y -= 1f;
16133 Main.dust[num4].velocity.X *= 2.5f;
16134 Main.dust[num4].scale = 1.3f;
16135 Main.dust[num4].alpha = 100;
16136 Main.dust[num4].noGravity = true;
16137 }
16138 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16139 }
16140 else
16141 {
16142 for (int num5 = 0; num5 < 10; num5++)
16143 {
16144 int num6 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, Dust.dustWater());
16145 Main.dust[num6].velocity.Y -= 4f;
16146 Main.dust[num6].velocity.X *= 2.5f;
16147 Main.dust[num6].scale = 1.3f;
16148 Main.dust[num6].alpha = 100;
16149 Main.dust[num6].noGravity = true;
16150 }
16151 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16152 }
16153 }
16154 else
16155 {
16156 for (int num7 = 0; num7 < 10; num7++)
16157 {
16158 int num8 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
16159 Main.dust[num8].velocity.Y -= 1.5f;
16160 Main.dust[num8].velocity.X *= 2.5f;
16161 Main.dust[num8].scale = 1.3f;
16162 Main.dust[num8].alpha = 100;
16163 Main.dust[num8].noGravity = true;
16164 }
16165 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
16166 }
16167 }
16168 }
16169 if (!wet)
16170 {
16171 lavaWet = false;
16172 honeyWet = false;
16173 shimmerWet = false;
16174 }
16175 if (wetCount > 0)
16176 {
16177 wetCount--;
16178 }
16179 }
16180 if (shimmerWet)
16181 {
16182 Shimmer();
16183 }
16188 {
16189 if (velocity.X < 0f)
16190 {
16191 direction = -1;
16192 }
16193 else
16194 {
16195 direction = 1;
16196 }
16197 }
16198 if (!active)
16199 {
16200 return;
16201 }
16202 ProjLight();
16203 if (!npcProj && friendly && Main.player[owner].magicQuiver && extraUpdates < 1 && arrow)
16204 {
16205 extraUpdates = 1;
16206 }
16207 if (type == 2 || type == 82)
16208 {
16209 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100);
16210 }
16211 else if (type == 172)
16212 {
16213 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0f, 0f, 100);
16214 }
16215 else if (type == 103)
16216 {
16217 int num9 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, 0f, 0f, 100);
16218 if (Main.rand.Next(2) == 0)
16219 {
16220 Main.dust[num9].noGravity = true;
16221 Main.dust[num9].scale *= 2f;
16222 }
16223 }
16224 else if (type == 278)
16225 {
16226 int num10 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 169, 0f, 0f, 100);
16227 if (Main.rand.Next(2) == 0)
16228 {
16229 Main.dust[num10].noGravity = true;
16230 Main.dust[num10].scale *= 1.5f;
16231 }
16232 }
16233 else if (type == 4)
16234 {
16235 if (Main.rand.Next(5) == 0)
16236 {
16237 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 150, default(Color), 1.1f);
16238 }
16239 }
16240 else if (type == 5)
16241 {
16242 overrideHeight = Main.rand.Next(3);
16243 Dust.NewDust(Type: overrideHeight switch
16244 {
16245 0 => 15,
16246 1 => 57,
16247 _ => 58,
16248 }, Position: position, Width: width, Height: height, SpeedX: velocity.X * 0.5f, SpeedY: velocity.Y * 0.5f, Alpha: 150, newColor: default(Color), Scale: 1.2f);
16249 }
16250 Damage();
16251 if (type == 434 && localAI[0] == 0f && numUpdates == 0)
16252 {
16253 extraUpdates = 1;
16254 velocity = Vector2.Zero;
16255 localAI[0] = 1f;
16256 localAI[1] = 0.9999f;
16257 netUpdate = true;
16258 }
16259 if (Main.netMode != 1 && (type == 99 || type == 1013 || type == 655 || type == 727 || type == 1014 || type == 1021))
16260 {
16261 Collision.SwitchTiles(position, width, height, oldPosition, 3);
16262 }
16264 {
16265 for (int num12 = oldPos.Length - 1; num12 > 0; num12--)
16266 {
16267 oldPos[num12] = oldPos[num12 - 1];
16268 }
16269 oldPos[0] = position;
16270 }
16271 else if (ProjectileID.Sets.TrailingMode[type] == 1)
16272 {
16273 if (frameCounter == 0 || oldPos[0] == Vector2.Zero)
16274 {
16275 for (int num13 = oldPos.Length - 1; num13 > 0; num13--)
16276 {
16277 oldPos[num13] = oldPos[num13 - 1];
16278 }
16279 oldPos[0] = position;
16280 if (velocity == Vector2.Zero && type == 466)
16281 {
16282 float num14 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
16283 float num15 = (float)Main.rand.NextDouble() * 2f + 2f;
16284 ((Vector2)(ref vector))._002Ector((float)Math.Cos(num14) * num15, (float)Math.Sin(num14) * num15);
16285 int num16 = Dust.NewDust(oldPos[oldPos.Length - 1], 0, 0, 229, vector.X, vector.Y);
16286 Main.dust[num16].noGravity = true;
16287 Main.dust[num16].scale = 1.7f;
16288 }
16289 if (velocity == Vector2.Zero && type == 580)
16290 {
16291 float num17 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
16292 float num18 = (float)Main.rand.NextDouble() * 2f + 2f;
16293 ((Vector2)(ref vector2))._002Ector((float)Math.Cos(num17) * num18, (float)Math.Sin(num17) * num18);
16294 int num19 = Dust.NewDust(oldPos[oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
16295 Main.dust[num19].noGravity = true;
16296 Main.dust[num19].scale = 1.7f;
16297 }
16298 }
16299 }
16300 else if (ProjectileID.Sets.TrailingMode[type] == 2)
16301 {
16302 for (int num20 = oldPos.Length - 1; num20 > 0; num20--)
16303 {
16304 oldPos[num20] = oldPos[num20 - 1];
16305 oldRot[num20] = oldRot[num20 - 1];
16307 }
16308 oldPos[0] = position;
16309 oldRot[0] = rotation;
16311 }
16312 else if (ProjectileID.Sets.TrailingMode[type] == 3)
16313 {
16314 for (int num21 = oldPos.Length - 1; num21 > 0; num21--)
16315 {
16316 oldPos[num21] = oldPos[num21 - 1];
16317 oldRot[num21] = oldRot[num21 - 1];
16319 }
16320 oldPos[0] = position;
16321 oldRot[0] = rotation;
16323 float amount = 0.65f;
16324 int num23 = 1;
16325 for (int num24 = 0; num24 < num23; num24++)
16326 {
16327 for (int num25 = oldPos.Length - 1; num25 > 0; num25--)
16328 {
16329 if (!(oldPos[num25] == Vector2.Zero))
16330 {
16331 if (oldPos[num25].Distance(oldPos[num25 - 1]) > 2f)
16332 {
16333 oldPos[num25] = Vector2.Lerp(oldPos[num25], oldPos[num25 - 1], amount);
16334 }
16335 oldRot[num25] = (oldPos[num25 - 1] - oldPos[num25]).SafeNormalize(Vector2.Zero).ToRotation();
16336 }
16337 }
16338 }
16339 }
16340 else if (ProjectileID.Sets.TrailingMode[type] == 4)
16341 {
16342 Vector2 vector3 = Main.player[owner].position - Main.player[owner].oldPosition;
16343 for (int num26 = oldPos.Length - 1; num26 > 0; num26--)
16344 {
16345 oldPos[num26] = oldPos[num26 - 1];
16346 oldRot[num26] = oldRot[num26 - 1];
16348 if (numUpdates == 0 && oldPos[num26] != Vector2.Zero)
16349 {
16350 ref Vector2 reference = ref oldPos[num26];
16351 reference += vector3;
16352 }
16353 }
16354 oldPos[0] = position;
16355 oldRot[0] = rotation;
16357 }
16358 else if (ProjectileID.Sets.TrailingMode[type] == 5)
16359 {
16360 for (int num27 = oldPos.Length - 1; num27 > 0; num27--)
16361 {
16362 oldPos[num27] = oldPos[num27 - 1];
16363 oldRot[num27] = oldRot[num27 - 1];
16365 }
16366 oldPos[0] = position;
16367 oldRot[0] = velocity.ToRotation();
16369 }
16371 {
16372 timeLeft++;
16373 }
16374 timeLeft--;
16375 if (timeLeft <= 0)
16376 {
16377 Kill();
16378 }
16379 if (penetrate == 0)
16380 {
16381 Kill();
16382 }
16383 if (!active || owner != Main.myPlayer)
16384 {
16385 continue;
16386 }
16387 if (netUpdate2)
16388 {
16389 netUpdate = true;
16390 }
16391 if (!active)
16392 {
16393 netSpam = 0;
16394 }
16395 if (netUpdate)
16396 {
16397 if (netSpam < 60)
16398 {
16399 netSpam += 5;
16400 NetMessage.SendData(27, -1, -1, null, i);
16401 netUpdate2 = false;
16402 }
16403 else
16404 {
16405 netUpdate2 = true;
16406 }
16407 }
16408 if (netSpam > 0)
16409 {
16410 netSpam--;
16411 }
16412 }
16413 netUpdate = false;
16414 }
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
Vector2 oldPosition
Definition Entity.cs:35
bool honeyWet
Definition Entity.cs:61
bool shimmerWet
Definition Entity.cs:59
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
int oldDirection
Definition Entity.cs:39
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
float Distance(Vector2 Other)
Definition Entity.cs:275
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
Vector2 oldVelocity
Definition Entity.cs:37
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 int[] TrailingMode
Determines what data will be remembered for projectile trails. Each projectile type defaults to -1,...
static bool[] IsAGolfBall
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile is a kind of g...
static bool[] IsADD2Turret
Iff true for a given projectile type (F:Terraria.Projectile.type), then that projectile is counted as...
bool sentry
Indicates that this projectile is a sentry Defaults to false. All sentries should set F:Terraria....
float minionSlots
Set to 1f on a minion to count it towards the minion limit of the summoning player (Optic Staff summo...
bool netUpdate2
Used internally to check for projectiles that spam F:Terraria.Projectile.netUpdate....
bool minion
Indicates that this projectile is a minion Defaults to false.
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] oldRot
Holds the value of F:Terraria.Projectile.rotation from previous updates from newest to oldest....
void HandleMovement(Vector2 wetVelocity, out int overrideWidth, out int overrideHeight)
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
int OriginalCritChance
The crit chance of this projectile, without any player bonuses, similar to F:Terraria....
int penetrate
The remaining number of npc can this projectile hit before dying. (Or tile bounces)....
int ArmorPenetration
The number of defense points that this projectile can ignore on its own. Cannot be set to negative va...
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
bool ignoreWater
The projectile will not be affected by water. Defaults to false.
int[] oldSpriteDirection
Holds the value of F:Terraria.Projectile.spriteDirection from previous updates from newest to oldest....
bool ContinuouslyUpdateDamageStats
If set F:Terraria.Projectile.damage will be recalculated based on F:Terraria.Projectile....
Vector2[] oldPos
Holds the value of F:Terraria.Entity.position from previous updates from newest to oldest....
bool friendly
If True, this projectile will hurt enemies (!F:Terraria.NPC.friendly) Defaults to false.
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool AutomaticallyChangesDirection()
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float light
Set to a value above 0f to make this projectile emit a white light (higher number: more intensive lig...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
float stepSpeed
Has nothing to do with the speed that this projectile travels, that is dictated by AI code adjusting ...
int extraUpdates
Additional update steps per tick. Useful for really fast projectiles such as Shadowbeam Staff....
bool npcProj
If true, this projectile was spawned by a friendly Town NPC.
bool usesLocalNPCImmunity
If true, this projectile manages it's own immunity timers for each npc. Use this rather than F:Terra...
static int GetByUUID(int owner, float uuid)
int CritChance
The critical strike chance modifier of this projectile. Cannot be set to negative values....
int OriginalArmorPenetration
The crit chance of this projectile, without any player bonuses, similar to F:Terraria....
void UpdateEnchantmentVisuals()
float gfxOffY
An offset from the actual position of the projectile that will be added to the draw position....
int minionPos
A number indicating the order of minions. Minion AI code typically uses this value to determine a sui...
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.
DamageClass DamageType
The damage type assigned to this projectile, represented as a DamageClass. Leave blank or use DamageC...

References Terraria.Entity.active, Terraria.Projectile.ai, Terraria.Projectile.AI(), Terraria.ModLoader.StatModifier.ApplyTo(), Terraria.Projectile.ArmorPenetration, Terraria.Projectile.arrow, Terraria.Projectile.AutomaticallyChangesDirection(), Terraria.Main.bottomWorld, Terraria.Projectile.ContinuouslyUpdateDamageStats, Terraria.Projectile.CritChance, Terraria.Projectile.damage, Terraria.Projectile.Damage(), Terraria.Projectile.DamageType, Terraria.Entity.direction, Terraria.Entity.Distance(), Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Projectile.extraUpdates, Terraria.Projectile.frameCounter, Terraria.Projectile.friendly, Terraria.Projectile.GetByUUID(), Terraria.Player.GetTotalArmorPenetration(), Terraria.Player.GetTotalCritChance(), Terraria.Player.GetTotalDamage(), Terraria.Projectile.gfxOffY, Terraria.Projectile.HandleMovement(), Terraria.Entity.height, Terraria.Collision.honey, Terraria.Entity.honeyWet, Terraria.Projectile.ignoreWater, Terraria.ID.ProjectileID.Sets.IsADD2Turret, Terraria.ID.ProjectileID.Sets.IsAGolfBall, Terraria.Projectile.Kill(), Terraria.Collision.LavaCollision(), Terraria.Entity.lavaWet, Terraria.Main.leftWorld, Terraria.Projectile.light, Terraria.Projectile.localAI, Terraria.Projectile.localNPCImmunity, Terraria.Projectile.minion, Terraria.Projectile.minionPos, Terraria.Projectile.minionSlots, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Projectile.netSpam, Terraria.Projectile.netUpdate, Terraria.Projectile.netUpdate2, Terraria.Dust.NewDust(), Terraria.Projectile.noEnchantmentVisuals, Terraria.Projectile.npcProj, Terraria.Projectile.numUpdates, Terraria.Entity.oldDirection, Terraria.Projectile.oldPos, Terraria.Entity.oldPosition, Terraria.Projectile.oldRot, Terraria.Projectile.oldSpriteDirection, Terraria.Entity.oldVelocity, Terraria.GameContent.Events.DD2Event.Ongoing, Terraria.Projectile.OriginalArmorPenetration, Terraria.Projectile.OriginalCritChance, Terraria.Projectile.originalDamage, Terraria.Projectile.owner, Terraria.Projectile.penetrate, Terraria.Main.player, Terraria.Projectile.playerImmune, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.projectile, Terraria.Projectile.ProjLight(), Terraria.Main.rand, Terraria.Projectile.rotation, Terraria.Main.sectionManager, Terraria.NetMessage.SendData(), Terraria.Projectile.sentry, Terraria.Collision.shimmer, Terraria.Projectile.Shimmer(), Terraria.Entity.shimmerWet, Terraria.Projectile.ShouldUseWindPhysics(), Terraria.Projectile.soundDelay, Terraria.Projectile.spriteDirection, Terraria.Projectile.stepSpeed, Terraria.Collision.SwitchTiles(), Terraria.Main.tile, Terraria.Projectile.timeLeft, Terraria.ID.ProjectileID.Sets.TrailingMode, Terraria.Projectile.type, Terraria.Projectile.UpdateEnchantmentVisuals(), Terraria.Projectile.usesLocalNPCImmunity, Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Collision.WetCollision(), Terraria.Entity.wetCount, Terraria.Entity.whoAmI, Terraria.Entity.width, Terraria.Main.windPhysicsStrength, Terraria.Main.windSpeedCurrent, and Terraria.Main.worldSurface.

+ Here is the call graph for this function: