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

◆ MakeFloorDust()

void Terraria.Player.MakeFloorDust ( bool Falling,
int type,
int paintColor )
inlineprivate

Definition at line 22838 of file Player.cs.

22839 {
22840 if (type == 659 || type == 667)
22841 {
22842 bool flag = true;
22843 if (!Falling)
22844 {
22845 float num = Math.Abs(velocity.X) / 3f;
22846 if ((float)Main.rand.Next(100) > num * 50f)
22847 {
22848 flag = false;
22849 }
22850 }
22851 if (!flag)
22852 {
22853 return;
22854 }
22855 Vector2 positionInWorld = new Vector2(position.X, position.Y + (float)height - 2f) + new Vector2((float)width * Main.rand.NextFloat(), 6f * Main.rand.NextFloat());
22856 Vector2 movementVector = Main.rand.NextVector2Circular(0.8f, 0.8f);
22857 if (movementVector.Y > 0f)
22858 {
22859 movementVector.Y *= -1f;
22860 }
22862 {
22863 PositionInWorld = positionInWorld,
22864 MovementVector = movementVector
22865 }, whoAmI);
22866 }
22867 if (type != 147 && type != 25 && type != 53 && type != 189 && type != 0 && type != 123 && type != 57 && type != 112 && type != 116 && type != 196 && type != 193 && type != 195 && type != 197 && type != 199 && type != 229 && type != 234 && type != 371 && type != 460 && type != 666)
22868 {
22869 return;
22870 }
22871 int num2 = 1;
22872 if (Falling)
22873 {
22874 num2 = 20;
22875 if (type == 666)
22876 {
22877 SoundEngine.PlaySound(SoundID.Item177, (int)base.Center.X, (int)base.Bottom.Y);
22878 }
22879 }
22880 for (int i = 0; i < num2; i++)
22881 {
22882 bool flag2 = true;
22883 int num3 = 76;
22884 if (type == 666)
22885 {
22886 if (paintColor != 0)
22887 {
22888 break;
22889 }
22890 num3 = 322;
22891 }
22892 if (type == 53)
22893 {
22894 num3 = 32;
22895 }
22896 if (type == 189)
22897 {
22898 num3 = 16;
22899 }
22900 if (type == 0)
22901 {
22902 num3 = 0;
22903 }
22904 if (type == 123)
22905 {
22906 num3 = 53;
22907 }
22908 if (type == 57)
22909 {
22910 num3 = 36;
22911 }
22912 if (type == 112)
22913 {
22914 num3 = 14;
22915 }
22916 if (type == 234)
22917 {
22918 num3 = 122;
22919 }
22920 if (type == 116)
22921 {
22922 num3 = 51;
22923 }
22924 if (type == 196)
22925 {
22926 num3 = 108;
22927 }
22928 if (type == 193)
22929 {
22930 num3 = 4;
22931 }
22932 if (type == 195 || type == 199)
22933 {
22934 num3 = 5;
22935 }
22936 if (type == 197)
22937 {
22938 num3 = 4;
22939 }
22940 if (type == 229)
22941 {
22942 num3 = 153;
22943 }
22944 if (type == 371)
22945 {
22946 num3 = 243;
22947 }
22948 if (type == 460)
22949 {
22950 num3 = 108;
22951 }
22952 if (type == 25)
22953 {
22954 num3 = 37;
22955 }
22956 if (num3 == 32 && Main.rand.Next(2) == 0)
22957 {
22958 flag2 = false;
22959 }
22960 if (num3 == 14 && Main.rand.Next(2) == 0)
22961 {
22962 flag2 = false;
22963 }
22964 if (num3 == 51 && Main.rand.Next(2) == 0)
22965 {
22966 flag2 = false;
22967 }
22968 if (num3 == 36 && Main.rand.Next(2) == 0)
22969 {
22970 flag2 = false;
22971 }
22972 if (num3 == 0 && Main.rand.Next(3) != 0)
22973 {
22974 flag2 = false;
22975 }
22976 if (num3 == 53 && Main.rand.Next(3) != 0)
22977 {
22978 flag2 = false;
22979 }
22980 Color newColor = default(Color);
22981 if (type == 193)
22982 {
22983 newColor = new Color(30, 100, 255, 100);
22984 }
22985 if (type == 197)
22986 {
22987 newColor = new Color(97, 200, 255, 100);
22988 }
22989 if (type == 460)
22990 {
22991 newColor = new Color(100, 150, 130, 100);
22992 }
22993 if (!Falling)
22994 {
22995 float num4 = Math.Abs(velocity.X) / 3f;
22996 if ((float)Main.rand.Next(100) > num4 * 100f)
22997 {
22998 flag2 = false;
22999 }
23000 }
23001 if (!flag2)
23002 {
23003 continue;
23004 }
23005 float num5 = velocity.X;
23006 if (num5 > 6f)
23007 {
23008 num5 = 6f;
23009 }
23010 if (num5 < -6f)
23011 {
23012 num5 = -6f;
23013 }
23014 if (!(velocity.X != 0f || Falling))
23015 {
23016 continue;
23017 }
23018 int num6 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), width, 6, num3, 0f, 0f, 50, newColor);
23019 if (gravDir == -1f)
23020 {
23021 Main.dust[num6].position.Y -= height + 4;
23022 }
23023 if (num3 == 76)
23024 {
23025 Main.dust[num6].scale += (float)Main.rand.Next(3) * 0.1f;
23026 Main.dust[num6].noLight = true;
23027 }
23028 if (num3 == 16 || num3 == 108 || num3 == 153)
23029 {
23030 Main.dust[num6].scale += (float)Main.rand.Next(6) * 0.1f;
23031 }
23032 if (num3 == 37)
23033 {
23034 Main.dust[num6].scale += 0.25f;
23035 Main.dust[num6].alpha = 50;
23036 }
23037 if (num3 == 5)
23038 {
23039 Main.dust[num6].scale += (float)Main.rand.Next(2, 8) * 0.1f;
23040 }
23041 Main.dust[num6].noGravity = true;
23042 if (num3 == 322)
23043 {
23044 if (Main.rand.Next(4) == 0)
23045 {
23046 Main.dust[num6].noGravity = false;
23047 Main.dust[num6].scale *= 1.1f;
23048 }
23049 else
23050 {
23051 Main.dust[num6].scale *= 1.2f;
23052 }
23053 }
23054 if (num2 > 1)
23055 {
23056 Main.dust[num6].velocity.X *= 1.2f;
23057 Main.dust[num6].velocity.Y *= 0.8f;
23058 Main.dust[num6].velocity.Y -= 1f;
23059 Main.dust[num6].velocity *= 0.8f;
23060 Main.dust[num6].scale += (float)Main.rand.Next(3) * 0.1f;
23061 Main.dust[num6].velocity.X = (Main.dust[num6].position.X - (position.X + (float)(width / 2))) * 0.2f;
23062 if (Main.dust[num6].velocity.Y > 0f)
23063 {
23064 Main.dust[num6].velocity.Y *= -1f;
23065 }
23066 Main.dust[num6].velocity.X += num5 * 0.3f;
23067 }
23068 else
23069 {
23070 Main.dust[num6].velocity *= 0.2f;
23071 }
23072 Main.dust[num6].position.X -= num5 * 1f;
23073 if (gravDir == -1f)
23074 {
23075 Main.dust[num6].velocity.Y *= -1f;
23076 }
23077 }
23078 }
static double Abs(double value)
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static readonly LegacySoundStyle Item177
Definition SoundID.cs:768

References System.Math.Abs(), Terraria.Main.dust, Terraria.ID.SoundID.Item177, Terraria.Dust.NewDust(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.GameContent.Drawing.ParticleOrchestrator.RequestParticleSpawn(), and System.type.